Skip to content

Instantly share code, notes, and snippets.

@PeterHindes
Created May 25, 2018 23:22
Show Gist options
  • Save PeterHindes/f441f27423e46b36a818f9f7243b0105 to your computer and use it in GitHub Desktop.
Save PeterHindes/f441f27423e46b36a818f9f7243b0105 to your computer and use it in GitHub Desktop.
Fix Battle Block Theater Error That The Devs Refuse To
#!/usr/bin/env bash
FILE=BattleBlockTheater
MD5_PRE=436e91811d8a38de1918991969347b3d
MD5_POST=71eb6519233b21d85c858b39f2b4871f
OFFSET=0x24f2b9
PAYLOAD='\x90\x90'
function getMD5()
{
echo $(md5sum "${1}" | cut -d ' ' -f 1)
}
if [[ ${MD5_PRE} != $(getMD5 ${FILE}) ]]
then
echo Input has wrong checksum. Already patched?
exit 11
fi
echo -ne ${PAYLOAD} | dd if=/dev/stdin of="${FILE}" bs=1 conv=notrunc seek=$((${OFFSET})) status=none
if [[ $? != 0 ]]
then
echo Patching binary failed.
exit 77
fi
if [[ ${MD5_POST} != $(getMD5 ${FILE}) ]]
then
echo Output has wrong checksum. Expect trouble!
exit 22
fi
echo Yay... everything went well.
@PeterHindes
Copy link
Author

PeterHindes commented May 25, 2018

How to use this

Put in the game folder, make executable, execute :P

-Steam User: de.nagical[linux]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment