pub struct CommandContext {Show 38 fields
pub int_vec_pool: IntVecPool,
pub project_dir: PathBuf,
pub emote_key: Option<u32>,
pub images: ImageManager,
pub layers: LayerManager,
pub solid_white: ImageHandle,
pub bgm: BgmEngine,
pub audio: AudioHub,
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 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 pending_scene_restart: Option<(String, i32)>,
pub local_save_snapshot: Option<LocalSaveSnapshot>,
pub pending_auto_savepoint: bool,
/* private fields */
}Fields§
§int_vec_pool: IntVecPoolReused element/chain buffers (see IntVecPool).
project_dir: PathBuf§emote_key: Option<u32>Project-wide variable DWORD used by encrypted Emote PSB files. Native
hosts preload/recover this before scene execution; direct VM users still
pick up an explicitly configured key.toml value here.
images: ImageManager§layers: LayerManager§solid_white: ImageHandle1x1 white sprite used for screen-space overlays (filters, etc.).
bgm: BgmEngine§audio: AudioHub§koe: KoeEngine§pcm: PcmEngine§se: SeEngine§movie: MovieManager§ids: RuntimeConstantsRuntime numeric constants (form/element/op codes).
gfx: GfxRuntimeGraphics runtime state for stage/object sprite binding.
ui: UiRuntimeUI runtime (text window, message waits, etc.).
font_cache: FontCacheShared font cache for stage/object text rendering.
input: InputStateRuntime-visible input state (button manager, waits, runtime systems).
script_input: InputStateScript-visible input state (Gp_script_input in the original engine).
screen_w: u32Current render target size (used for UI layout).
screen_h: u32§wait: VmWaitVM blocking state (WAIT / WAIT_KEY).
net: TnmNetLightweight network/browser helper mirroring the engine’s tnm_net slot.
tables: AssetTablesGameexe-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§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: i64Current 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.
pending_scene_restart: Option<(String, i32)>Explicit scene and Z label supplied by GLOBAL.RETURNMENU(scene[, z]). Original cmd_global.cpp routes these overloads through tnm_syscom_restart_from_scene(), not the return-to-menu proc.
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: boolSet 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
impl CommandContext
pub fn sync_script_input_from_runtime(&mut self)
pub fn proc_generation(&self) -> u64
pub fn request_read_flag_no(&mut self)
pub fn request_read_flag_no_for_mwnd( &mut self, form_id: u32, stage_idx: i64, mwnd_idx: usize, )
pub fn request_read_flag_no_for_selbtn(&mut self)
pub fn take_read_flag_no_request(&mut self) -> bool
Sourcepub fn discard_read_flag_no_request(&mut self)
pub fn discard_read_flag_no_request(&mut self)
Drop the target retained by take_read_flag_no_request() when the
current scene uses the legacy command ABI with no trailing read-flag
operand. Do not submit -1: old scenes did not perform the newer
read/skip bookkeeping for that command at all.
pub fn submit_read_flag_no(&mut self, value: i32)
pub fn request_runtime_save(&mut self, kind: RuntimeSaveKind, index: usize)
Sourcepub fn request_auto_savepoint(&mut self)
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.
pub fn take_pending_auto_savepoint(&mut self) -> bool
pub fn request_sel_point_with_result(&mut self, result: i64)
pub fn take_pending_sel_point_result(&mut self) -> Option<i32>
pub fn request_runtime_load(&mut self, kind: RuntimeSaveKind, index: usize)
pub fn take_runtime_save_request(&mut self) -> Option<RuntimeSaveRequest>
pub fn take_runtime_load_request(&mut self) -> Option<RuntimeLoadRequest>
pub fn begin_runtime_load_apply(&mut self)
pub fn mark_runtime_load_completed(&mut self)
pub fn take_runtime_load_completed(&mut self) -> bool
pub fn needs_continuous_frame(&self) -> bool
pub fn last_proc_kind(&self) -> ProcKind
pub fn request_proc_boundary(&mut self, kind: ProcKind)
pub fn request_disp_proc_boundary(&mut self)
pub fn request_message_block_proc_boundary(&mut self)
pub fn request_message_wait_proc_boundary(&mut self)
pub fn request_wait_proc_boundary(&mut self, kind: ProcKind)
Sourcepub fn finish_wipe_runtime(&mut self)
pub fn finish_wipe_runtime(&mut self)
End the active wipe with the same teardown performed by
C_tnm_wipe::end() in the original engine.
GlobalState::finish_wipe() only clears the timing marker and is kept
for whole-runtime resets. Live wipe completion must use this method so
the copied NEXT stage and all of its backend sprites are reinitialized.
pub fn notify_wait_key(&mut self) -> bool
pub fn notify_movie_wait_down_up(&mut self, result: i64) -> bool
pub fn new(project_dir: PathBuf) -> Self
Sourcepub fn set_active_append(&mut self, append_dir: String, append_name: String)
pub fn set_active_append(&mut self, append_dir: String, append_name: String)
Update the active append selected by the original Gp_dir state and
keep all resource managers that cache it in sync. SceneVm observes the
same value and reloads Scene.pck only when this directory changes.
Sourcepub fn reset_active_append_to_initial(&mut self)
pub fn reset_active_append_to_initial(&mut self)
Restore the startup append selected by the first Select.ini entry,
matching tnm_scene_proc_restart_from_menu_scene().
pub fn has_active_custom_mouse_cursor(&mut self) -> bool
pub fn lookup_scene_no(&self, scene_name: &str) -> Result<i64>
Sourcepub fn reset_for_scene_restart(&mut self)
pub fn reset_for_scene_restart(&mut self)
Reinitialize scene-local engine state.
This mirrors C_tnm_eng::reinit_local(true): local flag banks and
render/input/sound objects are rebuilt, while global G/Z/M flags, global
names, read flags, loaded configuration, global save state and the active
append survive. The previous implementation replaced the entire
GlobalState, which was equivalent to calling init_global() on every
scene restart and destroyed data that the original engine retains.
Sourcepub fn set_external_form_handler(
&mut self,
h: Option<Arc<dyn ExternalFormHandler>>,
)
pub fn set_external_form_handler( &mut self, h: Option<Arc<dyn ExternalFormHandler>>, )
Install or clear an external form handler.
pub fn platform_shortcuts_blocked(&self) -> bool
pub fn on_key_down(&mut self, k: VmKey)
pub fn on_key_up(&mut self, k: VmKey)
pub fn on_text_input(&mut self, text: &str)
pub fn on_ime_preedit(&mut self, text: &str, cursor: Option<(usize, usize)>)
pub fn on_ime_disabled(&mut self)
pub fn editbox_accepts_keyboard_input(&self) -> bool
pub fn editbox_accepts_direct_text(&self) -> bool
pub fn focused_editbox_ime_area(&self) -> Option<(i32, i32, i32, i32)>
pub fn on_mouse_move(&mut self, x: i32, y: i32)
pub fn on_mouse_down(&mut self, b: VmMouseButton)
pub fn on_mouse_up(&mut self, b: VmMouseButton)
pub fn on_mouse_wheel(&mut self, delta_y: i32)
pub fn begin_input_frame(&mut self)
Sourcepub fn begin_frame_main_proc_pass(&mut self)
pub fn begin_frame_main_proc_pass(&mut self)
Mark the start of one C++-style frame_main_proc script pass.
pub fn wait_poll(&mut self) -> bool
pub fn push(&mut self, v: Value)
pub fn pop(&mut self) -> Option<Value>
pub fn set_native_ui_backend( &mut self, backend: Option<Arc<dyn NativeUiBackend>>, )
Sourcepub fn game_title(&self) -> String
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.
Sourcepub fn game_display_info(&self) -> GameDisplayInfo
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.
Sourcepub fn game_cover(&self) -> Option<GameCover>
pub fn game_cover(&self) -> Option<GameCover>
Return the optional cover for bundle/mobile UI.
pub fn submit_native_messagebox_result(&mut self, request_id: u64, value: i64)
pub fn request_system_messagebox( &mut self, kind: i32, debug_only: bool, text: String, buttons: Vec<SystemMessageBoxButton>, )
pub fn request_system_messagebox_no_return( &mut self, kind: i32, debug_only: bool, text: String, buttons: Vec<SystemMessageBoxButton>, )
Sourcepub fn request_internal_system_messagebox_no_return(
&mut self,
kind: i32,
debug_only: bool,
text: String,
buttons: Vec<SystemMessageBoxButton>,
)
pub fn request_internal_system_messagebox_no_return( &mut self, kind: i32, debug_only: bool, text: String, buttons: Vec<SystemMessageBoxButton>, )
Show an engine-rendered modal without delegating to a platform-native message box. Syscom’s built-in fallback menus use this path because they are multi-step in-game UI and must behave identically on every winit target.
Sourcepub fn request_chihaya_bench_dialog(&mut self, text: String)
pub fn request_chihaya_bench_dialog(&mut self, text: String)
eng_chihaya.cpp::tnm_open_chihaya_bench_dialog(). The original call
does not return to the script until the modal information window closes.
pub fn set_screen_size(&mut self, w: u32, h: u32)
pub fn tick_frame(&mut self)
pub fn set_frame_capture_backend( &mut self, backend: Option<FrameCaptureBackendRef>, )
pub fn render_frame_with_effects(&mut self) -> RenderFrame
Sourcepub fn render_list_with_effects(&mut self) -> Vec<RenderSprite>
pub fn render_list_with_effects(&mut self) -> Vec<RenderSprite>
Compatibility/debug flattening. Actual presentation uses RenderFrame
and never rasterizes a stage on the CPU.
pub fn debug_active_texture_entries( &self, submitted: &[RenderSprite], ) -> Vec<DebugActiveTextureEntry>
Sourcepub fn capture_frame_rgba(&mut self) -> Result<RgbaImage>
pub fn capture_frame_rgba(&mut self) -> Result<RgbaImage>
Capture the current frame through the same wgpu render graph as presentation.
Auto Trait Implementations§
impl !Freeze for CommandContext
impl !RefUnwindSafe for CommandContext
impl !Send for CommandContext
impl !Sync for CommandContext
impl !UnwindSafe for CommandContext
impl Unpin for CommandContext
impl UnsafeUnpin for CommandContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.