mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
Remove uses of MATCHING environment variable and make patchpiracysums offer advice when it fails
This commit is contained in:
1 parent
810f86cc19
commit
2de0ef3028
3 files changed
+12
-11
No files matched your search
+2
-4
@@ -132,15 +132,13 @@ def main():
|
||||
|
||||
fd = open(sys.argv[1], 'rb+')
|
||||
|
||||
if os.environ['MATCHING'] == '1':
|
||||
write_garbage(fd, locations)
|
||||
write_garbage(fd, locations)
|
||||
|
||||
pack_lib(fd, locations)
|
||||
pack_data(fd, locations)
|
||||
pack_game(fd, locations)
|
||||
|
||||
if os.environ['MATCHING'] == '1':
|
||||
fill_tail(fd)
|
||||
fill_tail(fd)
|
||||
|
||||
# Truncate to 32MB
|
||||
fd.seek(0)
|
||||
|
||||
@@ -165,10 +165,14 @@ class Tool:
|
||||
pos += 4
|
||||
|
||||
if upperpos is None or lowerpos is None:
|
||||
print('0x%08x' % checksum)
|
||||
raise ValueError('Unable to find checksum location in %s (upperpos=%s, lowerpos=%s)' % (
|
||||
patchfunc, upperpos, lowerpos
|
||||
))
|
||||
print('Unable to find placeholder checksum in %s.' % patchfunc)
|
||||
print('This can happen if you\'ve turned PIRACYCHECKS off, built the files, then turned it on without rebuilding.')
|
||||
print('To fix, try running the following:')
|
||||
print('')
|
||||
print(' touch $(grep -lr PIRACYCHECKS src)')
|
||||
print(' make')
|
||||
print('')
|
||||
exit(1)
|
||||
|
||||
self.fd.seek(upperpos)
|
||||
self.fd.write((0x3c010000 | (checksum >> 16)).to_bytes(4, 'big'))
|
||||
@@ -200,7 +204,7 @@ class Tool:
|
||||
|
||||
self.fd.close()
|
||||
|
||||
if os.environ['PIRACYCHECKS']:
|
||||
if os.environ['PIRACYCHECKS'] == '1':
|
||||
tool = Tool()
|
||||
tool.run()
|
||||
|
||||
Reference in new issue
Block a user