Changing back line (DevKitPro)

Discussion in 'Wii - Hacking' started by D-Jay, Feb 15, 2009.

Feb 15, 2009

Changing back line (DevKitPro) by D-Jay at 6:42 PM (2,081 Views / 0 Likes) 23 replies

  1. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    Hi guys,

    I'm working on some code for an install-dol.

    So, I want to put a "waiting-cursor" behing each installing WAD.
    For that I use the follwing code:

    Code:
    ÂÂÂÂprintf("Some Text\n");
    ÂÂÂÂfflush(stdout);
    
    ÂÂÂÂ/* Opening */
    ÂÂÂÂfp = fopen(filepath, "rb");
    ÂÂÂÂif (!fp) {
    ÂÂÂÂÂÂÂÂprintf(" ERROR!\n");
    ÂÂÂÂÂÂÂÂgoto out;
    ÂÂÂÂ}
    ÂÂÂÂprintf("\b Waiting-Cursor-Text");

    But "Waiting-Cursor-Text" appears in the NEXT line and not as defined behind "Some Text"!?

    I guess, I do not see the wood for the trees...
     


  2. Holt

    Newcomer Holt Member

    Joined:
    Jan 23, 2009
    Messages:
    44
    Location:
    Fortaleza
    Country:
    Brazil
    \n makes u jump a line
     
  3. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    Yes, I know. I have I list-view for all available WAD-files, so behind each WAD-file in the list, there's a "\n" to break the line.

    But I want to "break back" (if you know what I mean) the line to output some text behind the WAD-file-title.
     
  4. Holt

    Newcomer Holt Member

    Joined:
    Jan 23, 2009
    Messages:
    44
    Location:
    Fortaleza
    Country:
    Brazil
    put the line in the place you want to, i know a lots of commands in java/C++ but i don't remeber any to back a line. Sorry.
     
  5. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    How?
     
  6. Holt

    Newcomer Holt Member

    Joined:
    Jan 23, 2009
    Messages:
    44
    Location:
    Fortaleza
    Country:
    Brazil
    in the place that you want for it to appear.
     
  7. mousex

    Member mousex GBAtemp Advanced Fan

    Joined:
    Jan 23, 2009
    Messages:
    987
    Country:
    United States
    Code:
    ÂÂ printf("Some Text");
    ÂÂÂÂfflush(stdout);
    
    ÂÂÂÂ/* Opening */
    ÂÂÂÂfp = fopen(filepath, "rb");
    ÂÂÂÂif (!fp) {
    ÂÂÂÂÂÂÂÂprintf(" ERROR!\n");
    ÂÂÂÂÂÂÂÂgoto out;
    ÂÂÂÂ}
    ÂÂÂÂprintf("\b Waiting-Cursor-Text\n");
    Provided that "Some Text" is the WADs name. You write "Some Text", then "Waiting -Cursor-Text" and then a new line.
     
  8. Holt

    Newcomer Holt Member

    Joined:
    Jan 23, 2009
    Messages:
    44
    Location:
    Fortaleza
    Country:
    Brazil
    do you want to appear on your screen like this?:
    Waiting-Cursor-Text

    Some Text
     
  9. blitter

    Newcomer blitter Advanced Member

    Joined:
    Jan 26, 2009
    Messages:
    74
    Country:
    United Kingdom
    I use a ttf font, but looking through the examples there's one which allows you to position the cursor with coords direct:

    Code:
    ÂÂÂÂ// The console understands VT terminal escape codes
    ÂÂÂÂ// This positions the cursor on row 2, column 0
    ÂÂÂÂ// we can use variables for this with format codes too
    ÂÂÂÂ// e.g. printf ("\x1b[%d;%dH", row, column );
    ÂÂÂÂprintf("\x1b[2;0H");
    HTH
     
  10. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
     
  11. Holt

    Newcomer Holt Member

    Joined:
    Jan 23, 2009
    Messages:
    44
    Location:
    Fortaleza
    Country:
    Brazil
    i guess the swith command can solve that.
     
  12. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    So, as you see "Print filename" hast a line breaker after the filename to show the next file in the next line.
     
  13. zapu

    Member zapu GBAtemp Regular

    Joined:
    Jul 27, 2006
    Messages:
    182
    Country:
    Poland
    2up: No and you have no fscking idea about things being discussed now.

    D-Jay, there are special characters to position cursor in a line so you can 'erase' that 'installing' text when you need (just print spaces over it).
     
  14. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    I understand what you mean.

    But the "installing"-text just appears when I run the install-function.
     
  15. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    I have to think about. It's complicated for me. [​IMG]
     
  16. zapu

    Member zapu GBAtemp Regular

    Joined:
    Jul 27, 2006
    Messages:
    182
    Country:
    Poland
    Basically:

    print everything in for loop
    ...
    move back to first enity using VT terminal escape codes
    'rewrite' the text under that line to 'blablabh installing...'
    do the install stuff
    move back to the beginning of the line using VT terminal escape codes
    'rewrite' the text to 'blablabla ' < yup, some spaces to erase 'installing...' part
    ...
    do the same with the rest
     
  17. blitter

    Newcomer blitter Advanced Member

    Joined:
    Jan 26, 2009
    Messages:
    74
    Country:
    United Kingdom
    Guess you missed this post OP?
     
  18. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    FINISHED (Thanks, zapu)
     
  19. blitter

    Newcomer blitter Advanced Member

    Joined:
    Jan 26, 2009
    Messages:
    74
    Country:
    United Kingdom
    my bad
     
  20. Don Killah

    Member Don Killah GBAtemp Maniac

    Joined:
    Nov 21, 2002
    Messages:
    1,127
    Country:
    France
    So D-Jay, you're really coding an installer.
    My guess was right though ^^
    Maybe you're gonna share this piece of code with us now?
     

Share This Page