Homebrew GBARunner2

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,411
Trophies
2
Location
In my house
XP
5,006
Country
Mexico
When I ran GBA it took me to GBARunner 2 and the screen has 1x black border around outer the game screen i tried to get it in full screen. There is no I can do about it? Also how do I exit GBARunner 2 back to Twilight Menu ++ instead of press Home button??

You can't increase GBARunner2 resolution as it runs in native DS resoultion, and trying to stretch the image in such a tiny gap would be pointless, is not even at 1.5x in ratio.

Btw, if you're using a 3DS, is recommended to use open_agb_firm instead, that one runs in native GBA mode, which means you'll have almost 99% compatibility.
 

4d1xlaan

Well-Known Member
Member
Joined
Apr 21, 2024
Messages
813
Trophies
0
XP
828
Country
United States
You know what doesn't have this issue? Releases. is it that hard to just mark it as alpha and tell anyone with issues that support isn't guaranteed?
Shame this doesn't fix my issue with SRW J, hope it helps out the other guy at least.
releases wouldnt help any of this, because there is no branch with both hicode and profi's sd driver combined on the repo in the first place

it will have to wait until more work gets done and prs + branches get merged together, etc
 
  • Like
Reactions: devlman127

FanNintendo

Well-Known Member
Member
Joined
Apr 16, 2018
Messages
1,643
Trophies
0
Age
52
XP
2,717
Country
United States
You can't increase GBARunner2 resolution as it runs in native DS resoultion, and trying to stretch the image in such a tiny gap would be pointless, is not even at 1.5x in ratio.

Btw, if you're using a 3DS, is recommended to use open_agb_firm instead, that one runs in native GBA mode, which means you'll have almost 99% compatibility.
that is what i am looking for! i look in my sd directory which isnt there i dont know how happen
Post automatically merged:

You can't increase GBARunner2 resolution as it runs in native DS resoultion, and trying to stretch the image in such a tiny gap would be pointless, is not even at 1.5x in ratio.

Btw, if you're using a 3DS, is recommended to use open_agb_firm instead, that one runs in native GBA mode, which means you'll have almost 99% compatibility.
open_agb_firm have good screen and im curious can it play Game Boy or Game Boy Color also I would like to map the analog if it is possible? It would be cool if can inject that open_agb_firm on 3DS but I read the read.me I understand
 
Last edited by FanNintendo,
  • Like
Reactions: DSoryu

EdwardTheWatzo

Member
Newcomer
Joined
Feb 3, 2024
Messages
15
Trophies
0
XP
253
Country
Australia
When I ran GBA it took me to GBARunner 2 and the screen has 1x black border around outer the game screen i tried to get it in full screen. There is no I can do about it? Also how do I exit GBARunner 2 back to Twilight Menu ++ instead of press Home button??
You can't exit back to Twilight Menu, you just have to reopen it.
 
  • Like
Reactions: FanNintendo

ImEvolutiON

New Member
Newbie
Joined
Aug 4, 2024
Messages
2
Trophies
0
Age
22
XP
5
Country
France
Hey everyone,

Here to let a print on the internet for those who are looking to play Pokémon ROM Hacks on r4 flashcards.

I've been trying to play ROM Hacks on my DS Lite with a R4 Upgrade Revolution (these details may not be important), and because the 3rom build for GBARunner2 worked for Emerald but didn't work Clover, this is were my search brought me to GBARunner3.
I didn't try the GBARunner2 hicode branch, cause I read that it was for DSi and 3DS only ; feel free to test i guess
I've been testing my modifications to run ROMHacks with Pokémon Unbound and Pokémon Clover ; and my modifications on gba bios / emulation (GBARunner) with simple ROM (FireRed and Emerald). As you also have certainly experienced if you're looking for the same thing as I was, you successfully booted FireRed but not Emerald, well, as discussed in this forum, the hicode branch works fine for Emerald AND FireRed !

Now here I am : experiencing with this successful GBARunner3 hicode branch, I tried to boot Pokémon Clover ; it's working. (Seems like it was using hicode too ?). Keep in mind that RTC isn't supported now (if I understood correctly the discussions) so some events in Clover may not work as intended. I'll try to do a little playthrough looking for bugs and crashes with ROM Hacks and keep this post updated if anything happens.
UPDATE1 : the game begins with a 'RTC events will not occur' warning but states that it's still playable.
UPDATE 2 : completed Route 1 and absolutely no problem, maybe music being weird, but i don't know if that's already the case in Clover ; upon saving, very cool glitchy sound, but no corruption. Now I'll try Unbound.

