Page 1 of 1

help with getdstring

Posted: Fri Jul 08, 2016 11:24 am
by happydance
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
	goto NAMEPOS
	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 test3.bms
- 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

Re: help with getdstring

Posted: Tue Aug 02, 2016 12:09 am
by WRS
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