diff --git a/Makefile b/Makefile index c7c81eb8a..2f62f781c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ # User configurable ROMID ?= ntsc-final -MATCHING ?= 1 PIRACYCHECKS ?= 1 QEMU_IRIX ?= tools/irix/qemu-irix @@ -152,7 +151,7 @@ $(B_DIR)/pd.z64: $(B_DIR)/stage3.bin $(ASSET_FILES) # the ROM to 32MB. $(B_DIR)/stage3.bin: $(B_DIR)/stage2.bin $(B_DIR)/segments/gamezips.bin @cp $< $@.tmp - MATCHING=$(MATCHING) tools/packrom $@.tmp && mv $@.tmp $@ + tools/packrom $@.tmp && mv $@.tmp $@ # Stage2 takes stage1 and calculates the piracy checksums. $(B_DIR)/stage2.bin: $(B_DIR)/stage1.bin diff --git a/tools/packrom b/tools/packrom index 2f98b80e3..0c4dc942a 100755 --- a/tools/packrom +++ b/tools/packrom @@ -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) diff --git a/tools/patchpiracysums b/tools/patchpiracysums index b4f9f8c10..27af84596 100755 --- a/tools/patchpiracysums +++ b/tools/patchpiracysums @@ -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()