align vm runtime
This commit is contained in:
@@ -498,7 +498,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
return Ok(());
|
||||
}
|
||||
Syscall::SystemRunCart => {
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
return Ok(());
|
||||
}
|
||||
_ => {}
|
||||
@@ -513,15 +513,14 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
|
||||
// --- GFX Syscalls ---
|
||||
|
||||
// gfx.clear(color_index) -> null
|
||||
// gfx.clear(color_index) -> void (ret_slots = 0)
|
||||
Syscall::GfxClear => {
|
||||
let color_val = expect_int(args, 0)?;
|
||||
let color = self.get_color(color_val);
|
||||
hw.gfx_mut().clear(color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.draw_rect(x, y, w, h, color_index) -> null
|
||||
// gfx.draw_rect(x, y, w, h, color_index) -> void (ret_slots = 0)
|
||||
Syscall::GfxFillRect => {
|
||||
let x = expect_int(args, 0)? as i32;
|
||||
let y = expect_int(args, 1)? as i32;
|
||||
@@ -530,10 +529,9 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let color_val = expect_int(args, 4)?;
|
||||
let color = self.get_color(color_val);
|
||||
hw.gfx_mut().fill_rect(x, y, w, h, color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.draw_line(x1, y1, x2, y2, color_index) -> null
|
||||
// gfx.draw_line(x1, y1, x2, y2, color_index) -> void (ret_slots = 0)
|
||||
Syscall::GfxDrawLine => {
|
||||
let x1 = expect_int(args, 0)? as i32;
|
||||
let y1 = expect_int(args, 1)? as i32;
|
||||
@@ -542,10 +540,9 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let color_val = expect_int(args, 4)?;
|
||||
let color = self.get_color(color_val);
|
||||
hw.gfx_mut().draw_line(x1, y1, x2, y2, color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.draw_circle(x, y, r, color_index) -> null
|
||||
// gfx.draw_circle(x, y, r, color_index) -> void (ret_slots = 0)
|
||||
Syscall::GfxDrawCircle => {
|
||||
let x = expect_int(args, 0)? as i32;
|
||||
let y = expect_int(args, 1)? as i32;
|
||||
@@ -553,10 +550,9 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let color_val = expect_int(args, 3)?;
|
||||
let color = self.get_color(color_val);
|
||||
hw.gfx_mut().draw_circle(x, y, r, color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.draw_disc(x, y, r, border_color_idx, fill_color_idx) -> null
|
||||
// gfx.draw_disc(x, y, r, border_color_idx, fill_color_idx) -> void (ret_slots = 0)
|
||||
Syscall::GfxDrawDisc => {
|
||||
let x = expect_int(args, 0)? as i32;
|
||||
let y = expect_int(args, 1)? as i32;
|
||||
@@ -566,10 +562,9 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let fill_color = self.get_color(fill_color_val);
|
||||
let border_color = self.get_color(border_color_val);
|
||||
hw.gfx_mut().draw_disc(x, y, r, border_color, fill_color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.draw_square(x, y, w, h, border_color_idx, fill_color_idx) -> null
|
||||
// gfx.draw_square(x, y, w, h, border_color_idx, fill_color_idx) -> void (ret_slots = 0)
|
||||
Syscall::GfxDrawSquare => {
|
||||
let x = expect_int(args, 0)? as i32;
|
||||
let y = expect_int(args, 1)? as i32;
|
||||
@@ -580,7 +575,6 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let fill_color = self.get_color(fill_color_val);
|
||||
let border_color = self.get_color(border_color_val);
|
||||
hw.gfx_mut().draw_square(x, y, w, h, border_color, fill_color);
|
||||
ret.push_null();
|
||||
Ok(())
|
||||
}
|
||||
// gfx.set_sprite(asset_name, id, x, y, tile_id, palette_id, active, flip_x, flip_y, priority)
|
||||
@@ -617,7 +611,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
priority,
|
||||
};
|
||||
}
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
Syscall::GfxDrawText => {
|
||||
@@ -633,7 +627,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
let color_val = expect_int(args, 3)?;
|
||||
let color = self.get_color(color_val);
|
||||
hw.gfx_mut().draw_text(x, y, &msg, color);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
// gfx.clear565(color_u16) -> void
|
||||
@@ -873,7 +867,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
0,
|
||||
prometeu_hal::LoopMode::Off,
|
||||
);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -909,7 +903,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
hw.assets().find_slot_by_name(&asset_name, BankType::SOUNDS).unwrap_or(0);
|
||||
|
||||
hw.audio_mut().play(bank_id, sample_id, voice_id, volume, pan, pitch, 0, loop_mode);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -971,7 +965,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
Syscall::FsClose => {
|
||||
let handle = expect_int(args, 0)? as u32;
|
||||
self.open_files.remove(&handle);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
// FS_LIST_DIR(path)
|
||||
@@ -1087,13 +1081,13 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
Syscall::AssetCommit => {
|
||||
let handle = expect_int(args, 0)? as u32;
|
||||
hw.assets().commit(handle);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
Syscall::AssetCancel => {
|
||||
let handle = expect_int(args, 0)? as u32;
|
||||
hw.assets().cancel(handle);
|
||||
ret.push_null();
|
||||
// ret_slots = 0 (void). Must return exactly 0 values per SyscallMeta.
|
||||
Ok(())
|
||||
}
|
||||
Syscall::BankInfo => {
|
||||
|
||||
Reference in New Issue
Block a user