Homebrew Development

aliak11 Jan 16, 2014.

  1. williamdabastrd

    williamdabastrd GBAtemp Regular

    Member
    2
    Apr 10, 2010
    United States
    Ohio
    Awesome, thank you for the explanation. That makes perfect sense. I am just looking through libctru to understand the underlying code before even starting anything, as my C++ is very rusty, and the last I used plain C was back when I was in college... haha

    Looking through the code, it is nice to see it is well-documented as well as well-written (as far as I can tell from a cursory glance). Let's see how long it takes me to actually get anything to even run on a test unit. :P
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    7
    Jul 28, 2008
    United States
    The examples were moved over to the devkitpro git repository. Not sure if they get added with the devkitpro installer. But they are a good place to start.
     
    williamdabastrd likes this.
  3. williamdabastrd

    williamdabastrd GBAtemp Regular

    Member
    2
    Apr 10, 2010
    United States
    Ohio
    GBATemp can be annoying at times, but this is not one of those times. I am very glad the community of developers for the 3DS are patient with the uninitiated, and that I can find such a wide array of information by searching this forum. So, thank you again. :)
     
  4. Spaqin

    Spaqin GBAtemp Regular

    Member
    2
    Feb 17, 2015
    Poland
    Another question: is it okay to have multiple loops w/ aptMainLoop() as the condition? It's more a question of proper programming etiquette, but I couldn't find what it means, and what does it really do.
     
  5. delsky

    delsky Newbie

    Newcomer
    1
    Jan 15, 2016
    France
    HI, i may be misunderstood but, the aptMainLoop() return true as long as no exit command has been send, so it should be only on your main loop. If you want some hint about how to manage your main loop maybe this article can help (it's c++ but the idea is the same in c, and if you go for c++ the whole book is great):
    http://gameprogrammingpatterns.com/game-loop.html .
    Documentation about aptMainLoop():
    https://smealum.github.io/ctrulib/apt_8h.html#a84808c36d9a8c389896ecf241c7f89cb
    An example:
    https://smealum.github.io/ctrulib/app_launch_2source_2main_8c-example.html#a1
     
  6. Xen0

    Xen0 GBAtemp Fan

    Member
    6
    Oct 8, 2015
    Germany
    So I´m a really big noob in programming, and have just learnt a bit c++ / java, but in generell when looking at same examples I kinda uneerstand them. But there are (of cource) many many new commands, and i would like to know if there is a list with them. Also how do I choose where for example a text is displayed? And can I just use allthe normal commands that i know from c++ (cin;cout;if,else;do,while;int,double,etc)?
     
  7. Spaqin

    Spaqin GBAtemp Regular

    Member
    2
    Feb 17, 2015
    Poland
    http://smealum.github.io/ctrulib/
    The entire documentation. You'll want to have a look.
    From all the examples I see that using int is discouraged (why? is it because it's 16-bit?), use s32/u32 instead.
    Not sure if cin/couts are supported, besides printf is more versatile :^)
    I'm afraid you'll have to learn more. Don't worry, documentation is your friend. As is Stack Overflow, but only if you browse it. And if you have a more concrete question and post here, I'm pretty sure someone will respond.

    For the "how to set where is displayed" you'll want to go to Files and find "console.h" for console related functions.

    I wanted to give the user a chance to see if an error occured (during texture loading or something else - the checks happen before the main loop) and wait for him to press START to exit (and that requires a loop of course). I guess I could put that into the main loop with a flag or something, but I'd prefer to keep it as efficient and clean as possible.
     
    Last edited by Spaqin, Jan 16, 2016
    Xen0 likes this.
  8. SLiV3R

    SLiV3R 3DS Friend Code: 0473-9069-2206

    Member
    8
    Jan 9, 2006
    I know almost nothing about coding. Have only tried php, xml and mysql a little.

    I want to try to port open source games. Like the ones in the link MasterFeizz posted.

    http://osgameclones.com

    Would Python and Lua be the best choices to work with?
     
    Last edited by SLiV3R, Jan 16, 2016
  9. MasterFeizz

    MasterFeizz GBAtemp Advanced Fan

    Member
    9
    Oct 15, 2015
    United States
    Forget python, lua could work. Most games there either use C or C++, those are the best choices.
     
    SLiV3R likes this.
  10. erman1337

    erman1337 GBAtemp Maniac

    Member
    6
    Sep 27, 2015
    Belgium
    Brussels
    i've been thinking of making a homebrew application that downloads badges from badges.3dsthem.es, but my 3ds' sd card slot has duct tape stuck on it,
    is it possible to debug homebrew on a pc?

    does it have networking?
     
  11. MasterFeizz

    MasterFeizz GBAtemp Advanced Fan

    Member
    9
    Oct 15, 2015
    United States
    Use 3dslink to push the 3dsx to your 3ds and ftp to push necessary files.
     
  12. erman1337

    erman1337 GBAtemp Maniac

    Member
    6
    Sep 27, 2015
    Belgium
    Brussels
    I can't slide in the card, it just comes out
     
  13. delsky

    delsky Newbie

    Newcomer
    1
    Jan 15, 2016
    France
    In smealum portal3ds, he use multiple successive loops. You could do the same but with gameInit return a boolean at true if everything is ok false otherwise. I don't know the best way, but this is how i'll would do on a single or two screen game in c.

    Smealum portal3ds main.c:
    https://github.com/smealum/portal3DS/blob/master/source/main.c
     
    Last edited by delsky, Jan 16, 2016
    Spaqin likes this.
  14. erman1337

    erman1337 GBAtemp Maniac

    Member
    6
    Sep 27, 2015
    Belgium
    Brussels
    So I got citra running, when I load lpp-3ds on it, it says that it can't find index.lua

    i got it, it had to be in user/sdmc
     
    Last edited by erman1337, Jan 16, 2016
  15. erman1337

    erman1337 GBAtemp Maniac

    Member
    6
    Sep 27, 2015
    Belgium
    Brussels
    well shit, citra doesn't have networking
     
  16. Gelex

    Gelex Member

    Newcomer
    1
    Jan 17, 2016
    United States
    Hey all,

    As an introduction to 3DS homebrew development, I've taken it upon myself to help port oot3dhax_installer from ctrulib-0.6.0 to ctrulib-1.0.0. At this point, I've got most of the transition done, but there's something that I'm not understanding... I've forked the code to my repository here.

    The issue is specifically with this file, filesystem.c . So currently, in my last commit, trying to open the archive for the save data is failing with error code 0xC920454. Now, after playing around a lot, I figured out the following work-around:

    Code:
    #include <string.h>
    #include <stdio.h>
    #include <inttypes.h>
    
    #include <3ds.h>
    
    #include "filesystem.h"
    
    FS_Archive saveGameArchive, sdmcArchive;
    Handle fsHandle;
    
    Result filesystemInit()
    {
      Result ret;
    
      //Workaround begin
      srvGetServiceHandleDirect(&fsHandle, "fs:USER");
      FSUSER_Initialize(fsHandle);
      fsUseSession(fsHandle, false);
      //Workaround end
    
      sdmcArchive = (FS_Archive){ARCHIVE_SDMC, (FS_Path){PATH_EMPTY, 1, (u8*)""}, 0};
      ret = FSUSER_OpenArchive(&sdmcArchive);
    
      saveGameArchive = (FS_Archive){ARCHIVE_SAVEDATA, (FS_Path){PATH_EMPTY, 1, (u8*)""}, 0}; 
      ret = FSUSER_OpenArchive(&saveGameArchive);
    
      return ret;
    }
    
    Result filesystemExit()
    {
      Result ret;
     
      ret = FSUSER_CloseArchive(&saveGameArchive);
      ret = FSUSER_CloseArchive(&sdmcArchive);
    
      fsEndUseSession();
    
      return ret;
    }
    Why exactly do I need to request another handle, and substitute the main one with it in order to get the "FSUSER_OpenArchive(&saveGameArchive);" to work? I have a hunch it's something having to do with permissions with the original handle, but I don't know how to go about testing that. Any suggestions?

    Another observation is that changing srvGetServiceHandleDirect to srvGetServiceHandle leads to another error message and actually leads to a program hang as it's trying to exit. I'm guessing (from having looked at the ctrulib source code) that this has to do with the fact the latter function probably just copies the original handle, versus the former which returns a new one unconditionally. Thoughts?
     
    SLiV3R likes this.
  17. Lectem

    Lectem Member

    Newcomer
    1
    Nov 21, 2014
    France
    You should use

    fsUseSession
    fsEndUseSession

    whenever you want to use a different archive.

    This is because all the FS_* functions were changed during great-refactor to use only the current session handle.
    Now you should be able to simply use fsUseSession(savedataHandle, false) to have access to the savedata, and still be able to use the standard fopen fclose for the sdmc access
     
    Last edited by Lectem, Jan 17, 2016
    Gelex likes this.
  18. Gelex

    Gelex Member

    Newcomer
    1
    Jan 17, 2016
    United States
    Aaah, that makes sense, especially with fsUseSession() being initialized to false (so that the SD access still goes to the original handle). I wish somewhere anything would have mentioned that every archive needs its own handle. The great refactor made me think that wasn't needed anymore.

    The current approach of overriding the current session feels cludgy. I would have much rather preferred manually providing handles, and allowing that parameter be NULL so that a default is used. That's just my personal taste, though. Thanks for the insight.
     
  19. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    14
    Nov 24, 2014
    Italy
    Bologna
    Where i can find latest version of makerom? It looks like the one i'm using crashes everytime i try to build a CIA/3DS for a stripped elf i have and link on 3dbrew is just broken.
     
  20. Vappy

    Vappy GBAtemp Advanced Maniac

    Member
    9
    May 23, 2012
Quick Reply
Draft saved Draft deleted
Loading...