mirror of
https://github.com/grp/Wii.py.git
synced 2025-06-19 07:15:49 -04:00
Added a CCF packer/unpacker
This commit is contained in:
parent
f2a80801ca
commit
94e23f2ade
@ -27,6 +27,7 @@ class CCF():
|
|||||||
self.fileSizeDecompressed = Struct.uint32
|
self.fileSizeDecompressed = Struct.uint32
|
||||||
|
|
||||||
def __init__(self, fileName):
|
def __init__(self, fileName):
|
||||||
|
self.fileName = fileName
|
||||||
self.fd = open(fileName, 'r+b')
|
self.fd = open(fileName, 'r+b')
|
||||||
|
|
||||||
def compress(self, folder):
|
def compress(self, folder):
|
||||||
@ -85,8 +86,12 @@ class CCF():
|
|||||||
if fileHdr.magic != "\x43\x43\x46\x00":
|
if fileHdr.magic != "\x43\x43\x46\x00":
|
||||||
raise ValueError("Wrong magic, 0x{0}".format(fileHdr.magic))
|
raise ValueError("Wrong magic, 0x{0}".format(fileHdr.magic))
|
||||||
|
|
||||||
os.mkdir('/' + self.fd.name.replace(".", "_") + "_out")
|
try:
|
||||||
os.chdir('/' + self.fd.name.replace(".", "_") + "_out")
|
os.mkdir(os.path.dirname(self.fileName) + '/' + self.fd.name.replace(".", "_") + "_out")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(self.fileName) + '/' + self.fd.name.replace(".", "_") + "_out")
|
||||||
|
|
||||||
currentOffset = len(fileHdr)
|
currentOffset = len(fileHdr)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user