Homebrew How do I convert 3DNES.3DS to CIA?

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
Sorry if this has been asked before. I have the tools all compiled (on Ubuntu 14.10 x64) and successfully tested them with some of my game cartridge dumps.

So how to you convert a homebrew 3DS to a CIA? I'm thinking it ought to be easier.
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
Ok,think I did it, but it seems to have messed something up:

The cia installed w/o issue, but when I started it, there was no border image in the game selection menu at startup.

I selected megaman just to test and it locked up the 3DS with a grey top screen and a black bottom screen.

I had no big issues compiling 3DNES, just changed gfxInit() to gfxInitDefault() in main.c to get it to compile.

I created the 3DNES directory and subdirectories for the roms and saves on my SD card.

I'm testing it in emunand 9.5.

These are the commands I am using to make the cia, from the build-cia.bat file in the git repo:

Code:
arm-none-eabi-strip 3DNES.elf
makerom -f cia -o 3DNES.cia -elf 3DNES.elf -rsf build_cia.rsf -icon icon.icn -banner banner.bnr -exefslogo -target t

I got the following error the first time I tried run this:

Code:
[RSF ERROR] Unrecognised Key: 'Rom'
[RSF ERROR] Error Proccessing RSF file

So I commented out the Rom: section of build_cia.rsf. Did that mess something up? There are only two comments in this section, but maybe the section has to exist? I don't know what I'm doing.

I just put a little # before Rom: and makerom worked. Here's the section:

Code:
#Rom:
  # Specifies the root path of the file system to include in the ROM.
  # HostRoot                : "$(ROMFS_ROOT)"
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
I tested my 3DS file, loading it from the gateway microsd card. It doesn't crash the system, but the graphics are messed up in every game I try. The 3DS file I downloaded from the github works fine with the same games, so I am definitely messed something up. Maybe that gfxInit() and gfxInitDefault() are different?

Oh well, I guess I can live without sound and a 3DNES icon on my home screen.

I took this from the build-3ds.bat file, so maybe there is something wrong with the rsf, too.
Code:
 ./makerom -f cci -o 3DNES.3ds -rsf gw_workaround.rsf -target d -exefslogo -elf 3DNES.elf -icon icon.icn -banner banner.bnr
 

mid-kid

GBAtemp spamBOT
Member
Joined
Aug 2, 2012
Messages
879
Trophies
0
Age
25
XP
1,163
Country
I tested my 3DS file, loading it from the gateway microsd card. It doesn't crash the system, but the graphics are messed up in every game I try. The 3DS file I downloaded from the github works fine with the same games, so I am definitely messed something up. Maybe that gfxInit() and gfxInitDefault() are different?

Oh well, I guess I can live without sound and a 3DNES icon on my home screen.

I took this from the build-3ds.bat file, so maybe there is something wrong with the rsf, too.
Code:
 ./makerom -f cci -o 3DNES.3ds -rsf gw_workaround.rsf -target d -exefslogo -elf 3DNES.elf -icon icon.icn -banner banner.bnr

