Editing ISO.BIN.EDAT

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== ISO.BIN.EDAT ==
==ISO.BIN.EDAT==
 
This is an encryted container format, first step to work with it is to decrypt it <!--more info an internal links to other wiki pages needed--><br>
ISO.BIN.EDAT is an encryted container format. First step to work with it is to decrypt it <!--more info an internal links to other wiki pages needed-->
After decryption we shoould refer to it as ISO.BIN.DAT (without the "E"... so the EDAT became a DAT)
 
After decryption, we should refer to ISO.BIN.EDAT as ISO.BIN.DAT (without the "E"... so the EDAT became a DAT).


==ISO.BIN.DAT (decrypted)==
==ISO.BIN.DAT (decrypted)==
Line 51: Line 49:
! Cluster Nº !! Block Nº !! Offset !! Length !! Name !! Example !! Notes
! Cluster Nº !! Block Nº !! Offset !! Length !! Name !! Example !! Notes
|-
|-
| rowspan="28" style="background-color:#DDDDDD;" | 0 <br /> '''Disc map header''' || rowspan="3" style="background-color:#DDDDDD;" | 1 || 0x0000 || 0x00C (12 bytes) || '''magic''' || PSISOIMG0000 || In "PSP Minis" It's NPUMDIMG ([[Environments|NP]] UMD Image) ..... probably another for "ps2 classics" (speculation)
| rowspan="25" style="background-color:#DDDDDD;" | 0 <br /> '''Disc map header''' || rowspan="3" style="background-color:#DDDDDD;" | 1 || 0x0000 || 0x00C (12 bytes) || '''magic''' || PSISOIMG0000 || In "PSP Minis" It's NPUMDIMG ([[Environments|NP]] UMD Image) ..... probably another for "ps2 classics" (speculation)
|-
|-
| 0x000C || 0x004 (4 bytes) || '''section size''' || || Offset from the start of the PSISOIMG section to the next section<br>For uncompressed images this is usually 0x100000 + size of iso-image padded to 0x9300<br>If the disc contains CD-DA tracks then this number will also include all the ATRACK encoded audio that follows after the disk image.
| 0x000C || 0x004 (4 bytes) || '''section size''' || || Offset from the start of the PSISOIMG section to the next section<br>For uncompressed images this is usually 0x100000 + size of iso-image padded to 0x9300<br>If the disc contains CD-DA tracks then this number will also include all the ATRACK encoded audio that follows after the disk image.
Line 57: Line 55:
| 0x0010 || 0x3F0 (1008 bytes) || ''padding'' || ||
| 0x0010 || 0x3F0 (1008 bytes) || ''padding'' || ||
|-
|-
| rowspan="5" style="background-color:#DDDDDD;" | 2 || 0x0400 || 0x010 (16 bytes) || '''disc id''' || _SLES_12345 || in games with several discs each disc has a different id
| rowspan="2" style="background-color:#DDDDDD;" | 2 || 0x0400 || 0x010 (16 bytes) || '''disc id''' || _SLES_12345 || in games with several discs each disc has a different id
|-
|-
| 0x0410 || 0x14 (20 bytes) || ''padding'' || ||
| 0x0410 || 0x3F0 (1008 bytes) || ''padding'' || ||
|-
| 0x0424 || 0x4 (4 bytes) || '''Ad hoc ps1 config revision''' || 0x12345 (bcd) || Ad hoc game config revision in bcd little endian.
|-
| 0x042C || up to 0x40 (64 bytes) || '''Ad hoc ps1 configs''' || 0x01, 0x40 || Ad hoc game configs in little endian. Single config is 4 bytes command and 4 bytes param for said command. Up to 8 Commands is supported. ps1_netemu only. ISO.BIN.EDAT exclusive.
|-
| 0x046C || 0x394 (916 bytes) || ''padding'' || ||
|-
|-
| rowspan="2" style="background-color:#DDDDDD;" | 3 || 0x0800 || 0x3FС (1020 bytes) || '''[[ISO.BIN.EDAT#Disc toc table|Disc toc table]]''' || variable || Table of content, like CUE sheet, supports upto 99 entries (102 entries total)
| rowspan="2" style="background-color:#DDDDDD;" | 3 || 0x0800 || 0x3FС (1020 bytes) || '''[[ISO.BIN.EDAT#Disc toc table|Disc toc table]]''' || variable || Table of content, like CUE sheet, supports upto 99 entries (102 entries total)
Line 75: Line 67:
| rowspan="5" style="background-color:#DDDDDD;" | 5 || 0x1000 || 0x220 (544 bytes) || '''[[ISO.BIN.EDAT#Audio tracks table|Audio tracks table]]''' || || Datas of audio tracks (66-99). offset, size, and more
| rowspan="5" style="background-color:#DDDDDD;" | 5 || 0x1000 || 0x220 (544 bytes) || '''[[ISO.BIN.EDAT#Audio tracks table|Audio tracks table]]''' || || Datas of audio tracks (66-99). offset, size, and more
|-
|-
| 0x12B0 || 0x004 (4 bytes) || '''Libcrypt Magic Word''' || 0x1234 || Little endian. Magic word is used as an answer to COP0 BPC reads for libcrypt games.
| 0x1220 || 0x0B4 (180 bytes) || '''[[ISO.BIN.EDAT#Game params table|Game params table]]''' || || <!-- doesnt makes sense to start using a block with a padding, i bet it was an unused area in the file/s i was looking at when i made this table -->
|-
|-
| 0x12D4 || 0x004 (4 bytes) || '''subchannel offset''' || 0x100400 || Offset to where subchannel data is stored. This is used with libcrypt.
| 0x12D4 || 0x004 (4 bytes) || '''subchannel offset''' || 0x100400 || Offset to where subchannel data is stored. This is used with libcrypt.
|-
|-
| 0x12D8 || 0x004 (4 bytes) || '''subchannel count''' || 0x178 || Number of subchannel blocks. Each block is 12 bytes.
| 0x12D8 || 0x004 (4 bytes) || '''subchannel count''' || 0x178 || Number of subchannel blocks. Each block is 12 bytes. Content is unknown.
|-
|-
| 0x12DC || 0x124 (292 bytes) || ''padding'' || ||
| 0x12DC || 0x124 (292 bytes) || ''padding'' || ||
Line 156: Line 148:
| 0x08 || 0x04 (4 bytes) || '''unknown_0''' ||  || always zeroed
| 0x08 || 0x04 (4 bytes) || '''unknown_0''' ||  || always zeroed
|-
|-
| 0x0C || 0x04 (4 bytes) || ''enc_key'' ||  || encryption key (or 0 if not encrypted)
| 0x0C || 0x04 (4 bytes) || '''and more \o/''' ||  || encryption key
|-
|-
| style="background-color:#DDDDDD;" | Up to 98 || || || || || same structure than the previous entry
| style="background-color:#DDDDDD;" | Up to 98 || || || || || same structure than the previous entry
|}
|}
The audio tracks themselves are raw ATRAC3 streams without a header.
 
