implements PR-026

This commit is contained in:
2026-03-24 13:40:56 +00:00
parent 67e7acf73b
commit 0ff4909079
11 changed files with 44 additions and 66 deletions
@@ -23,7 +23,6 @@ impl VirtualMachineRuntime {
current_cartridge_title: String::new(),
current_cartridge_app_version: String::new(),
current_cartridge_app_mode: AppMode::Game,
current_entrypoint: String::new(),
logs_written_this_frame: HashMap::new(),
telemetry_current: TelemetryFrame::default(),
telemetry_last: TelemetryFrame::default(),
@@ -97,7 +96,6 @@ impl VirtualMachineRuntime {
self.current_cartridge_title.clear();
self.current_cartridge_app_version.clear();
self.current_cartridge_app_mode = AppMode::Game;
self.current_entrypoint.clear();
self.logs_written_this_frame.clear();
self.telemetry_current = TelemetryFrame::default();
@@ -122,13 +120,12 @@ impl VirtualMachineRuntime {
self.clear_cartridge_state();
vm.set_capabilities(cartridge.capabilities);
match vm.initialize(cartridge.program.clone(), &cartridge.entrypoint) {
match vm.initialize(cartridge.program.clone()) {
Ok(_) => {
self.current_app_id = cartridge.app_id;
self.current_cartridge_title = cartridge.title.clone();
self.current_cartridge_app_version = cartridge.app_version.clone();
self.current_cartridge_app_mode = cartridge.app_mode;
self.current_entrypoint = cartridge.entrypoint.clone();
Ok(())
}
Err(e) => {
@@ -59,7 +59,6 @@ fn cartridge_with_program(program: Vec<u8>, capabilities: u64) -> Cartridge {
title: "Test Cart".into(),
app_version: "1.0.0".into(),
app_mode: AppMode::Game,
entrypoint: "".into(),
capabilities,
program,
assets: AssetsPayloadSource::empty(),
@@ -270,7 +269,6 @@ fn reset_clears_cartridge_scoped_runtime_state() {
runtime.current_cartridge_title = "Cart".into();
runtime.current_cartridge_app_version = "1.2.3".into();
runtime.current_cartridge_app_mode = AppMode::System;
runtime.current_entrypoint = "main".into();
runtime.logs_written_this_frame.insert(42, 3);
runtime.telemetry_current.frame_index = 8;
runtime.telemetry_current.cycles_used = 99;
@@ -296,7 +294,6 @@ fn reset_clears_cartridge_scoped_runtime_state() {
assert!(runtime.current_cartridge_title.is_empty());
assert!(runtime.current_cartridge_app_version.is_empty());
assert_eq!(runtime.current_cartridge_app_mode, AppMode::Game);
assert!(runtime.current_entrypoint.is_empty());
assert!(runtime.logs_written_this_frame.is_empty());
assert_eq!(runtime.telemetry_current.frame_index, 0);
assert_eq!(runtime.telemetry_current.cycles_used, 0);
@@ -352,7 +349,6 @@ fn initialize_vm_failure_clears_previous_identity_and_handles() {
assert!(runtime.current_cartridge_title.is_empty());
assert!(runtime.current_cartridge_app_version.is_empty());
assert_eq!(runtime.current_cartridge_app_mode, AppMode::Game);
assert!(runtime.current_entrypoint.is_empty());
assert!(runtime.open_files.is_empty());
assert_eq!(runtime.next_handle, 1);
assert!(!runtime.paused);
@@ -1030,7 +1026,6 @@ fn tick_memcard_slot_roundtrip_for_game_profile() {
title: "Memcard Game".into(),
app_version: "1.0.0".into(),
app_mode: AppMode::Game,
entrypoint: "".into(),
capabilities: caps::FS,
program,
assets: AssetsPayloadSource::empty(),
@@ -1070,7 +1065,6 @@ fn tick_memcard_access_is_denied_for_non_game_profile() {
title: "System App".into(),
app_version: "1.0.0".into(),
app_mode: AppMode::System,
entrypoint: "".into(),
capabilities: caps::FS,
program,
assets: AssetsPayloadSource::empty(),
@@ -58,7 +58,7 @@ impl VirtualMachineRuntime {
self.begin_logical_frame(signals, hw);
if self.needs_prepare_entry_call || vm.call_stack_is_empty() {
vm.prepare_call(&self.current_entrypoint);
vm.prepare_boot_call();
self.needs_prepare_entry_call = false;
}