No, gfxInit changed into gfxInitDefault a while ago in ctrulib. You did well in changing that.
I've compiled multiple homebrews into .cia using BigRedMenu's cia.rsf.
To create the icon.bin and banner.bin, you can look at 3DS_Banner_maker or bannertool (which I prefer, if you're too lazy to make audio for it, use the -ca /dev/zero (Or /dev/urandom if you like glitch music) option when making the banner).
The command you used for building the .cia is correct.
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
No, gfxInit changed into gfxInitDefault a while ago in ctrulib. You did well in changing that.
I've compiled multiple homebrews into .cia using BigRedMenu's cia.rsf.
To create the icon.bin and banner.bin, you can look at 3DS_Banner_maker or bannertool (which I prefer, if you're too lazy to make audio for it, use the -ca /dev/zero (Or /dev/urandom if you like glitch music) option when making the banner).
The command you used for building the .cia is correct.

I never installed ctrulib. It came with devkitPro which some perl script installed for me a few months ago. Should I upgrade it or stick with the old ctrulib? It has been updated recently:
https://github.com/smealum/ctrulib

Ok, so I'll use this rsf.
Change the BasicInfo Title and ProductCode to 3DNES and CTR-3DNX?
And the UniqueId to 0xf0021?

If two CIAs have the same info in these fields and I install both, will installing the second overwrite the first?

Are there any other customizations to the rsf?
 

mid-kid

GBAtemp spamBOT
Member
Joined
Aug 2, 2012
Messages
879
Trophies
0
Age
25
XP
1,163
Country
I never installed ctrulib. It came with devkitPro which some perl script installed for me a few months ago. Should I upgrade it or stick with the old ctrulib? It has been updated recently:
https://github.com/smealum/ctrulib

Ok, so I'll use this rsf.
Change the BasicInfo Title and ProductCode to 3DNES and CTR-3DNX?
And the UniqueId to 0xf0021?

If two CIAs have the same info in these fields and I install both, will installing the second overwrite the first?

Are there any other customizations to the rsf?

Projects should adapt to the new ctrulib/devkitARM requirements. If you upgrade, be sure to set -mfloat-abi to hard in the makefile (That's the biggest change, among others).
It comes with devkitPRO, that's right.

I've never actually messed around with .rsf files and consider them voodoo. I just go with templates like that one anc change some BasicInfo. I do know that you can't use a .rsf made for generating .3ds to generate a .cia.

Yes.

I dunno.
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
Projects should adapt to the new ctrulib/devkitARM requirements. If you upgrade, be sure to set -mfloat-abi to hard in the makefile (That's the biggest change, among others).

Ok, I tested my cia made with the rsf from RedMenu and now it does not crash but the graphics in each game are totally messed up. I am able to quit by pressing HOME. This is the same as I was getting with the .3ds I compiled.

So I thought there was something up with libctru and tried to build the new one. But that does not work:

Code:
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: error: unknown field 'rmdir_r' specified in initializer
  .rmdir_r      = sdmc_rmdir,
  ^
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: warning: excess elements in struct initializer
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: warning: (near initialization for 'sdmc_devoptab')
~/devkitPro/devkitARM/base_rules:85: recipe for target 'sdmc_dev.o' failed
make[1]: *** [sdmc_dev.o] Error 1
Makefile:125: recipe for target 'build' failed
make: *** [build] Error 2

As usual, I tried commenting out line 95 of sdmc_dev.c but then there are more errors:

Code:
~/ctrulib-master/libctru/source/system/initSystem.c: In function '__libctru_init':
~/ctrulib-master/libctru/source/system/initSystem.c:26:15: error: '__syscalls_t' has no member named 'gettod_r'
    __syscalls.gettod_r = __libctru_gtod;
              ^
~/devkitPro/devkitARM/base_rules:85: recipe for target 'initSystem.o' failed
make[1]: *** [initSystem.o] Error 1
Makefile:125: recipe for target 'build' failed
make: *** [build] Error 2
 

mid-kid

GBAtemp spamBOT
Member
Joined
Aug 2, 2012
Messages
879
Trophies
0
Age
25
XP
1,163
Country
Ok, I tested my cia made with the rsf from RedMenu and now it does not crash but the graphics in each game are totally messed up. I am able to quit by pressing HOME. This is the same as I was getting with the .3ds I compiled.

So I thought there was something up with libctru and tried to build the new one. But that does not work:

Code:
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: error: unknown field 'rmdir_r' specified in initializer
  .rmdir_r      = sdmc_rmdir,
  ^
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: warning: excess elements in struct initializer
~/ctrulib-master/libctru/source/sdmc_dev.c:95:3: warning: (near initialization for 'sdmc_devoptab')
~/devkitPro/devkitARM/base_rules:85: recipe for target 'sdmc_dev.o' failed
make[1]: *** [sdmc_dev.o] Error 1
Makefile:125: recipe for target 'build' failed
make: *** [build] Error 2

As usual, I tried commenting out line 95 of sdmc_dev.c but then there are more errors:

Code:
~/ctrulib-master/libctru/source/system/initSystem.c: In function '__libctru_init':
~/ctrulib-master/libctru/source/system/initSystem.c:26:15: error: '__syscalls_t' has no member named 'gettod_r'
    __syscalls.gettod_r = __libctru_gtod;
              ^
~/devkitPro/devkitARM/base_rules:85: recipe for target 'initSystem.o' failed
make[1]: *** [initSystem.o] Error 1
Makefile:125: recipe for target 'build' failed
make: *** [build] Error 2

I've just built ctrulib to try it out, and it Werks on my PC™.
You should just update it with the perl updater script. ctrulib is not the only thing that updated; devkitARM did so too.
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
oh. That was easy. Now I can compile ctrulib without issue. But I already have it.

Unfortunately, it looks like there is some Makefile voodoo needed because now I can't build 3DNES. I get many linking errors with regards to VFP, "virtual floating point?"

Code:
/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: error: nesSystem.o uses VFP register arguments, ~/Desktop/shit/3DNES/3DNES.elf does not

I did run make clean to get rid of the old object files. I also changed -mfloat-abi=softfp to -mfloat-abi=hard in the makefile.

Is there something else I need to change?

Code:
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH    :=      -march=armv6k -mtune=mpcore
 
CFLAGS  :=      -g -Wall -O3 -mword-relocations -save-temps \
                        -fomit-frame-pointer -ffast-math -mfloat-abi=hard\
                        $(ARCH)
 
CFLAGS  +=      $(INCLUDE) -DARM11 -D_3DS
 
CXXFLAGS        := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
 
ASFLAGS :=      -g $(ARCH)
LDFLAGS =      -specs=3dsx.specs -g $(ARCH) \
                        -Wl,-Map,$(TARGET).map
 
LIBS    := -lctru -lm
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
oh. That was easy. Now I can compile ctrulib without issue. But I already have it.

Unfortunately, it looks like there is some Makefile voodoo needed because now I can't build 3DNES. I get many linking errors with regards to VFP, "virtual floating point?"

Code:
/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: error: nesSystem.o uses VFP register arguments, ~/Desktop/shit/3DNES/3DNES.elf does not

I did run make clean to get rid of the old object files. I also changed -mfloat-abi=softfp to -mfloat-abi=hard in the makefile.

Is there something else I need to change?

Code:
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH    :=      -march=armv6k -mtune=mpcore
 
CFLAGS  :=      -g -Wall -O3 -mword-relocations -save-temps \
                        -fomit-frame-pointer -ffast-math -mfloat-abi=hard\
                        $(ARCH)
 
CFLAGS  +=      $(INCLUDE) -DARM11 -D_3DS
 
CXXFLAGS        := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
 
ASFLAGS :=      -g $(ARCH)
LDFLAGS =      -specs=3dsx.specs -g $(ARCH) \
                        -Wl,-Map,$(TARGET).map
 
LIBS    := -lctru -lm


You have to add -mfloat-abi=hard to the LDFLAGS as well to get it to link.

Unfortunately, I still have corrupt graphics. But different this time: there are three copies of the screen stacked vertically. The images are also really garbled. About ready to give up on this for a while.....
 

mid-kid

GBAtemp spamBOT
Member
Joined
Aug 2, 2012
Messages
879
Trophies
0
Age
25
XP
1,163
Country
The problem is most probably that 3DNES has to be updated to be able to build with the current version of the build tools.
 

romanaOne

Well-Known Member
OP
Member
Joined
Apr 18, 2014
Messages
453
Trophies
0
Age
49
Location
where the potential goes to zero
XP
1,024
Country
United States
The problem is most probably that 3DNES has to be updated to be able to build with the current version of the build tools.

Yeah, I got around to taking a look at the older threads about 3DNES, and kinda got bummed out when I realized that he probably hadn't finished updating it for the new tool set when the new school year began and he got busy.
 

m1n10n

Member
Newcomer
Joined
Jan 15, 2016
Messages
5
Trophies
0
Age
43
XP
52
Country
United States
I wanted to do this as well.

I used '3DS Simplie CIA Converter v4.3' to create a ncchininfo.bin, make xorpads with this in rxTools and then install the created CIA w/ the CIA converter into my EMUNAND (9.2)

It installed fine ... from there the app seems to lockup and I can't load a ROM...

Would love to hear that someone made this work!?
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
I'd suggest moving on to RetroArch's FCEUMM, QuickNES, or NEStopia instead of this emulator (on Old 3DS, stick with QuickNES), it's long since been abandoned, and it only ran a few games, if I recall correctly.
 
Last edited by daxtsu,
  • Like
Reactions: m1n10n and SLiV3R

m1n10n

Member
Newcomer
Joined
Jan 15, 2016
Messages
5
Trophies
0
Age
43
XP
52
Country
United States
I'd suggest moving on to RetroArch's FCEUMM, QuickNES, or NEStopia instead of this emulator (on Old 3DS, stick with QuickNES), it's long since been abandoned, and it only ran a few games, if I recall correctly.

Good Call - I grabbed it from the Retroarch thread and it was one of the CIAs included in the CIA package ... hahaha - I see DOXBOX in there too - amazing!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Soon your birthday?