Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,789
  • Replies Replies 6,048
  • Likes Likes 54
You're probably right! But i can't test it now because i accidentally removed my microsd from my pc while copying a file and now it says that i have to format it. It says RAW filesystem... I recovered all my roms, but i can't format it because it says "Sdcard has write lock".

The draw_string function isn't overloaded to take ints so it'll crash if you do that.
however you can do this:

int variable;
char buffer[100];
sprintf(buffer,"The result is %d",variable);
draw_string(buffer, 1, 41, 255, 255, 255, BOTTOM_SCREEN);
 
On the SD card there's a small little notch on the top leftish that you can move up and down. Toggles write protection.
It's a microsdcard, not a big SD Card. Anyway i successfully formatted it after recovering my roms!
The draw_string function isn't overloaded to take ints so it'll crash if you do that.
however you can do this:

int variable;
char buffer[100];
sprintf(buffer,"The result is %d",variable);
draw_string(buffer, 1, 41, 255, 255, 255, BOTTOM_SCREEN);
Thank you! I'll try once i get home!
 
Hello everyone, here a little tutorial to whom wanna begin with homebrew on 3DS :P

Before anything you will need these files:
DevKitARM : devkitpro.org
DevKitARM Add-on 3ds: http://mtheall.com/~fincs/3dsdkA/
3DSTemplate(with new ctrulib): http://filetrip.net/dl?rqkeqrIIns

After download all files:
1 - open the "dkA-3dsx-patch-12092014.zip" and copy the DevKitARM folder to DevKitPro/DevKitARM folder on your PC.
2 - extract 3dstemplate where you wanna, open the 3dstemplate folder and copy the "libctru" on C:/ or D:/ or where you wanna on your disk.
3 - Go to environment variables and at system variables, create a new with name: CTRULIB , value: D:\libctru (change to your libctru directory !).
4 - on 3dstemplate folder open the build.bat, if you did everything correct, it will generate three new files, ".elf", ".3dsx" and ".3ds", the .3ds is to Gateway users, .elf to alternative homebrew loaders and .3dsx to future Smea Homebrew Loader.

If you wanna edit the code, just go to source and edit the main.c, there is a little example on code, have fun :P



Code:
3DSTemplate
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/3DSTemplate/build/main.d -g -Wall -O
2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-math -mfloat-abi=so
ftfp -march=armv6k -mtune=mpcore -I/c/devkitPro/3DSTemplate/include -IC:\libctru
/include -I/c/devkitPro/3DSTemplate/build -DARM11 -D_3DS -c /c/devkitPro/3DSTemp
late/source/main.c -o main.o
linking 3DSTemplate.elf
built ... 3DSTemplate.3dsx
'arm-none-eabi-strip' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
[ELF ERROR] Too large section size.
Segment size = 0x49c0
Section Size = 0xfff015a0
[ELF ERROR] Failed to process ELF file (-16)
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
Appuyez sur une touche pour continuer...

I have an error too !!!
 
Code:
3DSTemplate
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/3DSTemplate/build/main.d -g -Wall -O
2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-math -mfloat-abi=so
ftfp -march=armv6k -mtune=mpcore -I/c/devkitPro/3DSTemplate/include -IC:\libctru
/include -I/c/devkitPro/3DSTemplate/build -DARM11 -D_3DS -c /c/devkitPro/3DSTemp
late/source/main.c -o main.o
linking 3DSTemplate.elf
built ... 3DSTemplate.3dsx
'arm-none-eabi-strip' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
[ELF ERROR] Too large section size.
Segment size = 0x49c0
Section Size = 0xfff015a0
[ELF ERROR] Failed to process ELF file (-16)
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
Appuyez sur une touche pour continuer...

I have an error too !!!
Have you installed GCC?
 
Guys i'm having some trouble with draw functions.. Here's the log:

Code:
3DSTemplate
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/Projects/3DS/3DSTemplate/build/main.
d -g -Wall -O2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-math -
mfloat-abi=softfp -march=armv6k -mtune=mpcore -I/c/devkitPro/Projects/3DS/3DSTem
plate/include -IC:\devkitPro\libctru/include -I/c/devkitPro/Projects/3DS/3DSTemp
late/build -DARM11 -D_3DS -c /c/devkitPro/Projects/3DS/3DSTemplate/source/main.c
-o main.o
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c: In function 'main':
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c:51:4: warning: implicit decl
aration of function 'draw_string' [-Wimplicit-function-declaration]
    draw_string("********************************", 1, 1, 255, 255, 255, BOTTOM_
SCREEN);
    ^
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c: In function 'initscreens':
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c:230:2: warning: implicit dec
laration of function 'draw_fillrect' [-Wimplicit-function-declaration]
  draw_fillrect(0, 0, 320, 240, 90, 100, 225, BOTTOM_SCREEN);
  ^
linking 3DSTemplate.elf
main.o: In function `initscreens':
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c:230: undefined reference to
`draw_fillrect'
c:/devkitPro/Projects/3DS/3DSTemplate/source/main.c:231: undefined reference to
`draw_fillrect'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/devkitPro/Projects/3DS/3DSTemplate/3DSTemplate.elf] Error 1
make: *** [build] Error 2
arm-none-eabi-strip: '3DSTemplate.elf': No such file
[NCCH ERROR] Failed to open elf file '3DSTemplate.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
[NCCH ERROR] Failed to open elf file '3DSTemplate.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
Premere un tasto per continuare . . .

I've already added #include "draw.h" at the top of main.c file.... but it seems that everything related to draw.c / draw.h is not working...
 
Ha, I had this same issue. If I were at home, I would paste you my Path settings. It's ridiculously tough to explain how to set that stuff up.
 
Code:
3DSTemplate
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/3DSTemplate/build/main.d -g -Wall -O
2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-math -mfloat-abi=so
ftfp -march=armv6k -mtune=mpcore -I/c/devkitPro/3DSTemplate/include -IC:\libctru
/include -I/c/devkitPro/3DSTemplate/build -DARM11 -D_3DS -c /c/devkitPro/3DSTemp
late/source/main.c -o main.o
linking 3DSTemplate.elf
built ... 3DSTemplate.3dsx
'arm-none-eabi-strip' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
[ELF ERROR] Too large section size.
Segment size = 0x49c0
Section Size = 0xfff015a0
[ELF ERROR] Failed to process ELF file (-16)
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
Appuyez sur une touche pour continuer...

I have an error too !!!


Probably something wrong with DevKitARM, did you installed it ?
 
Guys i'm having some trouble with draw functions.. Here's the log:

Code:
    draw_string("********************************", 1, 1, 255, 255, 255, BOTTOM_
SCREEN);
.

I've already added #include "draw.h" at the top of main.c file.... but it seems that everything related to draw.c / draw.h is not working...


Did you not read YoungNerdyJoes reply to you? You have to create a char buffer and pass the pointer to the array as the first parameter...

Just use my modified example of 3DSTemplate. I already did all the work porting it over...

https://www.sendspace.com/file/o0l19n
 
  • Like
Reactions: st4rk
Did you not read YoungNerdyJoes reply to you? You have to create a char buffer and pass the pointer to the array as the first parameter...

Just use my modified example of 3DSTemplate. I already did all the work porting it over...

https://www.sendspace.com/file/o0l19n

I'm already using your 3DS template.. and i thought that YoungNerdyJoes reply was related with printing a variable, not a normal text.
 
I'm already using your 3DS template.. and i thought that YoungNerdyJoes reply was related with printing a variable, not a normal text.

It still does not work... I used "buffer" to print, but it gives me the same error as before.

Code:
3DSBaseConverter
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/Projects/3DS/3DSBaseConverter/build/
main.d -g -Wall -O2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-m
ath -mfloat-abi=softfp -march=armv6k -mtune=mpcore -I/c/devkitPro/Projects/3DS/3
DSBaseConverter/include -IC:\devkitPro\libctru/include -I/c/devkitPro/Projects/3
DS/3DSBaseConverter/build -DARM11 -D_3DS -c /c/devkitPro/Projects/3DS/3DSBaseCon
verter/source/main.c -o main.o
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c: In function 'main':
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:72:4: warning: implicit
 declaration of function 'draw_string' [-Wimplicit-function-declaration]
    draw_string(buffer1, 1, 1, 255, 255, 255, BOTTOM_SCREEN);
    ^
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:246:9: error: 'input' u
ndeclared (first use in this function)
     if (input & KEY_A)
         ^
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:246:9: note: each undec
lared identifier is reported only once for each function it appears in
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
arm-none-eabi-strip: '3DSBaseConverter.elf': No such file
[NCCH ERROR] Failed to open elf file '3DSBaseConverter.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
[NCCH ERROR] Failed to open elf file '3DSBaseConverter.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile

Plus, it says that "input" variable is underclared. I used u32 input = hidKeysDown();
Do i need to declare it as an int? As a char?
 
It still does not work... I used "buffer" to print, but it gives me the same error as before.

Code:
3DSBaseConverter
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/Projects/3DS/3DSBaseConverter/build/
main.d -g -Wall -O2 -mword-relocations -save-temps -fomit-frame-pointer -ffast-m
ath -mfloat-abi=softfp -march=armv6k -mtune=mpcore -I/c/devkitPro/Projects/3DS/3
DSBaseConverter/include -IC:\devkitPro\libctru/include -I/c/devkitPro/Projects/3
DS/3DSBaseConverter/build -DARM11 -D_3DS -c /c/devkitPro/Projects/3DS/3DSBaseCon
verter/source/main.c -o main.o
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c: In function 'main':
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:72:4: warning: implicit
declaration of function 'draw_string' [-Wimplicit-function-declaration]
    draw_string(buffer1, 1, 1, 255, 255, 255, BOTTOM_SCREEN);
    ^
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:246:9: error: 'input' u
ndeclared (first use in this function)
    if (input & KEY_A)
        ^
c:/devkitPro/Projects/3DS/3DSBaseConverter/source/main.c:246:9: note: each undec
lared identifier is reported only once for each function it appears in
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
arm-none-eabi-strip: '3DSBaseConverter.elf': No such file
[NCCH ERROR] Failed to open elf file '3DSBaseConverter.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile
[NCCH ERROR] Failed to open elf file '3DSBaseConverter.elf'
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile

Plus, it says that "input" variable is underclared. I used u32 input = hidKeysDown();
Do i need to declare it as an int? As a char?


where you did the declaration ?
 
AlbertoSONIC, the first error you posted had to do with draw.c not being compiled with the project, causing undefined references to draw_fillrect.
There was nothing wrong with the draw_string calls. It was just spitting out harmless warning because you were converting from const char* to char*.

As for the error about input I'll second st4rk, where is the declaration?
Make sure that input is declared in the functions you want to use it in or define it globally.

EDIT: side note, they REALLY did a good job cleaning up ctrulib since I last used it
 
AlbertoSONIC, the first error you posted had to do with draw.c not being compiled with the project, causing undefined references to draw_fillrect.
There was nothing wrong with the draw_string calls. It was just spitting out harmless warning because you were converting from const char* to char*.

As for the error about input I'll second st4rk, where is the declaration?
Make sure that input is declared in the functions you want to use it in or define it globally.

EDIT: side note, they REALLY did a good job cleaning up ctrulib since I last used it
So, how can i get draw features to work?

And how can i declare input? What kind of variable is it?

st4rk Just give me so time to post it to pastebin. Please don't say anything about its lenght ;) I know that it could be shorter, but since it's my first attempt in 3ds homebrewing, i'd like to learn everything step by step. Once i will get it to work completely fine, i'll start to optimize its size...
 
So, how can i get draw features to work?

And how can i declare input? What kind of variable is it?

st4rk Just give me so time to post it to pastebin. Please don't say anything about its lenght ;) I know that it could be shorter, but since it's my first attempt in 3ds homebrewing, i'd like to learn everything step by step. Once i will get it to work completely fine, i'll start to optimize its size...


u32 will work for input
 
Probably something wrong with DevKitARM, did you installed it ?

It's new install for 3DS with only DevkitARM (Minimal instal)

[mirror] url=
[msys] Version=1.0.17
[devkitARM] Version=42
[devkitPPC] Version=0
[devkitPSP] Version=0
[libgba] Version=20090222
[libnds] Version=1.5.8
[libmirko] Version=0.9.7
[pnotepad] Version=2.0.8.718
[insight] Version=0
[ndsexamples] Version=20140401
[gbaexamples] Version=20090222
[cubeexamples] Version=0
[pspdoc] Version=0
[libgbafat] Version=1.0.12
[maxmodgba] Version=1.0.9
[libndsfat] Version=1.0.12
[defaultarm7] Version=0.5.25
[filesystem] Version=0.9.11
[dswifi] Version=0.3.16
[maxmodds] Version=1.0.9
[gp32examples] Version=20051021
 

Site & Scene News

Popular threads in this forum