Homebrew Application problems? I believe it might be a memory issue?

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
27
XP
76
Country
United States
Like the title says, I'm having a problem in a C app I'm making where in the console, there's a small bit of tearing on the letters when they're typed to the console in certain situations, and only on an actual 3DS. I have an original 3DSXL, so there you go. Most of the top screen is dominated by an upper window with a pixel image I've custom made using console commands (I think it may be taking up too many resources), so I thought that may have been the problem. But all tries to reduce the image's size and content haven't fixed anything. In the zip below, I've included the application files and the source code. Select (Or N if you're using Citra) will advance the text a single time.

If anyone could be of any service, I would greatly appreciate it!

EDIT: This has been fixed, but I posted a second question below.
 

Attachments

  • It_Hurts.zip
    102.1 KB · Views: 177
Last edited by pengawill,

lolzvid

Well-Known Member
Member
Joined
Dec 26, 2014
Messages
148
Trophies
0
Age
23
XP
288
Country
Brazil
I think the way that you're initializing the console is the problem (two top screens and one bottom screen in a row?).

Try using them only when you need, with something like this:

Code:
consoleInit(GFX_TOP, NULL);
faceSmile();
 

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
27
XP
76
Country
United States
I think the way that you're initializing the console is the problem (two top screens and one bottom screen in a row?).

Try using them only when you need, with something like this:

Code:
consoleInit(GFX_TOP, NULL);
faceSmile();

While doing this, I'm assuming I'll have to set the dimensions of each window after the window is initialized, each time?

After using consoleInit(GFX_TOP, &TopBot); I'll have to put consoleSetWindow(&TopTop, 1, 1, 48, 19); whenever I need to use it?

Also, very sorry If I'm completely wrong. I'm just now learning C and programming in general.
 

lolzvid

Well-Known Member
Member
Joined
Dec 26, 2014
Messages
148
Trophies
0
Age
23
XP
288
Country
Brazil
While doing this, I'm assuming I'll have to set the dimensions of each window after the window is initialized, each time?

After using consoleInit(GFX_TOP, &TopBot); I'll have to put consoleSetWindow(&TopTop, 1, 1, 48, 19); whenever I need to use it?

Also, very sorry If I'm completely wrong. I'm just now learning C and programming in general.
I think you will need to do that, too.

Try doing some experiments with that and see what happens.
 

Giantblargg

Active Member
Newcomer
Joined
Nov 28, 2015
Messages
41
Trophies
0
Location
Behind you
XP
167
Country
Canada
I haven't tested your code but just looking at it, it seems similar to a problem I had

You need to call
Code:
gfxFlushBuffers();
gfxSwapBuffers();
every time you write to the console.
 
  • Like
Reactions: lolzvid

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
27
XP
76
Country
United States
I haven't tested your code but just looking at it, it seems similar to a problem I had

You need to call
Code:
gfxFlushBuffers();
gfxSwapBuffers();
every time you write to the console.

Thank you godly man, placing this after each print to the console fixes the issue.

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

I hope if anyone has the time, another question.

Would anyone know how display a few strings of text in a sequence? As in, have the program wait for user input (probably via the A button) and display the next string?

This is the first string.
*Press A*
This is the second.
*Press A*
This is definitely the third string.
 

thatbooisaspy

Well-Known Member
Member
Joined
Oct 28, 2015
Messages
353
Trophies
0
XP
229
Country
Thank you godly man, placing this after each print to the console fixes the issue.

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

I hope if anyone has the time, another question.

Would anyone know how display a few strings of text in a sequence? As in, have the program wait for user input (probably via the A button) and display the next string?

I don't know the best C way to go about this, but since this is just a simple conditional statement:
Code:
kDown & KEY_START
Couldn't you do some hacky thing like this?
Code:
print_or_whatever_man("This is the first string.");
while(!(kDown & KEY_START)) { 
    wait here...
}
print_or_whatever_man("This is a second string");
...
Again, libctru has no wait() function (nor do i think newlib) so this is as far as I would know. In normal C/C++ you would use something like getchar() or system("sleep") but since ctrulib doesn't capture stdout it isn't possible here. Note that this stops the entire main loop if you do it this way.

Another solution is this (and again in psuedocode):
Code:
mainloop() {
    getuserinput();

    if(!keydown) {
       clearConsole();
       print("This is the first string.");
    } else {
        if(!keydown2) {
           clearConsole();
           printf("This is a second string.");
        }
    }
}
However it isn't really pretty, or the most efficient way (try to not depend on huge state machines, if possible). Just keep doing research, i'm sure someone else had to encounter this problem where getchar() wasn't the answer. Hope this helps (or gives you some ideas).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Did you feed the hamster in your internet router? It prob died and is running slow now.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, why did you start saying my pc has a hamster in the first place?
    +1
  • BigOnYa @ BigOnYa:
    Its actua!ly just a old joke, meaning its slow. Was just kidding around with you.
    +1
  • BigOnYa @ BigOnYa:
    I bet @AncientBoi has some hamsters hidden somewhere tho....
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I think Game streaming should work like this.... Local Hardware able the run the game fine, game engine and common assets stored locally, all FMV and music and textures could be streaming
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Some temporary storage
  • Xdqwerty @ Xdqwerty:
    also @BigOnYa im making some progress on my gdevelop project, implemented various mechanics
  • Psionic Roshambo @ Psionic Roshambo:
    They went all in on streaming, should have been more of a hybrid approach
    +1
  • BigOnYa @ BigOnYa:
    Or free government supplied high speed internet be nice also. Like Obama care. Xdqwerty that's cool, its time consuming but rewarding once done or playable, to see what you've made from scratch. Animations take forever, but worth it.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, although the bullets are a bit buggy
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Not to mention this would be a massive pain to pirate
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    and the visual aspect of the game is quite crude (the sprite that looks best is that of the protagonist just because he is a stickman with sunglasses)
    +1
  • BigOnYa @ BigOnYa:
    There is a bullets behaviour you assign to your character, that makes the code easier, under "behaviours"
  • Xdqwerty @ Xdqwerty:
    i meant that when the character is pointing to the right, the bullets spawn where they should, but when he is on the right, they move to the right but the spawn point is incorrect
  • BigOnYa @ BigOnYa:
    Itch.io has lots of free assets also. Under the bullets behavior tab, there is a "rotate bullets" option, can try that. Or in the code can try
    - fire bullet Player.X(PlayerDirection)
  • Xdqwerty @ Xdqwerty:
    im taking a break for today anyway
    +1
  • BigOnYa @ BigOnYa:
    YEa gotta after a while, looking at code for long periods will bug your eyes.
    +1
  • BigOnYa @ BigOnYa:
    That's cool tho, I'm proud of you going back to it, not giving up. It is difficult at first to learn, but fun once you get the hang of it. I think I've watched every tutorial video there is, but I still struggle sometimes to get stuff to work right. But gotta keep trying dif things, and eventually you will get it right.
    +1
  • K3Nv2 @ K3Nv2:
    Lol McDonald's has a grandma mcflurry
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, furry grandma?
  • BigOnYa @ BigOnYa:
    It sounds good actually, I like butterscotch
  • K3Nv2 @ K3Nv2:
    It sucked don't know wtf these little bits and pieces are they use now
    K3Nv2 @ K3Nv2: It sucked don't know wtf these little bits and pieces are they use now