mirror of
https://github.com/a2-4am/4cade.git
synced 2025-04-08 23:38:22 +00:00
minor Pythonic update to HGR packer, and some comments
This commit is contained in:
parent
cd38e5d173
commit
8d95d437ad
@ -4,25 +4,24 @@ import sys
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
i = open(infile,"rb")
|
||||
filedata = i.read()
|
||||
i.close
|
||||
with open(infile,"rb") as i:
|
||||
filedata = i.read()
|
||||
|
||||
# If the file has a JMP in the last screen hole, the
|
||||
# game has an animated title, skip packing and copy
|
||||
# the file as is instead.
|
||||
# Some HGR files were saved as 8184 bytes (without
|
||||
# final screen hole) so check file length first.
|
||||
if(len(filedata) >= 8192 and filedata[8189] == 0x4c):
|
||||
print (infile, "has animation, not packing")
|
||||
outdata = bytearray(filedata[0:8192])
|
||||
else:
|
||||
outdata = bytearray(filedata[0:7680])
|
||||
|
||||
for h in range(60):
|
||||
oh = h*128+120
|
||||
ih = h*8+7680+(int(h/15)*8)
|
||||
outdata[oh:oh+8] = filedata[ih:ih+8]
|
||||
|
||||
o = open(outfile,"wb")
|
||||
o.write(outdata)
|
||||
o.close
|
||||
for h in range(60):
|
||||
oh = h*128+120
|
||||
ih = h*8+7680+(int(h/15)*8)
|
||||
outdata[oh:oh+8] = filedata[ih:ih+8]
|
||||
|
||||
with open(outfile,"wb") as o:
|
||||
o.write(outdata)
|
||||
|
Loading…
x
Reference in New Issue
Block a user