Working on reading IRD

This commit is contained in:
Nichlas Severinsen 2018-06-21 22:02:47 +02:00
parent 9d75699178
commit 730b54d6bf
3 changed files with 26 additions and 4 deletions

View file

@ -17,6 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import os import os
import sys
import gzip import gzip
ORDER = 'big' ORDER = 'big'
@ -54,6 +55,21 @@ class IRD:
self.header = ird.read(SECTOR*3) self.header = ird.read(SECTOR*3)
self.footer = ird.read(SECTOR) self.footer = ird.read(SECTOR)
self.region_count = ird.read(1) self.region_count = ird.read(1)
back = ird.tell()
prefix = bytes_to_int(ird.read(1))
length = prefix >> 1
if prefix & 0b00000001:
ird.seek(back)
self.header = ird.read(length)
back = ird.tell()
prefix = bytes_to_int(ird.read(1))
length = prefix >> 1
ird.seek(back)
self.footer = ird.read(length)
self.region_count
print()
sys.exit()
print(self.game_name, self.update_version, self.game_version, self.region_count) print(self.game_name, self.update_version, self.game_version, self.region_count)
@ -67,10 +83,12 @@ class IRD:
self.pic = ird.read(115) self.pic = ird.read(115)
self.uid = ird.read(2) self.uid = ird.read(2)
print(self.pic)
print(self.uid) print(self.uid)
print(self.game_id)
if filename != 'ird': if filename != 'ird':
os.rm('ird') os.remove('ird')

View file

@ -41,9 +41,9 @@ def bprint(byte):
if __name__ == '__main__': if __name__ == '__main__':
#core.IRD('ird.ird') core.IRD('ird')
#sys.exit() sys.exit()
bprint(b'\x00\x00\x00\x00') bprint(b'\x00\x00\x00\x00')
bprint(b'\x00\x00\x0c\xbf') bprint(b'\x00\x00\x0c\xbf')
@ -51,7 +51,7 @@ if __name__ == '__main__':
bprint(b'\x00\x00s\xc2\x7f') bprint(b'\x00\x00s\xc2\x7f')
bprint(b'\x00\x00s\xc2\x80') bprint(b'\x00\x00s\xc2\x80')
data = bytes(bytearray.fromhex("c9c1ec71205c2a6e8adc19795f9bfbd8")) data = bytes(bytearray.fromhex("02EE0CE9E4C7CC1AD739ACC0DB6A3AA1"))
key = bytes(bytearray.fromhex("380bcf0b53455b3c7817ab4fa3ba90ed")) key = bytes(bytearray.fromhex("380bcf0b53455b3c7817ab4fa3ba90ed"))
iv = bytes(bytearray.fromhex("69474772af6fdab342743aefaa186287")) iv = bytes(bytearray.fromhex("69474772af6fdab342743aefaa186287"))

View file

@ -10,3 +10,7 @@ A hackable, crossplatform, alternative to ISOTools and ISO-Rebuilder.
[see also](http://www.psdevwiki.com/ps3/Bluray_disc#Encryption) ([archive.fo](https://archive.fo/hN1E6)) [see also](http://www.psdevwiki.com/ps3/Bluray_disc#Encryption) ([archive.fo](https://archive.fo/hN1E6))
[7bit encoded int / RLE / CLP](https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/io/binaryreader.cs#L582-L600)
clp = compressed length prefix