Join also our Discord channel! Click here.

Silent Hill 3 MFA Files

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
Henderson
n00b
Posts: 16
Joined: Thu Nov 10, 2011 1:01 pm
Has thanked: 2 times

Silent Hill 3 MFA Files

Post by Henderson » Sun Dec 04, 2011 9:31 pm

The contents of this post was deleted because of possible forum rules violation.

piratesephiroth
beginner
Posts: 26
Joined: Sun Nov 08, 2009 11:05 am
Location: Brazil
Has thanked: 3 times
Been thanked: 10 times

Re: Silent Hill 3 MFA Files

Post by piratesephiroth » Sat Dec 31, 2011 5:36 am

Extraction script:

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
Last edited by piratesephiroth on Fri Jan 13, 2012 10:10 am, edited 2 times in total.

Henderson
n00b
Posts: 16
Joined: Thu Nov 10, 2011 1:01 pm
Has thanked: 2 times

Re: Silent Hill 3 MFA Files

Post by Henderson » Sat Dec 31, 2011 12:43 pm

The script is perfect *--*

Thank you very much!!!

peronmls
advanced
Posts: 55
Joined: Tue Oct 04, 2011 11:21 pm
Has thanked: 6 times
Contact:

Re: Silent Hill 3 MFA Files

Post by peronmls » Sat Sep 28, 2013 11:15 pm

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.

User avatar
SILENTpavel
advanced
Posts: 54
Joined: Fri Aug 05, 2011 5:53 am
Has thanked: 86 times
Been thanked: 15 times

Re: Silent Hill 3 MFA Files

Post by SILENTpavel » Tue Mar 04, 2014 6:46 pm

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!
from QuickBMS readme
http://pastebin.com/sGGiVDUk

Post Reply