Silent Hill 3 MFA Files
Posted: Sun Dec 04, 2011 9:31 pm
The contents of this post was deleted because of possible forum rules violation.
Code: Select all
# Silent Hill 3 [PS2] MFA extractor
#start of header
GET filename FILENAME
IF filename & "0.mfa"
GOTO 0xD8
ELSE
GOTO 0xB8
ENDIF
MATH header_size = 2048
GET real_size ASIZE
CALLFUNCTION Extract 1
MATH temp_size = block_size
FOR block = 1
IF temp_size < real_size # if the current total extracted size is smaller than the MFA archive size, continue extracting
PRINT "Addtional block number %block% at offset %temp_size|h%"
CALLFUNCTION Additional 1
ELSE
CLEANEXIT
ENDIF
NEXT block
STARTFUNCTION Additional
MATH extra = 1
MATH offset = temp_size
MATH offset += 8
GOTO offset
CALLFUNCTION Extract 1
MATH temp_size += block_size
ENDFUNCTION
STARTFUNCTION Extract
GET number_of_files LONG
PRINT "Files: %number_of_files%"
GET file_section_size LONG
MATH block_size = file_section_size
MATH block_size += header_size
SAVEPOS offset
FOR i = 0 < number_of_files
# read file name
GET name_offset LONG
IF extra = 1
MATH name_offset += temp_size
ENDIF
GOTO name_offset
GET filename STRING
#read file offset
MATH offset += 4
GOTO offset
GET file_offset LONG
MATH file_offset += header_size
IF extra = 1
MATH file_offset += temp_size
ENDIF
# this unknown attribute seems to be related to Korean files
MATH offset += 4
GOTO offset
GET korean LONG
IF korean == 0x000081A4
STRING filename += "[K]"
ENDIF
# read file size
GET filesize LONG
# save the file to disk
LOG filename file_offset filesize
SAVEPOS offset
NEXT i
ENDFUNCTION
peronmls wrote:Sorry to bump an old thread. Wasn't sure if i should make a new one. Can someone make a script that can do the opposite of this? Make it import files instead of export.
Code: Select all
===============================
3) Reimport the extracted files
===============================
As already said QuickBMS is primarly an extraction tool, anyway from
version 0.4.9 it supports also the -r option that transforms the tool
in a simple reimporter/reinjector and so could be useful in some cases
for who wants to mod or translate a game.
The idea consists in being able to reimport ("injecting back") the
modified files in the majority archives without touching a single line
of the script, yeah just reusing the same bms scripts that already
exist!