feat(launcher): Process.*, Http.save_to/received/expected, App.window_hide/show

Process.spawn/poll/kill/free - non-blocking child processes with no shell: posix_spawn on
macOS (process.ll), CreateProcessW with MSVC-quoted arguments and no console window on
Windows (process_win.ll), linked only when a program uses Process.*.

Http.save_to streams a response body into a file (NSURLSession with a run-time delegate
class on macOS, the WinHTTP read loop on Windows); Http.received / Http.expected report
progress while it is pending. Freeing a pending request cancels it and parks the slot
until the worker has finished.

App.window_hide / App.window_show take the game's window off the screen and back without
closing it; the run goes on while hidden. Docs, examples, tests and a changeset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-17 13:32:23 +03:00
parent c1db0d71ed
commit 43d5eb5b88
31 changed files with 89274 additions and 86727 deletions

View file

@ -49,6 +49,7 @@ declare ptr @CreateWindowExA(i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, p
declare i64 @DefWindowProcA(ptr, i32, i64, i64)
declare i32 @ShowWindow(ptr, i32)
declare i32 @SetForegroundWindow(ptr)
declare i32 @BringWindowToTop(ptr)
declare i32 @PeekMessageA(ptr, ptr, i32, i32, i32)
declare i64 @DispatchMessageA(ptr)
declare ptr @GetDC(ptr)
@ -267,6 +268,39 @@ out:
ret void
}
; ---- App.window_hide / App.window_show ------------------------------------------------
; The game's window leaves the screen and comes back with its GL context or Vulkan surface
; untouched: a launcher steps aside while the game it started runs. A hidden window is
; still a window, so the run goes on. Both are no-ops before there is a window.
define void @app_window_hide() {
entry:
%h = load ptr, ptr @W_hwnd
%none = icmp eq ptr %h, null
br i1 %none, label %out, label %go
go:
%r = call i32 @ShowWindow(ptr %h, i32 0) ; SW_HIDE
; keys held as it went never send their key-up here
call void @llvm.memset.p0.i64(ptr @W_held, i8 0, i64 32, i1 false)
store i32 0, ptr @W_mbtn
br label %out
out:
ret void
}
define void @app_window_show() {
entry:
%h = load ptr, ptr @W_hwnd
%none = icmp eq ptr %h, null
br i1 %none, label %out, label %go
go:
%r = call i32 @ShowWindow(ptr %h, i32 5) ; SW_SHOW
%t = call i32 @BringWindowToTop(ptr %h)
%f = call i32 @SetForegroundWindow(ptr %h)
br label %out
out:
ret void
}
; ---- the native window, for a graphics API that makes its own surface ------------------
; A Vulkan swapchain is created on the window itself (VkWin32SurfaceCreateInfoKHR takes the
; module instance and the HWND), not through a context this file attaches. Null before