help with getdstring

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
Posts: 25
Joined: Thu Apr 17, 2014 3:11 pm
Has thanked: 1 time
Been thanked: 2 times

help with getdstring

Post by happydance » Fri Jul 08, 2016 11:24 am

still learning and run into a problem using getdstring to get the name of the files

here's the script I made

Code: Select all

endian big
get PACKhead1 long
get FILENUM long
get UNK1 long
get PACKhead3 long
get UNK2 long
get startfo long
xMath sizeoff "FILENUM * 4 + 20"
xMath nameoff "FILENUM * 4 + 40"
set filetbloff 0x14
set sizetbloff sizeoff
set nametbloff nameoff
for i = 0 < FILENUM
	goto filetbloff
	get OFFSET long
	savepos filetbloff
	goto sizetbloff
	get SIZE long
	savepos sizetbloff
	goto nametbloff
	get NAMEPOS long
	savepos nametbloff
	get NAMESZ byte
	getdstring NAME NAMESZ
	log "NAME" offset size
next i
the file have 5 files but only can extract 4 since it encountered this problem

Code: Select all

- open input file F:\Script ng natsuiro\PACK1.001
- open script
- set output folder TEST

  offset   filesize   filename
  00000050 1744       ui_base.tmd2
  00000730 2392       ui_main_win.tmd2
  000010b0 1376       ui_select_line.tmd2
  00001630 2376       ui_sub_win.tmd2

Error: incomplete input file 0: F:\Script ng natsuiro\PACK1.001
       Can't read 101 bytes from offset 00002800.
       Anyway don't worry, it's possible that the BMS script has been written
       to exit in this way if it's reached the end of the archive so check it
       or contact its author or verify that all the files have been extracted.
       Please check the following coverage information to know if it's ok.

  coverage file 0    82%   8456       10240

Last script line before the error or that produced the error:
  25  getdstring NAME NAMESZ
because the name 5th file is on the end of the big file and it doesn't meet the byte length on the "get NAMESZ byte" and now only 0xf long
You do not have the required permissions to view the files attached to this post.

Posts: 596
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 73 times
Been thanked: 132 times

Re: help with getdstring

Post by WRS » Tue Aug 02, 2016 12:09 am

is it possible that

Code: Select all

get NAMESZ byte
is actually the wrong value? it could just be a null-terminated string at the position you have.

other filenames work because quickbms treats the string as a c-string anyway.. so any larger filenames are accepted, but trimmed to the first 00 byte.

something like

Code: Select all

get DUMMY byte # was get NAMESZ byte
get NAME string
Useful tool links:

Post Reply