Weird Get TEXT LINE behavior

Doubts, help and support about QuickBMS and other game research tools
happydance
Posts: 81
Joined: Sun Jul 10, 2016 11:07 am

Weird Get TEXT LINE behavior

Post by happydance »

Not really sure if this how really the LINE Variable behaves or a bug, but if there are spaces at the beginning of the text it entirely skips it and goes for the next text no matter how many spaces before the text is


for example like this text...

Code: Select all

          (This is a test)


if i do this...

Code: Select all

log MEMORY_FILE 0 0
get TEXT LINE

put TEXT LINE MEMORY_FILE
get SIZE ASIZE MEMORY_FILE
log 000.txt 0 SIZE MEMORY_FILE


the output will be just

Code: Select all

(This is a test)


and the 10 spaces before the "(This is a test)" is skipped, is this how really the LINE variable works? can't find anything in the read me regarding it. it works fine with Get TEXT string, though I kinda need its delimiting of 0x00, 0x0a and 0x0d, since i have no idea how long each text will be and I want to cut every line break. If this is how it works then no problem, I bet there are lots of ways to get around it.


BTW testes on 0.10.0 and 0.9.2

Thanks in advance.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Weird Get TEXT LINE behavior

Post by aluigi »

It's the intended behavior.
The "line" type automatically removes spaces and tabs from the beginning and end of the string (lines 3246 and 3279 of current file.c):
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Weird Get TEXT LINE behavior

Post by aluigi »

If you want to preserve the spaces you can try with this alternative solution, but it will keep the carriage return ('\r') in it:
getct VAR string '\n'
happydance
Posts: 81
Joined: Sun Jul 10, 2016 11:07 am

Re: Weird Get TEXT LINE behavior

Post by happydance »

Thanks!

the getct VAR string '\n' maybe perfect for my needs