Hacking Changing back line (DevKitPro)

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
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...
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
Country
Germany
Holt said:
\n makes u jump a line

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.
 

mousex

Well-Known Member
Member
Joined
Jan 23, 2009
Messages
986
Trophies
0
XP
115
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.
 

blitter

Well-Known Member
Newcomer
Joined
Jan 26, 2009
Messages
74
Trophies
0
XP
8
Country
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
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
Country
Germany
Holt said:
do you want to appear on your screen like this?:
Waiting-Cursor-Text

Some Text


I want that the text appears like that:

CODEÂÂÂÂ file1.wad ..installed
ÂÂÂÂ file2.wad ..installed
>>ÂÂ file3.wad ...installing
ÂÂÂÂ file4.wad
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
Country
Germany
mousex said:
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.

This does not work, cause I use a list-view

CODE(...) Removed for better viewing

So, as you see "Print filename" hast a line breaker after the filename to show the next file in the next line.
 

zapu

Well-Known Member
Member
Joined
Jul 27, 2006
Messages
182
Trophies
0
XP
103
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).
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
Country
Germany
zapu said:
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).

I understand what you mean.

But the "installing"-text just appears when I run the install-function.
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
44
Location
Home
XP
550
Country
Germany
I have to think about. It's complicated for me.
unsure.gif
 

zapu

Well-Known Member
Member
Joined
Jul 27, 2006
Messages
182
Trophies
0
XP
103
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
 

blitter

Well-Known Member
Newcomer
Joined
Jan 26, 2009
Messages
74
Trophies
0
XP
8
Country
blitter said:
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

Guess you missed this post OP?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: Sup