mirror of
https://github.com/PodeCaradox/GalaxyQuest-SteamFrame.git
synced 2026-10-18 02:01:15 +02:00
A native port built on the Petari decompilation (previous commit): an HLE platform layer (OS, DVD, GX, audio, input, NAND) under the game's own code, an OpenXR presentation (a diorama around the player, a giant screen, the HUD and settings as compositor layers, SpaceWarp, dynamic resolution), Touch Plus controls, the tools that convert your own game files (tools/cook, which also takes the few pieces of data the game's executable holds from your sys/main.dol), and the port's changes to the decompilation (`git diff petari-base -- decomp`). README.md explains installing and building, docs/TECHNICAL.md how it works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""The decomp's types.h used `#define nullptr 0` under CodeWarrior, so some code
|
|
uses `nullptr` as an integer/bool zero. For every compiler error that involves
|
|
std::nullptr_t, replace `nullptr` with `0` on the reported line (0 is valid in
|
|
both pointer and integer contexts)."""
|
|
import re
|
|
import sys
|
|
import os
|
|
|
|
log = open(sys.argv[1], encoding='utf-8', errors='replace').read()
|
|
root = sys.argv[2]
|
|
pat = re.compile(r'^(?P<file>[^\s:]+(?::[^\s:]+)?):(?P<line>\d+):\d+: error: [^\n]*nullptr_t', re.M)
|
|
targets = {}
|
|
for m in pat.finditer(log):
|
|
f = m.group('file').replace('\\', '/')
|
|
idx = f.find('/decomp/')
|
|
if idx < 0:
|
|
continue
|
|
rel = f[idx + len('/decomp/'):]
|
|
targets.setdefault(rel, set()).add(int(m.group('line')))
|
|
|
|
changed = 0
|
|
for rel, lines in targets.items():
|
|
p = os.path.join(root, rel)
|
|
with open(p, 'rb') as fh:
|
|
text = fh.read().decode('utf-8', 'surrogateescape')
|
|
rows = text.split('\n')
|
|
for ln in lines:
|
|
i = ln - 1
|
|
if 'nullptr' in rows[i]:
|
|
rows[i] = re.sub(r'\bnullptr\b', '0', rows[i])
|
|
changed += 1
|
|
with open(p, 'wb') as fh:
|
|
fh.write('\n'.join(rows).encode('utf-8', 'surrogateescape'))
|
|
print('patched', changed, 'lines in', len(targets), 'files')
|