View Single Post
Old 05-23-2012   #38
sandungas
Homebrew Developer
 
sandungas's Avatar
 
Join Date: Oct 2011
Location: dev_hdd0/home/
Posts: 499
Likes: 239
Liked 503 Times in 211 Posts
Mentioned: 100 Post(s)
Tagged: 0 Thread(s)
The file structure of a decrypted iso.bin is divided in "blocks" and "clusters"
Code:
1 block = 1024 bytes (0x400)
1 cluster = 16 blocks = 1024*16 bytes =16384 bytes (0x4000)
First you have the header (1 block) <--- this header can be considered "patched" to the start of the file, doesnt count as part of first cluster... clusters are used only inside the "discs" areas
Then the "disc 1" starts (1024 blocks, 64 clusters)
Then the "disc 2" starts (another 1024 blocks, 64 clusters)
etc...

Inside the first clusters of each disc (this cluster can be considered another header specific for this disc) you have the "magic" PSISOIMG0000 that is different for "psp minis" (i dont remember)..... and probably another for "ps2 classics" (speculation)
Also the "game_id"... "number of clusters"... some unknown counters... (probably blocks used or similar)
But the most important area of this cluster is the 32 bytes (seems to be a key) displaced 0x800 bytes from the start of the cluster
Then there is a block of padding
And in the second cluster it begins the "file_table"... this table last to the end of the "disc 1" (and not-used clusters contains a checksum of 16 bytes)

The file_table is composed of entries of 32 bytes each
In each entry you have...the displacement from start of table, file size ?, cluster number (inside the iso) ?... etc...

--------------------------------------
Well... this file_table is pointing to the disc in iso format, and probably to "sectors" of the disc... it can be a TOC
And here is where is important to take in account the track data mode of the old ps1 discs, because it had an special track (known as MODE2)


Edit:
The positions are always fixed, so for a game with 4 discs the important stuff is at this offsets:
discs_start -----------> 0x000400 (disc1), 0x100400 (disc2), 0x200400 (disc3), 0x300400 (disc4)
discs_keys -----------> 0x000C00 (disc1), 0x100C00 (disc2), 0x200C00 (disc3), 0x300C00 (disc4)
discs_file_tables ------> 0x004400 (disc1), 0x104400 (disc2), 0x204400 (disc3), 0x304400 (disc4)

Last edited by sandungas; 05-23-2012 at 07:40 PM.
sandungas is offline   Reply With Quote
Likes: (5)