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
  • K3Nv2 @ K3Nv2:
    You met yourself also and is a giant piece of shit?
    +1
  • OctoAori20 @ OctoAori20:
    Then again, I don't think I'd really enjoy it //shrug
  • OctoAori20 @ OctoAori20:
    I'm sure it's an acquired taste :P
  • K3Nv2 @ K3Nv2:
    Poor lad can never enjoy the amazing taste of four loko
    +1
  • BigOnYa @ BigOnYa:
    Root beer is a gateway drink, don't ever try it either.
  • K3Nv2 @ K3Nv2:
    @BigOnYa, don't you love how smooth MD20 is
  • BigOnYa @ BigOnYa:
    Mad dog 20 20? Oh yea fixed the typo. I haven't seen that or had forever. Do they still make it?
  • K3Nv2 @ K3Nv2:
    I think it's why I'm alive
    +1
  • BigOnYa @ BigOnYa:
    What happens if when playing Paper Mario, you start a fire in-game?
  • Psionic Roshambo @ Psionic Roshambo:
    Paper Mario is a drug dealer and he is all about the paper yo lol
    +2
  • OctoAori20 @ OctoAori20:
    Ffft
  • OctoAori20 @ OctoAori20:
    On another note, I love how folks are drawing Callie in that suit that Splatoon NA dropped on Twitter
  • RetroNerdGamer @ RetroNerdGamer:
    Beer isnt my thing but a root beer once in a while is good
  • RetroNerdGamer @ RetroNerdGamer:
    it gotta be MUG brand tho
  • RetroNerdGamer @ RetroNerdGamer:
    man i shoulda gotten one to open a cold one with TTYD Remake
  • Sicklyboy @ Sicklyboy:
    man, rootbeer is so good
  • Sicklyboy @ Sicklyboy:
    Think I prefer Barq's to MUG though. But, it's been a while, maybe I need a side by side to refresh my memory lol
  • K3Nv2 @ K3Nv2:
    I like Frosties if you see it at the store worth atry
    +1
  • Sicklyboy @ Sicklyboy:
    Hmmm interesting
  • K3Nv2 @ K3Nv2:
    Fucking bottled sodas priced more stupid than 12 packs
  • RetroNerdGamer @ RetroNerdGamer:
    yooo might try taht frostie one
  • RetroNerdGamer @ RetroNerdGamer:
    order it onlinen if i have to.
  • RetroNerdGamer @ RetroNerdGamer:
    soda in glass bottles are like B L I S S
    RetroNerdGamer @ RetroNerdGamer: soda in glass bottles are like B L I S S