aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFenrir <[email protected]>2016-05-02 21:10:45 -0700
committerFenrir <[email protected]>2016-05-02 22:03:42 -0700
commitc314c0098ec01aa5f806ce4fd31410e74ad686d9 (patch)
tree24773c04a6444792e7244f7b3c3c6a27f3093bff /src
parentDeleted old files (diff)
downloadctru-rs-c314c0098ec01aa5f806ce4fd31410e74ad686d9.tar.xz
ctru-rs-c314c0098ec01aa5f806ce4fd31410e74ad686d9.zip
Added new bindings
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs3
-rw-r--r--src/services/apt.rs44
-rw-r--r--src/services/gsp.rs34
-rw-r--r--src/services/hid.rs2
4 files changed, 40 insertions, 43 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3ba65e4..9d9cbd5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,9 +5,6 @@
extern crate ctru_sys as libctru;
-pub type Result = i32;
-pub type Handle = u32;
-
pub mod srv;
pub mod gfx;
pub mod sdmc;
diff --git a/src/services/apt.rs b/src/services/apt.rs
index 68da008..5d3f04f 100644
--- a/src/services/apt.rs
+++ b/src/services/apt.rs
@@ -14,36 +14,36 @@ pub enum AppStatus {
AppletClosed
}
-impl From<AppStatus> for apt::APP_STATUS {
- fn from(a: AppStatus) -> apt::APP_STATUS {
+impl From<AppStatus> for apt::APT_AppStatus {
+ fn from(a: AppStatus) -> apt::APT_AppStatus {
use self::AppStatus::*;
match a {
- NotInitialized => apt::APP_STATUS::APP_NOTINITIALIZED,
- Running => apt::APP_STATUS::APP_RUNNING,
- Suspended => apt::APP_STATUS::APP_SUSPENDED,
- Exiting => apt::APP_STATUS::APP_EXITING,
- Suspending => apt::APP_STATUS::APP_SUSPENDING,
- SleepMode => apt::APP_STATUS::APP_SLEEPMODE,
- PrepareSleepMode => apt::APP_STATUS::APP_PREPARE_SLEEPMODE,
- AppletStarted => apt::APP_STATUS::APP_APPLETSTARTED,
- AppletClosed => apt::APP_STATUS::APP_APPLETCLOSED,
+ NotInitialized => apt::APT_AppStatus::APP_NOTINITIALIZED,
+ Running => apt::APT_AppStatus::APP_RUNNING,
+ Suspended => apt::APT_AppStatus::APP_SUSPENDED,
+ Exiting => apt::APT_AppStatus::APP_EXITING,
+ Suspending => apt::APT_AppStatus::APP_SUSPENDING,
+ SleepMode => apt::APT_AppStatus::APP_SLEEPMODE,
+ PrepareSleepMode => apt::APT_AppStatus::APP_PREPARE_SLEEPMODE,
+ AppletStarted => apt::APT_AppStatus::APP_APPLETSTARTED,
+ AppletClosed => apt::APT_AppStatus::APP_APPLETCLOSED,
}
}
}
-impl From<apt::APP_STATUS> for AppStatus {
- fn from(a: apt::APP_STATUS) -> AppStatus {
+impl From<apt::APT_AppStatus> for AppStatus {
+ fn from(a: apt::APT_AppStatus) -> AppStatus {
use self::AppStatus::*;
match a {
- apt::APP_STATUS::APP_NOTINITIALIZED => NotInitialized,
- apt::APP_STATUS::APP_RUNNING => Running,
- apt::APP_STATUS::APP_SUSPENDED => Suspended,
- apt::APP_STATUS::APP_EXITING => Exiting,
- apt::APP_STATUS::APP_SUSPENDING => Suspending,
- apt::APP_STATUS::APP_SLEEPMODE => SleepMode,
- apt::APP_STATUS::APP_PREPARE_SLEEPMODE => PrepareSleepMode,
- apt::APP_STATUS::APP_APPLETSTARTED => AppletStarted,
- apt::APP_STATUS::APP_APPLETCLOSED => AppletClosed
+ apt::APT_AppStatus::APP_NOTINITIALIZED => NotInitialized,
+ apt::APT_AppStatus::APP_RUNNING => Running,
+ apt::APT_AppStatus::APP_SUSPENDED => Suspended,
+ apt::APT_AppStatus::APP_EXITING => Exiting,
+ apt::APT_AppStatus::APP_SUSPENDING => Suspending,
+ apt::APT_AppStatus::APP_SLEEPMODE => SleepMode,
+ apt::APT_AppStatus::APP_PREPARE_SLEEPMODE => PrepareSleepMode,
+ apt::APT_AppStatus::APP_APPLETSTARTED => AppletStarted,
+ apt::APT_AppStatus::APP_APPLETCLOSED => AppletClosed
}
}
}
diff --git a/src/services/gsp.rs b/src/services/gsp.rs
index 8b4b7f3..722bab6 100644
--- a/src/services/gsp.rs
+++ b/src/services/gsp.rs
@@ -1,4 +1,4 @@
-use libctru::services::gsp;
+use libctru::services::gspgpu;
use core::convert::From;
@@ -34,9 +34,9 @@ impl FramebufferFormat {
}
}
-impl From<gsp::GSP_FramebufferFormats> for FramebufferFormat {
- #[inline] fn from(g: gsp::GSP_FramebufferFormats) -> FramebufferFormat {
- use libctru::services::gsp::GSP_FramebufferFormats::*;
+impl From<gspgpu::GSPGPU_FramebufferFormats> for FramebufferFormat {
+ #[inline] fn from(g: gspgpu::GSPGPU_FramebufferFormats) -> FramebufferFormat {
+ use libctru::services::gspgpu::GSPGPU_FramebufferFormats::*;
use self::FramebufferFormat::*;
match g {
GSP_RGBA8_OES => Rgba8,
@@ -48,9 +48,9 @@ impl From<gsp::GSP_FramebufferFormats> for FramebufferFormat {
}
}
-impl From<FramebufferFormat> for gsp::GSP_FramebufferFormats {
- #[inline] fn from(g: FramebufferFormat) -> gsp::GSP_FramebufferFormats {
- use libctru::services::gsp::GSP_FramebufferFormats::*;
+impl From<FramebufferFormat> for gspgpu::GSPGPU_FramebufferFormats {
+ #[inline] fn from(g: FramebufferFormat) -> gspgpu::GSPGPU_FramebufferFormats {
+ use libctru::services::gspgpu::GSPGPU_FramebufferFormats::*;
use self::FramebufferFormat::*;
match g {
Rgba8 => GSP_RGBA8_OES,
@@ -62,18 +62,18 @@ impl From<FramebufferFormat> for gsp::GSP_FramebufferFormats {
}
}
-fn to_raw_event(ev: Event) -> gsp::GSP_Event {
- use libctru::services::gsp::GSP_Event::*;
+fn to_raw_event(ev: Event) -> gspgpu::GSPGPU_Event {
+ use libctru::services::gspgpu::GSPGPU_Event::*;
use self::Event::*;
match ev {
- Psc0 => GSPEVENT_PSC0,
- Psc1 => GSPEVENT_PSC1,
- VBlank0 => GSPEVENT_VBlank0,
- VBlank1 => GSPEVENT_VBlank1,
- PPF => GSPEVENT_PPF,
- P3D => GSPEVENT_P3D,
- DMA => GSPEVENT_DMA
+ Psc0 => GSPGPU_EVENT_PSC0,
+ Psc1 => GSPGPU_EVENT_PSC1,
+ VBlank0 => GSPGPU_EVENT_VBlank0,
+ VBlank1 => GSPGPU_EVENT_VBlank1,
+ PPF => GSPGPU_EVENT_PPF,
+ P3D => GSPGPU_EVENT_P3D,
+ DMA => GSPGPU_EVENT_DMA
}
}
@@ -91,6 +91,6 @@ fn to_raw_event(ev: Event) -> gsp::GSP_Event {
pub fn wait_for_event(ev: Event) -> () {
unsafe {
// TODO second argument?
- gsp::gspWaitForEvent(to_raw_event(ev), 0);
+ gspgpu::gspWaitForEvent(to_raw_event(ev), 0);
}
}
diff --git a/src/services/hid.rs b/src/services/hid.rs
index 8f785d0..cb96c3a 100644
--- a/src/services/hid.rs
+++ b/src/services/hid.rs
@@ -80,7 +80,7 @@ pub struct Hid {
impl Hid {
pub fn new() -> Result<Hid, i32> {
unsafe {
- let r = hid::hidInit(hid::HID_SHAREDMEM_DEFAULT as *mut u32);
+ let r = hid::hidInit();
if r < 0 {
Err(r)
} else {