Browse Source

Add bindings for several more services.

pull/10/head
Ronald Kinard 10 years ago
parent
commit
42e0b9986f
  1. 8
      src/raw/console.rs
  2. 6
      src/raw/linear.rs
  3. 2
      src/raw/mod.rs
  4. 9
      src/raw/services/ac.rs
  5. 30
      src/raw/services/am.rs
  6. 128
      src/raw/services/apt.rs
  7. 11
      src/raw/services/cfgnor.rs
  8. 16
      src/raw/services/cfgu.rs
  9. 11
      src/raw/services/hb.rs
  10. 103
      src/raw/services/hid.rs
  11. 14
      src/raw/services/ir.rs
  12. 21
      src/raw/services/irrst.rs
  13. 19
      src/raw/services/mic.rs
  14. 14
      src/raw/services/mod.rs
  15. 9
      src/raw/services/ns.rs
  16. 12
      src/raw/services/pm.rs
  17. 12
      src/raw/services/ptm.rs
  18. 7
      src/raw/services/soc.rs
  19. 7
      src/raw/svc.rs
  20. 1
      src/raw/types.rs

8
src/raw/console.rs

@ -1,18 +1,22 @@ @@ -1,18 +1,22 @@
extern crate core;
use core::option::Option;
use super::c_void;
use super::gfx::*;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ConsoleFont {
pub gfx: *mut u8,
pub asciiOffset: u16,
pub numChars: u16,
}
pub type ConsolePrint = Option<extern "C" fn(con: *mut c_void, c: i32) -> u8>;
#[repr(C)]
pub type ConsolePrint = extern "C" fn(con: *mut c_void, c: i32) -> u8;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct PrintConsole {
pub font: ConsoleFont,
pub frameBuffer: *mut u16,

6
src/raw/linear.rs

@ -2,9 +2,9 @@ use super::c_void; @@ -2,9 +2,9 @@ use super::c_void;
#[link(name = "ctru")]
extern "C" {
pub fn linearAlloc(size: isize) -> *mut c_void;
pub fn linearMemAlign(size: isize, alignment: isize) -> *mut c_void;
pub fn linearRealloc(mem: *mut c_void, size: isize) -> *mut c_void;
pub fn linearAlloc(size: i32) -> *mut c_void;
pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void;
pub fn linearRealloc(mem: *mut c_void, size: i32) -> *mut c_void;
pub fn linearFree(mem: *mut c_void) -> ();
pub fn linearSpaceFree() -> u32;
}

2
src/raw/mod.rs

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(overflowing_literals)]
#![allow(raw_pointer_derive)]
pub mod console;
pub mod gfx;

9
src/raw/services/ac.rs

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
use ::{Handle, Result};
#[link(name = "ctru")]
extern "C" {
pub fn acInit() -> Result;
pub fn acExit() -> Result;
pub fn ACU_GetWifiStatus(servhandle: *mut Handle, out: *mut u32) -> Result;
pub fn ACU_WaitInternetConnection() -> Result;
}

30
src/raw/services/am.rs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
use ::raw::c_void;
use ::{Result, Handle};
#[repr(C)]
#[derive(Clone, Copy)]
pub struct TitleList {
titleID: u64,
size: u64,
titleVersion: u16,
unknown2: [u8; 6usize]
}
#[link(name = "ctru")]
extern "C" {
pub fn amInit() -> Result;
pub fn amExit() -> Result;
pub fn amGetSessionHandle() -> *mut Handle;
pub fn AM_GetTitleCount(mediatype: u8, count: *mut u32) -> Result;
pub fn AM_GetTitleIdList(mediatype: u8, count: u32, titleIDs: *mut u64) -> Result;
pub fn AM_GetDeviceId(deviceID: *mut u32) -> Result;
pub fn AM_ListTitles(mediatype: u8, titleCount: u32, titleIdList: *mut u64, titleList: *mut TitleList) -> Result;
pub fn AM_StartCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result;
pub fn AM_StartDlpChildCiaInstall(ciaHandle: *mut Handle) -> Result;
pub fn AM_CancelCIAInstall(ciaHandle: *mut Handle) -> Result;
pub fn AM_FinishCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result;
pub fn AM_DeleteTitle(mediatype: u8, titleID: u64) -> Result;
pub fn AM_DeleteAppTitle(mediatype: u8, titleID: u64) -> Result;
pub fn AM_InstallFIRM(titleID: u64) -> Result;
pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64, productCode: *mut c_void) -> Result;
}

