quickbms string saving or string asize

spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

quickbms string saving or string asize

Post by spider91 »

Hi. I've made a script for text files (.strdb) of shadow of mordor and encountered one problem - quickbms can't save strings! (or i just don't know how :mrgreen: ). There is no sizes of fields in .strdb, only offsets and then you read unicode text, but how can i save it? I've bypassed that problem like this

Code: Select all

idstring "SKDB"
get VERSION long
get HEADER_SIZE long
get STRINGS long
get DUMMY long
get TEXT_SIZE long
get DUMMY long
set TOC_SIZE long STRINGS
math TOC_SIZE *= 8
math TOC_SIZE += HEADER_SIZE
for i = 0 < STRINGS
   get NAME_ID long
   string NAME_ID p= "0x%08x" NAME_ID
   string NAME_ID += ".txt"
   get OFFSET long
   math OFFSET *= 2
   math OFFSET += TOC_SIZE
   savepos POS
   goto OFFSET
   FindLoc SIZE STRING "\x00\x00\x00"
   math SIZE -= OFFSET
   math SIZE += 1
   goto POS
   log NAME_ID OFFSET SIZE
next i


but thats not very comfortable way and i need to save each string to another file, cause using memory files will loose string ID. So here we have another problem - how to save ID (long) to memory file like a text? If it's not clear here is an example of what i need.
it must be a text file with lines like this

Code: Select all

ID1=TEXT1
ID2=TEXT2
...

So can you add string saving or string asize (to get sizes an log it like normal file) and converting hex number to string on memory file, aluigi?

Here is a .strdb file
https://mega.nz/#!Uk4C0Dab!zcjFMta5WZ8h ... 5CgrpRXyZs
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms string saving or string asize

Post by aluigi »

The Slog command is still to be designed:
viewtopic.php?p=4944#p4944
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: quickbms string saving or string asize

Post by spider91 »

that would be really usefull. And does this includes converting of hex numbers to string in memory files?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms string saving or string asize

Post by aluigi »

What you mean exactly?
Quickbms already has tons of ways to handle and convert numbers to strings and viceversa, it depends exactly what you want to do.
You can even use String p= to use Printf and doing any operation you desire:
string NAME p "0x%08x.txt" NAME_ID
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: quickbms string saving or string asize

Post by spider91 »

I read ID as long and want to log it to memory file, but like text, cause memory file will be a .txt. Is that possible?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms string saving or string asize

Post by aluigi »

I give you a full example that shows how variables are both strings and numbers:

Code: Select all

math VAR = 0x1234
log MEMORY_FILE 0 0
put VAR string MEMORY_FILE # the number in VAR is dumped as a string (decimal)
goto 0
get SIZE asize MEMORY_FILE
log "dump.dat" 0 SIZE MEMORY_FILE
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: quickbms string saving or string asize

Post by spider91 »

Thanks, i'll try that layter.

PS
Return "thanks" button, please =)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms string saving or string asize

Post by aluigi »

When the "Thanks for posts" mod will be stable, probably after phpbb 3.1.5.