CI / test (push) Successful in 2m25s
- New desktop module gamerig-library (components/gamerig-library, logic in lib/gamelib): the layout of gamerig's web library (desktop/ui) in draw ops. Top bar with the Gamerig mark, app count and search; sidebar with categories and counts, running apps (switch to, stop) and rig status (GPU, display, audio); card grid with featured games two columns wide, icon tiles, category and status badges, description, install hint, Launch / Big Picture / Switch to / Stop. Typing filters, arrows + Enter launch, the wheel scrolls. Colours: follow desktop, dark, light. - New game-library capability: tables 26-28 (status, games, launch modes), request 45, in the wasmer/wasmtime stub, the MoonBit wasmhost and the Rust host-wasm. - compositor/shell/gamelib.mbt polls GET $GAMERIG_DESKTOP_API/api/state (default http://127.0.0.1:8091) every 2 s with curl on a socket and POSTs launch/stop/focus; a file:// base reads a state file (tests). - --desktop NAME picks what fills the desktop at start. scripts/gamerig-kiosk.sh now runs a hybrid kiosk with the library as the desktop (CHANDRA_KIOSK_MODE=strict for the old one). - Tests: lib/gamelib, compositor/host/gamelib_test.mbt, a host-wasm test; docs/gamerig-library.md with a screenshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
115 lines
3.7 KiB
MoonBit
115 lines
3.7 KiB
MoonBit
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
|
|
|
///|
|
|
#doc(hidden)
|
|
pub fn wasmExportConfigItems() -> Int {
|
|
|
|
let (result) : (Array[ConfigItem]) = config_items();
|
|
let return_area = mbt_ffi_malloc(8)
|
|
|
|
let address3 = mbt_ffi_malloc((result).length() * 32);
|
|
for index4 = 0; index4 < (result).length(); index4 = index4 + 1 {
|
|
let iter_elem : ConfigItem = (result)[(index4)]
|
|
let iter_base = address3 + (index4 * 32);
|
|
|
|
let ptr = mbt_ffi_str2ptr((iter_elem).key)
|
|
mbt_ffi_store32((iter_base) + 4, (iter_elem).key.length())
|
|
mbt_ffi_store32((iter_base) + 0, ptr)
|
|
|
|
let ptr0 = mbt_ffi_str2ptr((iter_elem).label)
|
|
mbt_ffi_store32((iter_base) + 12, (iter_elem).label.length())
|
|
mbt_ffi_store32((iter_base) + 8, ptr0)
|
|
|
|
let address = mbt_ffi_malloc(((iter_elem).choices).length() * 8);
|
|
for index = 0; index < ((iter_elem).choices).length(); index = index + 1 {
|
|
let iter_elem : String = ((iter_elem).choices)[(index)]
|
|
let iter_base = address + (index * 8);
|
|
|
|
let ptr1 = mbt_ffi_str2ptr(iter_elem)
|
|
mbt_ffi_store32((iter_base) + 4, iter_elem.length())
|
|
mbt_ffi_store32((iter_base) + 0, ptr1)
|
|
|
|
}
|
|
mbt_ffi_store32((iter_base) + 20, ((iter_elem).choices).length())
|
|
mbt_ffi_store32((iter_base) + 16, address)
|
|
|
|
let ptr2 = mbt_ffi_str2ptr((iter_elem).value)
|
|
mbt_ffi_store32((iter_base) + 28, (iter_elem).value.length())
|
|
mbt_ffi_store32((iter_base) + 24, ptr2)
|
|
|
|
}
|
|
mbt_ffi_store32((return_area) + 4, (result).length())
|
|
mbt_ffi_store32((return_area) + 0, address3)
|
|
let ret = return_area
|
|
return ret
|
|
|
|
}
|
|
|
|
///|
|
|
#doc(hidden)
|
|
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|
|
|
for index0 = 0; index0 < (mbt_ffi_load32((p0) + 4)); index0 = index0 + 1 {
|
|
let iter_base = (mbt_ffi_load32((p0) + 0)) + (index0 * 32)
|
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 0))
|
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 8))
|
|
|
|
for index = 0; index < (mbt_ffi_load32((iter_base) + 20)); index = index + 1 {
|
|
let iter_base = (mbt_ffi_load32((iter_base) + 16)) + (index * 8)
|
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 0))
|
|
|
|
}
|
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 16))
|
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 24))
|
|
|
|
}
|
|
mbt_ffi_free(mbt_ffi_load32((p0) + 0))
|
|
|
|
}
|
|
|
|
///|
|
|
#doc(hidden)
|
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
|
|
let result = mbt_ffi_ptr2str(p0, p1)
|
|
|
|
let result0 = mbt_ffi_ptr2str(p2, p3)
|
|
|
|
let (result1) : (Bool) = set_config(result, result0);
|
|
let ret = (if result1 { 1 } else { 0 })
|
|
return ret
|
|
|
|
}
|
|
|
|
///|
|
|
#owned(str)
|
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
#|(func (param i32) (result i32) local.get 0)
|
|
|
|
///|
|
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
|
|
///|
|
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|
#|(func (param i32) (param i32) (result i32)
|
|
#| local.get 0
|
|
#| local.get 1 call $moonbit.init_array16
|
|
#| local.get 0)
|
|
|
|
///|
|
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|
#|(func (param i32) (result i32) (local i32)
|
|
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
|
#| local.get 1)
|
|
|
|
///|
|
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
|
|
|
///|
|
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
|
|