SMZ3 decoding fix (#1847)
This commit is contained in:
parent
00e3c44400
commit
df7462efcc
|
@ -12,7 +12,7 @@ import os
|
||||||
|
|
||||||
text_folder = Path(__file__).parents[3]
|
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__
|
filename = sys.modules[__name__].__file__
|
||||||
apworldExt = ".apworld"
|
apworldExt = ".apworld"
|
||||||
game = "smz3/"
|
game = "smz3/"
|
||||||
|
@ -25,7 +25,7 @@ def openFile(resource: str, mode: str = "r", encoding: None = None):
|
||||||
else:
|
else:
|
||||||
return io.TextIOWrapper(zf.open(zipFilePath, 'r'), encoding)
|
return io.TextIOWrapper(zf.open(zipFilePath, 'r'), encoding)
|
||||||
else:
|
else:
|
||||||
return open(os.path.join(text_folder, resource), mode)
|
return open(os.path.join(text_folder, resource), mode, encoding=encoding)
|
||||||
|
|
||||||
class Texts:
|
class Texts:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -36,7 +36,7 @@ class Texts:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ParseTextScript(resource: str):
|
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]
|
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")
|
scripts: Any = ParseYamlScripts.__func__("smz3/TotalSMZ3/Text/Scripts/General.yaml")
|
||||||
|
|
Loading…
Reference in New Issue