Homebrew Homebrew Development

Pikachuk

Well-Known Member
Member
Joined
Mar 19, 2016
Messages
767
Trophies
0
Age
23
Location
Bordeaux
XP
749
Country
France
It's possible if you manage to obtain a copy of Unity for 3DS from some shady source. But in this case you may not publish your game on this site(or on most most sites). This method isn't recommended. Porting Mono by yourself would be a huge undertakement. There exist some tools which convert C# to C++(Unity has it's own and uses it for it's mobile platforms including the 3DS) but I doubt those are suitable for 3DS development.

There are two major programming languages in the 3DS dev scene: C and C++. Besides these two it's also possible to program in Lua but this is limited to normal applications. And really, writing a custom firmware doesn't only need a good programming skills but also great knowledge about the 3DS architecture. If your'e just starting, writing a CFW in near future is an unrealistc goal.
But if you're still interested in homebrew programming I recommend you to simply start by learning Lua for the PC.

EDIT: ah, I was ninjaed. C is also an option, but if you're a total beginner, I would definitely recommend Lua over C

Yes the best option for me would probably be to learn C++ instead of waiting for a mono that will never exist on the homebrew scene XD
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
722
Trophies
1
XP
3,952
Country
Germany
I have some experience with programming i did computing for 2 years at school and my first year of college and i am a quick learner do you know what would be some good places so start learning c and c++ is it worth buying textbooks??
Regarding to this I can't give any tips. I started by programming websites when I was in the fith grade and then I tried a lot of other things. I revisited them later and that's how I learned how to program computers until the 8th grade, at this time I started to learn things until the end.
To come back to your question, I think there is very good literature on C and C++. C is a simple language and I think it's possible to read a good book and when you are finished it you know C. Keep in mind that C is very bare to the metal and can be very nasty. Nowdays C is only used in very constraint environment or from people who simply never liked to learn something else. But it can be a very good experience to do everything the manual way.
C++ is another story. C++ originally started out as an extended version of C and exactly that's what C++ is until this day. Learning C++ is rather a long term task. If you want to do something in C++ there are always the C way of doing it and probably two C++ ways of doing it. I don't want you to scare away from C++, but C++ by itself is a monster with a lot of little dirty details. There are some people who deny this, but it's true(to clarify this C/C++ thing, knowing C++ doesn't mean knowing C and vice versa, because as I said before there's almost always a C and different C++ way of doing something in C++). Because there are so many ways of doing things in C++ different people have different styles. Some of them use the more modern features of C++ and some of them don't. Remember C++ was invented in the late 70s, so it carries a large legacy(including C:), which hasn't changed to much since it was developed).
I assume you have some programming experience so you would be to implement algorithms or patterns in C or C++. The thing is that if you want do a real application you need to learn other libraries, protocols etc. E.g. if you want to do game programming you have to learn how to use libraries which you can use to open windows, draw graphics, listen to inputs and play sound. Beside these libraries you also have to learn about graphic formats or maybe how GPUs work or helpful programming patterns(I think you got the point). So learning a programming language is never enough.

So yes, if you want to, learn C or C++. BTW you want to write your own CFW? There are a lot of options available, isn't there something that fits your needs. I think almost all of them are Open Source, maybe it's a better option to simply contribute to an existing one.

PS you're getting advice from a high school student, keep this in mind:)
 
Last edited by catlover007,

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
I'm getting a bunch of undefined reference errors, even thought I updated ctrulib, SDL, and I'm using the latest devkitPro (I think)

Here's my code:
Code:
#include <3ds.h>
#include <stdio.h>
#include <SDL/sdl.h>
#include <SDL/SDL_image.h>

int main(int argc, char **argv)
{
    //Initialize gfx (note: not needed if you're using SF2Dlib)
    gfxInitDefault();
    
    SDL_Init(SDL_INIT_EVERYTHING);
    IMG_Init(IMG_INIT_JPG);
    
    SDL_Surface* image = NULL;
    SDL_Surface* screen = NULL;
    screen = SDL_SetVideoMode(400, 240, 32, SDL_SWSURFACE);
    image = IMG_Load("ssgss.jpeg");
    SDL_BlitSurface(image, NULL, screen, NULL);

    
    consoleInit(GFX_BOTTOM, NULL);

    // Main loop
    while (aptMainLoop())
    {
        //Scan all the inputs. This should be done once for each frame
        hidScanInput();

        //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)
        //hidKeysHeld returns information about which buttons are currently pressed (regardless if they were pressed or not pressed in the previous frame)
        //hidKeysUp returns information about which buttons are not pressed but were pressed in the previous frame
        u32 kDown = hidKeysDown();
        
        if (kDown & KEY_START) break; // break in order to return to hbmenu

        // Flush and swap framebuffers, this is needed for rendering these will not be needed when using SF2D lib
        gfxFlushBuffers();
        gfxSwapBuffers();

        //Wait for VBlank, this is needed for rendering these will not be needed when using SF2D lib
        gspWaitForVBlank();
    }
    SDL_FreeSurface(image);
    IMG_Quit();
    SDL_Quit();
    gfxExit();
    return 0;
}
 

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
Include all the lib that are prerequisites of SDL_Image and SDL. Use the makefile of a game of mine as reference.
The only library I left out was "-jpeg" and every time I included that I got this:

