mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
fix: Project Zomboid runs on G1 and the C1 JIT instead of ZGC (#2016)
This commit is contained in:
2 files changed
+99
No files matched your search
@@ -243,6 +243,59 @@ def ubisoft_overlay_off(env):
|
||||
print("droiddeck-game-env: Ubisoft Connect overlay left as is (%s)" % error, file=sys.stderr)
|
||||
|
||||
|
||||
PZ_JVM_FLAGS = ("-XX:+UseG1GC", "-XX:TieredStopAtLevel=1")
|
||||
|
||||
|
||||
def zomboid_vm_args(args):
|
||||
updated = [arg for arg in args if not re.fullmatch(r"-XX:\+Use\w*GC", arg) or arg == "-XX:+UseG1GC"]
|
||||
for flag in PZ_JVM_FLAGS:
|
||||
if flag not in updated:
|
||||
updated.append(flag)
|
||||
return updated
|
||||
|
||||
|
||||
def zomboid_rewrite(node):
|
||||
changed = False
|
||||
if isinstance(node, dict):
|
||||
for key, value in node.items():
|
||||
if key == "vmArgs" and isinstance(value, list) and all(isinstance(arg, str) for arg in value):
|
||||
updated = zomboid_vm_args(value)
|
||||
if updated != value:
|
||||
node[key] = updated
|
||||
changed = True
|
||||
elif isinstance(value, dict):
|
||||
changed |= zomboid_rewrite(value)
|
||||
return changed
|
||||
|
||||
|
||||
def project_zomboid_jvm(command):
|
||||
if len(command) <= 2:
|
||||
return
|
||||
exe = Path(command[2])
|
||||
if not exe.stem.lower().startswith("projectzomboid"):
|
||||
return
|
||||
settings = exe.with_suffix(".json")
|
||||
try:
|
||||
with settings.open(encoding="utf-8-sig") as source:
|
||||
data = json.load(source)
|
||||
if not zomboid_rewrite(data):
|
||||
return
|
||||
handle, staged = tempfile.mkstemp(prefix=".droiddeck-", dir=settings.parent)
|
||||
try:
|
||||
with os.fdopen(handle, "w", encoding="utf-8") as target:
|
||||
json.dump(data, target, indent=4)
|
||||
target.write("\n")
|
||||
os.chmod(staged, settings.stat().st_mode & 0o7777)
|
||||
os.replace(staged, settings)
|
||||
except BaseException:
|
||||
os.unlink(staged)
|
||||
raise
|
||||
print("droiddeck-game-env: Project Zomboid: G1 garbage collector and C1 JIT only (ZGC overheats and stalls here)",
|
||||
file=sys.stderr)
|
||||
except (OSError, ValueError, AttributeError) as error:
|
||||
print("droiddeck-game-env: Project Zomboid JVM settings left as is (%s)" % error, file=sys.stderr)
|
||||
|
||||
|
||||
def offline_without_anticheat(command, env):
|
||||
if (env.get("DROIDDECK_ANTICHEAT_OFFLINE") != "1" or len(command) <= 2
|
||||
or command[1] != "waitforexitandrun"
|
||||
@@ -939,6 +992,7 @@ def main():
|
||||
if waiting:
|
||||
command = skip_red_launcher(command)
|
||||
ubisoft_overlay_off(env)
|
||||
project_zomboid_jvm(command)
|
||||
fixes, extra, notes = engine_fixes(command[2], command[3:]) if len(command) > 2 else ({}, [], [])
|
||||
if not gl_default:
|
||||
fixes.pop("vblank_mode", None)
|
||||
|
||||
Reference in new issue
Block a user