Homebrew Homebrew Development

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
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.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
You should change the SD Card Read Delay Multplier from 13 to 35.
Never Call SDCard Init, only Controller Init.
Force set SDHC in the sdmmc file.

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).
 

CalebW

Fellow Temper
Member
Joined
Jun 29, 2012
Messages
638
Trophies
0
Location
Texas
XP
545
Country
United States
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.
 

Attachments

  • Breakout3DS.zip
    7.3 KB · Views: 563

gamesquest1

Nabnut
Former Staff
Joined
Sep 23, 2013
Messages
15,153
Trophies
2
XP
12,247
I don't have access to a camera right now, so if someone would like to post a pic please do.

DSC_0815.jpg

enjoy
 
  • Like
Reactions: Huntereb

PewnyPL

Well-Known Member
Member
Joined
Feb 2, 2014
Messages
771
Trophies
1
XP
2,175
Country
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'?
 

Kane49

Well-Known Member
Member
Joined
Nov 4, 2013
Messages
446
Trophies
0
Age
36
XP
343
Country
Gambia, The
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'?


Its checking for different flanks
 

Kane49

Well-Known Member
Member
Joined
Nov 4, 2013
Messages
446
Trophies
0
Age
36
XP
343
Country
Gambia, The
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.

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 :)
 

Snailface

My frothing demand for 3ds homebrew is increasing
Member
Joined
Sep 20, 2010
Messages
4,324
Trophies
2
Age
40
Location
Engine Room with Cyan, watching him learn.
XP
2,256
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.
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.
 

PewnyPL

Well-Known Member
Member
Joined
Feb 2, 2014
Messages
771
Trophies
1
XP
2,175
Country
Poland
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.


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.
 

Snailface

My frothing demand for 3ds homebrew is increasing
Member
Joined
Sep 20, 2010
Messages
4,324
Trophies
2
Age
40
Location
Engine Room with Cyan, watching him learn.
XP
2,256
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.
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.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
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.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Julie_Pilgrim @ Julie_Pilgrim:
    the internet
  • Julie_Pilgrim @ Julie_Pilgrim:
    @Psionic Roshambo i have 16 gb in my pc and i run into issues with ram more than i'd like to admit
  • HiradeGirl @ HiradeGirl:
    I got only 8GB of RAM. But I want 32GB.
  • Sonic Angel Knight @ Sonic Angel Knight:
    Time to just download more ram
  • K3Nv2 @ K3Nv2:
    Yeah search Google
  • Sonic Angel Knight @ Sonic Angel Knight:
    Or, I also heard that if you use flash memory, it can act as more "RAM" at least windows tell me when I stick a flash drive into it.
  • Veho @ Veho:
    It can act as a swap drive but that isn't more RAM, it's slooow.
  • K3Nv2 @ K3Nv2:
    I wish we could have 1Gbps external storage by now
  • K3Nv2 @ K3Nv2:
    Like for micro
  • Veho @ Veho:
    New Myoo.
  • SylverReZ @ SylverReZ:
    @Veho, Yooo noice
  • SylverReZ @ SylverReZ:
    Looks like a Famicom handheld
  • Veho @ Veho:
    Yeah, they were going for that.
  • Veho @ Veho:
    It's not very good though.
  • Veho @ Veho:
    I'm watching the review, the emulators it uses suck bawls.
  • Veho @ Veho:
    Software update might improve it.
  • Psionic Roshambo @ Psionic Roshambo:
    Or maybe someone will make like Emulation Station for it or something?
  • Veho @ Veho:
    That counts as a software update :tpi:
    +1
  • OctoAori20 @ OctoAori20:
    Ello
  • K3Nv2 @ K3Nv2:
    I can think of the design teams process another joystick and no audio or a joystick and mono audio
  • Veho @ Veho:
    "You think we can just put the speakers at the top
    ?" "NO!"
    +1
  • K3Nv2 @ K3Nv2:
    Pft stereo speakers you're fired
    +1
    K3Nv2 @ K3Nv2: Pft stereo speakers you're fired +1