diff --git a/LibRay-PS3/core.py b/LibRay-PS3/core.py index 66ba7fd..1e6f933 100644 --- a/LibRay-PS3/core.py +++ b/LibRay-PS3/core.py @@ -17,6 +17,7 @@ # along with this program. If not, see . import os +import sys import gzip ORDER = 'big' @@ -54,6 +55,21 @@ class IRD: self.header = ird.read(SECTOR*3) self.footer = ird.read(SECTOR) 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) @@ -67,10 +83,12 @@ class IRD: self.pic = ird.read(115) self.uid = ird.read(2) + print(self.pic) print(self.uid) + print(self.game_id) if filename != 'ird': - os.rm('ird') + os.remove('ird') diff --git a/LibRay-PS3/libray-ps3.py b/LibRay-PS3/libray-ps3.py index 2cfc7ab..9b5fbf7 100644 --- a/LibRay-PS3/libray-ps3.py +++ b/LibRay-PS3/libray-ps3.py @@ -41,9 +41,9 @@ def bprint(byte): if __name__ == '__main__': - #core.IRD('ird.ird') + core.IRD('ird') - #sys.exit() + sys.exit() bprint(b'\x00\x00\x00\x00') bprint(b'\x00\x00\x0c\xbf') @@ -51,7 +51,7 @@ if __name__ == '__main__': bprint(b'\x00\x00s\xc2\x7f') bprint(b'\x00\x00s\xc2\x80') - data = bytes(bytearray.fromhex("c9c1ec71205c2a6e8adc19795f9bfbd8")) + data = bytes(bytearray.fromhex("02EE0CE9E4C7CC1AD739ACC0DB6A3AA1")) key = bytes(bytearray.fromhex("380bcf0b53455b3c7817ab4fa3ba90ed")) iv = bytes(bytearray.fromhex("69474772af6fdab342743aefaa186287")) diff --git a/README.md b/README.md index 2584c37..efd3ad5 100644 --- a/README.md +++ b/README.md @@ -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)) + +[7bit encoded int / RLE / CLP](https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/io/binaryreader.cs#L582-L600) + +clp = compressed length prefix