However, considering Pokémon Unbound, booting seems successful as the background screen with Hoopa appears, but then black screen. I don't know if it is linked to RTC -even if I changed it to another RTC ID-, SRAM, or anything else. Maybe the size ? The only difference I have when looking through GData between Clover and Unbound is that Clover is 128 mbit while every. other. romhack. that. didnt. work (Unbound included) were 256 mbit. So far, every tested game that successfuly booted were 128 mbit (see below), any 256 mbit would crash (white screen).
UPDATE : DSOryu posted just below a "how-to-run Unbound" and it perfectly worked !

Yup, that post was mostly written to help newbie (like me) play ROM Hacks on R4, not a lot of content to help dev(s) in any way, I just deep dived in the ROM Hack community and technologies soooo yeah not a professional here - however, if anything caught your attention, I can try to give you details.
I don't know if such things were possible with GBARunner2 (i don't think so) but it feels like a step towards a new era for gba emulation on DS :) !

PS : I'm overexcited cause I've been told for the past 24 hours that emulating GBA ROM Hacks with new regions etc etc was completely impossible with a R4



List of Pokemon ROM Hacks that worked so far
- Pokemon Renegade Platinum​
- Pokemon BlazeBlack & VoltWhite​
- Pokemon BlazeBlack 2 redux & VoltWhite 2 redux​
- Pokemon Clover (128 mbits)​
- Pokemon Altair & Sirius (128 mbits)​
- Pokemon Vega (128 mbits)​
- Pokemon Unbound (256 mbits) with the steps described by DSoryu​
 
Last edited by ImEvolutiON,

4d1xlaan

Well-Known Member
Member
Joined
Apr 21, 2024
Messages
813
Trophies
0
XP
828
Country
United States
the problem with rom hacks is that they'll often be doing some unusual or different stuff compared to the official games, and for now gbarunner is focused on getting official games working

some rom hacks might work fine if they don't have too much custom code, but the ones with extra code might need more work to support them later (if they even work on real hardware)
 
  • Like
Reactions: DSoryu

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,411
Trophies
2
Location
In my house
XP
5,006
Country
Mexico
Hey everyone,

Here to let a print on the internet for those who are looking to play Pokémon ROM Hacks on r4 flashcards.

I've been trying to play ROM Hacks on my DS Lite with a R4 Upgrade Revolution (these details may not be important), and because the 3rom build for GBARunner2 worked for Emerald but didn't work Clover, this is were my search brought me to GBARunner3.
I didn't try the GBARunner2 hicode branch, cause I read that it was for DSi and 3DS only ; feel free to test i guess
I've been testing my modifications to run ROMHacks with Pokémon Unbound and Pokémon Clover ; and my modifications on gba bios / emulation (GBARunner) with simple ROM (FireRed and Emerald). As you also have certainly experienced if you're looking for the same thing as I was, you successfully booted FireRed but not Emerald, well, as discussed in this forum, the hicode branch works fine for Emerald AND FireRed !

Now here I am : experiencing with this successful GBARunner3 hicode branch, I tried to boot Pokémon Clover ; it's working. (Seems like it was using hicode too ?). Keep in mind that RTC isn't supported now (if I understood correctly the discussions) so some events in Clover may not work as intended. I'll try to do a little playthrough looking for bugs and crashes with ROM Hacks and keep this post updated if anything happens.
UPDATE1 : the game begins with a 'RTC events will not occur' warning but states that it's still playable.
UPDATE 2 : completed Route 1 and absolutely no problem, maybe music being weird, but i don't know if that's already the case in Clover ; upon saving, very cool glitchy sound, but no corruption. Now I'll try Unbound.

However, considering Pokémon Unbound, booting seems successful as the background screen with Hoopa appears, but then black screen. I don't know if it is linked to RTC -even if I changed it to another RTC ID-, SRAM, or anything else. Maybe the size ? The only difference I have when looking through GData between Clover and Unbound is that Clover is 128 mbit while every. other. romhack. that. didnt. work (Unbound included) were 256 mbit.

Yup, that post was mostly written to help newbie (like me) play ROM Hacks on R4, not a lot of content to help dev(s) in any way, I just deep dived in the ROM Hack community and technologies soooo yeah not a professional here - however, if anything caught your attention, I can try to give you details.
I don't know if such things were possible with GBARunner2 (i don't think so) but it feels like a step towards a new era for gba emulation on DS :) !

PS : I'm overexcited cause I've been told for the past 24 hours that emuating GBA ROM Hacks with new regions etc etc was completely impossible with a R4

Is not that complicated, is just a combination of hicode (expected), self modifying code (most romhacks use the "better sound mixer patch") and manual JIT patches (GBARunner specific patch addresses for performance).

Also, RTC doesn't work because it hasn't been implemented yet, is not a romhack issue.

Any romhack that doesn't contain "unreachable" hicode (code beyond 0x08F00000, which isn't currently supported) will run just fine with proper manual JIT patches and Cache invalidation patches (both supported by GBARunner3).

For example, Pokémon Unbound works with Emerald manual JIT patches and 0x0880DEF0 address for cache invalidation, like this:

JavaScript:
{
    "runSettings": {
        "jitPatchAddresses": [
            "0x08000208",
            "0x08000214",
            "0x08000258",
            "0x0800034C",
            "0x08000358",
            "0x08000378",
            "0x08000384",
            "0x08000394"
        ],
        "selfModifyingPatchAddresses": [
            "0x0880DEF0"
        ]
    }
}

You can save this as "BPEE02.json" inside _/gba/configs.

Then modify Unbound rom using a HEX editor with this (to avoid conflicts with a base emerald rom):

Code:
000000A0: 50 4F 4B 45 4D 4F 4E 20 46 49 52 45 42 50 45 45
000000B0: 30 31 96 00 00 00 00 00 00 00 00 00 02 73 00 00

With these steps, Unbound will work just fine, with some minor performance issues if you have sound set to "High Quality" (Mid is recommended).

This process can be applied to other romhacks, but addresses for manual JIT patches may be a bit different depending of the romhack, and cache invalidation addresses are ALWAYS different, since the better sound mixer patch allocates itself in different locations depending on the size of the romhack.

the problem with rom hacks is that they'll often be doing some unusual or different stuff compared to the official games, and for now gbarunner is focused on getting official games working

some rom hacks might work fine if they don't have too much custom code, but the ones with extra code might need more work to support them later (if they even work on real hardware)

Yeah, "unreachable" hicode, as explained above.
 
Last edited by DSoryu,
  • Like
Reactions: 4d1xlaan

ImEvolutiON

New Member
Newbie
Joined
Aug 4, 2024
Messages
2
Trophies
0
Age
22
XP
5
Country
France
Is not that complicated, is just a combination of hicode (expected), self modifying code (most romhacks use the "better sound mixer patch") and manual JIT patches (GBARunner specific patch addresses for performance).

Also, RTC doesn't work because it hasn't been implemented yet, is not a romhack issue.

Any romhack that doesn't contain "unreachable" hicode (code beyond 0x08F00000, which isn't currently supported) will run just fine with proper manual JIT patches and Cache invalidation patches (both supported by GBARunner3). For example, Pokémon Unbound works with Emerald manual JIT patches and 0x0880DEF0 address for cache invalidation, like this:

JavaScript:
{
    "runSettings": {
        "jitPatchAddresses": [
            "0x08000208",
            "0x08000214",
            "0x08000258",
            "0x0800034C",
            "0x08000358",
            "0x08000378",
            "0x08000384",
            "0x08000394"
        ],
        "selfModifyingPatchAddresses": [
            "0x0880DEF0"
        ]
    }
}

You can save this as "BPEE02.json" inside _/gba/configs, and modify Unbound rom with this (to avoid conflicts with a base emerald rom), and it will work just fine, with some minor performance issues if you have sound set to "High Quality" (Mid is recommended)

Code:
000000A0: 50 4F 4B 45 4D 4F 4E 20 46 49 52 45 42 50 45 45
000000B0: 30 31 96 00 00 00 00 00 00 00 00 00 02 73 00 00



Yeah, "unreachable" hicode, as explained above.
Wow !

That's amazing. I'll try to get my hands into this as soon as possible !
I don't understand everything yet, but let's just fastlearn everything, that's the fun part.

Thank you a lot, hoping I'll get through very easily !


