[Scummvm-git-logs] scummvm-tools master -> f925981f18c9b0f42436cabb902e7937529b17f9

aquadran noreply at scummvm.org
Sun Oct 12 05:53:05 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://api.github.com/repos/scummvm/scummvm-tools .

Summary:
f925981f18 WINTERMUTE: Improve script decompiler


Commit: f925981f18c9b0f42436cabb902e7937529b17f9
    https://github.com/scummvm/scummvm-tools/commit/f925981f18c9b0f42436cabb902e7937529b17f9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-10-12T07:52:58+02:00

Commit Message:
WINTERMUTE: Improve script decompiler

Changed paths:
    engines/wintermute/decompile_script.py


diff --git a/engines/wintermute/decompile_script.py b/engines/wintermute/decompile_script.py
index 42b841a5..9eaa9e6b 100755
--- a/engines/wintermute/decompile_script.py
+++ b/engines/wintermute/decompile_script.py
@@ -39,6 +39,14 @@ import os
 import sys
 import traceback
 
+def safe_decode(b):
+    for enc in ("cp1252", "latin-1", "utf-8"):
+        try:
+            return b.decode(enc)
+        except UnicodeDecodeError:
+            continue
+    return b.decode("latin-1", errors="replace")
+
 if  len(sys.argv) == 1 or len(sys.argv) > 3:
     print("Usage: %s <path-to-compiled-script> [<path-to-inc-folder>]")
     sys.exit(-1)
@@ -157,7 +165,7 @@ class WinterMuteDecompiler:
         return result
 
     def read_header(self):
-        self.fname = self.data[32:self.offsets[2]].strip().decode("utf-8")
+        self.fname = safe_decode(self.data[32:self.offsets[2]].strip())
         self.tables = {}
         self.externals = []
         for i,title in enumerate(self.table_names):




More information about the Scummvm-git-logs mailing list