ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sun May 19, 2019 8:32 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Mar 18, 2019 11:33 pm 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 169
I want to read 4 bytes and convert them to a string so that for instance [44 4A 44 3A] look like "444A443A" so that I can name the files after a series of bytes.
Looked around the documentation for hours, but can't find how to do that, if that can be done.

How is this done in a BMS script?

Edit: Just saw that there WAS a help section for QuickBMS. wow I have missed that for years lol. So, move this there if you want to.

_________________
Be kind to everyone, even those you do not like.


Top
   
PostPosted: Tue Mar 26, 2019 2:35 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10231
Anyway one method is the following:
Code:
math VAR = 0x444A443A
string STR = VAR
print "%STR%"


Top
   
PostPosted: Wed Mar 27, 2019 8:33 am 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 169
aluigi wrote:
Anyway one method is the following:
Code:
math VAR = 0x444A443A
string STR = VAR
print "%STR%"


I tried this, but it displays the string of the value, so "48 8A BA DE" becomes "HŠºÞ".

I want to read 4 bytes from the file and use the hexadecimal values as the name of the file, but it always translate them to the string counterpart(or an integer)

So to further explain, I want to read hexadecimals and also display the hexadecimals and NOT the strings or integers that those hexadecimals represent.
I want 48 8A BA DE to display as the same thing but as a string, but NOT convert it to a string, but display 48 8A BA DE when i do "print" or name a file.

Edit: Here is how I am setting the name:

Code:
string NAME p "%s\%s\%s" FOLDER "OFFSET" "AES1"


AES1 is just
Code:
get AES1 long


Edit2: After LOTS of looking in the documentation, I figured out you need to use "%x" to display the Hex values.
So the end result should look like this:

Code:
string NAME p "%s\%s\%x" FOLDER "OFFSET" "AES1"


or

Code:
string NAME p "%s\%s\%X" FOLDER "OFFSET" "AES1"


for uppercase letters.

_________________
Be kind to everyone, even those you do not like.


Top
   
PostPosted: Wed Mar 27, 2019 7:18 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10231
ok you already found the solution :D

Maybe you want to use %08x instead of %x for giving a fixed size to the hex


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited