Skip to content

Instantly share code, notes, and snippets.

@arisada
Created October 17, 2018 18:32
Show Gist options
  • Save arisada/98590e331f71c31bd3b50a17e1ff9597 to your computer and use it in GitHub Desktop.
Save arisada/98590e331f71c31bd3b50a17e1ff9597 to your computer and use it in GitHub Desktop.
NOCD patch for Constructor (1997)
#!/usr/bin/env python
# This script will let you play constructor without the CD
# in the drive. My retrogaming laptop has no CD drive.
f = open("GAME.EXE").read()
patches = [
(272174,"\x74","\xeb"),
(642050,"\x83\x3d\x88\x3b\x04\x00\x00","\x90\x90\x90\x90\x90\x90\x90"),
(750753,"\x75","\xeb"),
(750850,"\xfa\xff\xff\xff","\x00\x00\x00\x00"),
(750887,"\x74","\xeb"),
]
for p in patches:
if f[p[0]:p[0] + len(p[1])] != p[1]:
print "Original data invalid. Already patched ?"
if f[p[0]:p[0] + len(p[1])] == p[2]:
print "Yes."
else:
print "No."
else:
f = f[:p[0]] + p[2] + f[p[0] + len(p[2]):]
patched = open("GAME_NOCD.EXE","w")
patched.write(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment