Homebrew Development

Discussion in '3DS - Homebrew Development and Emulators' started by aliak11, Jan 16, 2014.

Jan 16, 2014

Homebrew Development by aliak11 at 3:25 AM (815,049 Views / 41 Likes) 5,299 replies

  1. LinkKenedy

    Newcomer LinkKenedy Member

    Joined:
    Feb 14, 2015
    Messages:
    48
    Country:
    France
    But i have all exports in ./bashcr! What i am doing wrong!? :S

    IMG!
    Warning: Spoilers inside!
     
    Last edited by LinkKenedy, Dec 23, 2016


  2. CuriousTommy

    Member CuriousTommy GBAtemp Fan

    Joined:
    Jul 22, 2014
    Messages:
    315
    Country:
    United States
    I think it is suppose to be ./bashrc

    And if that doesn't work, try ./bash_profile
     
    Last edited by CuriousTommy, Dec 23, 2016
  3. Hayleia

    Member Hayleia GBAtemp Maniac

    Joined:
    Feb 26, 2015
    Messages:
    1,122
    Country:
    France
    I'm so dirty I add the exports at the beginning of my Makefile :P
    That's the wrong way to fix this problem but I'm too lazy to fix dev environment problems when I can fix code problems instead.
     
  4. kasai07

    Newcomer kasai07 Advanced Member

    Joined:
    Jan 17, 2016
    Messages:
    67
    Country:
    France
  5. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    809
    Location:
    brussels
    Country:
    Belgium
    Hey, how can I trigger this screen whenever the app gets shut down?
    [​IMG]
     
  6. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    809
    Location:
    brussels
    Country:
    Belgium
    Looks like older versions of ctrulib did that, but I can't seem to figure out how
     
    Last edited by erman1337, Dec 26, 2016
  7. phoen1x74

    Newcomer phoen1x74 Member

    Joined:
    Aug 1, 2016
    Messages:
    33
    Country:
    United States
    Has anyone here successfully compiled ninjhax2.x? Modifiyng it for personal purposes and need help compiling it. I'm running python2 scripts/buildAll.py from the root of the directory, but have trouble. Using the latest superto branch from the github.
     
  8. duffmmann

    Member duffmmann GBAtemp Addict

    Joined:
    Mar 11, 2009
    Messages:
    2,625
    Country:
    United States
    I have no idea how feasible something like this could be. But, is there any way that a homebrew application could be made that when you boot it, you can select any NES VC title you've installed, but in a way where these VC titles do not appear on your main 3DS screen? Essentially this would be a program that kinda seems like an emulator, but in reality all it is is a shell that loads VC titles of one specific system. So there could be NES one, a SNES one, or a GB/C one. I'm guessing that because of the different way GBA VC titles are loaded, that such a thing might not be possible for those VC titles.

    The reason for something like this would be all the better emulation of official VC titles, with the ability to store more than 300 titles of any system. If there were 300+ NES games I could have them all as VC titles, without taking up any space on the actual main screen and allowing for other titles to populate the 3DS main screen.

    I hope that all makes sense, and I wouldn't be surprised if its not possible.
     
  9. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    You can do it only with a homebrew in CIA format.

    use this code:

    Code:
    static bool task_quit;
    static Handle task_pause_event;
    static Handle task_suspend_event;
    static aptHookCookie cookie;
    
    static void task_apt_hook(APT_HookType hook, void* param) {
      switch(hook) {
      case APTHOOK_ONSUSPEND:
      svcClearEvent(task_suspend_event);
    //       Mix_PauseMusic();  // NOP90 code: used to pause CSND music output when jumping in Home menu
    //       muspaused=1; // NOP90 code: internal flag with music state to resume music returning to the program from Home menu
      break;
    //  case APTHOOK_ONSLEEP:
    //  svcClearEvent(task_pause_event);
    //  break;
      default:
      break;
      }
    }
    
    void task_init() {
      task_quit = false;
    
      svcCreateEvent(&task_pause_event, RESET_STICKY);
    
      svcCreateEvent(&task_suspend_event, RESET_STICKY);
    
      svcSignalEvent(task_pause_event);
      svcSignalEvent(task_suspend_event);
    
      aptHook(&cookie, task_apt_hook, NULL);
    }
    
    void task_exit() {
      task_quit = true;
    
      aptUnhook(&cookie);
    
      if(task_pause_event != 0) {
      svcCloseHandle(task_pause_event);
      task_pause_event = 0;
      }
    
      if(task_suspend_event != 0) {
      svcCloseHandle(task_suspend_event);
      task_suspend_event = 0;
      }
    }
    
    I took it from a ctrulib example, but can't remember which one.

    In your main() function call task_init() , than as usual make run your program in this loop:

    Code:
    cfguInit();
    task_init();
    while (aptMainLoop())
        {
            your code here...
           svcSleepThread(10000000); // pause the thread a little bit to make run the event handler thread
        }
    task_exit(); // closing...
    cfguExit();
    
    PS: In the first block of code I commented out two lines to pause CSND music: you don't need it if you don't use CSND. If you do, well you have to figure out yourself how to stop music when you pause your program :)
     
    Last edited by nop90, Jan 1, 2017
    KiiWii likes this.
  10. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    809
    Location:
    brussels
    Country:
    Belgium
  11. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    Works for me with a ctrulib version of november.

    What is the app behaviour? exiting to home menu and closing the app from the menu works fine?
     
  12. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    809
    Location:
    brussels
    Country:
    Belgium
    Yes, it's the exact same behavior as before. It just jumps to the home menu whenever the app closes
     
  13. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    Tonight I'll back home very late, but tomorrow I'll make a simple helloworld app and after testing the behaviour I'll share the code. If it will work for me and not for you, there is something different in the ctrulib version.
     
    Last edited by nop90, Dec 30, 2016
    erman1337 likes this.
  14. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    @erman1337
    I did my homeworks and found two things:

    1) I forgot to mention that in the main loop there must be a a sleep thread call or the event handler will never run (added a 10ms pause in the previous example). This makes Home menu handling to work fine
    2) the code is not working for the power button handling. The screen goes black and the system freeze

    Since everything is working fine with my other homebrews (try it with Sqrxz4 if you want) I'm probably missing to initialize some services.

    Now I have to prepare the dinner for the New Year's Eve, but tomorrow I'll continue the investigation.

    Happy New Year Tempers!!!!!
     
    Last edited by nop90, Dec 31, 2016
    Arubaro likes this.
  15. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    @erman1337

    solved, as promised.

    The code needs a call to cfguInit() at the beginning of main(), and cfguExit() before exiting. Added it to my previous post.

    Attached a complete sample app (code and compiled as cia).
     

    Attached Files:

    CuriousTommy likes this.
  16. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    809
    Location:
    brussels
    Country:
    Belgium
    @nop90 I tried the included CIA, it still jumps to the home menu when I hit the start button. It's not that important, thanks for your efforts though :)
     
  17. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,016
    Location:
    Rome
    Country:
    Italy
    Have to do it, the screen you asked for pops up when you press the power button
     
    Last edited by nop90, Jan 2, 2017
  18. Robz8

    Member Robz8 Coolest of TWL

    Joined:
    Oct 1, 2010
    Messages:
    3,670
    Country:
    United States
    I'm thinking of using the system font in TWLoader, in place of the one currently stored in RomFS. How would I do that?
    I know that I store the font into a buffer, and use the sftd_load_font_mem function to load it.
     
  19. FrostyDialga

    Newcomer FrostyDialga Advanced Member

    Joined:
    Dec 28, 2016
    Messages:
    86
    Country:
    Australia
    I know how to build 3dsx homebrew but how do I build CIA homebrew. When I try to compile a CIA homebrew I edited it doesn't work.
     
  20. Robz8

    Member Robz8 Coolest of TWL

    Joined:
    Oct 1, 2010
    Messages:
    3,670
    Country:
    United States
    Do you have this in your makefile?
    Code:
    #---------------------------------------------------------------------------------
    cia: $(BUILD)
        @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile cia
    
    #---------------------------------------------------------------------------------
    
     

Share This Page