Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Metal Gear Solid 2(both Original(PS2), Document(PS2) and Substance(PS2/XBOX) editions)
- # Metal Gear Solid The Twin Snakes
- # Zone of the Enders The 2nd Runner(both the original(PS2) and Special Edition(PS2) versions)
- # Metal Gear Solid 3(both Original(PS2) and Subsistence(PS2 - DVD5x3) versions)
- get archive_name basename
- get archive_size asize
- if archive_name & "stage" | archive_name & "face"
- get sign1 long
- get sign2 long
- if sign1 == 0x00000001
- endian little
- goto 0
- callfunction stage_extract 1
- elif sign1 == 0x10000000
- endian big
- goto 0
- callfunction stage_extract 1
- else
- if sign2 == 0x00010001
- endian little
- goto 0
- callfunction stage_extract 1
- elif sign2 == 0x01000100
- endian big
- goto 0
- callfunction stage_extract 1
- else
- print "whoops"
- cleanexit
- endif
- endif
- elif archive_name & "codec"
- elif archive_name & "slot"
- else
- get offset_limit asize
- get endian_check long
- endian guess endian_check
- goto 0
- math xz = 1
- for y = 0
- math y2 = 0
- string name p "%s_%08d" archive_name xz
- append
- do
- savepos offset
- math initial_info = 0
- get dummy01 long
- get size long
- get count1 long
- get zero long
- if dummy01 == 0x10
- if size == 0x10
- if count1 == 0
- math initial_info = 1
- putarray 11 y2 zero
- math y2 + 1
- endif
- endif
- elif dummy01 == 0xf0
- math initial_info = 1
- endif
- putarray 11 y2 ""
- if dummy01 != 0
- if initial_info = 0
- math total_types = y2
- math last_type = total_types
- for t1 = 0 <= total_types
- getarray file_type 11 t1
- if dummy01 == file_type
- putarray 1 30 dummy01
- putarray 2 30 size
- putarray 3 30 count1
- putarray 4 30 zero
- if size == size
- if count1 == count1
- if zero == zero
- log name offset size
- break
- endif
- endif
- endif
- else
- if t1 = last_type
- math size = 0x10
- log name offset size
- endif
- endif
- next t1
- elif initial_info = 1
- log name offset size
- endif
- else
- break
- endif
- if offset <= offset_limit
- math offset + size
- goto offset
- endif
- while dummy01 != 0
- append
- math xz + 1
- next y
- endif
- startfunction stage_extract
- get sd01 long
- if sd01 != 1
- goto -4 0 SEEK_CUR
- get time_stamp time
- endif
- get sd02 long
- xmath minor_version "sd02 & 0xffff"
- xmath minor_version "sd02 >> 16"
- get sd03 long
- xmath stage_entries "sd03 & 0xffff"
- xmath stage_dat_signature "sd03 >> 16"
- get sd04 long
- for i = 0 < stage_entries
- getdstring stage_name 8
- get stage_offset long
- math stage_offset << 11
- savepos stage_temp_position_01
- goto stage_offset
- get file_entries long
- xmath file_offset "(((file_entries * 8) + 4) && 0x800) + stage_offset"
- for j = 0 < file_entries
- get h1 long
- xmath c1 "h1 >> 24"
- putarray 1 j c1
- xmath c2 "h1 & 0xffffff"
- putarray 2 j c2
- get h2 long
- putarray 3 j h2
- next j
- goto stage_temp_position_01
- math end_of_line = 0
- math sdx_is_here = 0
- string directory_name_per_entry p "%s/" stage_name
- set sub_directory_name_per_entry string ""
- set file_name_per_entry string ""
- set full_file_name_per_entry string ""
- for j2 = 0 < file_entries
- putarray 4 j2 file_offset
- getarray file_type 1 j2
- if file_type == 0x7f
- getarray dynamic_type 2 j2
- getarray dynamic_size 3 j2
- string sub_directory_name_per_entry p "%06x/" dynamic_type
- if dynamic_type == 0
- math file_offset x 0x800
- if sdx_is_here = 1
- math sdx_is_here = 0
- endif
- math end_of_line = 1
- else
- math end_of_line = 0
- if dynamic_type = 0x10
- math sdx_is_here = 1
- endif
- endif
- else
- if end_of_line = 0
- if sdx_is_here = 0
- getarray file_name_hash 2 j2
- if file_name_hash != 0
- getarray singular_file_offset 3 j2
- math j2 + 1
- getarray next_file_offset 3 j2
- math j2 - 1
- xmath singular_file_size "next_file_offset - singular_file_offset"
- endif
- string file_name_per_entry p "%06x.%02x" file_name_hash file_type
- elif sdx_is_here = 1
- getarray file_name_hash 2 j2
- getarray singular_file_offset 3 j2
- math j2 + 1
- getarray next_file_offset 3 j2
- math j2 - 1
- xmath singular_file_size "next_file_offset - singular_file_offset"
- string file_name_per_entry p "pk%06x.sdx" individual_name_hash
- endif
- string full_file_name_per_entry p "%s%s%s" directory_name_per_entry sub_directory_name_per_entry file_name_per_entry
- log full_file_name_per_entry file_offset singular_file_size
- math file_offset + singular_file_size
- endif
- endif
- next j2
- next i
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement