Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

[Blocker 1/6] Make stall fix deterministic #1

Description

@mgrz18

Symptom

Same env vars, same code: bossMainloop receives 1 DONE per run sometimes, 152 DONEs other times.

  • 2-3 of 5 runs stall at DONEs=1 (animation never advances)
  • 1-2 of 5 runs reach DONEs=152 (game advances ~150 frames)

What we know

  • __scTaskComplete (/tmp/ge_decomp/src/sched.c:406-433) forwards t->msg verbatim to clientQ.
  • Real msg is &localGfxDoneMsg — a stack OSScMsg in bossMainloop, NOT the static g_bossGfxDoneMsg.
  • Bogus OSTask submissions (data_ptr=0x7FC00000) have garbage in their enclosing OSScTask msg field.
  • Our heal at lib/N64ModernRuntime/ultramodern/src/events.cpp:614+ overwrites bogus msg with hardcoded 0x803B38B8.
  • That hardcoded address is NOT &g_bossGfxDoneMsg — was a guess. The OSScMsg there is uninitialised → bossMainloop reads gen.type=0 → switch falls through default → no decrement → stall.

What was tried

  • ❌ Hardcoded fallback 0x803B38B8 — works sometimes, fails others
  • ❌ Stamping gen.type=2 at hardcoded addr — caused regression (memory corruption?)
  • ❌ Unconditional heal on every submit — overwrote healthy submissions, broke flow
  • ❌ Recv-side gen.type ∈ [1..5] filter — too aggressive, dropped valid msgs

Try next

  1. Lazy-learn &localGfxDoneMsg from FIRST healthy submission (no hardcoded fallback). Defer healing until learned.
  2. Once learned, stamp gen.type=2 at the learned address as defensive measure.
  3. Investigate timing race between our heal write and game-side __scTaskComplete.

Files

  • lib/N64ModernRuntime/ultramodern/src/events.cpp:568-700
  • lib/N64ModernRuntime/ultramodern/src/mesgqueue.cpp:206-224
  • /tmp/ge_decomp/src/sched.c:406-433 (reference)

Acceptance criteria

Every run has DONEs ≥ 100 (currently 30-40% rate).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions