siglus_scene_vm/runtime/forms/koe_st.rs
1//! Global KOE_ST form.
2//!
3//! The public C++ implementation routes `GLOBAL.KOE_ST` to `tnm_command_proc_koe`,
4//! and that command handler is a stub: it only returns the element itself when the
5//! chain stops at `KOE_ST`, and otherwise treats the operation as unsupported.
6//!
7//! Keep the Rust port aligned to that public source surface. Voice playback flows
8//! through other script/UI paths, not through `GLOBAL.KOE_ST` commands here.
9
10use anyhow::Result;
11
12use crate::runtime::{CommandContext, Value};
13
14fn find_chain<'a>(ctx: &'a CommandContext, _args: &'a [Value]) -> Option<&'a [i32]> {
15 let vm_call = ctx.vm_call.as_ref()?;
16 Some(vm_call.element.as_slice())
17}
18
19pub fn dispatch(ctx: &mut CommandContext, args: &[Value]) -> Result<bool> {
20 let Some(chain) = find_chain(ctx, args) else {
21 return Ok(false);
22 };
23 if chain.is_empty() || chain[0] != ctx.ids.form_global_koe_st as i32 {
24 return Ok(false);
25 }
26
27 // Public C++ source: element reference only. Any actual sub-op is unsupported.
28 if chain.len() == 1 {
29 return Ok(true);
30 }
31
32 Ok(false)
33}