34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
"""Launch the patched game normally, without debugging or memory changes."""
|
|
import argparse
|
|
import ctypes as C
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
from ori_debug import STARTUPINFO, PROCESSINFO, CreateProcess, Close
|
|
|
|
p=argparse.ArgumentParser()
|
|
p.add_argument("--game",required=True,help="game root directory containing oriwotw.exe")
|
|
p.add_argument("--label",default="normal-patched-1")
|
|
a=p.parse_args()
|
|
if not a.label.replace("-","").replace("_","").isalnum():
|
|
raise SystemExit("Label must contain only letters, numbers, hyphens or underscores")
|
|
root=Path(a.game).resolve()
|
|
dll=root / "oriwotw_Data/Plugins/AkSoundEngine.dll"
|
|
if hashlib.sha256(dll.read_bytes()).hexdigest()!="62b2079a988d23eb251d4e83366ac04068a6f47e0d38efe92a76df022826f9f0":
|
|
raise SystemExit("The verified patch is not installed")
|
|
out=Path("ori-evidence") / a.label
|
|
out.mkdir(parents=True,exist_ok=True)
|
|
si,pi=STARTUPINFO(),PROCESSINFO()
|
|
si.cb=C.sizeof(si)
|
|
si.desktop="winsta0\\default"
|
|
si.flags=1
|
|
si.show=1
|
|
cmd=C.create_unicode_buffer('"'+str(root / "oriwotw.exe")+'" -screen-fullscreen 0 -screen-width 1280 -screen-height 720 -logFile "'+str((out / "game.log").resolve())+'"')
|
|
if not CreateProcess(str(root / "oriwotw.exe"),cmd,None,None,False,0,None,str(root),C.byref(si),C.byref(pi)):
|
|
raise C.WinError(C.get_last_error())
|
|
result={"pid":pi.pid,"game":str(root),"log":str((out / "game.log").resolve()),"debugger":False,"auto_close":False}
|
|
(out / "launch.json").write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding="utf-8")
|
|
print(json.dumps(result,ensure_ascii=False))
|
|
Close(pi.thread)
|
|
Close(pi.process)
|