prometeu-sdk scratch

This commit is contained in:
Nilton Constantino
2026-01-21 07:01:09 +00:00
parent b7425e5a20
commit 1b091e6ce8
3 changed files with 91 additions and 16 deletions
@@ -84,27 +84,51 @@ impl Syscall {
}
pub fn from_name(name: &str) -> Option<Self> {
match name {
let name_lower = name.to_lowercase();
match name_lower.as_str() {
"system.has_cart" => Some(Self::SystemHasCart),
"system.run_cart" => Some(Self::SystemRunCart),
"gfx.clear" => Some(Self::GfxClear),
"gfx.fillRect" | "gfx.draw_rect" => Some(Self::GfxFillRect),
"gfx.drawLine" | "gfx.draw_line" => Some(Self::GfxDrawLine),
"gfx.drawCircle" | "gfx.draw_circle" => Some(Self::GfxDrawCircle),
"gfx.drawDisc" | "gfx.draw_disc" => Some(Self::GfxDrawDisc),
"gfx.drawSquare" | "gfx.draw_square" => Some(Self::GfxDrawSquare),
"gfx.fillrect" | "gfx.draw_rect" => Some(Self::GfxFillRect),
"gfx.drawline" | "gfx.draw_line" => Some(Self::GfxDrawLine),
"gfx.drawcircle" | "gfx.draw_circle" => Some(Self::GfxDrawCircle),
"gfx.drawdisc" | "gfx.draw_disc" => Some(Self::GfxDrawDisc),
"gfx.drawsquare" | "gfx.draw_square" => Some(Self::GfxDrawSquare),
"input.get_pad" => Some(Self::InputGetPad),
"audio.playSample" | "audio.play_sample" => Some(Self::AudioPlaySample),
"audio.playsample" | "audio.play_sample" => Some(Self::AudioPlaySample),
"fs.open" => Some(Self::FsOpen),
"fs.read" => Some(Self::FsRead),
"fs.write" => Some(Self::FsWrite),
"fs.close" => Some(Self::FsClose),
"fs.listDir" => Some(Self::FsListDir),
"fs.listdir" => Some(Self::FsListDir),
"fs.exists" => Some(Self::FsExists),
"fs.delete" => Some(Self::FsDelete),
"log.write" => Some(Self::LogWrite),
"log.writeTag" => Some(Self::LogWriteTag),
_ => None,
"log.writetag" | "log.write_tag" => Some(Self::LogWriteTag),
_ => {
// Tenta corresponder exatamente se o lowercase falhar (para camelCase original)
match name {
"gfx.fillRect" => Some(Self::GfxFillRect),
"gfx.drawLine" => Some(Self::GfxDrawLine),
"gfx.drawCircle" => Some(Self::GfxDrawCircle),
"gfx.drawDisc" => Some(Self::GfxDrawDisc),
"gfx.drawSquare" => Some(Self::GfxDrawSquare),
"audio.playSample" => Some(Self::AudioPlaySample),
"fs.listDir" => Some(Self::FsListDir),
"log.writeTag" => Some(Self::LogWriteTag),
"Gfx.fillRect" => Some(Self::GfxFillRect),
"Gfx.drawLine" => Some(Self::GfxDrawLine),
"Gfx.drawCircle" => Some(Self::GfxDrawCircle),
"Gfx.drawDisc" => Some(Self::GfxDrawDisc),
"Gfx.drawSquare" => Some(Self::GfxDrawSquare),
"Audio.playSample" => Some(Self::AudioPlaySample),
"Fs.listDir" => Some(Self::FsListDir),
"Log.writeTag" => Some(Self::LogWriteTag),
"System.hasCart" | "System.has_cart" => Some(Self::SystemHasCart),
"System.runCart" | "System.run_cart" => Some(Self::SystemRunCart),
_ => None,
}
}
}
}
}