SMZ3 decoding fix (#1847)

This commit is contained in:
lordlou 2023-05-29 21:05:05 -04:00 committed by GitHub
parent 00e3c44400
commit df7462efcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import os
text_folder = Path(__file__).parents[3]
def openFile(resource: str, mode: str = "r", encoding: None = None):
def openFile(resource: str, mode: str = "r", encoding: str = None):
filename = sys.modules[__name__].__file__
apworldExt = ".apworld"
game = "smz3/"
@ -25,7 +25,7 @@ def openFile(resource: str, mode: str = "r", encoding: None = None):
else:
return io.TextIOWrapper(zf.open(zipFilePath, 'r'), encoding)
else:
return open(os.path.join(text_folder, resource), mode)
return open(os.path.join(text_folder, resource), mode, encoding=encoding)
class Texts:
@staticmethod
@ -36,7 +36,7 @@ class Texts:
@staticmethod
def ParseTextScript(resource: str):
with openFile(resource, 'r') as file:
with openFile(resource, 'r', encoding="utf-8-sig") as file:
return [text.rstrip('\n') for text in file.read().replace("\r", "").split("---\n") if text]
scripts: Any = ParseYamlScripts.__func__("smz3/TotalSMZ3/Text/Scripts/General.yaml")