C++, SFML, Homebrew

Discussion in '3DS - Homebrew Development and Emulators' started by The Thinker, Oct 18, 2014.

  1. The Thinker
    OP

    The Thinker Member

    Newcomer
    12
    0
    Oct 17, 2014
    London, United Kingdom
    Hi all, I bought 2 3ds XL on Ebay to experiment with homebrew. One is with gateway on firmware 4.1, the other one is with supercard dstwo on firmware 8.
    I have a general knowledge of C++ and I'm learning SFML, is it possible to develop something with these tools on the 3ds, I'd like to make a game in C++.
    Please let me know what do I need to configure the C++ environment and what are the best solutions to accomplish my goal (a simple game in C++ with visual studio or xcode).
    Thank you and keep up the good work :)
     
  2. Reisyukaku

    Reisyukaku Onii-sama~

    Member
    1,183
    2,291
    Feb 11, 2014
    United States
    deja vu? I swear, I've already answered this, lol.. Theres no currect way via straight up mset + arm9 vuln.. not sure if its even possible to inject into a ROM or not.. it may be though since people are injecting emulators.
     
  3. The Thinker
    OP

    The Thinker Member

    Newcomer
    12
    0
    Oct 17, 2014
    London, United Kingdom
    No deja vu and thank you for your answer :) I'd like to see what the community think.
     
  4. st4rk

    st4rk nah

    Member
    545
    672
    Feb 11, 2014
    Brazil

    Hello, so if you wanna write homebrews, you will need use DevKitARM and ctrulib, you can find it here:
    devkitpro.org - DevKitARM
    https://github.com/smealum/ctrulib/t

    There is some examples in the ctrulib folder, if you wanna compile a .3ds, there is some template in Homebrew Developed Thread, you can check it.

    Good Luck, we really need peoples on Homebrew 3DS Scene.
     
    cearp, ieatpixels and gamesquest1 like this.
  5. Reisyukaku

    Reisyukaku Onii-sama~

    Member
    1,183
    2,291
    Feb 11, 2014
    United States
    I forgot ctrulib existed, lol.. It still isnt complete, like all the other libraries :x .. it's probably the closest one to usable though.
     
  6. st4rk

    st4rk nah

    Member
    545
    672
    Feb 11, 2014
    Brazil

    We just have ctrulib and 3dsbrew documentation to homebrew, belive me, ctrulib is too good to work on homebrews and now have support to GPU, this is so good.
     
  7. AlbertoSONIC

    AlbertoSONIC Pasta Team Member

    Member
    929
    1,221
    Jun 27, 2014
    Italy
    Guys, Can i write a simple homebrew with C# or do i need to write it in C++?
     
  8. Reisyukaku

    Reisyukaku Onii-sama~

    Member
    1,183
    2,291
    Feb 11, 2014
    United States
    now thats taking it too far!.. lol.
    C# runs in a VM (at least for .Net).. good luck writing a compiler let alone an environment for it to 3DS. =)
     
  9. AlbertoSONIC

    AlbertoSONIC Pasta Team Member

    Member
    929
    1,221
    Jun 27, 2014
    Italy
    You introduced me a new world! I'm learning C# at school right now, so i thought i could use it. None at my school said that about C#! So i need to learn C++, right?
     
  10. Reisyukaku

    Reisyukaku Onii-sama~

    Member
    1,183
    2,291
    Feb 11, 2014
    United States
    I wouldnt even use C++, honestly.. C works best for me.. Introducing Object Oriented languages into this is asking for trouble, lol
     
  11. AlbertoSONIC

    AlbertoSONIC Pasta Team Member

    Member
    929
    1,221
    Jun 27, 2014
    Italy
    Nice, thank you!
     
  12. AlbertoSONIC

    AlbertoSONIC Pasta Team Member

    Member
    929
    1,221
    Jun 27, 2014
    Italy
    And what about development tools? What do i need to install?
     
  13. st4rk

    st4rk nah

    Member
    545
    672
    Feb 11, 2014
    Brazil
    Hi, C# will not work, how Reisy said: It run on Virtual Machine, we need native code compiled.

    Everything you will need is: Install DevKitARM, Get last ctrulib and a good IDE or Text Editor(I personally prefer Sublime Text Editor), here the links ²:

    devkitpro.org - DevKitARM
    https://github.com/smealum/ctrulib/t

    There is a thread here which may help you with it:
    http://gbatemp.net/threads/homebrew-development.360646/


    Good Luck (:
     
  14. Wabsta

    Wabsta you fight like a dairy farmer

    Member
    2,498
    69
    Apr 25, 2008
    Netherlands
    SCUMM Bar
    Can you elaborate? I'm building software for microcontrollers using C++ (and its OO functionality) just fine. Why would it bring trouble to NDS or 3DS homebrew?

    Not attacking you, just really curious why people say this :)
     
  15. Reisyukaku

    Reisyukaku Onii-sama~

    Member
    1,183
    2,291
    Feb 11, 2014
    United States
    short answer:
    no one wrote a compiler for it and probably wont.

    long answer:
    you need a c++ compiler, or to build one. but who really wants to build a C++ compiler for 3DS? thats just painful. Sure you could cross compile with GCC or something, but again, things that require any kind of malloc, or an stdout terminal are broken. For example, in just plain C, if i wanted to printf(), that requires that i have a standard output.. well the 3DS doesnt have one.. just has a screen to paint to by writing to RAM.. Also any command that is built using malloc is broken since deep down, that requires a syscall sbrk().. the 3DS doesnt have any syscall that acts like that (as far as I know). When I program for it, it just use stack allocation and write to the RAM to form pixels on the screen and write my own pseudo fuctions.
    So sure, we can achieve a similar fake environment where c++ would work, but its a lot of work and hasnt been done yet
     
  16. AlbertoSONIC

    AlbertoSONIC Pasta Team Member

    Member
    929
    1,221
    Jun 27, 2014
    Italy
    Just a strange question: developing homebrew for Nintendo DS involves the use of libnds and C or libnds and C++? Because i've written some DS homebrew and i can't remember which language i used!
     
  17. Coto

    Coto GBAtemp Addict

    Member
    2,343
    394
    Jun 4, 2010
    Chile

    gcc (c compiler) with libc
    and
    http://developer.mbed.org/users/fra...ocs/bf7b9fba3924/libnosys__gnu_8c_source.html
    and
    linker file

    should give support to sbrk. (which requires _sbrk)

    Linker's work is to set up environment properly. (well that's a job for library writters than normal coders). it's not malloc, calloc , sbrk are break if a new hardware is released, the same vendors should give you a proper g++ (libg in gnu ARM devices) and c compiler (libc in gnu ARM devices) , then a linker (ld in gnu ARM) whose job is to find and allocate symbols from objects and link to generate the executable file.

    But linker accepts a linker script file for a reason: to set up stacks, and memory map for your hardware . This is basically then later passed as arguments to libraries such above and correct areas are defined to work with higher level APIs later.

    But I have to say I don't like either C++ OOP style programming when static allocation of linear memory, because everything screws up. D: