Skip to content

feat: add Lua scripting integration and web dashboard#15

Merged
KaiserGranatapfel merged 1 commit intomainfrom
feature/lua-integration
Feb 9, 2026
Merged

feat: add Lua scripting integration and web dashboard#15
KaiserGranatapfel merged 1 commit intomainfrom
feature/lua-integration

Conversation

@KaiserGranatapfel
Copy link
Owner

@KaiserGranatapfel KaiserGranatapfel commented Feb 9, 2026

We're getting closer.


Note

Medium Risk
Adds a new embedded scripting layer and an HTTP upload/recompile service, increasing attack surface and adding concurrency/IO paths; core changes are mostly additive but touch the recompilation pipeline orchestration and optimization logic.

Overview
Adds first-class Lua scripting integration via new gcrecomp-lua crate (mlua) with bindings to config IO, pipeline stage orchestration, CPU/memory access, verification utilities (CRC/SHA, smoke test), basic output optimization helpers, and a registry for Lua-defined UI screens; the game binary now initializes LuaEngine and loads lua/game/init.lua.

Introduces a new local web dashboard (gcrecomp-web) using Axum/Tokio that serves web/static and exposes /api endpoints to upload/validate DOLs, run recompilation stages asynchronously with status/stats reporting, and get/update UI config.

Refactors gcrecomp-core to support scripting/orchestration: adds PipelineContext + PipelineStats and discrete stage_* methods, and enhances the optimizer with improved register-based DCE plus a reachable_functions helper for call-graph reachability; gcrecomp-ui gains a LuaScreen placeholder and optional Lua event handler hook. Workspace config is updated with new crates/dependencies and panic = "abort" in release.

Written by Cursor Bugbot for commit df9a0e7. This will update automatically on new commits. Configure here.

Add two new workspace crates (gcrecomp-lua, gcrecomp-web) providing a
Lua 5.4 scripting layer for pipeline orchestration, configuration,
in-game UI, verification, and optimization — plus a localhost web
dashboard for recompilation management.

- gcrecomp-lua: LuaEngine with mlua bindings for GameConfig, pipeline
  stages, CpuContext, MemoryManager, UI screen registration, CRC32/SHA256
  verification, and dead code elimination / size optimization
- gcrecomp-web: Axum-based REST server with DOL upload, recompilation
  control, status polling, config management, and static HTML frontend
- Refactor RecompilationPipeline into discrete stage methods via
  PipelineContext (backward compatible)
- Enhance Optimizer with li/addi/lis constant propagation and
  function-level DCE via call graph reachability
- Add LuaScreen variant to iced UI for Lua-defined menu screens
- Add optional Lua event handler delegate to GameIntegration
- Initialize LuaEngine in game entry point

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@KaiserGranatapfel KaiserGranatapfel merged commit 9431a53 into main Feb 9, 2026
0 of 6 checks passed
@KaiserGranatapfel KaiserGranatapfel deleted the feature/lua-integration branch February 9, 2026 19:14
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

rust_code.push_str(&format!(
"pub fn {}_0x{:08X}(_ctx: &mut CpuContext, _memory: &mut MemoryManager) -> Result<Option<u32>> {{\n",
codegen.sanitize_identifier(&func.name), func.address
));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stub function names don't match dispatcher references

High Severity

Stub function definitions use the format {name}_0x{:08X} (with 0x prefix), but the dispatcher at the bottom of the generated code uses {name}_{:08X} (without 0x prefix) for non-sub_ names, and func_0x{:08X} (completely different base name) for sub_/empty names. This naming mismatch means the dispatcher references functions that don't exist, causing the generated Rust code to fail compilation whenever any function falls back to a stub. The dispatcher naming matches generate_function_signature for successful functions, but diverges from the stub naming convention.

Additional Locations (1)

Fix in Cursor Fix in Web

let output = std::process::Command::new(&binary_path)
.arg("--smoke-test")
.output();

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke test ignores timeout parameter, may hang

Medium Severity

The smoke_test binding accepts a timeout_ms parameter (prefixed with _ to suppress warnings) but never applies it. The process is spawned via Command::new(...).output(), which blocks indefinitely. Callers like lua/verify/default.lua pass 10000 expecting a 10-second timeout, but the test will hang forever if the binary doesn't exit on its own.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant