Homebrew CitrAGB - 3DS GBA Emulator (WIP)

shinyquagsire23

SALT/Sm4sh Leak Guy
OP
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States
Greets all,

So I've been working on a thing for a while. I had originally abandoned the project because I thought it was unable to be done without the use of dynamic recompilation, however as it turns out it was in fact possible. I present my 3DS GBA Emulator: CitrAGB, a 3DS GBA emulator based on gpsp.

t0wIZum.png

ht0cjXh.png


As of now, compatibility is technically on-par with whatever gpsp's interpreter is able to handle, however, due to the nature of the port some games will not run or crash on particular parts. Flipping the screen to it's proper orientation did a bit of damage which might take a bit to get fixed up, and a lot of things still need implementation. But, on the plus side, many games that do run actually run fairly well, around 50% speed in optimal cases, or as low as 20% if the game uses extremely inefficient idle loops. In the future I also plan on hopefully porting gpsp's dynrec CPU to be able to work on the 3DS as well, once smea updated ninjhax to allow developers to set RAM pages executable. This will increase emulation speed dramatically.

Controls:
A, B, Start, Select, L, R, and the D/C-Pad all map out to their rightful GBA buttons. Y is bound to select, and X currently exits back to the homebrew menu

Sauce Code:
You can find the source code for CitrAGB on my GitHub here. Once again, this is very much a work in progress and extremely buggy, but the bugs will be fixed and the emulator refined with time. However, if you encounter bugs let me know the game name and when the bug occurs so I have games to test against while fixing bugs.

Installation Instructions:

For Ninjhax:
First, grab the .3dsx here and rename it/place it in sd:/3ds/<name of .3dsx>. You can also grab the smdh here and give it the same name and place it in the same directory as the 3dsx. Next, download game_config.txt from here and a sample homebrew application here to make sure everything is set up right before you run regular GBA ROMs. The last thing you will need is gba_bios.bin. You can either dump this/find this online, or you can use Normatt's open source GBA bios here. A proper GBA bios dump is preferred, Normatt's bios has shown issues with some games. Once you have gba_bios.bin, place it either in the root of your SD card or in /gba.

For CFW:
Grab the .cia from here and place it anywhere on your SD card. Use a .cia manager such as FBI, BRM, or DevMen to install it. Next, download game_config.txt from here and a sample homebrew application here to make sure everything is set up right before you run regular GBA ROMs. The last thing you will need is gba_bios.bin. You can either dump this/find this online, or you can use Normatt's open source GBA bios here. A proper GBA bios dump is preferred, although Normatt's bios hasn't shown any issues as of yet. Once you have gba_bios.bin, place it either in the root of your SD card or in /gba.

After downloading everything, your SD card structure should look something like this:
game_config.txt
gba_bios.bin
demo.gba
/3ds/<3dsx name>/<3dsx name>.3dsx
(3dsx only)
/3ds/<3dsx name>/<3dsx name>.smdh (3dsx only)

Currently Known Bugs:
  • Any video issues which may arise
Special Thanks
Big thanks to Normatt, smea, yellows8 and plutoo for helping me get this working. Probably wouldn't have got anywhere in some places without your help. Special thanks to @aliaspider for pointing out a fix for .cia.
 
Last edited by shinyquagsire23,

shinyquagsire23

SALT/Sm4sh Leak Guy
OP
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States
Does not work for me. I boot up the 3dsx file and 3/4 of the screen turns grey on both screens. Then it boots back to the system menu and restarts.

Hm, can't say I've gotten that. Any particular 3DS/system version you're running on? Make sure you've copied the file correctly, it should be 1.2MB in size. On that note, I'll also try re-uploading the .3dsx as well.
 

kane159

Well-Known Member
Member
Joined
May 28, 2013
Messages
215
Trophies
1
Age
34
XP
1,234
Country
Taiwan
Does not work for me. I boot up the 3dsx file and 3/4 of the screen turns grey on both screens. Then it boots back to the system menu and restarts.
me too ,and when i tried to build from source it gaves me this error,donno whats wrong :/

E:\gpsp-master\3ds>make
arm_stub.s video_blend.s
font.bin
gpspFont.bin
cheats.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/cheats.d -g -Wall -O3 -m
word-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -m
float-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inc
lude -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3
ds/../cheats.c -o cheats.o
cpu.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/cpu.d -g -Wall -O3 -mwor
d-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mflo
at-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/includ
e -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -Wno-unused-variable -
Wno-unused-label -c /e/gpsp-master/3ds/../cpu.c -o cpu.o
cpu_threaded.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/cpu_threaded.d -g -Wall
-O3 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpc
ore -mfloat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libct
ru/include -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -Wno-unused-v
ariable -Wno-unused-label -c /e/gpsp-master/3ds/../cpu_threaded.c -o cpu_threade
d.o
gui.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/gui.d -g -Wall -O3 -mwor
d-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mflo
at-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/includ
e -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds/
../gui.c -o gui.o
input.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/input.d -g -Wall -O3 -mw
ord-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mf
loat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/incl
ude -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3d
s/../input.c -o input.o
main.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/main.d -g -Wall -O3 -mwo
rd-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfl
oat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inclu
de -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds
/../main.c -o main.o
memory.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/memory.d -g -Wall -O3 -m
word-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -m
float-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inc
lude -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3
ds/../memory.c -o memory.o
sound.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/sound.d -g -Wall -O3 -mw
ord-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mf
loat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/incl
ude -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3d
s/../sound.c -o sound.o
video.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/video.d -g -Wall -O3 -mw
ord-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mf
loat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/incl
ude -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3d
s/../video.c -o video.o
zip.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/zip.d -g -Wall -O3 -mwor
d-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mflo
at-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/includ
e -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds/
../zip.c -o zip.o
_3ds.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/_3ds.d -g -Wall -O3 -mwo
rd-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfl
oat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inclu
de -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds
/./_3ds.c -o _3ds.o
draw.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/draw.d -g -Wall -O3 -mwo
rd-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfl
oat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inclu
de -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds
/./draw.c -o draw.o
font.c
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/font.d -g -Wall -O3 -mwo
rd-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfl
oat-abi=softfp -I/e/gpsp-master/3ds/include -IE:\devkitPro\ctrulib\libctru/inclu
de -I/e/gpsp-master/3ds/build -DARM11 -D_3DS -DARM_ARCH -w -c /e/gpsp-master/3ds
/./font.c -o font.o
arm_stub.s
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/arm_stub.d -x assembler-
with-cpp -g -march=armv6k -mtune=mpcore -mfloat-abi=softfp -c /e/gpsp-master/3ds
/../arm/arm_stub.s -o arm_stub.o
video_blend.s
arm-none-eabi-gcc -MMD -MP -MF /e/gpsp-master/3ds/build/video_blend.d -x assembl
er-with-cpp -g -march=armv6k -mtune=mpcore -mfloat-abi=softfp -c /e/gpsp-master/
3ds/../arm/video_blend.s -o video_blend.o
linking 3ds.elf
font.o:(.data+0x0): undefined reference to `font1Data'
font.o:(.data+0x4): undefined reference to `font1Desc'
font.o:(.data+0xc): undefined reference to `font1Data'
font.o:(.data+0x10): undefined reference to `font1Desc'
font.o:(.data+0x1c): undefined reference to `font1Desc'
font.o:(.data+0x28): undefined reference to `font1Desc'
font.o:(.data+0x34): undefined reference to `font1Desc'
font.o:(.data+0x40): undefined reference to `font1Desc'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/e/gpsp-master/3ds/3ds.elf] Error 1
make: *** [build] Error 2

E:\gpsp-master\3ds>pause
 

Idaho

Well-Known Member
Member
Joined
Oct 3, 2013
Messages
882
Trophies
1
Age
29
XP
1,399
Country
France
That's great, will we be able to also have it as .cia ? GBA emulation is one of the main goal in term on emulation on the 3DS, let's make it happen :3
 

Shadowtrance

Well-Known Member
Member
Joined
May 9, 2014
Messages
2,493
Trophies
0
Location
Hervey Bay, Queensland
XP
1,807
Country
Well copying the font1.c from hb menu got past that error with compiling, only to run into another one haha

All fine until it gets here near the end...

linking 3ds.elf
_3ds.o: In function `gpsp_plat_init':
c:/Users/Vortex/Desktop/gpsp/3ds/_3ds.c:79: undefined reference to `gfxSetDoubleBuffering'
c:/Users/Vortex/Desktop/gpsp/3ds/_3ds.c:80: undefined reference to `gfxSetDoubleBuffering'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/Users/Vortex/Desktop/gpsp/3ds/3ds.elf] Error 1
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Veho @ Veho:
    The fuuuuu---
  • Veho @ Veho:
    I thought it was an actual xBox at that price.
  • Sicklyboy @ Sicklyboy:
    I wanna grab a 360 Slim and a 360 E one of these days. Missed the boat of getting them at their lowest though, once they were discontinued. Could've got them for cheap back when I was a broke 20 something working at Target, but then again, I was a broke 20 something working at Target
  • Veho @ Veho:
    Being broke is no fun.
  • K3Nv2 @ K3Nv2:
    @Sicklyboy, $150 isn't that bad for a jtag slim on ebay
  • Veho @ Veho:
    I only wish it was actually playable.
  • Veho @ Veho:
    There's a guy on the Tube of You that makes playable mechanical arcade games out of Lego. This could work on the same principle.
  • Veho @ Veho:
    Just a couple of guys taking their manatee out for some fresh air, why you have to molest them?
  • Veho @ Veho:
    Stupid Chinese shop switched their shipping company and this one is slooooooow.
  • LeoTCK @ LeoTCK:
    STOP BUYING CHINESE CRAP THEN
  • LeoTCK @ LeoTCK:
    SUPPORT LOCAL PRODUCTS, MAKE REVOLUTION
  • LeoTCK @ LeoTCK:
    THEY KEEP REMOVING LOCAL SHIt AND REPLACING WItH INFERIOR CHINESE CRAP
  • LeoTCK @ LeoTCK:
    THATS WHY MY PARTNER CANT GET A GOOTWEAR HIS SIZE ANYMORE
  • LeoTCK @ LeoTCK:
    HE HAS BIG FOOT AND BIG DUCK
  • LeoTCK @ LeoTCK:
    d*ck i mean*
  • LeoTCK @ LeoTCK:
    lol
  • Veho @ Veho:
    Mkay.
  • Veho @ Veho:
    I just ordered another package from China just to spite you.
  • SylverReZ @ SylverReZ:
    Communism lol
  • SylverReZ @ SylverReZ:
    OUR products
  • The Real Jdbye @ The Real Jdbye:
    @LeoTCK actually good quality products are dying out because they can't compete with dropshipped chinese crap
    +1
    The Real Jdbye @ The Real Jdbye: @LeoTCK actually good quality products are dying out because they can't compete with dropshipped... +1