Code: Select all
math mode = 0
math log_number = 0
get cd_01 long
get cd_02 long
get cd_03 long
get cd_04 long
if cd_01 != 0xffffff00
if cd_02 != 0xffffffff
if cd_03 != 0x00ffffff
break
endif
endif
endif
if cd_04 == 0x01000200
math mode = 1
elif cd_04 == 0x02000200
math mode = 2
endif
goto 0
log MEMORY_FILE 0 0
math current_offset = 0
math offset_limit = 0xca20
math log_number = -1
callfunction parse_cdxa 1
goto 0x8000 MEMORY_FILE
get type byte MEMORY_FILE
getdstring id 5 MEMORY_FILE
get version byte MEMORY_FILE
get unused1 byte MEMORY_FILE
getdstring system_id 32 MEMORY_FILE
getdstring volume_id 32 MEMORY_FILE
getdstring unused2 8 MEMORY_FILE
get volume_space_size_01 long MEMORY_FILE
get volume_space_size_02 long MEMORY_FILE
getdstring unused3 32 MEMORY_FILE
get volume_set_size_01 short MEMORY_FILE
get volume_set_size_02 short MEMORY_FILE
get volume_sequence_number_01 short MEMORY_FILE
get volume_sequence_number_02 short MEMORY_FILE
get logical_block_size_01 short MEMORY_FILE
get logical_block_size_02 short MEMORY_FILE
get path_table_size_01 long MEMORY_FILE
get path_table_size_02 long MEMORY_FILE
get type_l_path_table long MEMORY_FILE
get opt_type_l_path_table long MEMORY_FILE
get type_m_path_table long MEMORY_FILE
get opt_type_m_path_table long MEMORY_FILE
getdstring root_directory_record 34 MEMORY_FILE
getdstring volume_set_id 128 MEMORY_FILE
getdstring publisher_id 128 MEMORY_FILE
getdstring preparer_id 128 MEMORY_FILE
getdstring application_id 128 MEMORY_FILE
getdstring copyright_file_id 37 MEMORY_FILE
getdstring abstract_file_id 37 MEMORY_FILE
getdstring bibliographic_file_id 37 MEMORY_FILE
getdstring creation_date 17 MEMORY_FILE
getdstring modification_date 17 MEMORY_FILE
getdstring expiration_date 17 MEMORY_FILE
getdstring effective_date 17 MEMORY_FILE
get file_structure_version byte MEMORY_FILE
get unused4 byte MEMORY_FILE
getdstring application_data 512 MEMORY_FILE
getdstring unused5 653 MEMORY_FILE
math type_l_path_table << 11
goto type_l_path_table MEMORY_FILE
log MEMORY_FILE2 0 0
math log_number = -2
for pt = 0
math pad_01 = 0
get directory_name_size byte MEMORY_FILE
if directory_name_size = 0
break
endif
get current_directory_number byte MEMORY_FILE
get directory_offset long MEMORY_FILE
get directory_record short MEMORY_FILE
getdstring directory_name_string directory_name_size MEMORY_FILE
putarray 2 0 ""
putarray 2 directory_record directory_name_string
xmath directory_extra_number "directory_record + 1"
putarray 2 directory_extra_number ""
putarray 1 256 directory_extra_number
get padding_byte byte MEMORY_FILE
if padding_byte != 0
goto -1 MEMORY_FILE SEEK_CUR
endif
savepos pt_pos MEMORY_FILE
if mode = 1
math pad_01 + 0x1a
elif mode = 2
math pad_01 + 0x22
endif
xmath tentative_offset "(directory_offset * 0x930) + pad_01"
goto tentative_offset
get directory_info_size long
xmath current_offset "directory_offset * 0x930"
xmath offset_limit "((directory_info_size >> 11) * 0x930) + current_offset"
callfunction parse_cdxa 1
savepos directory_offset_within_logged_memory MEMORY_FILE2
math directory_offset_within_logged_memory - directory_info_size
goto directory_offset_within_logged_memory MEMORY_FILE2
for d = 0
get number_of_bytes_in_record byte MEMORY_FILE2
if number_of_bytes_in_record == 0
break
endif
get number_of_sectors_in_extended_attribute_record byte MEMORY_FILE2
get entry_sector_in_disc_01 long MEMORY_FILE2
get entry_sector_in_disc_02 long MEMORY_FILE2
get entry_size_in_disc_01 long MEMORY_FILE2
get entry_size_in_disc_02 long MEMORY_FILE2
get year_since_1900 byte MEMORY_FILE2
get month byte MEMORY_FILE2
get day byte MEMORY_FILE2
get hour byte MEMORY_FILE2
get minute byte MEMORY_FILE2
get second byte MEMORY_FILE2
get greenwich_time_offset byte MEMORY_FILE2
get entry_flags byte MEMORY_FILE2
xmath entry_is_hidden_somewhere "entry_flags & 1"
putarray 8 8 entry_is_hidden_somewhere
xmath actual_entry_type "(entry_flags >> 1) & 1"
putarray 8 8 actual_entry_type
xmath entry_is_associated_with_something "(entry_flags >> 2) & 1"
putarray 8 8 entry_is_associated_with_something
xmath extra_attribute_info_from_entry "(entry_flags >> 3) & 1"
putarray 8 8 extra_attribute_info_from_entry
xmath only_mods_can_assess_this_entry "(entry_flags >> 4) & 1"
putarray 8 8 only_mods_can_assess_this_entry
xmath reserved_flags "(entry_flags >> 5) & 2"
putarray 8 8 reserved_flags
xmath record_does_not_end_with_this_entry "(entry_flags >> 7) & 1"
putarray 8 8 record_does_not_end_with_this_entry
get file_unit_size byte MEMORY_FILE2
get file_interleave_gap byte MEMORY_FILE2
get volume_sequence_number_01 short MEMORY_FILE2
get volume_sequence_number_02 short MEMORY_FILE2
get entry_name_size byte MEMORY_FILE2
getdstring entry_name_string entry_name_size MEMORY_FILE2
getarray directory_name_entries 1 256
if actual_entry_type == 0
set full_entry_name string ""
for n = 0 <= directory_name_entries
if n == directory_name_entries
string name_string = entry_name_string
putarray 2 n name_string
else
getarray name_string 2 n
endif
if n >= 1
string full_entry_name + "\"
string full_entry_name + name_string
endif
next n
putarray 0 0 full_entry_name
endif
get padding_byte byte MEMORY_FILE2
if padding_byte = 0
# do nothing
elif padding_byte = 1
get extra_byte byte MEMORY_FILE2
else
goto -1 MEMORY_FILE2 SEEK_CUR
endif
if system_id = "PLAYSTATION "
getdstring ps1_extra_bytes_01 3 MEMORY_FILE2
get is_cdda byte MEMORY_FILE2
if is_cdda != 0
goto -1 MEMORY_FILE2 SEEK_CUR
endif
get uxa_sign long MEMORY_FILE2
get is_cdxa byte MEMORY_FILE2
getdstring ps1_extra_bytes_02 5 MEMORY_FILE2
endif
next d
goto pt_pos MEMORY_FILE
next pt
startfunction parse_cdxa
goto current_offset
append
for OFFSET = current_offset u< offset_limit
math dummy_data = 0
idstring "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00"
for address = 1 <= 3
get address_value byte
next address
get cd_mode byte
if cd_mode == 1
savepos OFFSET
callfunction log_chunk 1
math OFFSET + 0x920
elif cd_mode == 2
for subheader = 1 <= 2
for info = 1 <= 4
get info_value byte
if info = 1
math file_number == info_value
putarray 1 0 file_number
elif info = 2
math channel_number == info_value
putarray 2 0 channel_number
elif info = 3
math submode == info_value
xmath submode_end_of_file "(submode >> 7) & 1"
xmath submode_real_time_sector "(submode >> 6) & 1"
xmath submode_form "(submode >> 5) & 1"
xmath submode_trigger "(submode >> 4) & 1"
xmath submode_data "(submode >> 3) & 1"
xmath submode_audio "(submode >> 2) & 1"
xmath submode_video "(submode >> 1) & 1"
xmath submode_end_of_record "submode & 1"
putarray 3 0 submode_end_of_file
putarray 4 0 submode_real_time_sector
putarray 5 0 submode_form
putarray 6 0 submode_trigger
putarray 7 0 submode_data
putarray 8 0 submode_audio
putarray 9 0 submode_video
putarray 10 0 submode_end_of_record
elif info = 4
math coding_info == info_value
if submode_data = 1
math reserved = coding_info
putarray 11 0 reserved
endif
if submode_audio = 1
xmath reserved "(coding_info >> 7) & 1"
xmath emphasis "(coding_info >> 6) & 1"
xmath number_of_bits_per_sample "(coding_info >> 5) & 3"
xmath sampling_frequency "(coding_info >> 3) & 3"
xmath mono_stereo "(coding_info >> 1) & 3"
putarray 11 0 reserved
putarray 12 0 emphasis
putarray 13 0 number_of_bits_per_sample
putarray 14 0 sampling_frequency
putarray 15 0 mono_stereo
endif
if submode_video = 1
xmath application_specific_coding_flag "(coding_info >> 7) & 1"
xmath even_odd_lines_flag "(coding_info >> 6) & 1"
xmath resolution "(coding_info >> 5) & 3"
xmath coding "(coding_info >> 3) & 15"
putarray 11 0 application_specific_coding_flag
putarray 12 0 even_odd_lines_flag
putarray 13 0 resolution
putarray 14 0 coding
endif
endif
next info
next subheader
savepos OFFSET
get chunk_sign long
callfunction log_chunk 1
math OFFSET + 0x918
endif
goto OFFSET
next
append
endfunction
startfunction log_chunk
if log_number = -1
log MEMORY_FILE OFFSET 0x800
elif log_number = -2
log MEMORY_FILE2 OFFSET 0x800
elif log_number = -3
log MEMORY_FILE3 OFFSET 0x800
endif
endfunction