Code:
arm-none-eabi-gcc.exe: error: unrecognized command line option '-jpeg'; did you mean '-pg'?
make[1]: *** [/c/~/sdltemplate/SDLTEST.elf] Error 1
make: *** [build] Error 2
 

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
To include a lib you have to use -l followeb by the lib name. So try -ljpeg.
Well one mistake was that I wasn't including those portlibs from the "armv6k" folder in LIBDIRS, so I added that, and I get this now

Code:
linking SDLTEST.elf
C:\devkitPro\portlibs\3ds\/lib\libSDL.a(SDL_n3dsvideo.o): In function `N3DS_SetVideoMode':
C:\~\SDL-3DS-master\SDL-1.2.15/src/video/n3ds/SDL_n3dsvideo.c:429: undefined reference to `C3D_TexInit'
C:\~\SDL-3DS-master\SDL-1.2.15/src/video/n3ds/SDL_n3dsvideo.c:430: undefined reference to `C3D_TexSetFilter'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/~/sdltemplate/SDLTEST.elf] Error 1
make: *** [build] Error 2

And here are the Libs I included:

Code:
LIBS    := -lSDL_image -lSDL -lpng -ljpeg -lz -lcitro3d -lctru -lm
 

erman1337

Well-Known Member
Member
Joined
Sep 27, 2015
Messages
1,211
Trophies
0
Location
Brussels
XP
983
Country
Belgium
Hey, any idea how to fix this in 11.4?

.eJwFwUEOwiAQAMC_8AAWCruwvRsTT_6gIZTQmlYaWE_GvzvzVZ9-qFltIteYAdZ95NZXPaT1VIuurdWjpGsfOrcTkkjK21neMsAykcMQbeDIODEZcMaFQBS9R0akSB4ez9t9mYwNxtu4GLbsUL-uqn5_w5skqw.A27YKHoqO98yhqpdFlV9iy54owE
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Well one mistake was that I wasn't including those portlibs from the "armv6k" folder in LIBDIRS, so I added that, and I get this now

Code:
linking SDLTEST.elf
C:\devkitPro\portlibs\3ds\/lib\libSDL.a(SDL_n3dsvideo.o): In function `N3DS_SetVideoMode':
C:\~\SDL-3DS-master\SDL-1.2.15/src/video/n3ds/SDL_n3dsvideo.c:429: undefined reference to `C3D_TexInit'
C:\~\SDL-3DS-master\SDL-1.2.15/src/video/n3ds/SDL_n3dsvideo.c:430: undefined reference to `C3D_TexSetFilter'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/~/sdltemplate/SDLTEST.elf] Error 1
make: *** [build] Error 2

And here are the Libs I included:

Code:
LIBS    := -lSDL_image -lSDL -lpng -ljpeg -lz -lcitro3d -lctru -lm

Included libs are ok. Try updating Citro3d.

--------------------- MERGED ---------------------------

Hey, any idea how to fix this in 11.4?

I read somewhere to use payloads for 11.2. Download them manually and replace the 11.2 ones (backup them first).

Let me know if it reaaly works.
 

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
Included libs are ok. Try updating Citro3d.

--------------------- MERGED ---------------------------



I read somewhere to use payloads for 11.2. Download them manually and replace the 11.2 ones (backup them first).

Let me know if it reaaly works.
I'm using the latest next branch version since the regular doesn't work, and I get the same error.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy

I changed
#include <SDL/sdl.h>
in
#include <SDL/SDL.h>
because it should be case sensitive.

Other than this, I canged in makefile
LIBDIRS := $(CTRULIB) $(3DS_PORTLIBS) $(ARMV6K_PORTLIBS)
in
LIBDIRS := $(CTRULIB) $(PORTLIBS)

but this one depends on how OS global variables are defined (is this a change from latest DEVKITPRO?)

this way the code for me compiles fine. So check the definition of the 3DS_PORTLIBS and ARMV6K_PORTLIBS

Note that in the makefile you are adding the SDL folder too in the INCLUDE folder list, so you can simply use

#include <SDL.h> instead of #include <SDL/SDL.h>. But both the two are good.

Let me know if you can compile the sources. Then there will be a lot of work to do on the code that is really messed.

Here are some hints:

- IMG_Load("ssgss.jpeg") loads the image from the root folder of th emulated sd if you use citra, using the 3dsx build it loads from the folder where is the 3dsx file, using the cia, don't know. Seems you want to use romfs to load the image, so the path for the image must be romfs:/ssgss.jpeg, but before using it you have to initialize romfs with romfsInit(); and you have to close it before exiting the program with romfsExit();

