Homebrew Homebrew Development

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
At the end of the main loop ;)

main loop:
-Draw things
-Do things
-Flush and Swap
-Wait for vblank
Forgot to reuse
u8* gfxGetFramebuffer

--------------------- MERGED ---------------------------

Does it hangs at a certain point or it doesn't boot at all?
It has been fixed, it didnt boot at all
 

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
you have to get framebuffer address every loop iteration?
does it move around on your system? that's pretty weird.
Mmmm actually, I've never noticed this thing. You're true, this is weird. I've been using this list of operations to do in main loop since my first 3ds homebrew and I brought this error with me for almost 1 year. :(

The correct thing is:

-GetFB

MAIN LOOP:
-Draw things
-Do things
-Flush and Swap FB
-Wait for VBlank
 
  • Like
Reactions: zoogie

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
Mmmm actually, I've never noticed this thing. You're true, this is weird. I've been using this list of operations to do in main loop since my first 3ds homebrew and I brought this error with me for almost 1 year. :(

The correct thing is:

-GetFB

MAIN LOOP:
-Draw things
-Do things
-Flush and Swap FB
-Wait for VBlank
IT doesn't matter if yo got a small app.
But in the end it really flickers
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
i'll post it in a minute

--------------------- MERGED ---------------------------

So you get FB before entering the main loop, right?

Code:
void get_buffers() {
    top = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
    bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
}

int main() {
    bool change = true;
  
    srvInit();
    aptInit();
    hidInit(NULL);
    gfxInitDefault();
    init();
  
    get_buffers();
    while (aptMainLoop())
    {
        gspWaitForVBlank();
        hidScanInput();
      
        u32 kDown;
        kDown = hidKeysDown();
      
        touchPosition touch;
        hidTouchRead(&touch);

        //should actually check keys here
      
        if(change == true || check_keyboard_click(touch)) {
            draw_keyboard(bottom);
            gfxFlushBuffers();
            change = true;
        }

        if(change) {
            draw_menu();
            gfxFlushBuffers();
            gfxSwapBuffers();
            get_buffers();
            change = false;
        }
      
        //check keys
      
        gfxFlushBuffers();
    }

    gfxExit();
    hidExit();
    aptExit();
    srvExit();
    return 0;
}

I'm going to place the //check keys part before the drawing, since everything would appear one tick earlier.

EDIT: Basicly i check if something changes, if it does, i redraw the necessary stuff, flush buffers, swap buffers, and get the buffers
 
Last edited by Tjessx,
  • Like
Reactions: AlbertoSONIC

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
I don't understand a things in this piece of code:

Code:
if(change == true || check_keyboard_click(touch)) {
draw_keyboard(bottom);
gfxFlushBuffers();
change = true;
}

if(change) {
draw_menu();
gfxFlushBuffers();
gfxSwapBuffers();
get_buffers();
change = false;
}

If "check" is true, the 3ds executes the code inside both the "if":

draw_keyboard(bottom);
gfxFlushBuffers();
change = true; check is already true, otherwise we wouldn't be running this code
draw_menu();
gfxFlushBuffers(); you flush again? Just do it one time!
gfxSwapBuffers();
get_buffers();
change = false;

I don't have the full code but *i think* there's something wrong here...
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
I don't understand a things in this piece of code:

Code:
if(change == true || check_keyboard_click(touch)) {
draw_keyboard(bottom);
gfxFlushBuffers();
change = true;
}

if(change) {
draw_menu();
gfxFlushBuffers();
gfxSwapBuffers();
get_buffers();
change = false;
}

If "check" is true, the 3ds executes the code inside both the "if":

draw_keyboard(bottom);
gfxFlushBuffers();
change = true; check is already true, otherwise we wouldn't be running this code
draw_menu();
gfxFlushBuffers(); you flush again? Just do it one time!
gfxSwapBuffers();
get_buffers();
change = false;

I don't have the full code but *i think* there's something wrong here...

It's pretty simple actually,
But you don't have the full code,
Instead of the //check here for key presses part, i check if a key is pressed, and if it has been pressed then change = true;

Then, in the next frame.
If something changed (still only keypress), i want to redraw the keyboard, and the menu.

But if nothing changed, i'm gonna check if someone pressed the keyboard in a way something changed, if it does I need to redraw the keyboard + the menu


