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

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
26
XP
66
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: 160
Last edited by pengawill,

lolzvid

Well-Known Member
Member
Joined
Dec 26, 2014
Messages
148
Trophies
0
Age
22
XP
278
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
26
XP
66
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
22
XP
278
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
157
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
26
XP
66
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
219
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).
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • JuanMena @ JuanMena:
    Kissing random dudes choking in celery? Really? Need to study for that?
  • K3N1 @ K3N1:
    Yes it requires a degree
  • K3N1 @ K3N1:
    I could also yank out the rest of my teeth but theirs professionals for that
  • x65943 @ x65943:
    If your throat closes, putting oxygen in your mouth will not solve anything - as you will be introducing oxygen prior to the area of obstruction
  • JuanMena @ JuanMena:
    Just kiss me Kyle.
  • x65943 @ x65943:
    You either need to be intubated to bypass obstruction or create a stoma inferior to the the area of obstruction to survive
  • x65943 @ x65943:
    "Just kiss me Kyle." And I thought all the godreborn gay stuff was a smear campaign
  • JuanMena @ JuanMena:
    If I die, tell my momma I won't be carrying Baby Jesus this christmas :sad::cry:
  • K3N1 @ K3N1:
    Smear campaigns are in The political section now?
  • JuanMena @ JuanMena:
    Chary! Chary! Chary, Chary, Chary!
  • Sonic Angel Knight @ Sonic Angel Knight:
    Pork Provolone :P
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds yummy
  • K3N1 @ K3N1:
    Sweet found my Wii u PSU right after I ordered a new one :tpi:
  • JuanMena @ JuanMena:
    It was waiting for you to order another one.
    Seems like, your PSU was waiting for a partner.
  • JuanMena @ JuanMena:
    Keep them both
    separated or you'll have more PSUs each year.
  • K3N1 @ K3N1:
    Well one you insert one PSU into the other one you get power
  • JuanMena @ JuanMena:
    It literally turns it on.
  • K3N1 @ K3N1:
    Yeah power supplies are filthy perverts
  • K3N1 @ K3N1:
    @Psionic Roshambo has a new friend
    +1
  • JuanMena @ JuanMena:
    It's Kyle, the guy that went to school to be a Certified man Kisser.
  • Psionic Roshambo @ Psionic Roshambo:
    Cartmans hand has taco flavored kisses
  • A @ abraarukuk:
    hi guys
  • Iron_Masuku @ Iron_Masuku:
    Hello
    Skelletonike @ Skelletonike: hmm