- conoleInit used with SDL is not a good idea. There is a custom SDL flag to use the console. For using it on the bottom screen use SDL_CONSOLEBOTTOM in SDL_SetVideoMode
- No need to use the SDL_SWSURFACE flag (it's forcedo to HWSURFACE in the video init code
- don't call gfxInitDefault(); . If you use SDL you don't have to use low level ctrulib gfx functions
- the same for gfxFlushBuffers(); gfxSwapBuffers(); and gspWaitForVBlank(); . Use SDL_Flip(screen); instead
- put SDL_BlitSurface(image, NULL, screen, NULL); inside the while loop (and before SDL_Flip) or nothing will be renered
 

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
I changed
#include <SDL/sdl.h>
in
#include <SDL/SDL.h>
because it should be case sensitive.

Other than this, I canged in makefile
LIBDIRS := $(CTRULIB) $(3DS_PORTLIBS) $(ARMV6K_PORTLIBS)
in
LIBDIRS := $(CTRULIB) $(PORTLIBS)

but this one depends on how OS global variables are defined (is this a change from latest DEVKITPRO?)

this way the code for me compiles fine. So check the definition of the 3DS_PORTLIBS and ARMV6K_PORTLIBS

Note that in the makefile you are adding the SDL folder too in the INCLUDE folder list, so you can simply use

#include <SDL.h> instead of #include <SDL/SDL.h>. But both the two are good.

Let me know if you can compile the sources. Then there will be a lot of work to do on the code that is really messed.

Here are some hints:

- IMG_Load("ssgss.jpeg") loads the image from the root folder of th emulated sd if you use citra, using the 3dsx build it loads from the folder where is the 3dsx file, using the cia, don't know. Seems you want to use romfs to load the image, so the path for the image must be romfs:/ssgss.jpeg, but before using it you have to initialize romfs with romfsInit(); and you have to close it before exiting the program with romfsExit();

- conoleInit used with SDL is not a good idea. There is a custom SDL flag to use the console. For using it on the bottom screen use SDL_CONSOLEBOTTOM in SDL_SetVideoMode
- No need to use the SDL_SWSURFACE flag (it's forcedo to HWSURFACE in the video init code
- don't call gfxInitDefault(); . If you use SDL you don't have to use low level ctrulib gfx functions
- the same for gfxFlushBuffers(); gfxSwapBuffers(); and gspWaitForVBlank(); . Use SDL_Flip(screen); instead
- put SDL_BlitSurface(image, NULL, screen, NULL); inside the while loop (and before SDL_Flip) or nothing will be renered
I think something is wrong with my installation because I'm getting the same error, but I updated everything on Github in case you see something wrong https://github.com/kprovost7314/error-sdl
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I think something is wrong with my installation because I'm getting the same error, but I updated everything on Github in case you see something wrong https://github.com/kprovost7314/error-sdl

In the attached files there is the project with small changes and the compiled 3dsx (so you can test it)

Changes are:
- added conversion of the image to the screen format
- added romfs ceration statements in the makefile
 

Attachments

  • error-sdl-master.zip
    1.5 MB · Views: 189

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
In the attached files there is the project with small changes and the compiled 3dsx (so you can test it)

Changes are:
- added conversion of the image to the screen format
- added romfs ceration statements in the makefile
I think something's wrong with Citro3D or SDL, I'm getting the same error, but thanks for the help
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @Sonic Angel Knight, Is that SAK I see. :ninja:
  • BigOnYa @ BigOnYa:
    What a weird game
  • K3Nv2 @ K3Nv2:
    Yeah I wanted to see shards of the titanic
  • BigOnYa @ BigOnYa:
    I kept thinking jaws was gonna come up and attack
  • K3Nv2 @ K3Nv2:
    Jaws is on a diet
  • K3Nv2 @ K3Nv2:
    Damn power went out
  • BigOnYa @ BigOnYa:
    Ok xdqwerty, your little bro prob tripped On the cord and unplugged you
  • K3Nv2 @ K3Nv2:
    Ya I'm afraid of the dark hug me
  • BigOnYa @ BigOnYa:
    Grab and hold close your AncientBoi doll.
  • K3Nv2 @ K3Nv2:
    Damn didn't charge my external battery either
  • BigOnYa @ BigOnYa:
    Take the batteries out of your SuperStabber3000... Or is it gas powered?
  • K3Nv2 @ K3Nv2:
    I stole batteries from your black mamba
    +1
  • K3Nv2 @ K3Nv2:
    My frozen food better hold up for an hour I know that
  • BigOnYa @ BigOnYa:
    Or else gonna be a big lunch and dinner tomorrow.
  • BigOnYa @ BigOnYa:
    Did you pay your power bill? Or give all yo money to my wife, again.
  • K3Nv2 @ K3Nv2:
    Oh good the estimated time is the same exact time they just said
    +1
  • BigOnYa @ BigOnYa:
    Load up your pc and monitor, and head to a McDonalds dining room, they have free WiFi
  • K3Nv2 @ K3Nv2:
    Sir please watch your porn in the bathroom
    +2
  • BigOnYa @ BigOnYa:
    No sir we can not sell you anymore apple pies, after what you did with the last one.
  • K3Nv2 @ K3Nv2:
    We ran out
  • HiradeGirl @ HiradeGirl:
    for your life
    +1
  • K3Nv2 @ K3Nv2:
    My life has no value my fat ass is staying right here
    K3Nv2 @ K3Nv2: My life has no value my fat ass is staying right here