edit -- yup it worked just fine !
 
Last edited by ImEvolutiON,

ShadowOne333

QVID PRO QVO
Editorial Team
Joined
Jan 17, 2013
Messages
12,425
Trophies
2
XP
38,103
Country
Mexico
Hey everyone,

Here to let a print on the internet for those who are looking to play Pokémon ROM Hacks on r4 flashcards.

I've been trying to play ROM Hacks on my DS Lite with a R4 Upgrade Revolution (these details may not be important), and because the 3rom build for GBARunner2 worked for Emerald but didn't work Clover, this is were my search brought me to GBARunner3.
I didn't try the GBARunner2 hicode branch, cause I read that it was for DSi and 3DS only ; feel free to test i guess
I've been testing my modifications to run ROMHacks with Pokémon Unbound and Pokémon Clover ; and my modifications on gba bios / emulation (GBARunner) with simple ROM (FireRed and Emerald). As you also have certainly experienced if you're looking for the same thing as I was, you successfully booted FireRed but not Emerald, well, as discussed in this forum, the hicode branch works fine for Emerald AND FireRed !

Now here I am : experiencing with this successful GBARunner3 hicode branch, I tried to boot Pokémon Clover ; it's working. (Seems like it was using hicode too ?). Keep in mind that RTC isn't supported now (if I understood correctly the discussions) so some events in Clover may not work as intended. I'll try to do a little playthrough looking for bugs and crashes with ROM Hacks and keep this post updated if anything happens.
UPDATE1 : the game begins with a 'RTC events will not occur' warning but states that it's still playable.
UPDATE 2 : completed Route 1 and absolutely no problem, maybe music being weird, but i don't know if that's already the case in Clover ; upon saving, very cool glitchy sound, but no corruption. Now I'll try Unbound.

However, considering Pokémon Unbound, booting seems successful as the background screen with Hoopa appears, but then black screen. I don't know if it is linked to RTC -even if I changed it to another RTC ID-, SRAM, or anything else. Maybe the size ? The only difference I have when looking through GData between Clover and Unbound is that Clover is 128 mbit while every. other. romhack. that. didnt. work (Unbound included) were 256 mbit. So far, every tested game that successfuly booted were 128 mbit (see below), any 256 mbit would crash (white screen).
UPDATE : DSOryu posted just below a "how-to-run Unbound" and it perfectly worked !

Yup, that post was mostly written to help newbie (like me) play ROM Hacks on R4, not a lot of content to help dev(s) in any way, I just deep dived in the ROM Hack community and technologies soooo yeah not a professional here - however, if anything caught your attention, I can try to give you details.
I don't know if such things were possible with GBARunner2 (i don't think so) but it feels like a step towards a new era for gba emulation on DS :) !

PS : I'm overexcited cause I've been told for the past 24 hours that emulating GBA ROM Hacks with new regions etc etc was completely impossible with a R4



List of Pokemon ROM Hacks that worked so far
- Pokemon Renegade Platinum​
- Pokemon BlazeBlack & VoltWhite​
- Pokemon BlazeBlack 2 redux & VoltWhite 2 redux​
- Pokemon Clover (128 mbits)​
- Pokemon Altair & Sirius (128 mbits)​
- Pokemon Vega (128 mbits)​
- Pokemon Unbound (256 mbits) with the steps described by DSoryu​
I posted about them earlier, but it seems like Crystal Dust and Crystal Dust Fork (both hacks of Emerald) have issues with both GBARunner2 and GBARunner3 to different results for each one.

Could you test them on your end and let me know if you managed to get them working somehow?
Here's the post, I uploaded the patches for each one as well for testing.
https://gbatemp.net/threads/gbarunner2.451970/page-194#post-10456037
 

devlman127

Well-Known Member
Newcomer
Joined
May 1, 2022
Messages
96
Trophies
0
Age
21
Location
Midwest
XP
364
Country
United States
I'm not very knowledgable on GBA emulation, can someone explain hicode/unreachable hicode to me and why it needs to be manually patched? Thanks.
 

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,411
Trophies
2
Location
In my house
XP
5,006
Country
Mexico
I'm not very knowledgable on GBA emulation, can someone explain hicode/unreachable hicode to me and why it needs to be manually patched? Thanks.

