126 lines
5.2 KiB
Rust
126 lines
5.2 KiB
Rust
use super::{Syscall, SyscallMeta, domains};
|
|
|
|
pub(crate) fn meta_for(syscall: Syscall) -> &'static SyscallMeta {
|
|
for entry in domains::all_entries() {
|
|
if entry.syscall == syscall {
|
|
return &entry.meta;
|
|
}
|
|
}
|
|
panic!("Missing SyscallMeta for {:?}", syscall);
|
|
}
|
|
|
|
impl Syscall {
|
|
pub fn from_u32(id: u32) -> Option<Self> {
|
|
match id {
|
|
0x0001 => Some(Self::SystemHasCart),
|
|
0x1001 => Some(Self::GfxClear),
|
|
0x1002 => Some(Self::GfxFillRect),
|
|
0x1003 => Some(Self::GfxDrawLine),
|
|
0x1004 => Some(Self::GfxDrawCircle),
|
|
0x1005 => Some(Self::GfxDrawDisc),
|
|
0x1006 => Some(Self::GfxDrawSquare),
|
|
0x1008 => Some(Self::GfxDrawText),
|
|
0x1201 => Some(Self::GfxUiClear),
|
|
0x1202 => Some(Self::GfxUiFillRect),
|
|
0x1203 => Some(Self::GfxUiDrawLine),
|
|
0x1204 => Some(Self::GfxUiDrawCircle),
|
|
0x1205 => Some(Self::GfxUiDrawDisc),
|
|
0x1206 => Some(Self::GfxUiDrawSquare),
|
|
0x1208 => Some(Self::GfxUiDrawText),
|
|
0x1101 => Some(Self::ComposerBindScene),
|
|
0x1102 => Some(Self::ComposerUnbindScene),
|
|
0x1103 => Some(Self::ComposerSetCamera),
|
|
0x1104 => Some(Self::ComposerEmitSprite),
|
|
0x3001 => Some(Self::AudioPlaySample),
|
|
0x3002 => Some(Self::AudioPlay),
|
|
0x4001 => Some(Self::FsOpen),
|
|
0x4002 => Some(Self::FsRead),
|
|
0x4003 => Some(Self::FsWrite),
|
|
0x4004 => Some(Self::FsClose),
|
|
0x4005 => Some(Self::FsListDir),
|
|
0x4006 => Some(Self::FsExists),
|
|
0x4007 => Some(Self::FsDelete),
|
|
0x4201 => Some(Self::MemSlotCount),
|
|
0x4202 => Some(Self::MemSlotStat),
|
|
0x4203 => Some(Self::MemSlotRead),
|
|
0x4204 => Some(Self::MemSlotWrite),
|
|
0x4205 => Some(Self::MemSlotCommit),
|
|
0x4206 => Some(Self::MemSlotClear),
|
|
0x5001 => Some(Self::LogWrite),
|
|
0x5002 => Some(Self::LogWriteTag),
|
|
0x6001 => Some(Self::AssetLoad),
|
|
0x6002 => Some(Self::AssetStatus),
|
|
0x6003 => Some(Self::AssetCommit),
|
|
0x6004 => Some(Self::AssetCancel),
|
|
0x6005 => Some(Self::AssetBacklogInfo),
|
|
0x6006 => Some(Self::AssetBacklogPosition),
|
|
0x6007 => Some(Self::AssetBacklogMove),
|
|
0x6008 => Some(Self::AssetBacklogPromote),
|
|
0x6009 => Some(Self::AssetBacklogDemote),
|
|
0x600A => Some(Self::AssetTargetStatus),
|
|
0x6101 => Some(Self::BankInfo),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub fn args_count(&self) -> usize {
|
|
super::meta_for(*self).arg_slots as usize
|
|
}
|
|
|
|
pub fn results_count(&self) -> usize {
|
|
super::meta_for(*self).ret_slots as usize
|
|
}
|
|
|
|
pub fn name(&self) -> &'static str {
|
|
match self {
|
|
Self::SystemHasCart => "SystemHasCart",
|
|
Self::GfxClear => "GfxClear",
|
|
Self::GfxFillRect => "GfxFillRect",
|
|
Self::GfxDrawLine => "GfxDrawLine",
|
|
Self::GfxDrawCircle => "GfxDrawCircle",
|
|
Self::GfxDrawDisc => "GfxDrawDisc",
|
|
Self::GfxDrawSquare => "GfxDrawSquare",
|
|
Self::GfxDrawText => "GfxDrawText",
|
|
Self::GfxUiClear => "GfxUiClear",
|
|
Self::GfxUiFillRect => "GfxUiFillRect",
|
|
Self::GfxUiDrawLine => "GfxUiDrawLine",
|
|
Self::GfxUiDrawCircle => "GfxUiDrawCircle",
|
|
Self::GfxUiDrawDisc => "GfxUiDrawDisc",
|
|
Self::GfxUiDrawSquare => "GfxUiDrawSquare",
|
|
Self::GfxUiDrawText => "GfxUiDrawText",
|
|
Self::ComposerBindScene => "ComposerBindScene",
|
|
Self::ComposerUnbindScene => "ComposerUnbindScene",
|
|
Self::ComposerSetCamera => "ComposerSetCamera",
|
|
Self::ComposerEmitSprite => "ComposerEmitSprite",
|
|
Self::AudioPlaySample => "AudioPlaySample",
|
|
Self::AudioPlay => "AudioPlay",
|
|
Self::FsOpen => "FsOpen",
|
|
Self::FsRead => "FsRead",
|
|
Self::FsWrite => "FsWrite",
|
|
Self::FsClose => "FsClose",
|
|
Self::FsListDir => "FsListDir",
|
|
Self::FsExists => "FsExists",
|
|
Self::FsDelete => "FsDelete",
|
|
Self::MemSlotCount => "MemSlotCount",
|
|
Self::MemSlotStat => "MemSlotStat",
|
|
Self::MemSlotRead => "MemSlotRead",
|
|
Self::MemSlotWrite => "MemSlotWrite",
|
|
Self::MemSlotCommit => "MemSlotCommit",
|
|
Self::MemSlotClear => "MemSlotClear",
|
|
Self::LogWrite => "LogWrite",
|
|
Self::LogWriteTag => "LogWriteTag",
|
|
Self::AssetLoad => "AssetLoad",
|
|
Self::AssetStatus => "AssetStatus",
|
|
Self::AssetCommit => "AssetCommit",
|
|
Self::AssetCancel => "AssetCancel",
|
|
Self::AssetBacklogInfo => "AssetBacklogInfo",
|
|
Self::AssetBacklogPosition => "AssetBacklogPosition",
|
|
Self::AssetBacklogMove => "AssetBacklogMove",
|
|
Self::AssetBacklogPromote => "AssetBacklogPromote",
|
|
Self::AssetBacklogDemote => "AssetBacklogDemote",
|
|
Self::AssetTargetStatus => "AssetTargetStatus",
|
|
Self::BankInfo => "BankInfo",
|
|
}
|
|
}
|
|
}
|