Skip to content

Fix VM startup and camera capture from the v20 laptop pass - #130

Merged
btsouth merged 2 commits into
masterfrom
fix/vm-start-and-camera-capture
Sep 17, 2026
Merged

btsouth merged 2 commits into
masterfrom
fix/vm-start-and-camera-capture

Conversation

@btsouth

@btsouth btsouth commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

The v0.0.20-preview laptop pass found defects that stop the app working on a clean machine, plus a diagnostic gap. This fixes them.

  • QEMU never started. The camera chardev was passed reconnect=1. QEMU deprecated reconnect in 9.2 and dropped it, so both the bundled WINQ-EMU runtime and the stock QEMU 11 fallback reject it with Invalid parameter 'reconnect' and QEMU exits before the guest boots. It now passes reconnect-ms=1000.
  • The camera bridge crashed the launcher. MFEnumDeviceSources was bound to mfplat.dll, and LazyProc.Call panics when an export is missing. On the tested Windows build that export lives in mf.dll, so the first real camera attempt took the whole app down. Capture now resolves its Media Foundation entry points across mfplat.dll, mf.dll and mfcore.dll, and reports a missing export as an error instead of panicking.
  • The frame size and frame rate were set through MFSetAttributeSize and MFSetAttributeRatio, which are inline helpers in mfapi.h rather than DLL exports. Windows CI caught it: they resolve to nothing, so the first camera attempt would have panicked even with the right DLL. They now pack the pair and call IMFAttributes::SetUINT64 directly.
  • Direct drops now log the VM window they are enabled on and each delivery attempt, so the next pass can tell whether WM_DROPFILES reaches the launcher at all.

Why the rest of the handoff list is not here

Several items in the report look like they come from the local QEMU shim used on the laptop, not from the source. That shim wraps the real binary as *.real.exe, so the SDL window belongs to a different process than the launcher's qemuPid. That breaks the title enforcer's pid match, which would in turn explain the un-renamed window title, the stock QEMU icon, the splash never auto-hiding (the enforcer is what closes it), and drops never being enabled on the window. Those need a re-test without the shim before changing code.

The LAN firewall profile and the settings behavior are as designed: public networks need the Settings toggle, and the settings dialog persists on Save, so closing it with X discards changes. Glad to take any of those on separately.

Test plan

  • go test ./... (Linux)
  • go vet ./... and GOOS=windows go vet -unsafeptr=false ./...
  • GOOS=windows go build of the launcher
  • New TestBuildQemuArgsUsesReconnectMSForTheCameraChardev covers the chardev option
  • Windows CI (go test ./...) resolves the Media Foundation exports on windows-latest
  • Laptop re-test without the shim

The camera chardev passed reconnect=1, which current QEMU rejects, so every
launch died at startup before the guest booted. Use reconnect-ms.

The Media Foundation capture resolved MFEnumDeviceSources from mfplat.dll
alone and let LazyProc.Call panic when it was missing; on current Windows the
export lives in mf.dll. Resolve the entry points across mfplat.dll, mf.dll and
mfcore.dll and return an error instead of crashing.

Also log the direct-drop path on the VM window so a future pass can tell
whether drops reach the launcher.
CI on Windows caught that MFSetAttributeSize and MFSetAttributeRatio are inline
helpers in mfapi.h, not mfplat.dll exports, so there is nothing to resolve for
them. Pack the pair and set the UINT64 attribute directly through
IMFAttributes::SetUINT64.
@btsouth
btsouth merged commit e4fb7ea into master Sep 17, 2026
4 checks passed
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