Added more diagnostics to the native world fixer and py logs system.

This commit is contained in:
2026-08-28 20:56:26 +02:00
parent b344506071
commit 010fe14ab4
6 changed files with 590 additions and 37 deletions

View File

@@ -49,6 +49,10 @@ from .self_update import (
rollback_launcher_update,
update_check_to_dict,
)
from .world_fix import (
create_world_fix_status_target,
read_world_fix_status,
)
def build_parser() -> argparse.ArgumentParser:
@@ -650,6 +654,12 @@ def _play_locked(
patterns=("log_*.txt",),
)
game_started_ns = time.time_ns()
world_fix_status_target = None
if not dry_run and not publisher_dll:
world_fix_status_target = create_world_fix_status_target(
paths.game_save,
game_started_ns,
)
try:
outcome = run_game(
paths,
@@ -658,6 +668,7 @@ def _play_locked(
runner,
use_gamebox=not no_box,
use_world_fix=not publisher_dll,
world_fix_status_target=world_fix_status_target,
)
except KeyboardInterrupt:
current_game_log = _current_game_log(
@@ -667,12 +678,26 @@ def _play_locked(
)
if current_game_log is not None and not as_json:
_print_interrupted_game_log(current_game_log)
world_fix_status = read_world_fix_status(
world_fix_status_target,
game_started_ns,
)
if world_fix_status is not None and not as_json:
print(
f"World-fix status: {str(world_fix_status['status'])} "
f"({str(world_fix_status['path'])})",
file=sys.stderr,
)
raise
current_game_log = _current_game_log(
native_log_directory,
native_log_baseline,
game_started_ns,
)
world_fix_status = read_world_fix_status(
world_fix_status_target,
game_started_ns,
)
_emit(
{
"ok": outcome.returncode == 0,
@@ -682,6 +707,7 @@ def _play_locked(
"setup_commands": [asdict(result) for result in setup_results],
"game": asdict(outcome),
"current_game_log": current_game_log,
"world_fix": world_fix_status,
},
as_json,
)
@@ -712,7 +738,17 @@ def _current_game_log(
"import_scene_threw": analysis.import_scene_threw,
"failed_import_scenes": analysis.failed_import_scenes,
"stage_without_new_stage": analysis.stage_without_new_stage,
"stage_without_new_stage_events": [
event.to_dict()
for event in analysis.events
if event.kind == "stage_without_new_stage"
],
"scene_imports": {
name: [scene.to_dict() for scene in imports]
for name, imports in sorted(analysis.scenes.items())
},
"failed_file_count": len(analysis.failed_files),
"failed_files": [event.to_dict() for event in analysis.failed_files[:64]],
}