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
35
XP
1,244
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
885
Trophies
1
Age
29
XP
1,418
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
  • No one is chatting at the moment.
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
    +1
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
  • Psionic Roshambo @ Psionic Roshambo:
    @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87 cents. Free shipping from China... It arrived it works and honestly I don't understand how it was so cheap.
    +1
    Psionic Roshambo @ Psionic Roshambo: @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87... +1