It's actually a consequence of a hardware limitation. The Nintendo DS has only 4MB of RAM, and since GBA roms need to access their whole ROM as linearly mapped memory, it would require at least 32MB of RAM to work out of the box, this being the reason why you can't just run GBA roms using the Slot-1 by normal means, and the reason on why GBA flashcards exist, these provide a "blank" cart with at least 32MB of memory available on the Slot-2.

GBARunner3 goal is to circumvent this limitation, by handling the GBA code in a way that it makes it possible to operate with only 4MB of RAM. This is achieved by running GBA code in DS mode (using the ARM9 instead of the ARM7), so some instructions need to be "emulated" or "replaced" by their equivalents, but only a few need this, think of it as some sort of "legacy compatibility mode".

Since most of the times, GBA executable code is only contained in the first few MB of a GBA rom, only the first 2MB of it is loaded linearly in the DS main ram, and the rest is only cached when the code calls it (graphics, sound data, sound samples etc.) in a memory area called "SD cache", this is done so the code is executed as fast as possible, to achieve full speed gameplay.

Now, some games due to a variety of reasons, have code above the first 2MB of code. be it jumps or veneers, this is what we call "hicode" for easier reference. GBARunner3 by itself can't run code that is out of the first 2MB of data that has been loaded in RAM, so it halts when there's hicode, Pokémon Emerald is a popular example of this, and most romhacks since those inject additional code at the end of the rom.

In the case of the hicode branch, it makes some clever tricks that allow to replace and run that code in specific ways. This is called "Hicode Cache", Gericom really made an outstanding job implementing it, and even managed to optimize using more tricks, taking benefit on how the ARM9 instruction cache behaves and allows you to take control of it, honestly I don't fully understand yet how it works, it requires great skills and great DS hardware knowledge.

TL DR: To run fast, GBARunner needs to load executable GBA code into main memory, and since the DS only has 4MB available, it only loads the first 2MB of the rom linearly in memory. but some games have code above the first 2MB, that's what we call "hicode", and since that code isn't being loaded anywhere, GBArunner can't continue to execute anything and halts.
 

devlman127

Well-Known Member
Newcomer
Joined
May 1, 2022
Messages
96
Trophies
0
Age
21
Location
Midwest
XP
364
Country
United States
In the case of the hicode branch, it makes some clever tricks that allow to replace and run that code in specific ways. This is called "Hicode Cache", Gericom really made an outstanding job implementing it, and even managed to optimize using more tricks, taking benefit on how the ARM9 instruction cache behaves and allows you to take control of it, honestly I don't fully understand yet how it works, it requires great skills and great DS hardware knowledge.
So the hicode branch needs patches for specific games to do this?
 

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,250
Trophies
2
XP
3,638
Country
Spain
Is there a known way to make Final Fantasy: Dawn of Souls to work properly?

On GBARunner2 back when i tried, any time I tried to walk on the overworld it would glitch massively, and on GBARunner3, whenever I try to go into the menu (by pressing start) it goes into a white screen and stays there.
 

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,411
Trophies
2
Location
In my house
XP
5,006
Country
Mexico
Is there a known way to make Final Fantasy: Dawn of Souls to work properly?

On GBARunner2 back when i tried, any time I tried to walk on the overworld it would glitch massively, and on GBARunner3, whenever I try to go into the menu (by pressing start) it goes into a white screen and stays there.

Those issues are known, and may get fixed at some point.

1723487015028.png


Make sure to use the hicode branch, as the develop branch is currently somewhat unstable due to the last commit that implemented irq yielding.
 
  • Like
Reactions: devlman127

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,250
Trophies
2
XP
3,638
Country
Spain
Oh, I see, thank you. it's kinda interesting then because someone told me they played the game through GBARunner, so who knows how it was done.

Regardless of that, thank you. Looking at the previous page of this thread, there's only the one version of Hicode shared by 4d1xlaan, then? I'll try it.
 

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,411
Trophies
2
Location
In my house
XP
5,006
Country
Mexico
Oh, I see, thank you. it's kinda interesting then because someone told me they played the game through GBARunner, so who knows how it was done.

Regardless of that, thank you. Looking at the previous page of this thread, there's only the one version of Hicode shared by 4d1xlaan, then? I'll try it.

I guess they used GBARunner3, since it only has the flickering issue. Also, yeah. that build should be good.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://youtu.be/m_mPE9gcQJo?si=T3EP9cXGAqre2JHX