Files
windows95/tools/probe-boot.sh
Felix Rieseberg 45f5a136b2 Add SMB1 server and host folder share
Windows 95 can now mount a host folder as a network drive at \\HOST\HOST.
Read-only, ~1500 lines, zero deps. Defaults to ~/Downloads, configurable in
Settings.

Protocol: NEGOTIATE (LANMAN2.1), SESSION_SETUP, TREE_CONNECT, TRANSACTION/RAP
(NetShareEnum, NetServerGetInfo, NetWkstaGetInfo), TRANSACTION2/FIND_FIRST2,
SEARCH (8.3 with ~N suffix mapping), OPEN_ANDX, NT_CREATE_ANDX, READ_ANDX,
CLOSE, QUERY_INFORMATION, CHECK_DIRECTORY. NetBIOS Name Service on UDP 137
answers Node Status and Name Query so \\HOST resolves.

v86 hook: monkeypatches adapter.on_tcp_connection (old API), shadows
adapter.receive during a port-80 probe to steal a TCPConnection without
side effects, re-aims it at port 139. Data via .on_data (Closure
dead-code-eliminated .on/.emit). Also registers tcp-connection bus event
for newer v86 builds.

Security: read-only, path traversal blocked lexically and through symlinks
(realpath the deepest existing ancestor, re-append tail, confirm under root).
Share path validated in main-process IPC.

BIOS updated to SeaBIOS 1.16.2 (compatible with old v86). v86 itself stays
on the Feb 2025 prod build — newer builds hang at the splash screen on fresh
boot (bisect tooling included in tools/).

Also: tools/update-v86.js builds wasm+libv86+BIOS from a local v86 checkout
and refuses to install JS/wasm pairs more than 14 days apart (copy.sh ships
mismatched pairs). tools/parcel-build.js dynamic-import patch made tolerant
of post-d4c5fa86 builds.
2026-04-11 01:03:34 -07:00

77 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Single boot probe: build → launch → wait for verdict → kill → report.
# Usage: tools/probe-boot.sh [json-options]
# tools/probe-boot.sh '{"acpi":false}'
# tools/probe-boot.sh '{"disable_jit":true}'
set -e
cd "$(dirname "$0")/.."
OPTS="${1:-{}}"
STATUS=/tmp/win95-probe.json
DONE=/tmp/win95-probe.done
SCREEN=/tmp/win95-screen.png
TIMEOUT=200
echo "═══ probe: opts=$OPTS ═══"
# clean slate
rm -f "$STATUS" "$DONE" "$SCREEN"
pkill -f "windows95/node_modules/electron" 2>/dev/null || true
sleep 1
# build (parcel only — forge's generateAssets does this too but we want
# direct control without the forge startup overhead)
rm -rf dist .cache
node tools/parcel-build.js > /tmp/win95-build.log 2>&1
if [ $? -ne 0 ]; then
echo "BUILD FAILED"
tail -20 /tmp/win95-build.log
exit 1
fi
# launch electron directly (skip forge to avoid double-build)
WIN95_PROBE=1 WIN95_PROBE_OPTS="$OPTS" \
./node_modules/.bin/electron . > /tmp/win95-electron.log 2>&1 &
PID=$!
echo "electron pid=$PID, waiting for verdict (timeout ${TIMEOUT}s)..."
# poll
for i in $(seq 1 $TIMEOUT); do
if [ -f "$DONE" ]; then
VERDICT=$(cat "$DONE")
echo "verdict at ${i}s: $VERDICT"
break
fi
if ! kill -0 $PID 2>/dev/null; then
echo "electron died at ${i}s"
tail -30 /tmp/win95-electron.log
VERDICT="CRASHED"
break
fi
sleep 1
done
if [ -z "$VERDICT" ]; then
echo "TIMEOUT at ${TIMEOUT}s"
VERDICT="TIMEOUT"
fi
# capture final state
echo "─── final status ───"
[ -f "$STATUS" ] && python3 -c "
import json
s=json.load(open('$STATUS'))
print(f\"phase={s['phase']} cpu={s['cpuRunning']} instr_delta={s['instructionDelta']:,}\")
print(f\"uptime={s['uptimeSec']}s\")
t=s['textScreen'].strip()
if t: print('text:'); print(' ' + t.replace(chr(10), chr(10)+' ')[:500])
" || echo "(no status file)"
# kill
kill $PID 2>/dev/null || true
wait $PID 2>/dev/null || true
echo "═══ $VERDICT ═══"
[ "$VERDICT" = "SUCCESS" ] && exit 0 || exit 1