Skip to main content

CommandContext

Struct CommandContext 

Source
pub struct CommandContext {
Show 39 fields pub project_dir: PathBuf, pub images: ImageManager, pub layers: LayerManager, pub solid_white: ImageId, pub audio: AudioHub, pub bgm: BgmEngine, pub koe: KoeEngine, pub pcm: PcmEngine, pub se: SeEngine, pub movie: MovieManager, pub ids: RuntimeConstants, pub gfx: GfxRuntime, pub ui: UiRuntime, pub font_cache: FontCache, pub input: InputState, pub script_input: InputState, pub screen_w: u32, pub screen_h: u32, pub wait: VmWait, pub net: TnmNet, pub tables: AssetTables, pub stack: Vec<Value>, pub unknown: UnknownOpRecorder, pub globals: GlobalState, pub tonecurve: ToneCurveRuntime, pub excall_state: ExcallCompatState, pub last_presented_render_list: Vec<RenderSprite>, pub wipe_front_rt_image: Option<ImageId>, pub wipe_next_rt_image: Option<ImageId>, pub overlay_rt_image: Option<ImageId>, pub external_forms: Option<Arc<dyn ExternalFormHandler>>, pub native_ui_backend: Option<Arc<dyn NativeUiBackend>>, pub native_ui: NativeUiRuntime, pub current_scene_no: Option<i64>, pub current_scene_name: Option<String>, pub current_line_no: i64, pub vm_call: Option<VmCallMeta>, pub local_save_snapshot: Option<LocalSaveSnapshot>, pub pending_auto_savepoint: bool, /* private fields */
}

Fields§

§project_dir: PathBuf§images: ImageManager§layers: LayerManager§solid_white: ImageId

1x1 white sprite used for screen-space overlays (filters, etc.).

§audio: AudioHub§bgm: BgmEngine§koe: KoeEngine§pcm: PcmEngine§se: SeEngine§movie: MovieManager§ids: RuntimeConstants

Runtime numeric constants (form/element/op codes).

§gfx: GfxRuntime

Graphics runtime state for stage/object sprite binding.

§ui: UiRuntime

UI runtime (text window, message waits, etc.).

§font_cache: FontCache

Shared font cache for stage/object text rendering.

§input: InputState

Runtime-visible input state (button manager, waits, runtime systems).

§script_input: InputState

Script-visible input state (Gp_script_input in the original engine).

§screen_w: u32

Current render target size (used for UI layout).

§screen_h: u32§wait: VmWait

VM blocking state (WAIT / WAIT_KEY).

§net: TnmNet

Lightweight network/browser helper mirroring the engine’s tnm_net slot.

§tables: AssetTables

Gameexe-driven asset tables (CGTABLE / DATABASE / THUMBTABLE).

§stack: Vec<Value>

Value stack used by form handlers to return results.

§unknown: UnknownOpRecorder§globals: GlobalState§tonecurve: ToneCurveRuntime§excall_state: ExcallCompatState§last_presented_render_list: Vec<RenderSprite>

Last fully presented scene list before wipe composition.

§wipe_front_rt_image: Option<ImageId>

Offscreen target image for the front/old stage during dual-source wipes.

§wipe_next_rt_image: Option<ImageId>

Offscreen target image for the next/new stage during dual-source wipes.

§overlay_rt_image: Option<ImageId>

Legacy runtime slot for overlay intermediate images. GPU overlay composition now bypasses it.

§external_forms: Option<Arc<dyn ExternalFormHandler>>

Optional project-provided form handler (game-specific).

§native_ui_backend: Option<Arc<dyn NativeUiBackend>>

Optional platform-native UI backend used by mobile ports.

§native_ui: NativeUiRuntime§current_scene_no: Option<i64>

Current scene number tracked by the VM.

§current_scene_name: Option<String>

Current scene name tracked by the VM.

§current_line_no: i64

Current source line tracked by the VM (CD_NL).

§vm_call: Option<VmCallMeta>

Current VM-originated form call metadata. Form handlers read this instead of relying on trailing wrapper arguments.

§local_save_snapshot: Option<LocalSaveSnapshot>

Engine-equivalent of Gp_eng->m_local_save. Built at GLOBAL_SAVEPOINT and refreshed by tnm_load_local_on_file-equivalent load. Save-to-file dispatch reads from here so the saved stream reflects the savepoint, not the live menu/UI state when the user picks a slot.

§pending_auto_savepoint: bool

Set when the engine wants the next safe boundary (post-command, pre-next-step) to (re)build local_save_snapshot. Mirrors C++ tnm_msg_proc_start_msg_block calling tnm_init_local_save + tnm_set_save_point at message-block start. Form handlers can’t build the snapshot themselves (they don’t see SceneVm), so they request via this flag and the VM drains it at a safe point.

Implementations§

Source§

impl CommandContext

Source

pub fn sync_script_input_from_runtime(&mut self)

Source

pub fn proc_generation(&self) -> u64

Source

pub fn request_read_flag_no(&mut self)

Source

pub fn request_read_flag_no_for_selbtn(&mut self)

Source

pub fn take_read_flag_no_request(&mut self) -> bool

Source

pub fn submit_read_flag_no(&mut self, value: i32)

Source

pub fn request_runtime_save(&mut self, kind: RuntimeSaveKind, index: usize)

Source

pub fn request_auto_savepoint(&mut self)

Form-handler entrypoint matching C++ tnm_msg_proc_start_msg_block’s tnm_init_local_save + (gated) tnm_set_save_point calls. Honors the dont_set_save_point script flag (suspends auto SAVEPOINT for special blocks). The VM drains the request at the next safe boundary and runs build_local_save_snapshot.

Source

pub fn take_pending_auto_savepoint(&mut self) -> bool

Source

pub fn request_runtime_load(&mut self, kind: RuntimeSaveKind, index: usize)

Source

pub fn take_runtime_save_request(&mut self) -> Option<RuntimeSaveRequest>

Source

pub fn take_runtime_load_request(&mut self) -> Option<RuntimeLoadRequest>

Source

pub fn begin_runtime_load_apply(&mut self)

Source

pub fn mark_runtime_load_completed(&mut self)

Source

pub fn take_runtime_load_completed(&mut self) -> bool

Source

pub fn needs_continuous_frame(&self) -> bool

Source

pub fn last_proc_kind(&self) -> ProcKind

Source

pub fn request_proc_boundary(&mut self, kind: ProcKind)

Source

pub fn request_disp_proc_boundary(&mut self)

Source

pub fn request_message_block_proc_boundary(&mut self)

Source

pub fn request_message_wait_proc_boundary(&mut self)

Source

pub fn request_wait_proc_boundary(&mut self, kind: ProcKind)

Source

pub fn notify_wait_key(&mut self) -> bool

Source

pub fn notify_movie_wait_down_up(&mut self, result: i64) -> bool

Source

pub fn new(project_dir: PathBuf) -> Self

Source

pub fn has_active_custom_mouse_cursor(&mut self) -> bool

Source

pub fn lookup_scene_no(&self, scene_name: &str) -> Result<i64>

Source

pub fn reset_for_scene_restart(&mut self)

Source

pub fn set_external_form_handler( &mut self, h: Option<Arc<dyn ExternalFormHandler>>, )

Install or clear an external form handler.

Source

pub fn platform_shortcuts_blocked(&self) -> bool

Source

pub fn on_key_down(&mut self, k: VmKey)

Source

pub fn on_key_up(&mut self, k: VmKey)

Source

pub fn on_text_input(&mut self, text: &str)

Source

pub fn focused_editbox_ime_area(&self) -> Option<(i32, i32, i32, i32)>

Source

pub fn on_mouse_move(&mut self, x: i32, y: i32)

Source

pub fn on_mouse_down(&mut self, b: VmMouseButton)

Source

pub fn on_mouse_up(&mut self, b: VmMouseButton)

Source

pub fn on_mouse_wheel(&mut self, delta_y: i32)

Source

pub fn wait_poll(&mut self) -> bool

Source

pub fn push(&mut self, v: Value)

Source

pub fn pop(&mut self) -> Option<Value>

Source

pub fn set_native_ui_backend( &mut self, backend: Option<Arc<dyn NativeUiBackend>>, )

Source

pub fn game_title(&self) -> String

Return the game title for platform UI and runtime dialogs.

The value is read from Gameexe GAMENAME when available. If Gameexe is missing, undecodable, or the field is empty, this returns the project directory name, then Siglus as the final fallback.

Source

pub fn game_name(&self) -> String

Return the game display name for bundle/mobile UI.

Source

pub fn game_display_info(&self) -> GameDisplayInfo

Return display metadata for platform UI.

If the game directory contains cover.png, cover.jpg, cover.jpeg, thumbnail.png, or icon.png, cover is populated. Otherwise callers should display the game name.

Source

pub fn game_cover(&self) -> Option<GameCover>

Return the optional cover for bundle/mobile UI.

Source

pub fn submit_native_messagebox_result(&mut self, request_id: u64, value: i64)

Source

pub fn request_system_messagebox( &mut self, kind: i32, debug_only: bool, text: String, buttons: Vec<SystemMessageBoxButton>, )

Source

pub fn request_system_messagebox_no_return( &mut self, kind: i32, debug_only: bool, text: String, buttons: Vec<SystemMessageBoxButton>, )

Source

pub fn set_screen_size(&mut self, w: u32, h: u32)

Source

pub fn tick_frame(&mut self)

Source

pub fn render_list_with_effects(&mut self) -> Vec<RenderSprite>

Source

pub fn debug_active_texture_entries( &self, submitted: &[RenderSprite], ) -> Vec<DebugActiveTextureEntry>

Source

pub fn capture_frame_rgba(&mut self) -> RgbaImage

Capture the current frame (UI + scene) into a CPU RGBA buffer.

Source

pub fn capture_frame_rgba_until( &mut self, end_order: i64, end_layer: i64, ) -> RgbaImage

Capture only sprites up to the original engine order/layer cut line.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> WasmNotSend for T
where T: Send,