One way to create such blobs is to use the atracdenc encoder and strip of the first 0x60 bytes which is the header. The resulting blob is what the Audio tracks table entries will point to.
====Game Params table====
There is a setting related with PS1 libcrypt protection in this area (located at <s>relative</s> absolute offset 0x12B0 for single disc or 0x16B0 in the first disc for Multidisc, lenght 0x4 little endian), see: [https://www.psx-place.com/threads/ps1-libcrypt-support-on-ps3-official-emus-research-thread.35836/page-7#post-316873 talk]
 
Libcrypt in emulator is supported by supplying ready 16 bit key in little endian format (0xA371 in CTR example).
List of keys can be obtained using [https://github.com/Red-J/LibcryptMagic-Word-Finder-PSX Libcrypt Magic Word Finder PSX]


====Disc map table====
====Disc map table====
Line 205: Line 201:
|}
|}


====Subchannel data====
There are 2 "special" entries to mark the "start of a disc" (FFFFFFFF 00000000 FFFFFFFF), and the "end of a disc" (FFFFFFFF FFFFFFFF FFFFFFFF). Between the start and the end, there are a variable number of entries.
This is data stored in separate .pgd in psar (0xED4 [0x12D4] in ISO header point to it if available), should be required only for games that use libcrypt protection (LC2 and higher).
 
Header of decrypted file is FFFFFFFF 00000000 FFFFFFFF, end of file is marked by FFFFFFFF FFFFFFFF FFFFFFFF.
There is also an added string at the end of the last disc (after the last FFFFFFFF FFFFFFFF FFFFFFFF entry)... is a 40 bytes unknown area (in my example my game had 4 discs so maybe this area is divided in chunks of 10 bytes for each disc)
Values are always 150 sectors lower than real disc sector (pregap?). Values are in little endian (sector only actually, others are 1 byte values). See section below for example code on how to generate this table.


