From 515baa90aac601caff64c39ce8160c81517a46ed Mon Sep 17 00:00:00 2001 From: yg2f Date: Sun, 10 May 2015 19:55:20 +0200 Subject: [PATCH] fixes memory overflow with ldd4.3 ldd4.3 Assets.lif contains a large db.lif file which fails to be extracted because of a memory overflow error with python 2.7. this path make extraction by blocks of 16MB. if the block size is too large, it is divided by 2 till it fits the file size ... (could be improved though) --- LIFExtractor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LIFExtractor.py b/LIFExtractor.py index d726e67..bd96013 100644 --- a/LIFExtractor.py +++ b/LIFExtractor.py @@ -123,8 +123,14 @@ def recurse(prefix, offset): #Loop through the list of files, saving them. for a in fileList: + print("- extracting : "+outFolder+a[0]) f = open((outFolder + a[0]), "wb") - f.write(fileData[a[1]:a[1]+a[2]]) + b = a[1]; e = a[1]+a[2] ; step = 0x1000000 + while b < e : + while (b+step) > e : + step /= 2 + f.write(fileData[b:b+step]) + b += step f.close() print("\tCOMPLETE: " + str(len(fileList)) + " files in " + str(len(folderList)) + " folders extracted.")