128
src/raw/services/apt.rs

@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
extern crate core;
use core::option::Option;
use ::{Handle, Result};
use ::raw::c_void;
pub const RUNFLAG_APTWORKAROUND: u32 = 1;
pub const RUNFLAG_APTREINIT: u32 = 2;
#[repr(C)]
pub enum NS_APPID {
APPID_HOMEMENU = 0x101, // Home Menu
APPID_CAMERA = 0x110, // Camera applet
APPID_FRIENDS_LIST = 0x112, // Friends List applet
APPID_GAME_NOTES = 0x113, // Game Notes applet
APPID_WEB = 0x114, // Internet Browser
APPID_INSTRUCTION_MANUAL = 0x115, // Instruction Manual applet
APPID_NOTIFICATIONS = 0x116, // Notifications applet
APPID_MIIVERSE = 0x117, // Miiverse applet
APPID_APPLICATION = 0x300, // Application
APPID_SOFTWARE_KEYBOARD = 0x401, // Software Keyboard
APPID_APPLETED = 0x402, // appletEd
APPID_PNOTE_AP = 0x404, // PNOTE_AP
APPID_SNOTE_AP = 0x405, // SNOTE_AP
APPID_ERROR = 0x406, // error
APPID_MINT = 0x407, // mint
APPID_EXTRAPAD = 0x408, // extrapad
APPID_MEMOLIB = 0x409, // memolib
} // cf http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs
#[repr(C)]
pub enum APP_STATUS {
APP_NOTINITIALIZED,
APP_RUNNING,
APP_SUSPENDED,
APP_EXITING,
APP_SUSPENDING,
APP_SLEEPMODE,
APP_PREPARE_SLEEPMODE,
APP_APPLETSTARTED,
APP_APPLETCLOSED
}
#[repr(C)]
pub enum APTSIGNAL {
APTSIGNAL_HOMEBUTTON = 1,
// 2: sleep-mode related?
APTSIGNAL_PREPARESLEEP = 3,
// 4: triggered when ptm:s GetShellStatus() returns 5.
APTSIGNAL_ENTERSLEEP = 5,
APTSIGNAL_WAKEUP = 6,
APTSIGNAL_ENABLE = 7,
APTSIGNAL_POWERBUTTON = 8,
APTSIGNAL_UTILITY = 9,
APTSIGNAL_SLEEPSYSTEM = 10,
APTSIGNAL_ERROR = 11
}
#[repr(C)]
pub enum APTHOOK {
APTHOOK_ONSUSPEND = 0,
APTHOOK_ONRESTORE,
APTHOOK_ONSLEEP,
APTHOOK_ONWAKEUP,
APTHOOK_ONEXIT,
APTHOOK_COUNT,
}
type aptHookFn = Option<extern "C" fn(hook: i32, param: *mut c_void) -> ()>;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct aptHookCookie {
next: *mut aptHookCookie,
callback: aptHookFn,
param: *mut c_void,
}
#[link(name = "ctru")]
extern "C" {
pub static mut aptEvents: [Handle; 3usize];
pub fn aptInit() -> Result;
pub fn aptExit() -> ();
pub fn aptOpenSession() -> ();
pub fn aptCloseSession() -> ();
pub fn aptSetStatus(status: APP_STATUS) -> ();
pub fn aptGetStatus() -> APP_STATUS;
pub fn aptGetStatusPower() -> u32;
pub fn aptSetStatusPower(status: u32) -> ();
pub fn aptReturnToMenu() -> ();
pub fn aptWaitStatusEvent() -> ();
pub fn aptSignalReadyForSleep() -> ();
pub fn aptGetMenuAppID() -> NS_APPID;
pub fn aptMainLoop() -> u8;
pub fn APT_GetLockHandle(handle: *mut Handle, flags: u16, lockHandle: *mut Handle) -> Result;
pub fn APT_Initialize(handle: *mut Handle, appId: NS_APPID, eventHandle1: *mut Handle, eventHandle2: *mut Handle) -> Result;
pub fn APT_HardwareResetAsync(handle: *mut Handle) -> Result;
pub fn APT_Enable(handle: *mut Handle, a: u32) -> Result;
pub fn APT_GetAppletManInfo(handle: *mut Handle, inval: u8, outval8: *mut u8, outval32: *mut u32, menu_appid: *mut NS_APPID, active_appid: *mut NS_APPID) -> Result;
pub fn APT_PrepareToJumpToHomeMenu(handle: *mut Handle) -> Result;
pub fn APT_JumpToHomeMenu(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result;
pub fn APT_IsRegistered(handle: *mut Handle, appID: NS_APPID, out: *mut u8) -> Result;
pub fn APT_InquireNotification(handle: *mut Handle, appID: u32, signalType: *mut u8) -> Result;
pub fn APT_NotifyToWait(handle: *mut Handle, appID: NS_APPID) -> Result;
pub fn APT_AppletUtility(handle: *mut Handle, out: *mut u32, a: u32, size1: u32, buf1: *mut u8, size2: u32, buf2: *mut u8) -> Result;
pub fn APT_GlanceParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result;
pub fn APT_ReceiveParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result;
pub fn APT_SendParameter(handle: *mut Handle, src_appID: NS_APPID, dst_appID: NS_APPID, bufferSize: u32, buffer: *mut u32, paramhandle: Handle, signalType: u8) -> Result;
pub fn APT_SendCaptureBufferInfo(handle: *mut Handle, bufferSize: u32, buffer: *mut u32) -> Result;
pub fn APT_ReplySleepQuery(handle: *mut Handle, appID: NS_APPID, a: u32) -> Result;
pub fn APT_ReplySleepNotificationComplete(handle: *mut Handle, appID: NS_APPID) -> Result;
pub fn APT_PrepareToCloseApplication(handle: *mut Handle, a: u8) -> Result;
pub fn APT_CloseApplication(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result;
pub fn APT_SetAppCpuTimeLimit(handle: *mut Handle, percent: u32) -> Result;
pub fn APT_GetAppCpuTimeLimit(handle: *mut Handle, percent: *mut u32) -> Result;
pub fn APT_CheckNew3DS_Application(handle: *mut Handle, out: *mut u8) -> Result;
pub fn APT_CheckNew3DS_System(handle: *mut Handle, out: *mut u8) -> Result;
pub fn APT_CheckNew3DS(handle: *mut Handle, out: *mut u8) -> Result;
pub fn APT_PrepareToDoAppJump(handle: *mut Handle, flags: u8, programID: u64, mediatype: u8) -> Result;
pub fn APT_DoAppJump(handle: *mut Handle, NSbuf0Size: u32, NSbuf1Size: u32, NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result;
pub fn APT_PrepareToStartLibraryApplet(handle: *mut Handle, appID: NS_APPID) -> Result;
pub fn APT_StartLibraryApplet(handle: *mut Handle, appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result;
pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result;
pub fn APT_PrepareToStartSystemApplet(handle: *mut Handle, appID: NS_APPID) -> Result;
pub fn APT_StartSystemApplet(handle: *mut Handle, appID: NS_APPID, bufSize: u32, applHandle: Handle, buf: *mut u8) -> Result;
}

11
src/raw/services/cfgnor.rs

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
use ::Result;
#[link(name = "ctru")]
extern "C" {
pub fn CFGNOR_Initialize(value: u8) -> Result;
pub fn CFGNOR_Shutdown() -> Result;
pub fn CFGNOR_ReadData(offset: u32, buf: *mut u32, size: u32) -> Result;
pub fn CFGNOR_WriteData(offset: u32, buf: *mut u32, size: u32) -> Result;
pub fn CFGNOR_DumpFlash(buf: *mut u32, size: u32) -> Result;
pub fn CFGNOR_WriteFlash(buf: *mut u32, size: u32) -> Result;
}

16
src/raw/services/cfgu.rs

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
use ::Result;
#[link(name = "ctru")]
extern "C" {
pub fn initCfgu() -> Result;
pub fn exitCfgu() -> Result;
pub fn CFGU_SecureInfoGetRegion(region: *mut u8) -> Result;
pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32, hash: *mut u64) -> Result;
pub fn CFGU_GetRegionCanadaUSA(value: *mut u8) -> Result;
pub fn CFGU_GetSystemModel(model: *mut u8) -> Result;
pub fn CFGU_GetModelNintendo2DS(value: *mut u8) -> Result;
pub fn CFGU_GetCountryCodeString(code: u16, string: *mut u16) -> Result;
pub fn CFGU_GetCountryCodeID(string: u16, code: *mut u16) -> Result;
pub fn CFGU_GetConfigInfoBlk2(size: u32, blkID: u32, outData: *mut u8) -> Result;
pub fn CFGU_GetSystemLanguage(language: *mut u8) -> Result;
}

11
src/raw/services/hb.rs

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
use ::Result;
use ::raw::c_void;
#[link(name = "ctru")]
extern "C" {
pub fn hbInit() -> Result;
pub fn hbExit() -> ();
pub fn HB_FlushInvalidateCache() -> Result;
pub fn HB_GetBootloaderAddresses(load3dsx: *mut *mut c_void, setArgv: *mut *mut c_void) -> Result;
pub fn HB_ReprotectMemory(addr: *mut u32, pages: u32, mode: u32, reprotectedPages: *mut u32) -> Result;
}

103
src/raw/services/hid.rs

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
use ::raw::types::*;
use ::{Result, Handle};
pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000;
#[repr(C)]
pub enum PAD_KEY {
KEY_A = 1,
KEY_B = 2,
KEY_SELECT = 4,
KEY_START = 8,
KEY_DRIGHT = 16,
KEY_DLEFT = 32,
KEY_DUP = 64,
KEY_DDOWN = 128,
KEY_R = 256,
KEY_L = 512,
KEY_X = 1024,
KEY_Y = 2048,
KEY_ZL = 4096, // (new 3DS only)
KEY_ZR = 8192, // (new 3DS only)
KEY_TOUCH = 1048576, // Not actually provided by HID
KEY_CSTICK_RIGHT = 16777216, // c-stick (new 3DS only)
KEY_CSTICK_LEFT = 33554432, // c-stick (new 3DS only)
KEY_CSTICK_UP = 67108864, // c-stick (new 3DS only)
KEY_CSTICK_DOWN = 134217728, // c-stick (new 3DS only)
KEY_CPAD_RIGHT = 268435456, // circle pad
KEY_CPAD_LEFT = 536870912, // circle pad
KEY_CPAD_UP = 1073741824, // circle pad
KEY_CPAD_DOWN = 2147483648, // circle pad
// Generic catch-all directions
/*KEY_UP = KEY_DUP | KEY_CPAD_UP,
KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN,
KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT,
KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT,*/
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct touchPosition {
px: u16,
py: u16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct circlePosition {
dx: s16,
dy: s16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct accelVector {
x: s16,
y: s16,
z: s16
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct angularRate {
x: s16, //roll
z: s16, //yaw
y: s16, //pitch
}
#[repr(C)]
pub enum HID_Event {
HIDEVENT_PAD0 = 0, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated."
HIDEVENT_PAD1, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated."
HIDEVENT_Accel, //"Event signaled by HID-module, when the sharedmem accelerometer state was updated."
HIDEVENT_Gyro, //"Event signaled by HID-module, when the sharedmem gyroscope state was updated."
HIDEVENT_DebugPad, //"Event signaled by HID-module, when the sharedmem DebugPad state was updated."
HIDEVENT_MAX, // used to know how many events there are
}
#[link(name = "ctru")]
extern "C" {
pub static hidMemHandle: Handle;
pub static hidSharedMem: *mut vu32;
pub fn hidInit(sharedMem: *mut u32) -> Result;
pub fn hidExit() -> ();
pub fn hidScanInput() -> ();
pub fn hidKeysHeld() -> u32;
pub fn hidKeysDown() -> u32;
pub fn hidKeysUp() -> u32;
pub fn hidTouchRead(pos: *mut touchPosition) -> ();
pub fn hidCircleRead(pos: *mut circlePosition) -> ();
pub fn hidAccelRead(vector: *mut accelVector) -> ();
pub fn hidGyroRead(rate: *mut angularRate) -> ();
pub fn hidWaitForEvent(id: HID_Event, nextEvent: u8) -> ();
pub fn HIDUSER_GetHandles(outMemHandle: *mut Handle, eventpad0: *mut Handle, eventpad1: *mut Handle, eventaccel: *mut Handle, eventgyro: *mut Handle, eventdebugpad: *mut Handle) -> Result;
pub fn HIDUSER_EnableAccelerometer() -> Result;
pub fn HIDUSER_DisableAccelerometer() -> Result;
pub fn HIDUSER_EnableGyroscope() -> Result;
pub fn HIDUSER_DisableGyroscope() -> Result;
pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: *mut f32) -> Result;
pub fn HIDUSER_GetSoundVolume(volume: *mut u8) -> Result;
}

14
src/raw/services/ir.rs

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" {
pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result;
pub fn IRU_Shutdown() -> Result;
pub fn IRU_GetServHandle() -> Handle;
pub fn IRU_SendData(buf: *mut u8, size: u32, wait: u32) -> Result;
pub fn IRU_RecvData(buf: *mut u8, size: u32, flag: u8, transfercount: *mut u32, wait: u32) -> Result;
pub fn IRU_SetBitRate(value: u8) -> Result;
pub fn IRU_GetBitRate(out: *mut u8) -> Result;
pub fn IRU_SetIRLEDState(value: u32) -> Result;
pub fn IRU_GetIRLEDRecvState(out: *mut u32) -> Result;
}

21
src/raw/services/irrst.rs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
use ::{Result, Handle};
use ::raw::types::*;
use super::hid::circlePosition;
#[link(name = "ctru")]
extern "C" {
pub static irrstMemHandle: Handle;
pub static irrstSharedMem: *mut vu32;
pub fn irrstInit(sharedMem: *mut u32) -> Result;
pub fn irrstExit() -> ();
pub fn irrstScanInput() -> ();
pub fn irrstKeysHeld() -> u32;
pub fn irrstCstickRead(pos: *mut circlePosition) -> ();
pub fn irrstWaitForEvent(nextEvent: u8) -> ();
pub fn IRRST_GetHandles(outMemHandle: *mut Handle,
outEventHandle: *mut Handle) -> Result;
pub fn IRRST_Initialize(unk1: u32, unk2: u8) -> Result;
pub fn IRRST_Shutdown() -> Result;
}

19
src/raw/services/mic.rs

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" {
pub fn MIC_Initialize(sharedmem: *mut u32, sharedmem_size: u32, control: u8, recording: u8, unk0: u8, unk1: u8, unk2: u8) -> Result;
pub fn MIC_Shutdown() -> Result;
pub fn MIC_GetSharedMemOffsetValue() -> u32;
pub fn MIC_ReadAudioData(outbuf: *mut u8, readsize: u32, waitforevent: u32) -> u32;
pub fn MIC_MapSharedMem(handle: Handle, size: u32) -> Result;
pub fn MIC_UnmapSharedMem() -> Result;
pub fn MIC_cmd3_Initialize(unk0: u8, unk1: u8, sharedmem_baseoffset: u32, sharedmem_endoffset: u32, unk2: u8) -> Result;
pub fn MIC_cmd5() -> Result;
pub fn MIC_GetCNTBit15(out: *mut u8) -> Result;
pub fn MIC_GetEventHandle(handle: *mut Handle) -> Result;
pub fn MIC_SetControl(value: u8) -> Result;
pub fn MIC_GetControl(value: *mut u8) -> Result;
pub fn MIC_SetRecording(value: u8) -> Result;
pub fn MIC_IsRecoding(value: *mut u8) -> Result;
}

14
src/raw/services/mod.rs

@ -1 +1,15 @@ @@ -1 +1,15 @@
pub mod ac;
pub mod am;
pub mod apt;
pub mod cfgnor;
pub mod cfgu;
pub mod gsp;
pub mod hb;
pub mod hid;
pub mod ir;
pub mod irrst;
pub mod mic;
pub mod ns;
pub mod pm;
pub mod ptm;
pub mod soc;

9
src/raw/services/ns.rs

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
use ::Result;
#[link(name = "ctru")]
extern "C" {
pub fn nsInit() -> Result;
pub fn nsExit() -> Result;
pub fn NS_LaunchTitle(titleid: u64, launch_flags: u32, procid: *mut u32) -> Result;
pub fn NS_RebootToTitle(mediatype: u8, titleid: u64) -> Result;
}

12
src/raw/services/pm.rs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
use ::Result;
#[link(name = "ctru")]
extern "C" {
pub fn pmInit() -> Result;
pub fn pmExit() -> Result;
pub fn PM_LaunchTitle(mediatype: u8, titleid: u64, launch_flags: u32) -> Result;
pub fn PM_GetTitleExheaderFlags(mediatype: u8, titleid: u64, out: *mut u8) -> Result;
pub fn PM_SetFIRMLaunchParams(size: u32, _in: *mut u8) -> Result;
pub fn PM_GetFIRMLaunchParams(size: u32, out: *mut u8) -> Result;
pub fn PM_LaunchFIRMSetParams(firm_titleid_low: u32, size: u32, _in: *mut u8) -> Result;
}

12
src/raw/services/ptm.rs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" {
pub fn ptmInit() -> Result;
pub fn ptmExit() -> Result;
pub fn PTMU_GetShellState(servhandle: *mut Handle, out: *mut u8) -> Result;
pub fn PTMU_GetBatteryLevel(servhandle: *mut Handle, out: *mut u8) -> Result;
pub fn PTMU_GetBatteryChargeState(servhandle: *mut Handle, out: *mut u8) -> Result;
pub fn PTMU_GetPedometerState(servhandle: *mut Handle, out: *mut u8) -> Result;
pub fn PTMU_GetTotalStepCount(servhandle: *mut Handle, steps: *mut u32) -> Result;
}

7
src/raw/services/soc.rs

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
use ::Result;
#[link(name = "ctru")]
extern "C" {
pub fn SOC_Initialize(context_addr: *mut u32, context_size: u32) -> Result;
pub fn SOC_Shutdown() -> Result;
}

7
src/raw/svc.rs

@ -3,7 +3,6 @@ use super::super::{Handle, Result}; @@ -3,7 +3,6 @@ use super::super::{Handle, Result};
extern crate core;
use core::clone::Clone;
use core::default::Default;
#[repr(C)]
pub enum MemOp {
@ -50,15 +49,11 @@ pub struct MemInfo { @@ -50,15 +49,11 @@ pub struct MemInfo {
}
#[repr(C)]
#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct PageInfo {
pub flags: u32,
}
impl Clone for PageInfo {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
pub enum ArbitrationType {
ARBITER_FREE =0,

1
src/raw/types.rs

@ -12,6 +12,7 @@ pub type s64 = i64; @@ -12,6 +12,7 @@ pub type s64 = i64;
// UHH, DUNNO HOW TO USE VOLATILES ????
pub type vu8 = u8;
pub type vu32 = u32;
// typedef uint8_t u8;
// typedef uint16_t u16;

Loading…
Cancel
Save