Skip to content

Instantly share code, notes, and snippets.

@AlexP11223
Last active August 15, 2021 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexP11223/73f72bbfeaeac99c945ac63ccd9dd06f to your computer and use it in GitHub Desktop.
Save AlexP11223/73f72bbfeaeac99c945ac63ccd9dd06f to your computer and use it in GitHub Desktop.
Set the file path and launch the script using Python 3. It will update the checksum at the end of gameinputmodule.pf. https://www.pcgamingwiki.com/wiki/Mafia:_Definitive_Edition#Map_Extended_Mouse_Buttons
import os
import zlib
# for Linux (Steam/Proton):
# /home/<USER>/.steam/debian-installation/steamapps/compatdata/1030840/pfx/drive_c/users/steamuser/My Documents/My Games/Mafia Definitive Edition/Data/<USER_ID>/profiles/temporaryprofile/gameinputmodule.pf
file_path = 'C:/Users/<USER>/My Documents/My Games/Mafia Definitive Edition/Data/<USER_ID>/profiles/temporaryprofile/gameinputmodule.pf'
size = os.path.getsize(file_path)
with open(file_path, 'rb+') as f:
data = f.read(size - 4)
crc = zlib.crc32(data)
print(hex(crc & 0xffffffff))
f.write(crc.to_bytes(4, byteorder='little'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment