From f45b3a38cb65e743860efb4c9767703a0e175dd1 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Mon, 15 Jun 2026 06:01:49 +0100 Subject: [PATCH] implements PLN-0107 --- crates/console/prometeu-vm/src/builtins.rs | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/crates/console/prometeu-vm/src/builtins.rs b/crates/console/prometeu-vm/src/builtins.rs index 80c056da..5bafab6f 100644 --- a/crates/console/prometeu-vm/src/builtins.rs +++ b/crates/console/prometeu-vm/src/builtins.rs @@ -1350,8 +1350,9 @@ fn input_touch_x( ctx: &mut HostContext<'_>, ) -> Result, IntrinsicExecutionError> { expect_touch_handle(args, "x")?; - let hw = ctx.require_hw().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; - Ok(vec![Value::Int64(hw.touch().x() as i64)]) + let platform = + ctx.require_platform().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; + Ok(vec![Value::Int64(platform.input().touch().x() as i64)]) } fn input_touch_y( @@ -1359,8 +1360,9 @@ fn input_touch_y( ctx: &mut HostContext<'_>, ) -> Result, IntrinsicExecutionError> { expect_touch_handle(args, "y")?; - let hw = ctx.require_hw().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; - Ok(vec![Value::Int64(hw.touch().y() as i64)]) + let platform = + ctx.require_platform().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; + Ok(vec![Value::Int64(platform.input().touch().y() as i64)]) } fn input_button_pressed( @@ -1435,9 +1437,11 @@ fn resolve_button( ctx: &mut HostContext<'_>, ) -> Result { let carrier = expect_builtin_carrier(args, 0)?; - let hw = ctx.require_hw().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; + let platform = + ctx.require_platform().map_err(|_| IntrinsicExecutionError::HardwareUnavailable)?; + let input = platform.input(); if carrier == TOUCH_BUTTON_CARRIER { - return Ok(*hw.touch().f()); + return Ok(*input.touch().f()); } let Some(index) = carrier.checked_sub(PAD_BUTTON_BASE) else { @@ -1448,18 +1452,18 @@ fn resolve_button( }); }; let button = match index { - 0 => *hw.pad().up(), - 1 => *hw.pad().down(), - 2 => *hw.pad().left(), - 3 => *hw.pad().right(), - 4 => *hw.pad().a(), - 5 => *hw.pad().b(), - 6 => *hw.pad().x(), - 7 => *hw.pad().y(), - 8 => *hw.pad().l(), - 9 => *hw.pad().r(), - 10 => *hw.pad().start(), - 11 => *hw.pad().select(), + 0 => *input.pad().up(), + 1 => *input.pad().down(), + 2 => *input.pad().left(), + 3 => *input.pad().right(), + 4 => *input.pad().a(), + 5 => *input.pad().b(), + 6 => *input.pad().x(), + 7 => *input.pad().y(), + 8 => *input.pad().l(), + 9 => *input.pad().r(), + 10 => *input.pad().start(), + 11 => *input.pad().select(), _ => { return Err(IntrinsicExecutionError::InvalidBuiltinCarrier { owner: "input.button",