mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-09-27 22:45:39 -04:00
bd5e21b366
- RE'd the full file-loader/overlay subsystem in Ghidra via MCP: CdReadRequest -> CdReadStateMachine (hand-rolled CdControl SeekL/ReadN reader, NOT PsyQ CdRead); LIST.CD RAM cache cdFileLocTable + ResourceGetCdLoc/resourceIdMap lookup; LZSS staging buffer 0x80079A70; loadDestPtrTable; ~50 symbols named (T1-T5,T8) - T6b MILESTONE: resident blob @0x800CEDF8 + location overlay @0x80128158 proven byte-identical (sha1-equal contiguous prefixes) vs live PCSX-Redux RAM; blobs imported into Ghidra (ImportOverlay.java); overlay-map table -> memory-map.md §4.3 - PCSX-Redux runtime oracle: Windows-native build, WSL reads RAM via the web API at 172.17.208.1:8081; ledger #4 resolved - live-verified player/time state: gold(/10) HP BP day hour tiredness boss-HP; save-header template (Q#5) + debug-menu dispatch (Q#9: DEBUG.BIN path is dead) - overlay map: 13 area-states across SC01/02/03, 2 duplicate pairs, location x chapter keying, free-roam vs menu-hub granularity - resolves Open Q#1/#3/#4/#5/#6/#8/#9/#12; corrects SLUS-90029 (FF8 demo, not BFM) - 2 US prototypes acquired + CRC-verified (Aug-31 1369DE07, Sep-8 5C24728E) - rules R9 (verify persistence), R10 (>=3-datapoint live verification), R11 (runtime oracle Windows-native, bridged to WSL) - bumps project version 1.2.0 -> 1.3.0
42 lines
1.8 KiB
Bash
42 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
# tools/ghidra_mcp_stop.sh — clean stop WITH save (the way headless MCP work is persisted).
|
|
# Touches the stopreq sentinel; BfmMcpServer stops the MCP server and returns, then
|
|
# analyzeHeadless COMMITS the pending transaction and saves+closes the project (releasing
|
|
# the .rep lock). The next session resumes from the saved state. Use at task/phase boundaries.
|
|
set -uo pipefail
|
|
|
|
PORT="8080"
|
|
RUNDIR="$HOME/bfm-decomp/.run"
|
|
LOG="$RUNDIR/ghidra-mcp.log"
|
|
STOPREQ="${BFM_MCP_STOPREQ:-$RUNDIR/mcp-stop.req}"
|
|
|
|
if ! ss -tln 2>/dev/null | grep -qE ":$PORT([^0-9]|$)"; then
|
|
echo "ghidra-mcp: not serving on :$PORT — nothing to stop"
|
|
exit 0
|
|
fi
|
|
|
|
before=$(wc -l < "$LOG" 2>/dev/null || echo 0)
|
|
echo "ghidra-mcp: requesting clean save+stop (touch $STOPREQ)"
|
|
: > "$STOPREQ"
|
|
|
|
# Wait for the port to free (server stopped)...
|
|
port_closed=0
|
|
for i in $(seq 1 90); do
|
|
if ! ss -tln 2>/dev/null | grep -qE ":$PORT([^0-9]|$)"; then echo "ghidra-mcp: server stopped after ${i}s"; port_closed=1; break; fi
|
|
sleep 1
|
|
done
|
|
[ "$port_closed" -eq 1 ] || { echo "WARN: still serving on :$PORT after 90s — inspect $LOG (do NOT SIGKILL; that loses the save)"; exit 1; }
|
|
|
|
# ...then wait for analyzeHeadless to report the save (commit happens during project close).
|
|
saved=0
|
|
for i in $(seq 1 45); do
|
|
if tail -n +"$((before+1))" "$LOG" 2>/dev/null | grep -qiE 'Save succeeded for processed file'; then
|
|
echo "ghidra-mcp: ✅ Save succeeded (committed on close) after ${i}s"; saved=1; break
|
|
fi
|
|
sleep 1
|
|
done
|
|
[ "$saved" -eq 1 ] || echo "WARN: did not see 'Save succeeded' in $LOG within 45s — verify before relying on the save"
|
|
|
|
echo "=== shutdown log tail ==="
|
|
tail -n +"$((before+1))" "$LOG" 2>/dev/null | grep -iE 'stop requested|server stopped|Save succeeded|FAILED|lock|read-only' | tail -10
|