Getting name from package files

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Getting name from package files

Post by sigroon365 »

Hi, I have a question about getting name from package files which doesn't contain name length.

Image
In this situation, how one can retrieve names of each files?

Sample files. https://www.sendspace.com/file/4a3zhw

And my bms script.

Code: Select all

endian little

get name_off long
get off long
goto off

get off_size long
get files long
get block_size long
xmath block_size "block_size - off_size"

for i = 0 < files

get offset long
savepos tmp
get next_offset long

if next_offset  > block_size
xmath size "block_size - offset"
xmath offset "offset + off + off_size"

else

xmath size "next_offset - offset"
xmath offset "offset + off + off_size"
goto tmp
endif

get packname filename
string packname += _unpacked/

log packname OFFSET SIZE

next i
TheUkrainianBard
Posts: 121
Joined: Sun May 01, 2016 10:06 pm

Re: Getting name from package files

Post by TheUkrainianBard »

But there's a 0x0A delimiter. Use

Code: Select all

GetCT VAR TYPE CHAR [FILENUM]

    It reads a string till the reaching of the CHAR delimiter.

    arguments
      VAR       Output variable
      TYPE      Only unicode is the alternative type, any other value
                is just ignored because doesn't matter for this
                operation
      CHAR      The delimiter character as 8bit number, if this number
                is negative QuickBMS will convert it to positive and
                read till the current byte is the same (so it's like
                a way to skip the same byte in a file)
      FILENUM   Number of the file associated to the archive (0)

    Examples:
      GetCT NAME string 0x0a
      GetCT NAME string 0x3b
      set DELIMITER_BYTE long 0x0a
      GetCT NAME string DELIMITER_BYTE
      GetCT NAME unicode 0x0a
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Getting name from package files

Post by aluigi »

sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: Getting name from package files

Post by sigroon365 »

Thank you. It's better than mine. :D
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: Getting name from package files

Post by sigroon365 »

aluigi wrote:http://aluigi.org/bms/senran_kagura_shinovi_versus.bms


Hi. :) Can you update the script for other types?

Code: Select all

get NAMES_OFF long

do
get OFFSET long
savepos tmp
get NEXT OFFSET long
...
while ~ end when 0xFFFFFFFF
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Getting name from package files

Post by aluigi »

Script 0.2
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: Getting name from package files

Post by sigroon365 »

aluigi wrote:Script 0.2


Thank you :)