{| class="wikitable"
So as an example... for a game with 4 discs this table is:
|-
* first entry of disc 1 ---> FFFFFFFF 00000000 FFFFFFFF (start of disc 1)
! Entry Nº !! Name !! Offset !! Size (bytes) !! Example !! Notes
* next entries of disc 1 --> data from disc.... the number is variable
|-
* last entry of disc 1 ---> FFFFFFFF FFFFFFFF FFFFFFFF (end of disc 1)
|-
* first entry of disc 2 ---> FFFFFFFF 00000000 FFFFFFFF (start of disc 2)
| rowspan="9" style="background-color:#DDDDDD;" | 1 or 2? || Sector || 0x00 || 4 || || Sector number - 150
* next entries of disc 2 --> data from disc.... the number is variable
|-
* last entry of disc 2 ---> FFFFFFFF FFFFFFFF FFFFFFFF (end of disc 2)
| Track Number || 0x04 || 1 || 0x01 || Always 0x01
* first entry of disc 3 ---> FFFFFFFF 00000000 FFFFFFFF (start of disc 3)
|-
* next entries of disc 3 --> data from disc.... the number is variable
| Index || 0x05  || 1 || 0x01 || Always 0x01
* last entry of disc 3 ---> FFFFFFFF FFFFFFFF FFFFFFFF (end of disc 3)
|-
* first entry of disc 4 ---> FFFFFFFF 00000000 FFFFFFFF (start of disc 4)
| Pmin(relative) || 0x06 || 1 || ||
* next entries of disc 4 --> data from disc.... the number is variable
|-
* last entry of disc 4 ---> FFFFFFFF FFFFFFFF FFFFFFFF (end of disc 4)
| Psec(relative) || 0x07 || 1 || ||
* unknown area of 40 bytes (10 bytes for each disc ?)
|-
| Pframe(relative) || 0x08 || 1 || ||
|-
| Amin (Absolute) || 0x09 || 1 || ||
|-
| Asec (Absolute) || 0x0A || 1 || ||
|-
| Aframe (Absolute) || 0x0B || 1 || ||
|-
| style="background-color:#DDDDDD;" | Up to 1024 || || || || || or up to 1022? (minus header/footer) same structure than the previous entry
|-
|}
*More info: https://www.psx-place.com/threads/ps1-libcrypt-support-on-ps3-official-emus-research-thread.35836/page-13#post-318506
*Unpacker able to extract that data: [[PS1_Emulation#PSone_Classic_Tools|PSone Classic Tools]]


== Minis ISO.BIN structure ==
== Minis ISO.BIN structure ==
Line 427: Line 408:


=== Decrypting with PSL1GHT ===
=== Decrypting with PSL1GHT ===
 
* https://github.com/euss/psp_edat_decryptor (not my code, just git'ed it for convenience)
* broken github: https://github.com/euss/psp_edat_decryptor (git'ed by euss for convenience)
* mirrors: [http://mir.cr/0XXBT99Z], [http://mir.cr/1SNVEH2D], [http://mir.cr/ZKZJFPET]
* broken mirrors: [http://mir.cr/0XXBT99Z], [http://mir.cr/1SNVEH2D], [http://mir.cr/ZKZJFPET]
 
=== Generate the subchannel blob ===
Python code to generate the subchannel blob:
<pre>
def generate_subchannels(magic_word):
    def generate_subchannel(sector, is_corrupt):
        def bcd(i):
            return int(i % 10) + 16 * (int(i / 10) % 10)
 
        sc = bytearray(12)
        s = sector - 150
        struct.pack_into('<I', sc, 0, s)
        struct.pack_into('<B', sc, 4, 1)
        struct.pack_into('<B', sc, 5, 1)
        if is_corrupt:
            s = s - 1
        struct.pack_into('<B', sc, 8, bcd(s % 75))
        s = s - (s % 75)
        s = int(s / 75)
        struct.pack_into('<B', sc, 7, bcd(s % 60))
        struct.pack_into('<B', sc, 6, bcd(int(s / 60)))
 
        s = sector
        if is_corrupt:
            s = s - 1
        struct.pack_into('<B', sc, 11, bcd(s % 75))
        s = s - (s % 75)
        s = int(s / 75)
        struct.pack_into('<B', sc, 10, bcd(s % 60))
        struct.pack_into('<B', sc, 9, bcd(int(s / 60)))
 
        return sc
 
    sector_pairs = {
        15: [14105,14110],
        14: [14231,14236],
        13: [14485,14490],
        12: [14579,14584],
        11: [14649,14654],
        10: [14899,14904],
        9: [15056,15061],
        8: [15130,15135],
        7: [15242,15247],
        6: [15312,15317],
        5: [15378,15383],
        4: [15628,15633],
        3: [15919,15924],
        2: [16031,16036],
        1: [16101,16106],
        0: [16167,16172]
        }
    scd = bytes(0)
    scd = scd + bytes([0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff])
    for i in range(15, -1, -1):
        scd = scd + generate_subchannel(sector_pairs[i][0], magic_word & (1<<i))
        scd = scd + generate_subchannel(sector_pairs[i][1], magic_word & (1<<i))
    scd = scd + bytes([0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff])
 
    print('Generate subchannel data for 0x%04x' % magic_word)
    s = scd
    while s:
        print(struct.unpack_from('<I', s, 0)[0], s[:12].hex())
        s = s[12:]
 
    return scd
</pre>


==About PS2 Classics==
==About PS2 Classics==
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)