EDIT: It makes sense if you get the complete code, but the change variable has a wrong name,
 
  • Like
Reactions: AlbertoSONIC

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
It's pretty simple actually,
But you don't have the full code,
Instead of the //check here for key presses part, i check if a key is pressed, and if it has been pressed then change = true;

Then, in the next frame.
If something changed (still only keypress), i want to redraw the keyboard, and the menu.

But if nothing changed, i'm gonna check if someone pressed the keyboard in a way something changed, if it does I need to redraw the keyboard + the menu


EDIT: It makes sense if you get the complete code, but the change variable has a wrong name,
Yeah I understood that but...

If change is true, it executes both the if.
If check_keyboard_click(touch) is true, it executes both the if.
If change is false, the two if's code won't get executed.
If check_keyboard_click(touch) is false, the two if's code won't get executed.

This means that those two "if" will behave the same, if one is executed, the other one is executed, if one isn't executed, the other one isn't executed. This means that those if can be merged in only one zip, with change || check_keyboard_click(touch) as condiction! ;)
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
Yeah I understood that but...

If change is true, it executes both the if.
If check_keyboard_click(touch) is true, it executes both the if.
If change is false, the two if's code won't get executed.
If check_keyboard_click(touch) is false, the two if's code won't get executed.

This means that those two "if" will behave the same, if one is executed, the other one is executed, if one isn't executed, the other one isn't executed. This means that those if can be merged in only one zip, with change || check_keyboard_click(touch) as condiction! ;)

Good point, I though of that, but it was late :P will change that, thanks :P
 
  • Like
Reactions: AlbertoSONIC

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I need help in setting up some libs in devkitpro.

I copied libz, libpng and other libs in devkitpro/portlibs/arm, but don't know what to to now to make them used by the #include <...> statement.

My os is win7

EDIT: solved with makefile on Xerpi github
 
Last edited by nop90,

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
  • BakerMan @ BakerMan:
    imagine not having hands, cringe
    +1
  • AncientBoi @ AncientBoi:
    ESPECIALLY for things I do to myself :sad:.. :tpi::rofl2: Or others :shy::blush::evil:
    +1
  • The Real Jdbye @ The Real Jdbye:
    @SylverReZ if you could find a v5 DS ML you would have the best of both worlds since the v5 units had the same backlight brightness levels as the DS Lite unlockable with flashme
  • The Real Jdbye @ The Real Jdbye:
    but that's a long shot
  • The Real Jdbye @ The Real Jdbye:
    i think only the red mario kart edition phat was v5
  • BigOnYa @ BigOnYa:
    A woman with no arms and no legs was sitting on a beach. A man comes along and the woman says, "I've never been hugged before." So the man feels bad and hugs her. She says "Well i've also never been kissed before." So he gives her a kiss on the cheek. She says "Well I've also never been fucked before." So the man picks her up, and throws her in the ocean and says "Now you're fucked."
    +1
  • BakerMan @ BakerMan:
    lmao
  • BakerMan @ BakerMan:
    anyways, we need to re-normalize physical media

    if i didn't want my games to be permanent, then i'd rent them
    +1
  • BigOnYa @ BigOnYa:
    Agreed, that why I try to buy all my games on disc, Xbox anyways. Switch games (which I pirate tbh) don't matter much, I stay offline 24/7 anyways.
  • AncientBoi @ AncientBoi:
    I don't pirate them, I Use Them :mellow:. Like I do @BigOnYa 's couch :tpi::evil::rofl2:
    +1
  • cearp @ cearp:
    @BakerMan - you can still "own" digital media, arguably easier and better than physical since you can make copies and backups, as much as you like.

    The issue is DRM
  • cearp @ cearp:
    You can buy drm free games / music / ebooks, and if you keep backups of your data (like documents and family photos etc), then you shouldn't lose the game. but with a disk, your toddler could put it in the toaster and there goes your $60

    :rofl2:
  • cearp @ cearp:
    still, I agree physical media is nice to have. just pointing out the issue is drm
  • rqkaiju2 @ rqkaiju2:
    i like physical media because it actually feels like you own it. thats why i plan on burning music to cds
    rqkaiju2 @ rqkaiju2: i like physical media because it actually feels like you own it. thats why i plan on burning...