Skip to content

Commit

Permalink
finish moving to pkgutil
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed Dec 5, 2024
1 parent 725a802 commit 2655d23
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions worlds/rusted_moss/RustedMossClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,24 @@ def _cmd_patch(self, directory: str = ""):
basemd5 = hashlib.md5()
with open(dataWinPath, "rb") as file:
base_data_bytes = bytes(file.read())
basemd5.update(base_data_bytes)
if RAWDATAHASH != basemd5.hexdigest():
self.output("ERROR: MD5 hash of data.win file does not match correct hash. Make sure you have downpatched to the correct version (1.47)")
return

modded_data = bsdiff4.patch(base_data_bytes, pkgutil.get_data(__name__, "data/rusted_moss_patch.bsdiff"))

with open(dataWinPath, "wb") as file:
file.write(modded_data)
moddedmd5 = hashlib.md5()
with open(dataWinPath, "rb") as file:
modded_data_bytes = bytes(file.read())
file.close()
basemd5.update(base_data_bytes)
if RAWDATAHASH != basemd5.hexdigest():
self.output("ERROR: MD5 hash of data.win file does not match correct hash. Make sure you have downpatched to the correct version (1.47)")
moddedmd5.update(modded_data_bytes)
if MODDEDDATAHASH != moddedmd5.hexdigest():
self.output("ERROR: MD5 hash of moddified data.win file does not match correct hash. Try again or contact mod owner.")
else:
bsdiff4.file_patch_inplace(dataWinPath, pkgutil.get_data(__name__, "data/rusted_moss_patch.bsdiff"))
moddedmd5 = hashlib.md5()
with open(dataWinPath, "rb") as file:
modded_data_bytes = bytes(file.read())
file.close()
moddedmd5.update(modded_data_bytes)
if MODDEDDATAHASH != moddedmd5.hexdigest():
self.output("ERROR: MD5 hash of moddified data.win file does not match correct hash. Try again or contact mod owner.")
else:
self.output("Patching successful")
self.output("Patching successful")

async def _cmd_deathlink(self):
"""Toggles deathlink on or off."""
Expand Down

0 comments on commit 2655d23

Please sign in to comment.