implements PLN-0076 render capability split

This commit is contained in:
2026-05-25 14:02:37 +01:00
parent c3396f5a61
commit 7c35edcb84
16 changed files with 297 additions and 69 deletions
@@ -188,6 +188,17 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().clear(color);
Ok(())
}
Syscall::GfxUiClear => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let color = self.get_color(expect_int(args, 0)?)?;
hw.gfx_mut().clear(color);
Ok(())
}
Syscall::GfxFillRect => {
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
@@ -197,6 +208,21 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().fill_rect(x, y, w, h, color);
Ok(())
}
Syscall::GfxUiFillRect => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
let w = expect_int(args, 2)? as i32;
let h = expect_int(args, 3)? as i32;
let color = self.get_color(expect_int(args, 4)?)?;
hw.gfx_mut().fill_rect(x, y, w, h, color);
Ok(())
}
Syscall::GfxDrawLine => {
let x1 = expect_int(args, 0)? as i32;
let y1 = expect_int(args, 1)? as i32;
@@ -206,6 +232,21 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().draw_line(x1, y1, x2, y2, color);
Ok(())
}
Syscall::GfxUiDrawLine => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x1 = expect_int(args, 0)? as i32;
let y1 = expect_int(args, 1)? as i32;
let x2 = expect_int(args, 2)? as i32;
let y2 = expect_int(args, 3)? as i32;
let color = self.get_color(expect_int(args, 4)?)?;
hw.gfx_mut().draw_line(x1, y1, x2, y2, color);
Ok(())
}
Syscall::GfxDrawCircle => {
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
@@ -214,6 +255,20 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().draw_circle(x, y, r, color);
Ok(())
}
Syscall::GfxUiDrawCircle => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
let r = expect_int(args, 2)? as i32;
let color = self.get_color(expect_int(args, 3)?)?;
hw.gfx_mut().draw_circle(x, y, r, color);
Ok(())
}
Syscall::GfxDrawDisc => {
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
@@ -223,6 +278,21 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().draw_disc(x, y, r, border_color, fill_color);
Ok(())
}
Syscall::GfxUiDrawDisc => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
let r = expect_int(args, 2)? as i32;
let border_color = self.get_color(expect_int(args, 3)?)?;
let fill_color = self.get_color(expect_int(args, 4)?)?;
hw.gfx_mut().draw_disc(x, y, r, border_color, fill_color);
Ok(())
}
Syscall::GfxDrawSquare => {
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
@@ -233,6 +303,22 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().draw_square(x, y, w, h, border_color, fill_color);
Ok(())
}
Syscall::GfxUiDrawSquare => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
let w = expect_int(args, 2)? as i32;
let h = expect_int(args, 3)? as i32;
let border_color = self.get_color(expect_int(args, 4)?)?;
let fill_color = self.get_color(expect_int(args, 5)?)?;
hw.gfx_mut().draw_square(x, y, w, h, border_color, fill_color);
Ok(())
}
Syscall::GfxDrawText => {
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
@@ -241,6 +327,20 @@ impl NativeInterface for VmRuntimeHost<'_> {
hw.gfx_mut().draw_text(x, y, &msg, color);
Ok(())
}
Syscall::GfxUiDrawText => {
if self.current_cartridge_app_mode != AppMode::Shell {
return Err(VmFault::Trap(
TRAP_INVALID_SYSCALL,
format!("{} is only available to the Shell profile", syscall.name()),
));
}
let x = expect_int(args, 0)? as i32;
let y = expect_int(args, 1)? as i32;
let msg = expect_string(args, 2, "message")?;
let color = self.get_color(expect_int(args, 3)?)?;
hw.gfx_mut().draw_text(x, y, &msg, color);
Ok(())
}
Syscall::ComposerBindScene => {
let scene_bank_id = match Self::int_arg_to_usize_status(expect_int(args, 0)?) {
Ok(id) => id,