Homebrew Development

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

  1. TheCruel

    TheCruel Developer

    Banned
    12
    Dec 6, 2013
    United States
    I started a C++ framework and library for homebrew 3DS games. It's very barebones now and I'm probably not even going to complete portions of it until smealum makes more stuff public so I can utilize his lib and have better access to the hardware. For instance, I have the layout coded for a flexible input event dispatcher, but for best effect it likely requires threading which I can't achieve at the moment.

    A basic example of what code will look like when using the framework can be seen here:
    https://github.com/Cruel/cpp3ds/blob/master/examples/gateway/src/gateway.cpp

    I'll add some more examples over this next week on my off days. Working on a Scene class at the moment to encapsulate the general game flow so you can easily duplicate it for different parts of games, like a intro screen, pause menu, game levels, etc. With that and a more developed Input class, it should be legitimately useful lol.
     
    mercluke, Kargaroc, dooodad and 3 others like this.
  2. nop90

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    Changed the multiplier and forced SDHC flag to 1. SDCard Init was never called in you code.

    But still I can't make it work. Mouting the DS with pf_mount returns always error 7 (No Filesystem).
     
  3. CalebW

    CalebW Fellow Temper

    Member
    4
    Jun 29, 2012
    United States
    New Mexico
    Here is a Breakout game I created, nothing fancy, about as simple as one can get.

    Left/Right and Y/A move the Paddle.
    X pauses the game.


    The sources are here: https://github.com/CalebDW/Breakout3DS, they're not in the best shape though-- it's my first attempt at programming.
     

    Attached Files:

  4. Huntereb

    Huntereb GBAtemp Psycho!

    Member
    9
    Sep 1, 2013
    United States

    Can you guys post some pics?
     
  5. CalebW

    CalebW Fellow Temper

    Member
    4
    Jun 29, 2012
    United States
    New Mexico
    I don't have access to a camera right now, so if someone would like to post a pic please do.
     
  6. CalebW
    This message by CalebW has been removed from public view by Cyan, Feb 2, 2014, Reason: double post.
    Feb 1, 2014
  7. gamesquest1

    gamesquest1 Nabnut

    Moderator
    21
    GBAtemp Patron
    gamesquest1 is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Sep 23, 2013
    [​IMG]
    enjoy
     
    Huntereb likes this.
  8. Technicmaster0

    Technicmaster0 GBAtemp Psycho!

    Member
    9
    Oct 22, 2011
    Gambia, The
    Here are 4 pics:
    Warning: Spoilers inside!
     
  9. CalebW

    CalebW Fellow Temper

    Member
    4
    Jun 29, 2012
    United States
    New Mexico
    Thanks for posting the pics gamesquest1 and Technicmaster0.
     
  10. Huntereb

    Huntereb GBAtemp Psycho!

    Member
    9
    Sep 1, 2013
    United States
    Damn, that looks epic. Nice job CalebW!! :bow:
     
  11. CalebW

    CalebW Fellow Temper

    Member
    4
    Jun 29, 2012
    United States
    New Mexico
    Thank-you, I'm glad people like it...that's what I made it for.
     
    RubenCantuVota likes this.
  12. PewnyPL

    PewnyPL GBAtemp Advanced Fan

    Member
    6
    Feb 2, 2014
    Poland
    Hello everyone.
    I've been looking through source code of all homebrew posted here (with exception of Yeti3DS) and I can't help but notice that there is one difference that doesn't make sense.
    When reading input, all 3 of them use the exact same function, read_word(HID). I checked, the code is the same and the HID address is the same. But what I don't get is, Pong3D reads the input like this:
    if (button & BUTTON_DOWN)
    While Breakout and Tetris do it like this:
    if(!(button_press & BUTTON_X))

    In both cases, the button code used is the button that is supposed to be pressed, then how come both of them work, when one is basically 'if pressed' and the other is 'if not pressed'?
     
  13. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    22
    Oct 27, 2002
    France
    Engine room, learning
    hey, that's nice ! thanks CalebW.
    One new game every week ;)
    I'll add it to wikitemp too.
     
  14. Kane49

    Kane49 GBAtemp Fan

    Member
    3
    Nov 4, 2013
    Gambia, The

    Its checking for different flanks
     
  15. PewnyPL

    PewnyPL GBAtemp Advanced Fan

    Member
    6
    Feb 2, 2014
    Poland
    Different flanks? I mean, it's not like the games check it both with and without !, it's that one game only uses ! and other doesn't at all, that's why I'm confused.
     
  16. Kane49

    Kane49 GBAtemp Fan

    Member
    3
    Nov 4, 2013
    Gambia, The
    I didnt read the code so i might be wrong but breakout and tetris probably have a mechanism to check if a button was pressed instead of only checking if a button is down.
    Probably comparing the Values of HID with its value from the last loop :)
     
  17. Snailface

    Snailface My frothing demand for 3ds homebrew is increasing

    Member
    10
    Sep 20, 2010
    Engine Room with Cyan, watching him learn.
    The input register (HID) is inverted bitwise.
    ex. 11101111 -- the fifth bit from the right '0' is the button being pressed. If you simply go, (button & BUTTON_SOMETHING) you will get an input reported for every button except the one you want. Probably not what you want. :P

    you can 'fix it' two ways -- they are opposite, but accomplish the same thing:

    button= read_word(HID);
    if( !(button & BUTTON_A) )fire();

    or my way:

    button= ~read_word(HID);
    if( button & BUTTON_A )fire();

    I think my way is probably a little better since you don't have to have a NOT operator (! or ~) for each input check.
     
  18. PewnyPL

    PewnyPL GBAtemp Advanced Fan

    Member
    6
    Feb 2, 2014
    Poland

    I did think that the register is inverted, which would make sense, but in the Pong3D, there is no ~ before read_word, that's why I was confused.
    Anywho, thank you for confirming the invertness.
     
  19. Snailface

    Snailface My frothing demand for 3ds homebrew is increasing

    Member
    10
    Sep 20, 2010
    Engine Room with Cyan, watching him learn.
    That's true, I forgot that I did it that way at first. :P Afterwards I used the better method, and I've since updated Pong's source code to use it.
     
  20. CalebW

    CalebW Fellow Temper

    Member
    4
    Jun 29, 2012
    United States
    New Mexico
    Has any one managed to read the C-Pad input?
     
  21. nop90

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    Me not yet. I scanned some parts of IO register memory, but at the moment I found only the 3D slider state register at 0x1014470C.

    Still trying to figure out what are the other non zero values i found, in the hope to be able to swap framebuffers.

    In the range I scanned (0x1012DFA0 - 0x10146BD6) nothing has values changing upon CPAD or touchscreen state.
     
Loading...