aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys/src
diff options
context:
space:
mode:
authorRonald Kinard <[email protected]>2016-05-03 01:15:18 -0500
committerRonald Kinard <[email protected]>2016-05-03 01:15:18 -0500
commitff5a09832fe4534f657b3dcd80dff9e178ee0d70 (patch)
treeaf443f2e659a288b45cc5db980f1ae6180739163 /ctru-sys/src
parentWhoops, that's zlib, not BSD-3. (diff)
parentUpdate AUTHORS.md (diff)
downloadctru-rs-ff5a09832fe4534f657b3dcd80dff9e178ee0d70.tar.xz
ctru-rs-ff5a09832fe4534f657b3dcd80dff9e178ee0d70.zip
Merge pull request #4 from FenrirWolf/master
Compatibility fixes + new bindings + refactoring
Diffstat (limited to 'ctru-sys/src')
-rw-r--r--ctru-sys/src/console.rs63
-rw-r--r--ctru-sys/src/env.rs14
-rw-r--r--ctru-sys/src/gfx.rs48
-rw-r--r--ctru-sys/src/gpu/gpu.rs26
-rw-r--r--ctru-sys/src/gpu/gx.rs94
-rw-r--r--ctru-sys/src/gpu/mod.rs5
-rw-r--r--ctru-sys/src/gpu/registers.rs743
-rw-r--r--ctru-sys/src/gpu/shaderProgram.rs89
-rw-r--r--ctru-sys/src/gpu/shbin.rs136
-rw-r--r--ctru-sys/src/ipc.rs10
-rw-r--r--ctru-sys/src/lib.rs38
-rw-r--r--ctru-sys/src/lock.rs33
-rw-r--r--ctru-sys/src/os.rs53
-rw-r--r--ctru-sys/src/sdmc.rs7
-rw-r--r--ctru-sys/src/services/ac.rs8
-rw-r--r--ctru-sys/src/services/am.rs49
-rw-r--r--ctru-sys/src/services/apt.rs169
-rw-r--r--ctru-sys/src/services/cam.rs410
-rw-r--r--ctru-sys/src/services/cfgnor.rs14
-rw-r--r--ctru-sys/src/services/cfgu.rs46
-rw-r--r--ctru-sys/src/services/dsp.rs48
-rw-r--r--ctru-sys/src/services/fs.rs536
-rw-r--r--ctru-sys/src/services/gspgpu.rs120
-rw-r--r--ctru-sys/src/services/gsplcd.rs17
-rw-r--r--ctru-sys/src/services/hb.rs13
-rw-r--r--ctru-sys/src/services/hid.rs110
-rw-r--r--ctru-sys/src/services/httpc.rs79
-rw-r--r--ctru-sys/src/services/ir.rs21
-rw-r--r--ctru-sys/src/services/irrst.rs21
-rw-r--r--ctru-sys/src/services/mic.rs42
-rw-r--r--ctru-sys/src/services/mod.rs27
-rw-r--r--ctru-sys/src/services/mvd.rs67
-rw-r--r--ctru-sys/src/services/news.rs11
-rw-r--r--ctru-sys/src/services/ns.rs9
-rw-r--r--ctru-sys/src/services/pm.rs24
-rw-r--r--ctru-sys/src/services/ps.rs46
-rw-r--r--ctru-sys/src/services/ptmsysm.rs7
-rw-r--r--ctru-sys/src/services/ptmu.rs11
-rw-r--r--ctru-sys/src/services/qtm.rs44
-rw-r--r--ctru-sys/src/services/soc.rs7
-rw-r--r--ctru-sys/src/services/srvpm.rs12
-rw-r--r--ctru-sys/src/services/y2r.rs185
-rw-r--r--ctru-sys/src/srv.rs15
-rw-r--r--ctru-sys/src/svc.rs450
-rw-r--r--ctru-sys/src/synchronization.rs19
-rw-r--r--ctru-sys/src/thread.rs19
-rw-r--r--ctru-sys/src/types.rs35
-rw-r--r--ctru-sys/src/vram.rs10
48 files changed, 4060 insertions, 0 deletions
diff --git a/ctru-sys/src/console.rs b/ctru-sys/src/console.rs
new file mode 100644
index 0000000..4d0c0e0
--- /dev/null
+++ b/ctru-sys/src/console.rs
@@ -0,0 +1,63 @@
+use 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 = 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,
+ pub cursorX: i32,
+ pub cursorY: i32,
+ pub prevCursorX: i32,
+ pub prevCursorY: i32,
+ pub consoleWidth: i32,
+ pub consoleHeight: i32,
+ pub windowX: i32,
+ pub windowY: i32,
+ pub windowWidth: i32,
+ pub windowHeight: i32,
+ pub tabSize: i32,
+ pub fg: i32,
+ pub bg: i32,
+ pub flags: i32,
+ pub PrintChar: ConsolePrint,
+ pub consoleInitialised: u8,
+}
+
+pub const CONSOLE_COLOR_BOLD: i32 = 1;
+pub const CONSOLE_COLOR_FAINT: i32 = 2;
+pub const CONSOLE_ITALIC: i32 = 4;
+pub const CONSOLE_UNDERLINE: i32 = 8;
+pub const CONSOLE_BLINK_SLOW: i32 = 16;
+pub const CONSOLE_BLINK_FAST: i32 = 32;
+pub const CONSOLE_COLOR_REVERSE: i32 = 64;
+pub const CONSOLE_CONCEAL: i32 = 128;
+
+#[repr(C)]
+pub enum debugDevice {
+ NULL = 0,
+ _3DMOO = 1,
+ CONSOLE = 2,
+}
+
+
+extern "C" {
+ pub fn consoleSetFont(console: *mut PrintConsole, font: *mut ConsoleFont) -> ();
+ pub fn consoleSetWindow(console: *mut PrintConsole, x: i32, y: i32, width: i32, height: i32) -> ();
+ pub fn consoleGetDefault() -> *mut PrintConsole;
+ pub fn consoleSelect(console: *mut PrintConsole) -> *mut PrintConsole;
+ pub fn consoleInit(screen: gfxScreen_t, console: *mut PrintConsole) -> *mut PrintConsole;
+ pub fn consoleDebugInit(device: debugDevice) -> ();
+ pub fn consoleClear() -> ();
+}
diff --git a/ctru-sys/src/env.rs b/ctru-sys/src/env.rs
new file mode 100644
index 0000000..2de21e4
--- /dev/null
+++ b/ctru-sys/src/env.rs
@@ -0,0 +1,14 @@
+//TODO: There are a bunch of static inline functions that bindgen didn't pick up and idk how they work
+
+use ::Handle;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ RUNFLAG_APTWORKAROUND = 1,
+ RUNFLAG_APTREINIT = 2,
+}
+
+extern "C" {
+ pub fn envGetHandle(name: *const u8) -> Handle;
+}
diff --git a/ctru-sys/src/gfx.rs b/ctru-sys/src/gfx.rs
new file mode 100644
index 0000000..1af87ee
--- /dev/null
+++ b/ctru-sys/src/gfx.rs
@@ -0,0 +1,48 @@
+use services::gspgpu::*;
+
+#[inline]
+pub fn RGB565(r: u32, g: u32, b: u32) -> u32 {
+ (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
+}
+
+#[inline]
+pub fn RGB8_to_565(r: u32, g: u32, b: u32) -> u32 {
+ (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
+}
+
+#[repr(C)]
+pub enum gfxScreen_t {
+ GFX_TOP = 0,
+ GFX_BOTTOM = 1
+}
+
+#[repr(C)]
+pub enum gfx3dSide_t {
+ GFX_LEFT = 0,
+ GFX_RIGHT = 1
+}
+
+extern "C" {
+ pub static mut gfxTopLeftFramebuffers: [*mut u8; 2usize];
+ pub static mut gfxTopRightFramebuffers: [*mut u8; 2usize];
+ pub static mut gfxBottomFramebuffers: [*mut u8; 2usize];
+
+ pub fn gfxInitDefault();
+ pub fn gfxInit(topFormat: GSPGPU_FramebufferFormats,
+ bottomFormat: GSPGPU_FramebufferFormats, vrambuffers: u8);
+ pub fn gfxExit();
+ pub fn gfxSet3D(enable: u8);
+ pub fn gfxIs3D() -> u8;
+ pub fn gfxSetScreenFormat(screen: gfxScreen_t,
+ format: GSPGPU_FramebufferFormats);
+ pub fn gfxGetScreenFormat(screen: gfxScreen_t)
+ -> GSPGPU_FramebufferFormats;
+ pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8);
+ pub fn gfxFlushBuffers();
+ pub fn gfxConfigScreen(scr: gfxScreen_t, immediate: u8);
+ pub fn gfxSwapBuffers();
+ pub fn gfxSwapBuffersGpu();
+ pub fn gfxGetFramebuffer(screen: gfxScreen_t, side: gfx3dSide_t,
+ width: *mut u16, height: *mut u16) -> *mut u8;
+
+}
diff --git a/ctru-sys/src/gpu/gpu.rs b/ctru-sys/src/gpu/gpu.rs
new file mode 100644
index 0000000..30e7a03
--- /dev/null
+++ b/ctru-sys/src/gpu/gpu.rs
@@ -0,0 +1,26 @@
+/* automatically generated by rust-bindgen */
+
+#[inline]
+pub fn GPUCMD_HEADER(incremental: u32, mask: u32, reg: u32) -> u32{
+ (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF))
+}
+
+extern "C" {
+ pub static mut gpuCmdBuf: *mut u32;
+ pub static mut gpuCmdBufSize: u32;
+ pub static mut gpuCmdBufOffset: u32;
+
+ pub fn GPUCMD_SetBuffer(adr: *mut u32, size: u32, offset: u32);
+ pub fn GPUCMD_SetBufferOffset(offset: u32);
+ pub fn GPUCMD_GetBuffer(adr: *mut *mut u32, size: *mut u32,
+ offset: *mut u32);
+ pub fn GPUCMD_AddRawCommands(cmd: *mut u32, size: u32);
+ pub fn GPUCMD_Run();
+ pub fn GPUCMD_FlushAndRun();
+ pub fn GPUCMD_Add(header: u32, param: *mut u32, paramlength: u32);
+ pub fn GPUCMD_Finalize();
+ pub fn f32tof16(f: f32) -> u32;
+ pub fn f32tof20(f: f32) -> u32;
+ pub fn f32tof24(f: f32) -> u32;
+ pub fn f32tof31(f: f32) -> u32;
+}
diff --git a/ctru-sys/src/gpu/gx.rs b/ctru-sys/src/gpu/gx.rs
new file mode 100644
index 0000000..69eeddf
--- /dev/null
+++ b/ctru-sys/src/gpu/gx.rs
@@ -0,0 +1,94 @@
+use ::Result;
+
+#[inline]
+pub fn GX_BUFFER_DIM(w: u32, h: u32) {
+ (((h)<<16)|((w)&0xFFFF));
+}
+
+#[repr(C)]
+pub enum GX_TRANSFER_FORMAT
+{
+ GX_TRANSFER_FMT_RGBA8 = 0,
+ GX_TRANSFER_FMT_RGB8 = 1,
+ GX_TRANSFER_FMT_RGB565 = 2,
+ GX_TRANSFER_FMT_RGB5A1 = 3,
+ GX_TRANSFER_FMT_RGBA4 = 4,
+}
+
+#[repr(C)]
+pub enum GX_TRANSFER_SCALE
+{
+ GX_TRANSFER_SCALE_NO = 0,
+ GX_TRANSFER_SCALE_X = 1,
+ GX_TRANSFER_SCALE_Y = 2,
+}
+
+#[repr(C)]
+pub enum GX_FILL_CONTROL {
+ GX_FILL_TRIGGER = 0x001,
+ GX_FILL_FINISHED = 0x002,
+ GX_FILL_16BIT_DEPTH = 0x000,
+ GX_FILL_24BIT_DEPTH = 0x100,
+ GX_FILL_32BIT_DEPTH = 0x200,
+}
+
+#[inline]
+pub fn GX_TRANSFER_FLIP_VERT(x: i32) {
+ ((x)<<0);
+}
+
+#[inline]
+pub fn GX_TRANSFER_OUT_TILED(x: i32) {
+ ((x)<<1);
+}
+
+#[inline]
+pub fn GX_TRANSFER_RAW_COPY(x: i32) {
+ ((x)<<3);
+}
+
+#[inline]
+pub fn GX_TRANSFER_IN_FORMAT(x: i32) {
+ ((x)<<8);
+}
+
+#[inline]
+pub fn GX_TRANSFER_OUT_FORMAT(x: i32) {
+ ((x)<<12);
+}
+
+#[inline]
+pub fn GX_TRANSFER_SCALING(x: i32) {
+ ((x)<<24);
+}
+
+#[inline]
+pub fn GX_CMDLIST_BIT0() {
+ (1u32<<(0));
+}
+
+#[inline]
+pub fn GX_CMNDLIST_FLUSH() {
+ (1u32<<(1));
+}
+
+extern "C" {
+ pub static mut gxCmdBuf: *mut u32;
+
+ pub fn GX_RequestDma(src: *mut u32, dst: *mut u32, length: u32)
+ -> Result;
+ pub fn GX_ProcessCommandList(buf0a: *mut u32, buf0s: u32, flags: u8)
+ -> Result;
+ pub fn GX_MemoryFill(buf0a: *mut u32, buf0v: u32, buf0e: *mut u32,
+ control0: u16, buf1a: *mut u32, buf1v: u32,
+ buf1e: *mut u32, control1: u16) -> Result;
+ pub fn GX_DisplayTransfer(inadr: *mut u32, indim: u32,
+ outadr: *mut u32, outdim: u32, flags: u32)
+ -> Result;
+ pub fn GX_TextureCopy(inadr: *mut u32, indim: u32, outadr: *mut u32,
+ outdim: u32, size: u32, flags: u32) -> Result;
+ pub fn GX_FlushCacheRegions(buf0a: *mut u32, buf0s: u32,
+ buf1a: *mut u32, buf1s: u32,
+ buf2a: *mut u32, buf2s: u32) -> Result;
+}
+
diff --git a/ctru-sys/src/gpu/mod.rs b/ctru-sys/src/gpu/mod.rs
new file mode 100644
index 0000000..2b9cb99
--- /dev/null
+++ b/ctru-sys/src/gpu/mod.rs
@@ -0,0 +1,5 @@
+pub mod gpu;
+pub mod gx;
+pub mod registers;
+pub mod shaderProgram;
+pub mod shbin;
diff --git a/ctru-sys/src/gpu/registers.rs b/ctru-sys/src/gpu/registers.rs
new file mode 100644
index 0000000..98b2a3b
--- /dev/null
+++ b/ctru-sys/src/gpu/registers.rs
@@ -0,0 +1,743 @@
+//Miscellaneous registers (0x000-0x03F)
+pub const GPUREG_0000: i32 = 0x0000;
+pub const GPUREG_0001: i32 = 0x0001;
+pub const GPUREG_0002: i32 = 0x0002;
+pub const GPUREG_0003: i32 = 0x0003;
+pub const GPUREG_0004: i32 = 0x0004;
+pub const GPUREG_0005: i32 = 0x0005;
+pub const GPUREG_0006: i32 = 0x0006;
+pub const GPUREG_0007: i32 = 0x0007;
+pub const GPUREG_0008: i32 = 0x0008;
+pub const GPUREG_0009: i32 = 0x0009;
+pub const GPUREG_000A: i32 = 0x000A;
+pub const GPUREG_000B: i32 = 0x000B;
+pub const GPUREG_000C: i32 = 0x000C;
+pub const GPUREG_000D: i32 = 0x000D;
+pub const GPUREG_000E: i32 = 0x000E;
+pub const GPUREG_000F: i32 = 0x000F;
+pub const GPUREG_FINALIZE: i32 = 0x0010;
+pub const GPUREG_0011: i32 = 0x0011;
+pub const GPUREG_0012: i32 = 0x0012;
+pub const GPUREG_0013: i32 = 0x0013;
+pub const GPUREG_0014: i32 = 0x0014;
+pub const GPUREG_0015: i32 = 0x0015;
+pub const GPUREG_0016: i32 = 0x0016;
+pub const GPUREG_0017: i32 = 0x0017;
+pub const GPUREG_0018: i32 = 0x0018;
+pub const GPUREG_0019: i32 = 0x0019;
+pub const GPUREG_001A: i32 = 0x001A;
+pub const GPUREG_001B: i32 = 0x001B;
+pub const GPUREG_001C: i32 = 0x001C;
+pub const GPUREG_001D: i32 = 0x001D;
+pub const GPUREG_001E: i32 = 0x001E;
+pub const GPUREG_001F: i32 = 0x001F;
+pub const GPUREG_0020: i32 = 0x0020;
+pub const GPUREG_0021: i32 = 0x0021;
+pub const GPUREG_0022: i32 = 0x0022;
+pub const GPUREG_0023: i32 = 0x0023;
+pub const GPUREG_0024: i32 = 0x0024;
+pub const GPUREG_0025: i32 = 0x0025;
+pub const GPUREG_0026: i32 = 0x0026;
+pub const GPUREG_0027: i32 = 0x0027;
+pub const GPUREG_0028: i32 = 0x0028;
+pub const GPUREG_0029: i32 = 0x0029;
+pub const GPUREG_002A: i32 = 0x002A;
+pub const GPUREG_002B: i32 = 0x002B;
+pub const GPUREG_002C: i32 = 0x002C;
+pub const GPUREG_002D: i32 = 0x002D;
+pub const GPUREG_002E: i32 = 0x002E;
+pub const GPUREG_002F: i32 = 0x002F;
+pub const GPUREG_0030: i32 = 0x0030;
+pub const GPUREG_0031: i32 = 0x0031;
+pub const GPUREG_0032: i32 = 0x0032;
+pub const GPUREG_0033: i32 = 0x0033;
+pub const GPUREG_0034: i32 = 0x0034;
+pub const GPUREG_0035: i32 = 0x0035;
+pub const GPUREG_0036: i32 = 0x0036;
+pub const GPUREG_0037: i32 = 0x0037;
+pub const GPUREG_0038: i32 = 0x0038;
+pub const GPUREG_0039: i32 = 0x0039;
+pub const GPUREG_003A: i32 = 0x003A;
+pub const GPUREG_003B: i32 = 0x003B;
+pub const GPUREG_003C: i32 = 0x003C;
+pub const GPUREG_003D: i32 = 0x003D;
+pub const GPUREG_003E: i32 = 0x003E;
+pub const GPUREG_003F: i32 = 0x003F;
+
+//Rasterizer registers (0x040-0x07F)
+pub const GPUREG_FACECULLING_CONFIG: i32 = 0x0040;
+pub const GPUREG_0041: i32 = 0x0041;
+pub const GPUREG_0042: i32 = 0x0042;
+pub const GPUREG_0043: i32 = 0x0043;
+pub const GPUREG_0044: i32 = 0x0044;
+pub const GPUREG_0045: i32 = 0x0045;
+pub const GPUREG_0046: i32 = 0x0046;
+pub const GPUREG_0047: i32 = 0x0047;
+pub const GPUREG_0048: i32 = 0x0048;
+pub const GPUREG_0049: i32 = 0x0049;
+pub const GPUREG_004A: i32 = 0x004A;
+pub const GPUREG_004B: i32 = 0x004B;
+pub const GPUREG_004C: i32 = 0x004C;
+pub const GPUREG_DEPTHMAP_SCALE: i32 = 0x004D;
+pub const GPUREG_DEPTHMAP_OFFSET: i32 = 0x004E;
+pub const GPUREG_SH_OUTMAP_TOTAL: i32 = 0x004F;
+pub const GPUREG_SH_OUTMAP_O0: i32 = 0x0050;
+pub const GPUREG_SH_OUTMAP_O1: i32 = 0x0051;
+pub const GPUREG_SH_OUTMAP_O2: i32 = 0x0052;
+pub const GPUREG_SH_OUTMAP_O3: i32 = 0x0053;
+pub const GPUREG_SH_OUTMAP_O4: i32 = 0x0054;
+pub const GPUREG_SH_OUTMAP_O5: i32 = 0x0055;
+pub const GPUREG_SH_OUTMAP_O6: i32 = 0x0056;
+pub const GPUREG_0057: i32 = 0x0057;
+pub const GPUREG_0058: i32 = 0x0058;
+pub const GPUREG_0059: i32 = 0x0059;
+pub const GPUREG_005A: i32 = 0x005A;
+pub const GPUREG_005B: i32 = 0x005B;
+pub const GPUREG_005C: i32 = 0x005C;
+pub const GPUREG_005D: i32 = 0x005D;
+pub const GPUREG_005E: i32 = 0x005E;
+pub const GPUREG_005F: i32 = 0x005F;
+pub const GPUREG_0060: i32 = 0x0060;
+pub const GPUREG_0061: i32 = 0x0061;
+pub const GPUREG_0062: i32 = 0x0062;
+pub const GPUREG_0063: i32 = 0x0063;
+pub const GPUREG_0064: i32 = 0x0064;
+pub const GPUREG_SCISSORTEST_MODE: i32 = 0x0065;
+pub const GPUREG_SCISSORTEST_POS: i32 = 0x0066;
+pub const GPUREG_SCISSORTEST_DIM: i32 = 0x0067;
+pub const GPUREG_0068: i32 = 0x0068;
+pub const GPUREG_0069: i32 = 0x0069;
+pub const GPUREG_006A: i32 = 0x006A;
+pub const GPUREG_006B: i32 = 0x006B;
+pub const GPUREG_006C: i32 = 0x006C;
+pub const GPUREG_006D: i32 = 0x006D;
+pub const GPUREG_006E: i32 = 0x006E;
+pub const GPUREG_006F: i32 = 0x006F;
+pub const GPUREG_0070: i32 = 0x0070;
+pub const GPUREG_0071: i32 = 0x0071;
+pub const GPUREG_0072: i32 = 0x0072;
+pub const GPUREG_0073: i32 = 0x0073;
+pub const GPUREG_0074: i32 = 0x0074;
+pub const GPUREG_0075: i32 = 0x0075;
+pub const GPUREG_0076: i32 = 0x0076;
+pub const GPUREG_0077: i32 = 0x0077;
+pub const GPUREG_0078: i32 = 0x0078;
+pub const GPUREG_0079: i32 = 0x0079;
+pub const GPUREG_007A: i32 = 0x007A;
+pub const GPUREG_007B: i32 = 0x007B;
+pub const GPUREG_007C: i32 = 0x007C;
+pub const GPUREG_007D: i32 = 0x007D;
+pub const GPUREG_007E: i32 = 0x007E;
+pub const GPUREG_007F: i32 = 0x007F;
+
+//Texturing registers (0x080-0x0FF)
+pub const GPUREG_TEXUNITS_CONFIG: i32 = 0x0080;
+pub const GPUREG_0081: i32 = 0x0081;
+pub const GPUREG_TEXUNIT0_DIM: i32 = 0x0082;
+pub const GPUREG_TEXUNIT0_PARAM: i32 = 0x0083;
+pub const GPUREG_0084: i32 = 0x0084;
+pub const GPUREG_TEXUNIT0_LOC: i32 = 0x0085;
+pub const GPUREG_0086: i32 = 0x0086;
+pub const GPUREG_0087: i32 = 0x0087;
+pub const GPUREG_0088: i32 = 0x0088;
+pub const GPUREG_0089: i32 = 0x0089;
+pub const GPUREG_008A: i32 = 0x008A;
+pub const GPUREG_008B: i32 = 0x008B;
+pub const GPUREG_008C: i32 = 0x008C;
+pub const GPUREG_008D: i32 = 0x008D;
+pub const GPUREG_TEXUNIT0_TYPE: i32 = 0x008E;
+pub const GPUREG_008F: i32 = 0x008F;
+pub const GPUREG_0090: i32 = 0x0090;
+pub const GPUREG_0091: i32 = 0x0091;
+pub const GPUREG_TEXUNIT1_DIM: i32 = 0x0092;
+pub const GPUREG_TEXUNIT1_PARAM: i32 = 0x0093;
+pub const GPUREG_0094: i32 = 0x0094;
+pub const GPUREG_TEXUNIT1_LOC: i32 = 0x0095;
+pub const GPUREG_TEXUNIT1_TYPE: i32 = 0x0096;
+pub const GPUREG_0097: i32 = 0x0097;
+pub const GPUREG_0098: i32 = 0x0098;
+pub const GPUREG_0099: i32 = 0x0099;
+pub const GPUREG_TEXUNIT2_DIM: i32 = 0x009A;
+pub const GPUREG_TEXUNIT2_PARAM: i32 = 0x009B;
+pub const GPUREG_009C: i32 = 0x009C;
+pub const GPUREG_TEXUNIT2_LOC: i32 = 0x009D;
+pub const GPUREG_TEXUNIT2_TYPE: i32 = 0x009E;
+pub const GPUREG_009F: i32 = 0x009F;
+pub const GPUREG_00A0: i32 = 0x00A0;
+pub const GPUREG_00A1: i32 = 0x00A1;
+pub const GPUREG_00A2: i32 = 0x00A2;
+pub const GPUREG_00A3: i32 = 0x00A3;
+pub const GPUREG_00A4: i32 = 0x00A4;
+pub const GPUREG_00A5: i32 = 0x00A5;
+pub const GPUREG_00A6: i32 = 0x00A6;
+pub const GPUREG_00A7: i32 = 0x00A7;
+pub const GPUREG_00A8: i32 = 0x00A8;
+pub const GPUREG_00A9: i32 = 0x00A9;
+pub const GPUREG_00AA: i32 = 0x00AA;
+pub const GPUREG_00AB: i32 = 0x00AB;
+pub const GPUREG_00AC: i32 = 0x00AC;
+pub const GPUREG_00AD: i32 = 0x00AD;
+pub const GPUREG_00AE: i32 = 0x00AE;
+pub const GPUREG_00AF: i32 = 0x00AF;
+pub const GPUREG_00B0: i32 = 0x00B0;
+pub const GPUREG_00B1: i32 = 0x00B1;
+pub const GPUREG_00B2: i32 = 0x00B2;
+pub const GPUREG_00B3: i32 = 0x00B3;
+pub const GPUREG_00B4: i32 = 0x00B4;
+pub const GPUREG_00B5: i32 = 0x00B5;
+pub const GPUREG_00B6: i32 = 0x00B6;
+pub const GPUREG_00B7: i32 = 0x00B7;
+pub const GPUREG_00B8: i32 = 0x00B8;
+pub const GPUREG_00B9: i32 = 0x00B9;
+pub const GPUREG_00BA: i32 = 0x00BA;
+pub const GPUREG_00BB: i32 = 0x00BB;
+pub const GPUREG_00BC: i32 = 0x00BC;
+pub const GPUREG_00BD: i32 = 0x00BD;
+pub const GPUREG_00BE: i32 = 0x00BE;
+pub const GPUREG_00BF: i32 = 0x00BF;
+pub const GPUREG_TEXENV0_CONFIG0: i32 = 0x00C0;
+pub const GPUREG_TEXENV0_CONFIG1: i32 = 0x00C1;
+pub const GPUREG_TEXENV0_CONFIG2: i32 = 0x00C2;
+pub const GPUREG_TEXENV0_CONFIG3: i32 = 0x00C3;
+pub const GPUREG_TEXENV0_CONFIG4: i32 = 0x00C4;
+pub const GPUREG_00C5: i32 = 0x00C5;
+pub const GPUREG_00C6: i32 = 0x00C6;
+pub const GPUREG_00C7: i32 = 0x00C7;
+pub const GPUREG_TEXENV1_CONFIG0: i32 = 0x00C8;
+pub const GPUREG_TEXENV1_CONFIG1: i32 = 0x00C9;
+pub const GPUREG_TEXENV1_CONFIG2: i32 = 0x00CA;
+pub const GPUREG_TEXENV1_CONFIG3: i32 = 0x00CB;
+pub const GPUREG_TEXENV1_CONFIG4: i32 = 0x00CC;
+pub const GPUREG_00CD: i32 = 0x00CD;
+pub const GPUREG_00CE: i32 = 0x00CE;
+pub const GPUREG_00CF: i32 = 0x00CF;
+pub const GPUREG_TEXENV2_CONFIG0: i32 = 0x00D0;
+pub const GPUREG_TEXENV2_CONFIG1: i32 = 0x00D1;
+pub const GPUREG_TEXENV2_CONFIG2: i32 = 0x00D2;
+pub const GPUREG_TEXENV2_CONFIG3: i32 = 0x00D3;
+pub const GPUREG_TEXENV2_CONFIG4: i32 = 0x00D4;
+pub const GPUREG_00D5: i32 = 0x00D5;
+pub const GPUREG_00D6: i32 = 0x00D6;
+pub const GPUREG_00D7: i32 = 0x00D7;
+pub const GPUREG_TEXENV3_CONFIG0: i32 = 0x00D8;
+pub const GPUREG_TEXENV3_CONFIG1: i32 = 0x00D9;
+pub const GPUREG_TEXENV3_CONFIG2: i32 = 0x00DA;
+pub const GPUREG_TEXENV3_CONFIG3: i32 = 0x00DB;
+pub const GPUREG_TEXENV3_CONFIG4: i32 = 0x00DC;
+pub const GPUREG_00DD: i32 = 0x00DD;
+pub const GPUREG_00DE: i32 = 0x00DE;
+pub const GPUREG_00DF: i32 = 0x00DF;
+pub const GPUREG_00E0: i32 = 0x00E0;
+pub const GPUREG_00E1: i32 = 0x00E1;
+pub const GPUREG_00E2: i32 = 0x00E2;
+pub const GPUREG_00E3: i32 = 0x00E3;
+pub const GPUREG_00E4: i32 = 0x00E4;
+pub const GPUREG_00E5: i32 = 0x00E5;
+pub const GPUREG_00E6: i32 = 0x00E6;
+pub const GPUREG_00E7: i32 = 0x00E7;
+pub const GPUREG_00E8: i32 = 0x00E8;
+pub const GPUREG_00E9: i32 = 0x00E9;
+pub const GPUREG_00EA: i32 = 0x00EA;
+pub const GPUREG_00EB: i32 = 0x00EB;
+pub const GPUREG_00EC: i32 = 0x00EC;
+pub const GPUREG_00ED: i32 = 0x00ED;
+pub const GPUREG_00EE: i32 = 0x00EE;
+pub const GPUREG_00EF: i32 = 0x00EF;
+pub const GPUREG_TEXENV4_CONFIG0: i32 = 0x00F0;
+pub const GPUREG_TEXENV4_CONFIG1: i32 = 0x00F1;
+pub const GPUREG_TEXENV4_CONFIG2: i32 = 0x00F2;
+pub const GPUREG_TEXENV4_CONFIG3: i32 = 0x00F3;
+pub const GPUREG_TEXENV4_CONFIG4: i32 = 0x00F4;
+pub const GPUREG_00F5: i32 = 0x00F5;
+pub const GPUREG_00F6: i32 = 0x00F6;
+pub const GPUREG_00F7: i32 = 0x00F7;
+pub const GPUREG_TEXENV5_CONFIG0: i32 = 0x00F8;
+pub const GPUREG_TEXENV5_CONFIG1: i32 = 0x00F9;
+pub const GPUREG_TEXENV5_CONFIG2: i32 = 0x00FA;
+pub const GPUREG_TEXENV5_CONFIG3: i32 = 0x00FB;
+pub const GPUREG_TEXENV5_CONFIG4: i32 = 0x00FC;
+pub const GPUREG_00FD: i32 = 0x00FD;
+pub const GPUREG_00FE: i32 = 0x00FE;
+pub const GPUREG_00FF: i32 = 0x00FF;
+
+//Framebuffer registers (0x100-0x13F)
+pub const GPUREG_COLOROUTPUT_CONFIG: i32 = 0x0100;
+pub const GPUREG_BLEND_CONFIG: i32 = 0x0101;
+pub const GPUREG_COLORLOGICOP_CONFIG: i32 = 0x0102;
+pub const GPUREG_BLEND_COLOR: i32 = 0x0103;
+pub const GPUREG_ALPHATEST_CONFIG: i32 = 0x0104;
+pub const GPUREG_STENCILTEST_CONFIG: i32 = 0x0105;
+pub const GPUREG_STENCILOP_CONFIG: i32 = 0x0106;
+pub const GPUREG_DEPTHTEST_CONFIG: i32 = 0x0107;
+pub const GPUREG_0108: i32 = 0x0108;
+pub const GPUREG_0109: i32 = 0x0109;
+pub const GPUREG_010A: i32 = 0x010A;
+pub const GPUREG_010B: i32 = 0x010B;
+pub const GPUREG_010C: i32 = 0x010C;
+pub const GPUREG_010D: i32 = 0x010D;
+pub const GPUREG_010E: i32 = 0x010E;
+pub const GPUREG_010F: i32 = 0x010F;
+pub const GPUREG_0110: i32 = 0x0110;
+pub const GPUREG_0111: i32 = 0x0111;
+pub const GPUREG_0112: i32 = 0x0112;
+pub const GPUREG_0113: i32 = 0x0113;
+pub const GPUREG_0114: i32 = 0x0114;
+pub const GPUREG_0115: i32 = 0x0115;
+pub const GPUREG_DEPTHBUFFER_FORMAT: i32 = 0x0116;
+pub const GPUREG_COLORBUFFER_FORMAT: i32 = 0x0117;
+pub const GPUREG_0118: i32 = 0x0118;
+pub const GPUREG_0119: i32 = 0x0119;
+pub const GPUREG_011A: i32 = 0x011A;
+pub const GPUREG_011B: i32 = 0x011B;
+pub const GPUREG_DEPTHBUFFER_LOC: i32 = 0x011C;
+pub const GPUREG_COLORBUFFER_LOC: i32 = 0x011D;
+pub const GPUREG_OUTBUFFER_DIM: i32 = 0x011E;
+pub const GPUREG_011F: i32 = 0x011F;
+pub const GPUREG_0120: i32 = 0x0120;
+pub const GPUREG_0121: i32 = 0x0121;
+pub const GPUREG_0122: i32 = 0x0122;
+pub const GPUREG_0123: i32 = 0x0123;
+pub const GPUREG_0124: i32 = 0x0124;
+pub const GPUREG_0125: i32 = 0x0125;
+pub const GPUREG_0126: i32 = 0x0126;
+pub const GPUREG_0127: i32 = 0x0127;
+pub const GPUREG_0128: i32 = 0x0128;
+pub const GPUREG_0129: i32 = 0x0129;
+pub const GPUREG_012A: i32 = 0x012A;
+pub const GPUREG_012B: i32 = 0x012B;
+pub const GPUREG_012C: i32 = 0x012C;
+pub const GPUREG_012D: i32 = 0x012D;
+pub const GPUREG_012E: i32 = 0x012E;
+pub const GPUREG_012F: i32 = 0x012F;
+pub const GPUREG_0130: i32 = 0x0130;
+pub const GPUREG_0131: i32 = 0x0131;
+pub const GPUREG_0132: i32 = 0x0132;
+pub const GPUREG_0133: i32 = 0x0133;
+pub const GPUREG_0134: i32 = 0x0134;
+pub const GPUREG_0135: i32 = 0x0135;
+pub const GPUREG_0136: i32 = 0x0136;
+pub const GPUREG_0137: i32 = 0x0137;
+pub const GPUREG_0138: i32 = 0x0138;
+pub const GPUREG_0139: i32 = 0x0139;
+pub const GPUREG_013A: i32 = 0x013A;
+pub const GPUREG_013B: i32 = 0x013B;
+pub const GPUREG_013C: i32 = 0x013C;
+pub const GPUREG_013D: i32 = 0x013D;
+pub const GPUREG_013E: i32 = 0x013E;
+pub const GPUREG_013F: i32 = 0x013F;
+
+//Fragment lighting registers (0x140-0x1FF)
+pub const GPUREG_0140: i32 = 0x0140;
+pub const GPUREG_0141: i32 = 0x0141;
+pub const GPUREG_0142: i32 = 0x0142;
+pub const GPUREG_0143: i32 = 0x0143;
+pub const GPUREG_0144: i32 = 0x0144;
+pub const GPUREG_0145: i32 = 0x0145;
+pub const GPUREG_0146: i32 = 0x0146;
+pub const GPUREG_0147: i32 = 0x0147;
+pub const GPUREG_0148: i32 = 0x0148;
+pub const GPUREG_0149: i32 = 0x0149;
+pub const GPUREG_014A: i32 = 0x014A;
+pub const GPUREG_014B: i32 = 0x014B;
+pub const GPUREG_014C: i32 = 0x014C;
+pub const GPUREG_014D: i32 = 0x014D;
+pub const GPUREG_014E: i32 = 0x014E;
+pub const GPUREG_014F: i32 = 0x014F;
+pub const GPUREG_0150: i32 = 0x0150;
+pub const GPUREG_0151: i32 = 0x0151;
+pub const GPUREG_0152: i32 = 0x0152;
+pub const GPUREG_0153: i32 = 0x0153;
+pub const GPUREG_0154: i32 = 0x0154;
+pub const GPUREG_0155: i32 = 0x0155;
+pub const GPUREG_0156: i32 = 0x0156;
+pub const GPUREG_0157: i32 = 0x0157;
+pub const GPUREG_0158: i32 = 0x0158;
+pub const GPUREG_0159: i32 = 0x0159;
+pub const GPUREG_015A: i32 = 0x015A;
+pub const GPUREG_015B: i32 = 0x015B;
+pub const GPUREG_015C: i32 = 0x015C;
+pub const GPUREG_015D: i32 = 0x015D;
+pub const GPUREG_015E: i32 = 0x015E;
+pub const GPUREG_015F: i32 = 0x015F;
+pub const GPUREG_0160: i32 = 0x0160;
+pub const GPUREG_0161: i32 = 0x0161;
+pub const GPUREG_0162: i32 = 0x0162;
+pub const GPUREG_0163: i32 = 0x0163;
+pub const GPUREG_0164: i32 = 0x0164;
+pub const GPUREG_0165: i32 = 0x0165;
+pub const GPUREG_0166: i32 = 0x0166;
+pub const GPUREG_0167: i32 = 0x0167;
+pub const GPUREG_0168: i32 = 0x0168;
+pub const GPUREG_0169: i32 = 0x0169;
+pub const GPUREG_016A: i32 = 0x016A;
+pub const GPUREG_016B: i32 = 0x016B;
+pub const GPUREG_016C: i32 = 0x016C;
+pub const GPUREG_016D: i32 = 0x016D;
+pub const GPUREG_016E: i32 = 0x016E;
+pub const GPUREG_016F: i32 = 0x016F;
+pub const GPUREG_0170: i32 = 0x0170;
+pub const GPUREG_0171: i32 = 0x0171;
+pub const GPUREG_0172: i32 = 0x0172;
+pub const GPUREG_0173: i32 = 0x0173;
+pub const GPUREG_0174: i32 = 0x0174;
+pub const GPUREG_0175: i32 = 0x0175;
+pub const GPUREG_0176: i32 = 0x0176;
+pub const GPUREG_0177: i32 = 0x0177;
+pub const GPUREG_0178: i32 = 0x0178;
+pub const GPUREG_0179: i32 = 0x0179;
+pub const GPUREG_017A: i32 = 0x017A;
+pub const GPUREG_017B: i32 = 0x017B;
+pub const GPUREG_017C: i32 = 0x017C;
+pub const GPUREG_017D: i32 = 0x017D;
+pub const GPUREG_017E: i32 = 0x017E;
+pub const GPUREG_017F: i32 = 0x017F;
+pub const GPUREG_0180: i32 = 0x0180;
+pub const GPUREG_0181: i32 = 0x0181;
+pub const GPUREG_0182: i32 = 0x0182;
+pub const GPUREG_0183: i32 = 0x0183;
+pub const GPUREG_0184: i32 = 0x0184;
+pub const GPUREG_0185: i32 = 0x0185;
+pub const GPUREG_0186: i32 = 0x0186;
+pub const GPUREG_0187: i32 = 0x0187;
+pub const GPUREG_0188: i32 = 0x0188;
+pub const GPUREG_0189: i32 = 0x0189;
+pub const GPUREG_018A: i32 = 0x018A;
+pub const GPUREG_018B: i32 = 0x018B;
+pub const GPUREG_018C: i32 = 0x018C;
+pub const GPUREG_018D: i32 = 0x018D;
+pub const GPUREG_018E: i32 = 0x018E;
+pub const GPUREG_018F: i32 = 0x018F;
+pub const GPUREG_0190: i32 = 0x0190;
+pub const GPUREG_0191: i32 = 0x0191;
+pub const GPUREG_0192: i32 = 0x0192;
+pub const GPUREG_0193: i32 = 0x0193;
+pub const GPUREG_0194: i32 = 0x0194;
+pub const GPUREG_0195: i32 = 0x0195;
+pub const GPUREG_0196: i32 = 0x0196;
+pub const GPUREG_0197: i32 = 0x0197;
+pub const GPUREG_0198: i32 = 0x0198;
+pub const GPUREG_0199: i32 = 0x0199;
+pub const GPUREG_019A: i32 = 0x019A;
+pub const GPUREG_019B: i32 = 0x019B;
+pub const GPUREG_019C: i32 = 0x019C;
+pub const GPUREG_019D: i32 = 0x019D;
+pub const GPUREG_019E: i32 = 0x019E;
+pub const GPUREG_019F: i32 = 0x019F;
+pub const GPUREG_01A0: i32 = 0x01A0;
+pub const GPUREG_01A1: i32 = 0x01A1;
+pub const GPUREG_01A2: i32 = 0x01A2;
+pub const GPUREG_01A3: i32 = 0x01A3;
+pub const GPUREG_01A4: i32 = 0x01A4;
+pub const GPUREG_01A5: i32 = 0x01A5;
+pub const GPUREG_01A6: i32 = 0x01A6;
+pub const GPUREG_01A7: i32 = 0x01A7;
+pub const GPUREG_01A8: i32 = 0x01A8;
+pub const GPUREG_01A9: i32 = 0x01A9;
+pub const GPUREG_01AA: i32 = 0x01AA;
+pub const GPUREG_01AB: i32 = 0x01AB;
+pub const GPUREG_01AC: i32 = 0x01AC;
+pub const GPUREG_01AD: i32 = 0x01AD;
+pub const GPUREG_01AE: i32 = 0x01AE;
+pub const GPUREG_01AF: i32 = 0x01AF;
+pub const GPUREG_01B0: i32 = 0x01B0;
+pub const GPUREG_01B1: i32 = 0x01B1;
+pub const GPUREG_01B2: i32 = 0x01B2;
+pub const GPUREG_01B3: i32 = 0x01B3;
+pub const GPUREG_01B4: i32 = 0x01B4;
+pub const GPUREG_01B5: i32 = 0x01B5;
+pub const GPUREG_01B6: i32 = 0x01B6;
+pub const GPUREG_01B7: i32 = 0x01B7;
+pub const GPUREG_01B8: i32 = 0x01B8;
+pub const GPUREG_01B9: i32 = 0x01B9;
+pub const GPUREG_01BA: i32 = 0x01BA;
+pub const GPUREG_01BB: i32 = 0x01BB;
+pub const GPUREG_01BC: i32 = 0x01BC;
+pub const GPUREG_01BD: i32 = 0x01BD;
+pub const GPUREG_01BE: i32 = 0x01BE;
+pub const GPUREG_01BF: i32 = 0x01BF;
+pub const GPUREG_01C0: i32 = 0x01C0;
+pub const GPUREG_01C1: i32 = 0x01C1;
+pub const GPUREG_01C2: i32 = 0x01C2;
+pub const GPUREG_01C3: i32 = 0x01C3;
+pub const GPUREG_01C4: i32 = 0x01C4;
+pub const GPUREG_01C5: i32 = 0x01C5;
+pub const GPUREG_01C6: i32 = 0x01C6;
+pub const GPUREG_01C7: i32 = 0x01C7;
+pub const GPUREG_01C8: i32 = 0x01C8;
+pub const GPUREG_01C9: i32 = 0x01C9;
+pub const GPUREG_01CA: i32 = 0x01CA;
+pub const GPUREG_01CB: i32 = 0x01CB;
+pub const GPUREG_01CC: i32 = 0x01CC;
+pub const GPUREG_01CD: i32 = 0x01CD;
+pub const GPUREG_01CE: i32 = 0x01CE;
+pub const GPUREG_01CF: i32 = 0x01CF;
+pub const GPUREG_01D0: i32 = 0x01D0;
+pub const GPUREG_01D1: i32 = 0x01D1;
+pub const GPUREG_01D2: i32 = 0x01D2;
+pub const GPUREG_01D3: i32 = 0x01D3;
+pub const GPUREG_01D4: i32 = 0x01D4;
+pub const GPUREG_01D5: i32 = 0x01D5;
+pub const GPUREG_01D6: i32 = 0x01D6;
+pub const GPUREG_01D7: i32 = 0x01D7;
+pub const GPUREG_01D8: i32 = 0x01D8;
+pub const GPUREG_01D9: i32 = 0x01D9;
+pub const GPUREG_01DA: i32 = 0x01DA;
+pub const GPUREG_01DB: i32 = 0x01DB;
+pub const GPUREG_01DC: i32 = 0x01DC;
+pub const GPUREG_01DD: i32 = 0x01DD;
+pub const GPUREG_01DE: i32 = 0x01DE;
+pub const GPUREG_01DF: i32 = 0x01DF;
+pub const GPUREG_01E0: i32 = 0x01E0;
+pub const GPUREG_01E1: i32 = 0x01E1;
+pub const GPUREG_01E2: i32 = 0x01E2;
+pub const GPUREG_01E3: i32 = 0x01E3;
+pub const GPUREG_01E4: i32 = 0x01E4;
+pub const GPUREG_01E5: i32 = 0x01E5;
+pub const GPUREG_01E6: i32 = 0x01E6;
+pub const GPUREG_01E7: i32 = 0x01E7;
+pub const GPUREG_01E8: i32 = 0x01E8;
+pub const GPUREG_01E9: i32 = 0x01E9;
+pub const GPUREG_01EA: i32 = 0x01EA;
+pub const GPUREG_01EB: i32 = 0x01EB;
+pub const GPUREG_01EC: i32 = 0x01EC;
+pub const GPUREG_01ED: i32 = 0x01ED;
+pub const GPUREG_01EE: i32 = 0x01EE;
+pub const GPUREG_01EF: i32 = 0x01EF;
+pub const GPUREG_01F0: i32 = 0x01F0;
+pub const GPUREG_01F1: i32 = 0x01F1;
+pub const GPUREG_01F2: i32 = 0x01F2;
+pub const GPUREG_01F3: i32 = 0x01F3;
+pub const GPUREG_01F4: i32 = 0x01F4;
+pub const GPUREG_01F5: i32 = 0x01F5;
+pub const GPUREG_01F6: i32 = 0x01F6;
+pub const GPUREG_01F7: i32 = 0x01F7;
+pub const GPUREG_01F8: i32 = 0x01F8;
+pub const GPUREG_01F9: i32 = 0x01F9;
+pub const GPUREG_01FA: i32 = 0x01FA;
+pub const GPUREG_01FB: i32 = 0x01FB;
+pub const GPUREG_01FC: i32 = 0x01FC;
+pub const GPUREG_01FD: i32 = 0x01FD;
+pub const GPUREG_01FE: i32 = 0x01FE;
+pub const GPUREG_01FF: i32 = 0x01FF;
+
+//Geometry pipeline registers (0x200-0x27F)
+pub const GPUREG_ATTRIBBUFFERS_LOC: i32 = 0x0200;
+pub const GPUREG_ATTRIBBUFFERS_FORMAT_LOW: i32 = 0x0201;
+pub const GPUREG_ATTRIBBUFFERS_FORMAT_HIGH: i32 = 0x0202;
+pub const GPUREG_ATTRIBBUFFER0_CONFIG0: i32 = 0x0203;
+pub const GPUREG_ATTRIBBUFFER0_CONFIG1: i32 = 0x0204;
+pub const GPUREG_ATTRIBBUFFER0_CONFIG2: i32 = 0x0205;
+pub const GPUREG_ATTRIBBUFFER1_CONFIG0: i32 = 0x0206;
+pub const GPUREG_ATTRIBBUFFER1_CONFIG1: i32 = 0x0207;
+pub const GPUREG_ATTRIBBUFFER1_CONFIG2: i32 = 0x0208;
+pub const GPUREG_ATTRIBBUFFER2_CONFIG0: i32 = 0x0209;
+pub const GPUREG_ATTRIBBUFFER2_CONFIG1: i32 = 0x020A;
+pub const GPUREG_ATTRIBBUFFER2_CONFIG2: i32 = 0x020B;
+pub const GPUREG_ATTRIBBUFFER3_CONFIG0: i32 = 0x020C;
+pub const GPUREG_ATTRIBBUFFER3_CONFIG1: i32 = 0x020D;
+pub const GPUREG_ATTRIBBUFFER3_CONFIG2: i32 = 0x020E;
+pub const GPUREG_ATTRIBBUFFER4_CONFIG0: i32 = 0x020F;
+pub const GPUREG_ATTRIBBUFFER4_CONFIG1: i32 = 0x0210;
+pub const GPUREG_ATTRIBBUFFER4_CONFIG2: i32 = 0x0211;
+pub const GPUREG_ATTRIBBUFFER5_CONFIG0: i32 = 0x0212;
+pub const GPUREG_ATTRIBBUFFER5_CONFIG1: i32 = 0x0213;
+pub const GPUREG_ATTRIBBUFFER5_CONFIG2: i32 = 0x0214;
+pub const GPUREG_ATTRIBBUFFER6_CONFIG0: i32 = 0x0215;
+pub const GPUREG_ATTRIBBUFFER6_CONFIG1: i32 = 0x0216;
+pub const GPUREG_ATTRIBBUFFER6_CONFIG2: i32 = 0x0217;
+pub const GPUREG_ATTRIBBUFFER7_CONFIG0: i32 = 0x0218;
+pub const GPUREG_ATTRIBBUFFER7_CONFIG1: i32 = 0x0219;
+pub const GPUREG_ATTRIBBUFFER7_CONFIG2: i32 = 0x021A;
+pub const GPUREG_ATTRIBBUFFER8_CONFIG0: i32 = 0x021B;
+pub const GPUREG_ATTRIBBUFFER8_CONFIG1: i32 = 0x021C;
+pub const GPUREG_ATTRIBBUFFER8_CONFIG2: i32 = 0x021D;
+pub const GPUREG_ATTRIBBUFFER9_CONFIG0: i32 = 0x021E;
+pub const GPUREG_ATTRIBBUFFER9_CONFIG1: i32 = 0x021F;
+pub const GPUREG_ATTRIBBUFFER9_CONFIG2: i32 = 0x0220;
+pub const GPUREG_ATTRIBBUFFERA_CONFIG0: i32 = 0x0221;
+pub const GPUREG_ATTRIBBUFFERA_CONFIG1: i32 = 0x0222;
+pub const GPUREG_ATTRIBBUFFERA_CONFIG2: i32 = 0x0223;
+pub const GPUREG_ATTRIBBUFFERB_CONFIG0: i32 = 0x0224;
+pub const GPUREG_ATTRIBBUFFERB_CONFIG1: i32 = 0x0225;
+pub const GPUREG_ATTRIBBUFFERB_CONFIG2: i32 = 0x0226;
+pub const GPUREG_INDEXBUFFER_CONFIG: i32 = 0x0227;
+pub const GPUREG_NUMVERTICES: i32 = 0x0228;
+pub const GPUREG_GEOSTAGE_CONFIG: i32 = 0x0229;
+pub const GPUREG_022A: i32 = 0x022A;
+pub const GPUREG_022B: i32 = 0x022B;
+pub const GPUREG_022C: i32 = 0x022C;
+pub const GPUREG_022D: i32 = 0x022D;
+pub const GPUREG_DRAWARRAYS: i32 = 0x022E;
+pub const GPUREG_DRAWELEMENTS: i32 = 0x022F;
+pub const GPUREG_0230: i32 = 0x0230;
+pub const GPUREG_0231: i32 = 0x0231;
+pub const GPUREG_0232: i32 = 0x0232;
+pub const GPUREG_0233: i32 = 0x0233;
+pub const GPUREG_0234: i32 = 0x0234;
+pub const GPUREG_0235: i32 = 0x0235;
+pub const GPUREG_0236: i32 = 0x0236;
+pub const GPUREG_0237: i32 = 0x0237;
+pub const GPUREG_0238: i32 = 0x0238;
+pub const GPUREG_0239: i32 = 0x0239;
+pub const GPUREG_023A: i32 = 0x023A;
+pub const GPUREG_023B: i32 = 0x023B;
+pub const GPUREG_023C: i32 = 0x023C;
+pub const GPUREG_023D: i32 = 0x023D;
+pub const GPUREG_023E: i32 = 0x023E;
+pub const GPUREG_023F: i32 = 0x023F;
+pub const GPUREG_0240: i32 = 0x0240;
+pub const GPUREG_0241: i32 = 0x0241;
+pub const GPUREG_0242: i32 = 0x0242;
+pub const GPUREG_0243: i32 = 0x0243;
+pub const GPUREG_0244: i32 = 0x0244;
+pub const GPUREG_0245: i32 = 0x0245;
+pub const GPUREG_0246: i32 = 0x0246;
+pub const GPUREG_0247: i32 = 0x0247;
+pub const GPUREG_0248: i32 = 0x0248;
+pub const GPUREG_0249: i32 = 0x0249;
+pub const GPUREG_024A: i32 = 0x024A;
+pub const GPUREG_024B: i32 = 0x024B;
+pub const GPUREG_024C: i32 = 0x024C;
+pub const GPUREG_024D: i32 = 0x024D;
+pub const GPUREG_024E: i32 = 0x024E;
+pub const GPUREG_024F: i32 = 0x024F;
+pub const GPUREG_0250: i32 = 0x0250;
+pub const GPUREG_0251: i32 = 0x0251;
+pub const GPUREG_0252: i32 = 0x0252;
+pub const GPUREG_0253: i32 = 0x0253;
+pub const GPUREG_0254: i32 = 0x0254;
+pub const GPUREG_0255: i32 = 0x0255;
+pub const GPUREG_0256: i32 = 0x0256;
+pub const GPUREG_0257: i32 = 0x0257;
+pub const GPUREG_0258: i32 = 0x0258;
+pub const GPUREG_0259: i32 = 0x0259;
+pub const GPUREG_025A: i32 = 0x025A;
+pub const GPUREG_025B: i32 = 0x025B;
+pub const GPUREG_025C: i32 = 0x025C;
+pub const GPUREG_025D: i32 = 0x025D;
+pub const GPUREG_PRIMITIVE_CONFIG: i32 = 0x025E;
+pub const GPUREG_025F: i32 = 0x025F;
+pub const GPUREG_0260: i32 = 0x0260;
+pub const GPUREG_0261: i32 = 0x0261;
+pub const GPUREG_0262: i32 = 0x0262;
+pub const GPUREG_0263: i32 = 0x0263;
+pub const GPUREG_0264: i32 = 0x0264;
+pub const GPUREG_0265: i32 = 0x0265;
+pub const GPUREG_0266: i32 = 0x0266;
+pub const GPUREG_0267: i32 = 0x0267;
+pub const GPUREG_0268: i32 = 0x0268;
+pub const GPUREG_0269: i32 = 0x0269;
+pub const GPUREG_026A: i32 = 0x026A;
+pub const GPUREG_026B: i32 = 0x026B;
+pub const GPUREG_026C: i32 = 0x026C;
+pub const GPUREG_026D: i32 = 0x026D;
+pub const GPUREG_026E: i32 = 0x026E;
+pub const GPUREG_026F: i32 = 0x026F;
+pub const GPUREG_0270: i32 = 0x0270;
+pub const GPUREG_0271: i32 = 0x0271;
+pub const GPUREG_0272: i32 = 0x0272;
+pub const GPUREG_0273: i32 = 0x0273;
+pub const GPUREG_0274: i32 = 0x0274;
+pub const GPUREG_0275: i32 = 0x0275;
+pub const GPUREG_0276: i32 = 0x0276;
+pub const GPUREG_0277: i32 = 0x0277;
+pub const GPUREG_0278: i32 = 0x0278;
+pub const GPUREG_0279: i32 = 0x0279;
+pub const GPUREG_027A: i32 = 0x027A;
+pub const GPUREG_027B: i32 = 0x027B;
+pub const GPUREG_027C: i32 = 0x027C;
+pub const GPUREG_027D: i32 = 0x027D;
+pub const GPUREG_027E: i32 = 0x027E;
+pub const GPUREG_027F: i32 = 0x027F;
+
+//Geometry shader registers (0x280-0x2AF)
+pub const GPUREG_GSH_BOOLUNIFORM: i32 = 0x0280;
+pub const GPUREG_GSH_INTUNIFORM_I0: i32 = 0x0281;
+pub const GPUREG_GSH_INTUNIFORM_I1: i32 = 0x0282;
+pub const GPUREG_GSH_INTUNIFORM_I2: i32 = 0x0283;
+pub const GPUREG_GSH_INTUNIFORM_I3: i32 = 0x0284;
+pub const GPUREG_0285: i32 = 0x0285;
+pub const GPUREG_0286: i32 = 0x0286;
+pub const GPUREG_0287: i32 = 0x0287;
+pub const GPUREG_0288: i32 = 0x0288;
+pub const GPUREG_GSH_INPUTBUFFER_CONFIG: i32 = 0x0289;
+pub const GPUREG_GSH_ENTRYPOINT: i32 = 0x028A;
+pub const GPUREG_GSH_ATTRIBUTES_PERMUTATION_LOW: i32 = 0x028B;
+pub const GPUREG_GSH_ATTRIBUTES_PERMUTATION_HIGH: i32 = 0x028C;
+pub const GPUREG_GSH_OUTMAP_MASK: i32 = 0x028D;
+pub const GPUREG_028E: i32 = 0x028E;
+pub const GPUREG_GSH_CODETRANSFER_END: i32 = 0x028F;
+pub const GPUREG_GSH_FLOATUNIFORM_CONFIG: i32 = 0x0290;
+pub const GPUREG_GSH_FLOATUNIFORM_DATA: i32 = 0x0291;
+pub const GPUREG_0299: i32 = 0x0299;
+pub const GPUREG_029A: i32 = 0x029A;
+pub const GPUREG_GSH_CODETRANSFER_CONFIG: i32 = 0x029B;
+pub const GPUREG_GSH_CODETRANSFER_DATA: i32 = 0x029C;
+pub const GPUREG_02A4: i32 = 0x02A4;
+pub const GPUREG_GSH_OPDESCS_CONFIG: i32 = 0x02A5;
+pub const GPUREG_GSH_OPDESCS_DATA: i32 = 0x02A6;
+pub const GPUREG_02AE: i32 = 0x02AE;
+pub const GPUREG_02AF: i32 = 0x02AF;
+
+//Vertex shader registers (0x2B0-0x2DF)
+pub const GPUREG_VSH_BOOLUNIFORM: i32 = 0x02B0;
+pub const GPUREG_VSH_INTUNIFORM_I0: i32 = 0x02B1;
+pub const GPUREG_VSH_INTUNIFORM_I1: i32 = 0x02B2;
+pub const GPUREG_VSH_INTUNIFORM_I2: i32 = 0x02B3;
+pub const GPUREG_VSH_INTUNIFORM_I3: i32 = 0x02B4;
+pub const GPUREG_02B5: i32 = 0x02B5;
+pub const GPUREG_02B6: i32 = 0x02B6;
+pub const GPUREG_02B7: i32 = 0x02B7;
+pub const GPUREG_02B8: i32 = 0x02B8;
+pub const GPUREG_VSH_INPUTBUFFER_CONFIG: i32 = 0x02B9;
+pub const GPUREG_VSH_ENTRYPOINT: i32 = 0x02BA;
+pub const GPUREG_VSH_ATTRIBUTES_PERMUTATION_LOW: i32 = 0x02BB;
+pub const GPUREG_VSH_ATTRIBUTES_PERMUTATION_HIGH: i32 = 0x02BC;
+pub const GPUREG_VSH_OUTMAP_MASK: i32 = 0x02BD;
+pub const GPUREG_02BE: i32 = 0x02BE;
+pub const GPUREG_VSH_CODETRANSFER_END: i32 = 0x02BF;
+pub const GPUREG_VSH_FLOATUNIFORM_CONFIG: i32 = 0x02C0;
+pub const GPUREG_VSH_FLOATUNIFORM_DATA: i32 = 0x02C1;
+pub const GPUREG_02C9: i32 = 0x02C9;
+pub const GPUREG_02CA: i32 = 0x02CA;
+pub const GPUREG_VSH_CODETRANSFER_CONFIG: i32 = 0x02CB;
+pub const GPUREG_VSH_CODETRANSFER_DATA: i32 = 0x02CC;
+pub const GPUREG_02D4: i32 = 0x02D4;
+pub const GPUREG_VSH_OPDESCS_CONFIG: i32 = 0x02D5;
+pub const GPUREG_VSH_OPDESCS_DATA: i32 = 0x02D6;
+pub const GPUREG_02DE: i32 = 0x02DE;
+pub const GPUREG_02DF: i32 = 0x02DF;
+
+//Unknown registers (0x2E0-0x2FF)
+pub const GPUREG_02E0: i32 = 0x02E0;
+pub const GPUREG_02E1: i32 = 0x02E1;
+pub const GPUREG_02E2: i32 = 0x02E2;
+pub const GPUREG_02E3: i32 = 0x02E3;
+pub const GPUREG_02E4: i32 = 0x02E4;
+pub const GPUREG_02E5: i32 = 0x02E5;
+pub const GPUREG_02E6: i32 = 0x02E6;
+pub const GPUREG_02E7: i32 = 0x02E7;
+pub const GPUREG_02E8: i32 = 0x02E8;
+pub const GPUREG_02E9: i32 = 0x02E9;
+pub const GPUREG_02EA: i32 = 0x02EA;
+pub const GPUREG_02EB: i32 = 0x02EB;
+pub const GPUREG_02EC: i32 = 0x02EC;
+pub const GPUREG_02ED: i32 = 0x02ED;
+pub const GPUREG_02EE: i32 = 0x02EE;
+pub const GPUREG_02EF: i32 = 0x02EF;
+pub const GPUREG_02F0: i32 = 0x02F0;
+pub const GPUREG_02F1: i32 = 0x02F1;
+pub const GPUREG_02F2: i32 = 0x02F2;
+pub const GPUREG_02F3: i32 = 0x02F3;
+pub const GPUREG_02F4: i32 = 0x02F4;
+pub const GPUREG_02F5: i32 = 0x02F5;
+pub const GPUREG_02F6: i32 = 0x02F6;
+pub const GPUREG_02F7: i32 = 0x02F7;
+pub const GPUREG_02F8: i32 = 0x02F8;
+pub const GPUREG_02F9: i32 = 0x02F9;
+pub const GPUREG_02FA: i32 = 0x02FA;
+pub const GPUREG_02FB: i32 = 0x02FB;
+pub const GPUREG_02FC: i32 = 0x02FC;
+pub const GPUREG_02FD: i32 = 0x02FD;
+pub const GPUREG_02FE: i32 = 0x02FE;
+pub const GPUREG_02FF: i32 = 0x02FF;
diff --git a/ctru-sys/src/gpu/shaderProgram.rs b/ctru-sys/src/gpu/shaderProgram.rs
new file mode 100644
index 0000000..f81f772
--- /dev/null
+++ b/ctru-sys/src/gpu/shaderProgram.rs
@@ -0,0 +1,89 @@
+use ::Result;
+use ::types::*;
+use gpu::shbin::*;
+
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed1 {
+ pub id: u32,
+ pub data: [u32; 3usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed1 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type float24Uniform_s = Struct_Unnamed1;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed2 {
+ pub dvle: *mut DVLE_s,
+ pub boolUniforms: u16,
+ pub boolUniformMask: u16,
+ pub intUniforms: [u32; 4usize],
+ pub float24Uniforms: *mut float24Uniform_s,
+ pub intUniformMask: u8,
+ pub numFloat24Uniforms: u8,
+}
+impl ::core::clone::Clone for Struct_Unnamed2 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed2 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type shaderInstance_s = Struct_Unnamed2;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed3 {
+ pub vertexShader: *mut shaderInstance_s,
+ pub geometryShader: *mut shaderInstance_s,
+ pub geoShaderInputPermutation: [u32; 2usize],
+ pub geoShaderInputStride: u8,
+ pub geoShaderMode: u8,
+}
+impl ::core::clone::Clone for Struct_Unnamed3 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed3 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type shaderProgram_s = Struct_Unnamed3;
+#[derive(Clone, Copy)]
+#[repr(u32)]
+pub enum Enum_Unnamed4 {
+ GSH_NORMAL = 0,
+ GSH_PARTICLE = 1,
+ GSH_SUBDIVISION_LOOP = 2,
+ GSH_SUBDIVISION_CATMULL_CLARK = 3,
+}
+pub type geoShaderMode = Enum_Unnamed4;
+extern "C" {
+ pub fn shaderInstanceInit(si: *mut shaderInstance_s, dvle: *mut DVLE_s)
+ -> Result;
+ pub fn shaderInstanceFree(si: *mut shaderInstance_s) -> Result;
+ pub fn shaderInstanceSetBool(si: *mut shaderInstance_s,
+ id: i32, value: u8)
+ -> Result;
+ pub fn shaderInstanceGetBool(si: *mut shaderInstance_s,
+ id: i32, value: *mut u8)
+ -> Result;
+ pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s,
+ name:
+ *const u8)
+ -> s8;
+ pub fn shaderProgramInit(sp: *mut shaderProgram_s) -> Result;
+ pub fn shaderProgramFree(sp: *mut shaderProgram_s) -> Result;
+ pub fn shaderProgramSetVsh(sp: *mut shaderProgram_s, dvle: *mut DVLE_s)
+ -> Result;
+ pub fn shaderProgramSetGsh(sp: *mut shaderProgram_s, dvle: *mut DVLE_s,
+ stride: u8) -> Result;
+ pub fn shaderProgramSetGshInputPermutation(sp: *mut shaderProgram_s,
+ permutation: u64) -> Result;
+ pub fn shaderProgramSetGshMode(sp: *mut shaderProgram_s,
+ mode: geoShaderMode) -> Result;
+ pub fn shaderProgramConfigure(sp: *mut shaderProgram_s, sendVshCode: u8,
+ sendGshCode: u8) -> Result;
+ pub fn shaderProgramUse(sp: *mut shaderProgram_s) -> Result;
+}
diff --git a/ctru-sys/src/gpu/shbin.rs b/ctru-sys/src/gpu/shbin.rs
new file mode 100644
index 0000000..1c5a453
--- /dev/null
+++ b/ctru-sys/src/gpu/shbin.rs
@@ -0,0 +1,136 @@
+use ::types::*;
+
+#[derive(Clone, Copy)]
+#[repr(u32)]
+pub enum Enum_Unnamed1 {
+ VERTEX_SHDR = 0,
+ GEOMETRY_SHDR = 1,
+}
+pub type DVLE_type = Enum_Unnamed1;
+#[derive(Clone, Copy)]
+#[repr(u32)]
+pub enum Enum_Unnamed2 {
+ DVLE_CONST_BOOL = 0,
+ DVLE_CONST_u8 = 1,
+ DVLE_CONST_FLOAT24 = 2,
+}
+pub type DVLE_constantType = Enum_Unnamed2;
+#[derive(Clone, Copy)]
+#[repr(u32)]
+pub enum Enum_Unnamed3 {
+ RESULT_POSITION = 0,
+ RESULT_NORMALQUAT = 1,
+ RESULT_COLOR = 2,
+ RESULT_TEXCOORD0 = 3,
+ RESULT_TEXCOORD0W = 4,
+ RESULT_TEXCOORD1 = 5,
+ RESULT_TEXCOORD2 = 6,
+ RESULT_VIEW = 8,
+}
+pub type DVLE_outputAttribute_t = Enum_Unnamed3;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed4 {
+ pub codeSize: u32,
+ pub codeData: *mut u32,
+ pub opdescSize: u32,
+ pub opcdescData: *mut u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed4 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed4 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLP_s = Struct_Unnamed4;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed5 {
+ pub _type: u16,
+ pub id: u16,
+ pub data: [u32; 4usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed5 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed5 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLE_constEntry_s = Struct_Unnamed5;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed6 {
+ pub _type: u16,
+ pub regID: u16,
+ pub mask: u8,
+ pub unk: [u8; 3usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed6 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed6 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLE_outEntry_s = Struct_Unnamed6;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed7 {
+ pub symbolOffset: u32,
+ pub startReg: u16,
+ pub endReg: u16,
+}
+impl ::core::clone::Clone for Struct_Unnamed7 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed7 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLE_uniformEntry_s = Struct_Unnamed7;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed8 {
+ pub _type: DVLE_type,
+ pub dvlp: *mut DVLP_s,
+ pub mainOffset: u32,
+ pub endmainOffset: u32,
+ pub constTableSize: u32,
+ pub constTableData: *mut DVLE_constEntry_s,
+ pub outTableSize: u32,
+ pub outTableData: *mut DVLE_outEntry_s,
+ pub uniformTableSize: u32,
+ pub uniformTableData: *mut DVLE_uniformEntry_s,
+ pub symbolTableData: *mut u8,
+ pub outmapMask: u8,
+ pub outmapData: [u32; 8usize],
+ pub outmapMode: u32,
+ pub outmapClock: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed8 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed8 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLE_s = Struct_Unnamed8;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed9 {
+ pub numDVLE: u32,
+ pub DVLP: DVLP_s,
+ pub DVLE: *mut DVLE_s,
+}
+impl ::core::clone::Clone for Struct_Unnamed9 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed9 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DVLB_s = Struct_Unnamed9;
+extern "C" {
+ pub fn DVLB_ParseFile(shbinData: *mut u32, shbinSize: u32)
+ -> *mut DVLB_s;
+ pub fn DVLB_Free(dvlb: *mut DVLB_s);
+ pub fn DVLE_GetUniformRegister(dvle: *mut DVLE_s,
+ name: *const u8) -> s8;
+ pub fn DVLE_GenerateOutmap(dvle: *mut DVLE_s);
+}
diff --git a/ctru-sys/src/ipc.rs b/ctru-sys/src/ipc.rs
new file mode 100644
index 0000000..390022d
--- /dev/null
+++ b/ctru-sys/src/ipc.rs
@@ -0,0 +1,10 @@
+//TODO: Implement static inline functions + solve the anonymous enum enigma
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum IPC_BufferRights {
+ IPC_BUFFER_R = 2,
+ IPC_BUFFER_W = 4,
+ IPC_BUFFER_RW = 6,
+}
+
diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs
new file mode 100644
index 0000000..4b212a5
--- /dev/null
+++ b/ctru-sys/src/lib.rs
@@ -0,0 +1,38 @@
+/*
+ * C bindings generation:
+ * bindgen --sysroot=$DEVKITARM/arm-none-eabi -I$CTRULIB/include $CTRULIB/include/3ds.h
+ */
+
+#![no_std]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(overflowing_literals)]
+
+pub mod console;
+pub mod env;
+pub mod gfx;
+pub mod gpu;
+pub mod ipc;
+pub mod lock;
+pub mod os;
+pub mod sdmc;
+pub mod srv;
+pub mod svc;
+pub mod synchronization;
+pub mod thread;
+pub mod types;
+
+pub mod services;
+
+pub use self::types::*;
+
+pub type Result = i32;
+pub type Handle = u32;
+
+#[repr(u8)]
+pub enum c_void {
+ __variant1,
+ __variant2,
+}
+
+pub type ThreadFunc = Option<extern "C" fn(arg1: *mut c_void) -> ()>;
diff --git a/ctru-sys/src/lock.rs b/ctru-sys/src/lock.rs
new file mode 100644
index 0000000..6a9bd1b
--- /dev/null
+++ b/ctru-sys/src/lock.rs
@@ -0,0 +1,33 @@
+//<sys/lock.h> from devkitArm, needed for synchronization.rs to compile
+
+//TODO: I don't even know this thing looks really spooky
+
+pub type _LOCK_T = i32;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct___lock_t {
+ pub lock: _LOCK_T,
+ pub thread_tag: u32,
+ pub counter: u32,
+}
+impl ::core::clone::Clone for Struct___lock_t {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct___lock_t {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type _LOCK_RECURSIVE_T = Struct___lock_t;
+extern "C" {
+ pub fn __libc_lock_init(lock: *mut _LOCK_T);
+ pub fn __libc_lock_init_recursive(lock: *mut _LOCK_RECURSIVE_T);
+ pub fn __libc_lock_close(lock: *mut _LOCK_T);
+ pub fn __libc_lock_close_recursive(lock: *mut _LOCK_RECURSIVE_T);
+ pub fn __libc_lock_acquire(lock: *mut _LOCK_T);
+ pub fn __libc_lock_acquire_recursive(lock: *mut _LOCK_RECURSIVE_T);
+ pub fn __libc_lock_release(lock: *mut _LOCK_T);
+ pub fn __libc_lock_release_recursive(lock: *mut _LOCK_RECURSIVE_T);
+ pub fn __libc_lock_try_acquire(lock: *mut _LOCK_T)
+ -> i32;
+ pub fn __libc_lock_try_acquire_recursive(lock: *mut _LOCK_RECURSIVE_T)
+ -> i32;
+}
diff --git a/ctru-sys/src/os.rs b/ctru-sys/src/os.rs
new file mode 100644
index 0000000..7dbe3be
--- /dev/null
+++ b/ctru-sys/src/os.rs
@@ -0,0 +1,53 @@
+//TODO: Fix Bindgen's issues again.
+
+use ::Result;
+use types::*;
+
+#[inline]
+pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) {
+ (((major)<<24)|((minor)<<16)|((revision)<<8));
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ MEMREGION_ALL = 0,
+ MEMREGION_APPLICATION = 1,
+ MEMREGION_SYSTEM = 2,
+ MEMREGION_BASE = 3,
+}
+pub type MemRegion = Enum_Unnamed1;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed2 {
+ pub build: u8,
+ pub minor: u8,
+ pub mainver: u8,
+ pub reserved_x3: u8,
+ pub region: u8,
+ pub reserved_x5: [u8; 3usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed2 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed2 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type OS_VersionBin = Struct_Unnamed2;
+extern "C" {
+ pub fn osConvertVirtToPhys(vaddr: *const ::c_void) -> u32;
+ pub fn osConvertOldLINEARMemToNew(vaddr: *const ::c_void)
+ -> *mut ::c_void;
+ pub fn osStrError(error: u32) -> *const u8;
+ pub fn osGetMemRegionUsed(region: MemRegion) -> s64;
+ pub fn osGetTime() -> u64;
+ pub fn osSetSpeedupEnable(enable: u8);
+ pub fn osGetSystemVersionData(nver_versionbin: *mut OS_VersionBin,
+ cver_versionbin: *mut OS_VersionBin)
+ -> Result;
+ pub fn osGetSystemVersionDataString(nver_versionbin: *mut OS_VersionBin,
+ cver_versionbin: *mut OS_VersionBin,
+ sysverstr:
+ *mut u8,
+ sysverstr_maxsize: u32) -> Result;
+}
diff --git a/ctru-sys/src/sdmc.rs b/ctru-sys/src/sdmc.rs
new file mode 100644
index 0000000..ee70839
--- /dev/null
+++ b/ctru-sys/src/sdmc.rs
@@ -0,0 +1,7 @@
+use Result;
+
+
+extern "C" {
+ pub fn sdmcInit() -> Result;
+ pub fn sdmcExit() -> Result;
+}
diff --git a/ctru-sys/src/services/ac.rs b/ctru-sys/src/services/ac.rs
new file mode 100644
index 0000000..f23369f
--- /dev/null
+++ b/ctru-sys/src/services/ac.rs
@@ -0,0 +1,8 @@
+use ::Result;
+
+extern "C" {
+ pub fn acInit() -> Result;
+ pub fn acExit();
+ pub fn acWaitInternetConnection() -> Result;
+ pub fn ACU_GetWifiStatus(out: *mut u32) -> Result;
+}
diff --git a/ctru-sys/src/services/am.rs b/ctru-sys/src/services/am.rs
new file mode 100644
index 0000000..971829e
--- /dev/null
+++ b/ctru-sys/src/services/am.rs
@@ -0,0 +1,49 @@
+use ::{Handle, Result};
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct AM_TitleEntry {
+ pub titleID: u64,
+ pub size: u64,
+ pub version: u16,
+ pub unk: [u8; 6usize],
+}
+
+impl ::core::clone::Clone for AM_TitleEntry {
+ fn clone(&self) -> Self { *self }
+}
+
+impl ::core::default::Default for AM_TitleEntry {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+extern "C" {
+ pub fn amInit() -> Result;
+ pub fn amExit();
+ 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 AM_TitleEntry)
+ -> 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_InstallNativeFirm() -> Result;
+ pub fn AM_InstallFirm(titleID: u64) -> Result;
+ pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64,
+ productCode: *mut u8)
+ -> Result;
+ pub fn AM_GetCiaFileInfo(mediatype: u8, titleEntry: *mut AM_TitleEntry,
+ fileHandle: Handle) -> Result;
+ pub fn AM_InitializeExternalTitleDatabase(overwrite: u8) -> Result;
+ pub fn AM_QueryAvailableExternalTitleDatabase(available: *mut u8)
+ -> Result;
+}
diff --git a/ctru-sys/src/services/apt.rs b/ctru-sys/src/services/apt.rs
new file mode 100644
index 0000000..a6ee0c0
--- /dev/null
+++ b/ctru-sys/src/services/apt.rs
@@ -0,0 +1,169 @@
+use ::{Result, Handle};
+use ::c_void;
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+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_MIIVERSE_POSTING = 0x118,
+ APPID_AMIIBO_SETTINGS = 0x119,
+ APPID_APPLICATION = 0x300, // Application
+ APPID_ESHOP = 0x301,
+ 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
+}
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum APT_AppStatus {
+ APP_NOTINITIALIZED = 0,
+ APP_RUNNING = 1,
+ APP_SUSPENDED = 2,
+ APP_EXITING = 3,
+ APP_SUSPENDING = 4,
+ APP_SLEEPMODE = 5,
+ APP_PREPARE_SLEEPMODE = 6,
+ APP_APPLETSTARTED = 7,
+ APP_APPLETCLOSED = 8,
+}
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum APT_Signal {
+ APTSIGNAL_HOMEBUTTON = 1,
+ APTSIGNAL_PREPARESLEEP = 3,
+ APTSIGNAL_ENTERSLEEP = 5,
+ APTSIGNAL_WAKEUP = 6,
+ APTSIGNAL_ENABLE = 7,
+ APTSIGNAL_POWERBUTTON = 8,
+ APTSIGNAL_UTILITY = 9,
+ APTSIGNAL_SLEEPSYSTEM = 10,
+ APTSIGNAL_ERROR = 11,
+}
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum APT_HookType {
+ APTHOOK_ONSUSPEND = 0,
+ APTHOOK_ONRESTORE = 1,
+ APTHOOK_ONSLEEP = 2,
+ APTHOOK_ONWAKEUP = 3,
+ APTHOOK_ONEXIT = 4,
+ APTHOOK_COUNT = 5,
+}
+
+pub type aptHookFn = Option<unsafe extern "C" fn(hook: APT_HookType, param: *mut c_void)>;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct aptHookCookie {
+ pub next: *mut aptHookCookie,
+ pub callback: aptHookFn,
+ pub param: *mut c_void,
+}
+impl ::core::clone::Clone for aptHookCookie {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for aptHookCookie {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+extern "C" {
+ pub static mut aptEvents: [Handle; 3usize];
+}
+extern "C" {
+ pub fn aptInit() -> Result;
+ pub fn aptExit();
+ pub fn aptOpenSession();
+ pub fn aptCloseSession();
+ pub fn aptSetStatus(status: APT_AppStatus);
+ pub fn aptGetStatus() -> APT_AppStatus;
+ 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 aptHook(cookie: *mut aptHookCookie, callback: aptHookFn,
+ param: *mut c_void);
+ pub fn aptUnhook(cookie: *mut aptHookCookie);
+ pub fn APT_GetLockHandle(flags: u16, lockHandle: *mut Handle) -> Result;
+ pub fn APT_Initialize(appId: NS_APPID, eventHandle1: *mut Handle,
+ eventHandle2: *mut Handle) -> Result;
+ pub fn APT_Finalize(appId: NS_APPID) -> Result;
+ pub fn APT_HardwareResetAsync() -> Result;
+ pub fn APT_Enable(a: u32) -> Result;
+ pub fn APT_GetAppletManInfo(inval: u8, outval8: *mut u8,
+ outval32: *mut u32,
+ menu_appid: *mut NS_APPID,
+ active_appid: *mut NS_APPID) -> Result;
+ pub fn APT_GetAppletInfo(appID: NS_APPID, pProgramID: *mut u64,
+ pMediaType: *mut u8, pRegistered: *mut u8,
+ pLoadState: *mut u8, pAttributes: *mut u32)
+ -> Result;
+ pub fn APT_GetAppletProgramInfo(id: u32, flags: u32,
+ titleversion: *mut u16) -> Result;
+ pub fn APT_GetProgramID(pProgramID: *mut u64) -> Result;
+ pub fn APT_PrepareToJumpToHomeMenu() -> Result;
+ pub fn APT_JumpToHomeMenu(param: *const u8, paramSize: usize,
+ handle: Handle) -> Result;
+ pub fn APT_PrepareToJumpToApplication(a: u32) -> Result;
+ pub fn APT_JumpToApplication(param: *const u8, paramSize: usize,
+ handle: Handle) -> Result;
+ pub fn APT_IsRegistered(appID: NS_APPID, out: *mut u8) -> Result;
+ pub fn APT_InquireNotification(appID: u32, signalType: *mut APT_Signal)
+ -> Result;
+ pub fn APT_NotifyToWait(appID: NS_APPID) -> Result;
+ pub fn APT_AppletUtility(out: *mut u32, a: u32, size1: u32,
+ buf1: *mut u8, size2: u32, buf2: *mut u8)
+ -> Result;
+ pub fn APT_GlanceParameter(appID: NS_APPID, bufferSize: u32,
+ buffer: *mut u32, actualSize: *mut u32,
+ signalType: *mut u8) -> Result;
+ pub fn APT_ReceiveParameter(appID: NS_APPID, bufferSize: u32,
+ buffer: *mut u32, actualSize: *mut u32,
+ signalType: *mut u8) -> Result;
+ pub fn APT_SendParameter(src_appID: NS_APPID, dst_appID: NS_APPID,
+ bufferSize: u32, buffer: *mut u32,
+ paramhandle: Handle, signalType: u8) -> Result;
+ pub fn APT_SendCaptureBufferInfo(bufferSize: u32, buffer: *mut u32)
+ -> Result;
+ pub fn APT_ReplySleepQuery(appID: NS_APPID, a: u32) -> Result;
+ pub fn APT_ReplySleepNotificationComplete(appID: NS_APPID) -> Result;
+ pub fn APT_PrepareToCloseApplication(a: u8) -> Result;
+ pub fn APT_CloseApplication(param: *const u8, paramSize: usize,
+ handle: Handle) -> Result;
+ pub fn APT_SetAppCpuTimeLimit(percent: u32) -> Result;
+ pub fn APT_GetAppCpuTimeLimit(percent: *mut u32) -> Result;
+ pub fn APT_CheckNew3DS_Application(out: *mut u8) -> Result;
+ pub fn APT_CheckNew3DS_System(out: *mut u8) -> Result;
+ pub fn APT_CheckNew3DS(out: *mut u8) -> Result;
+ pub fn APT_PrepareToDoAppJump(flags: u8, programID: u64, mediatype: u8)
+ -> Result;
+ pub fn APT_DoAppJump(NSbuf0Size: u32, NSbuf1Size: u32,
+ NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result;
+ pub fn APT_PrepareToStartLibraryApplet(appID: NS_APPID) -> Result;
+ pub fn APT_StartLibraryApplet(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(appID: NS_APPID) -> Result;
+ pub fn APT_StartSystemApplet(appID: NS_APPID, bufSize: u32,
+ applHandle: Handle, buf: *mut u8) -> Result;
+}
diff --git a/ctru-sys/src/services/cam.rs b/ctru-sys/src/services/cam.rs
new file mode 100644
index 0000000..e9ef4f6
--- /dev/null
+++ b/ctru-sys/src/services/cam.rs
@@ -0,0 +1,410 @@
+// TODO: Determine if anonymous enums are properly represented (they probably aren't)
+
+use ::{Handle, Result};
+use ::c_void;
+use ::types::*;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ PORT_NONE = 0,
+ PORT_CAM1 = 1,
+ PORT_CAM2 = 2,
+ PORT_BOTH = 3,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed2 {
+ SELECT_NONE = 0,
+ SELECT_OUT1 = 1,
+ SELECT_IN1 = 2,
+ SELECT_OUT2 = 4,
+ SELECT_IN1_OUT1 = 3,
+ SELECT_OUT1_OUT2 = 5,
+ SELECT_IN1_OUT2 = 6,
+ SELECT_ALL = 7,
+}
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed3 {
+ CONTEXT_NONE = 0,
+ CONTEXT_A = 1,
+ CONTEXT_B = 2,
+ CONTEXT_BOTH = 3,
+}
+
+pub type CAMU_Context = Enum_Unnamed3;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed4 {
+ FLIP_NONE = 0,
+ FLIP_HORIZONTAL = 1,
+ FLIP_VERTICAL = 2,
+ FLIP_REVERSE = 3,
+}
+pub type CAMU_Flip = Enum_Unnamed4;
+
+pub const SIZE_CTR_BOTTOM_LCD: Enum_Unnamed5 = Enum_Unnamed5::SIZE_QVGA;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed5 {
+ SIZE_VGA = 0,
+ SIZE_QVGA = 1,
+ SIZE_QQVGA = 2,
+ SIZE_CIF = 3,
+ SIZE_QCIF = 4,
+ SIZE_DS_LCD = 5,
+ SIZE_DS_LCDx4 = 6,
+ SIZE_CTR_TOP_LCD = 7,
+}
+pub type CAMU_Size = Enum_Unnamed5;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum CAMU_FrameRate {
+ FRAME_RATE_15 = 0,
+ FRAME_RATE_15_TO_5 = 1,
+ FRAME_RATE_15_TO_2 = 2,
+ FRAME_RATE_10 = 3,
+ FRAME_RATE_8_5 = 4,
+ FRAME_RATE_5 = 5,
+ FRAME_RATE_20 = 6,
+ FRAME_RATE_20_TO_5 = 7,
+ FRAME_RATE_30 = 8,
+ FRAME_RATE_30_TO_5 = 9,
+ FRAME_RATE_15_TO_10 = 10,
+ FRAME_RATE_20_TO_10 = 11,
+ FRAME_RATE_30_TO_10 = 12,
+}
+
+pub const WHITE_BALANCE_NORMAL: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_AUTO;
+pub const WHITE_BALANCE_TUNGSTEN: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_3200K;
+pub const WHITE_BALANCE_WHITE_FLUORESCENT_LIGHT: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_4150K;
+pub const WHITE_BALANCE_DAYLIGHT: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_5200K;
+pub const WHITE_BALANCE_CLOUDY: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_6000K;
+pub const WHITE_BALANCE_HORIZON: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_6000K;
+pub const WHITE_BALANCE_SHADE: Enum_Unnamed7 =
+ Enum_Unnamed7::WHITE_BALANCE_7000K;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed7 {
+ WHITE_BALANCE_AUTO = 0,
+ WHITE_BALANCE_3200K = 1,
+ WHITE_BALANCE_4150K = 2,
+ WHITE_BALANCE_5200K = 3,
+ WHITE_BALANCE_6000K = 4,
+ WHITE_BALANCE_7000K = 5,
+}
+pub type CAMU_WhiteBalance = Enum_Unnamed7;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed8 {
+ PHOTO_MODE_NORMAL = 0,
+ PHOTO_MODE_PORTRAIT = 1,
+ PHOTO_MODE_LANDSCAPE = 2,
+ PHOTO_MODE_NIGHTVIEW = 3,
+ PHOTO_MODE_LETTER = 4,
+}
+pub type CAMU_PhotoMode = Enum_Unnamed8;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed9 {
+ EFFECT_NONE = 0,
+ EFFECT_MONO = 1,
+ EFFECT_SEPIA = 2,
+ EFFECT_NEGATIVE = 3,
+ EFFECT_NEGAFILM = 4,
+ EFFECT_SEPIA01 = 5,
+}
+pub type CAMU_Effect = Enum_Unnamed9;
+pub const CONTRAST_LOW: Enum_Unnamed10 = Enum_Unnamed10::CONTRAST_PATTERN_05;
+pub const CONTRAST_NORMAL: Enum_Unnamed10 =
+ Enum_Unnamed10::CONTRAST_PATTERN_06;
+pub const CONTRAST_HIGH: Enum_Unnamed10 = Enum_Unnamed10::CONTRAST_PATTERN_07;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed10 {
+ CONTRAST_PATTERN_01 = 0,
+ CONTRAST_PATTERN_02 = 1,
+ CONTRAST_PATTERN_03 = 2,
+ CONTRAST_PATTERN_04 = 3,
+ CONTRAST_PATTERN_05 = 4,
+ CONTRAST_PATTERN_06 = 5,
+ CONTRAST_PATTERN_07 = 6,
+ CONTRAST_PATTERN_08 = 7,
+ CONTRAST_PATTERN_09 = 8,
+ CONTRAST_PATTERN_10 = 9,
+ CONTRAST_PATTERN_11 = 10,
+}
+pub type CAMU_Contrast = Enum_Unnamed10;
+pub const LENS_CORRECTION_DARK: Enum_Unnamed11 =
+ Enum_Unnamed11::LENS_CORRECTION_OFF;
+pub const LENS_CORRECTION_NORMAL: Enum_Unnamed11 =
+ Enum_Unnamed11::LENS_CORRECTION_ON_70;
+pub const LENS_CORRECTION_BRIGHT: Enum_Unnamed11 =
+ Enum_Unnamed11::LENS_CORRECTION_ON_90;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed11 {
+ LENS_CORRECTION_OFF = 0,
+ LENS_CORRECTION_ON_70 = 1,
+ LENS_CORRECTION_ON_90 = 2,
+}
+pub type CAMU_LensCorrection = Enum_Unnamed11;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed12 { OUTPUT_YUV_422 = 0, OUTPUT_RGB_565 = 1, }
+pub type CAMU_OutputFormat = Enum_Unnamed12;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed13 {
+ SHUTTER_SOUND_TYPE_NORMAL = 0,
+ SHUTTER_SOUND_TYPE_MOVIE = 1,
+ SHUTTER_SOUND_TYPE_MOVIE_END = 2,
+}
+pub type CAMU_ShutterSoundType = Enum_Unnamed13;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed14 {
+ pub aeBaseTarget: s16,
+ pub kRL: s16,
+ pub kGL: s16,
+ pub kBL: s16,
+ pub ccmPosition: s16,
+ pub awbCcmL9Right: u16,
+ pub awbCcmL9Left: u16,
+ pub awbCcmL10Right: u16,
+ pub awbCcmL10Left: u16,
+ pub awbX0Right: u16,
+ pub awbX0Left: u16,
+}
+impl ::core::clone::Clone for Struct_Unnamed14 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed14 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CAMU_ImageQualityCalibrationData = Struct_Unnamed14;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed15 {
+ pub isValidRotationXY: u8,
+ pub padding: [u8; 3usize],
+ pub scale: f32,
+ pub rotationZ: f32,
+ pub translationX: f32,
+ pub translationY: f32,
+ pub rotationX: f32,
+ pub rotationY: f32,
+ pub angleOfViewRight: f32,
+ pub angleOfViewLeft: f32,
+ pub distanceToChart: f32,
+ pub distanceCameras: f32,
+ pub imageWidth: s16,
+ pub imageHeight: s16,
+ pub reserved: [u8; 16usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed15 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed15 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CAMU_StereoCameraCalibrationData = Struct_Unnamed15;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed16 {
+ pub camera: u8,
+ pub exposure: s8,
+ pub whiteBalance: u8,
+ pub sharpness: s8,
+ pub autoExposureOn: u8,
+ pub autoWhiteBalanceOn: u8,
+ pub frameRate: u8,
+ pub photoMode: u8,
+ pub contrast: u8,
+ pub lensCorrection: u8,
+ pub noiseFilterOn: u8,
+ pub padding: u8,
+ pub autoExposureWindowX: s16,
+ pub autoExposureWindowY: s16,
+ pub autoExposureWindowWidth: s16,
+ pub autoExposureWindowHeight: s16,
+ pub autoWhiteBalanceWindowX: s16,
+ pub autoWhiteBalanceWindowY: s16,
+ pub autoWhiteBalanceWindowWidth: s16,
+ pub autoWhiteBalanceWindowHeight: s16,
+}
+impl ::core::clone::Clone for Struct_Unnamed16 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed16 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CAMU_PackageParameterCameraSelect = Struct_Unnamed16;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed17 {
+ pub camera: u8,
+ pub context: u8,
+ pub flip: u8,
+ pub effect: u8,
+ pub size: u8,
+}
+impl ::core::clone::Clone for Struct_Unnamed17 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed17 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CAMU_PackageParameterContext = Struct_Unnamed17;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed18 {
+ pub camera: u8,
+ pub context: u8,
+ pub flip: u8,
+ pub effect: u8,
+ pub width: s16,
+ pub height: s16,
+ pub cropX0: s16,
+ pub cropY0: s16,
+ pub cropX1: s16,
+ pub cropY1: s16,
+}
+impl ::core::clone::Clone for Struct_Unnamed18 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed18 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CAMU_PackageParameterContextDetail = Struct_Unnamed18;
+
+use services::y2r::Y2RU_StandardCoefficient;
+extern "C" {
+ pub fn camInit() -> Result;
+ pub fn camExit();
+ pub fn CAMU_StartCapture(port: u32) -> Result;
+ pub fn CAMU_StopCapture(port: u32) -> Result;
+ pub fn CAMU_IsBusy(busy: *mut u8, port: u32) -> Result;
+ pub fn CAMU_ClearBuffer(port: u32) -> Result;
+ pub fn CAMU_GetVsyncInterruptEvent(event: *mut Handle, port: u32)
+ -> Result;
+ pub fn CAMU_GetBufferErrorInterruptEvent(event: *mut Handle, port: u32)
+ -> Result;
+ pub fn CAMU_SetReceiving(event: *mut Handle,
+ dst: *mut c_void, port: u32,
+ imageSize: u32, transferUnit: s16) -> Result;
+ pub fn CAMU_IsFinishedReceiving(finishedReceiving: *mut u8, port: u32)
+ -> Result;
+ pub fn CAMU_SetTransferLines(port: u32, lines: s16, width: s16,
+ height: s16) -> Result;
+ pub fn CAMU_GetMaxLines(maxLines: *mut s16, width: s16, height: s16)
+ -> Result;
+ pub fn CAMU_SetTransferBytes(port: u32, bytes: u32, width: s16,
+ height: s16) -> Result;
+ pub fn CAMU_GetTransferBytes(transferBytes: *mut u32, port: u32)
+ -> Result;
+ pub fn CAMU_GetMaxBytes(maxBytes: *mut u32, width: s16, height: s16)
+ -> Result;
+ pub fn CAMU_SetTrimming(port: u32, trimming: u8) -> Result;
+ pub fn CAMU_IsTrimming(trimming: *mut u8, port: u32) -> Result;
+ pub fn CAMU_SetTrimmingParams(port: u32, xStart: s16, yStart: s16,
+ xEnd: s16, yEnd: s16) -> Result;
+ pub fn CAMU_GetTrimmingParams(xStart: *mut s16, yStart: *mut s16,
+ xEnd: *mut s16, yEnd: *mut s16, port: u32)
+ -> Result;
+ pub fn CAMU_SetTrimmingParamsCenter(port: u32, trimWidth: s16,
+ trimHeight: s16, camWidth: s16,
+ camHeight: s16) -> Result;
+ pub fn CAMU_Activate(select: u32) -> Result;
+ pub fn CAMU_SwitchContext(select: u32, context: CAMU_Context) -> Result;
+ pub fn CAMU_SetExposure(select: u32, exposure: s8) -> Result;
+ pub fn CAMU_SetWhiteBalance(select: u32, whiteBalance: CAMU_WhiteBalance)
+ -> Result;
+ pub fn CAMU_SetWhiteBalanceWithoutBaseUp(select: u32,
+ whiteBalance: CAMU_WhiteBalance)
+ -> Result;
+ pub fn CAMU_SetSharpness(select: u32, sharpness: s8) -> Result;
+ pub fn CAMU_SetAutoExposure(select: u32, autoExposure: u8) -> Result;
+ pub fn CAMU_IsAutoExposure(autoExposure: *mut u8, select: u32) -> Result;
+ pub fn CAMU_SetAutoWhiteBalance(select: u32, autoWhiteBalance: u8)
+ -> Result;
+ pub fn CAMU_IsAutoWhiteBalance(autoWhiteBalance: *mut u8, select: u32)
+ -> Result;
+ pub fn CAMU_FlipImage(select: u32, flip: CAMU_Flip,
+ context: CAMU_Context) -> Result;
+ pub fn CAMU_SetDetailSize(select: u32, width: s16, height: s16,
+ cropX0: s16, cropY0: s16, cropX1: s16,
+ cropY1: s16, context: CAMU_Context) -> Result;
+ pub fn CAMU_SetSize(select: u32, size: CAMU_Size, context: CAMU_Context)
+ -> Result;
+ pub fn CAMU_SetFrameRate(select: u32, frameRate: CAMU_FrameRate)
+ -> Result;
+ pub fn CAMU_SetPhotoMode(select: u32, photoMode: CAMU_PhotoMode)
+ -> Result;
+ pub fn CAMU_SetEffect(select: u32, effect: CAMU_Effect,
+ context: CAMU_Context) -> Result;
+ pub fn CAMU_SetContrast(select: u32, contrast: CAMU_Contrast) -> Result;
+ pub fn CAMU_SetLensCorrection(select: u32,
+ lensCorrection: CAMU_LensCorrection)
+ -> Result;
+ pub fn CAMU_SetOutputFormat(select: u32, format: CAMU_OutputFormat,
+ context: CAMU_Context) -> Result;
+ pub fn CAMU_SetAutoExposureWindow(select: u32, x: s16, y: s16,
+ width: s16, height: s16) -> Result;
+ pub fn CAMU_SetAutoWhiteBalanceWindow(select: u32, x: s16, y: s16,
+ width: s16, height: s16) -> Result;
+ pub fn CAMU_SetNoiseFilter(select: u32, noiseFilter: u8) -> Result;
+ pub fn CAMU_SynchronizeVsyncTiming(select1: u32, select2: u32)
+ -> Result;
+ pub fn CAMU_GetLatestVsyncTiming(timing: *mut s64, port: u32, past: u32)
+ -> Result;
+ pub fn CAMU_GetStereoCameraCalibrationData(data:
+ *mut CAMU_StereoCameraCalibrationData)
+ -> Result;
+ pub fn CAMU_SetStereoCameraCalibrationData(data:
+ CAMU_StereoCameraCalibrationData)
+ -> Result;
+ pub fn CAMU_WriteRegisterI2c(select: u32, addr: u16, data: u16)
+ -> Result;
+ pub fn CAMU_WriteMcuVariableI2c(select: u32, addr: u16, data: u16)
+ -> Result;
+ pub fn CAMU_ReadRegisterI2cExclusive(data: *mut u16, select: u32,
+ addr: u16) -> Result;
+ pub fn CAMU_ReadMcuVariableI2cExclusive(data: *mut u16, select: u32,
+ addr: u16) -> Result;
+ pub fn CAMU_SetImageQualityCalibrationData(data:
+ CAMU_ImageQualityCalibrationData)
+ -> Result;
+ pub fn CAMU_GetImageQualityCalibrationData(data:
+ *mut CAMU_ImageQualityCalibrationData)
+ -> Result;
+ pub fn CAMU_SetPackageParameterWithoutContext(param:
+ CAMU_PackageParameterCameraSelect)
+ -> Result;
+ pub fn CAMU_SetPackageParameterWithContext(param:
+ CAMU_PackageParameterContext)
+ -> Result;
+ pub fn CAMU_SetPackageParameterWithContextDetail(param:
+ CAMU_PackageParameterContextDetail)
+ -> Result;
+ pub fn CAMU_GetSuitableY2rStandardCoefficient(coefficient:
+ *mut Y2RU_StandardCoefficient)
+ -> Result;
+ pub fn CAMU_PlayShutterSound(sound: CAMU_ShutterSoundType) -> Result;
+ pub fn CAMU_DriverInitialize() -> Result;
+ pub fn CAMU_DriverFinalize() -> Result;
+ pub fn CAMU_GetActivatedCamera(select: *mut u32) -> Result;
+ pub fn CAMU_GetSleepCamera(select: *mut u32) -> Result;
+ pub fn CAMU_SetSleepCamera(select: u32) -> Result;
+ pub fn CAMU_SetBrightnessSynchronization(brightnessSynchronization: u8)
+ -> Result;
+}
diff --git a/ctru-sys/src/services/cfgnor.rs b/ctru-sys/src/services/cfgnor.rs
new file mode 100644
index 0000000..c2c1e44
--- /dev/null
+++ b/ctru-sys/src/services/cfgnor.rs
@@ -0,0 +1,14 @@
+use ::Result;
+
+extern "C" {
+ pub fn cfgnorInit(value: u8) -> Result;
+ pub fn cfgnorExit();
+ pub fn cfgnorDumpFlash(buf: *mut u32, size: u32) -> Result;
+ pub fn cfgnorWriteFlash(buf: *mut u32, size: u32) -> Result;
+ 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;
+}
diff --git a/ctru-sys/src/services/cfgu.rs b/ctru-sys/src/services/cfgu.rs
new file mode 100644
index 0000000..f1663f0
--- /dev/null
+++ b/ctru-sys/src/services/cfgu.rs
@@ -0,0 +1,46 @@
+use ::Result;
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum CFG_Region {
+ CFG_REGION_JPN = 0,
+ CFG_REGION_USA = 1,
+ CFG_REGION_EUR = 2,
+ CFG_REGION_AUS = 3,
+ CFG_REGION_CHN = 4,
+ CFG_REGION_KOR = 5,
+ CFG_REGION_TWN = 6,
+}
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum CFG_Language {
+ CFG_LANGUAGE_JP = 0,
+ CFG_LANGUAGE_EN = 1,
+ CFG_LANGUAGE_FR = 2,
+ CFG_LANGUAGE_DE = 3,
+ CFG_LANGUAGE_IT = 4,
+ CFG_LANGUAGE_ES = 5,
+ CFG_LANGUAGE_ZH = 6,
+ CFG_LANGUAGE_KO = 7,
+ CFG_LANGUAGE_NL = 8,
+ CFG_LANGUAGE_PT = 9,
+ CFG_LANGUAGE_RU = 10,
+ CFG_LANGUAGE_TW = 11,
+}
+
+extern "C" {
+ pub fn cfguInit() -> Result;
+ pub fn cfguExit();
+ 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;
+}
diff --git a/ctru-sys/src/services/dsp.rs b/ctru-sys/src/services/dsp.rs
new file mode 100644
index 0000000..12edfae
--- /dev/null
+++ b/ctru-sys/src/services/dsp.rs
@@ -0,0 +1,48 @@
+use ::{Handle, Result};
+use ::c_void;
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum DSP_InterruptType {
+ DSP_INTERRUPT_PIPE = 2,
+}
+
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum DSP_PipeDirection {
+ DSP_PIPE_INPUT = 0,
+ DSP_PIPE_OUTPUT = 1,
+}
+
+extern "C" {
+ pub fn dspInit() -> Result;
+ pub fn dspExit();
+ pub fn DSP_GetHeadphoneStatus(is_inserted: *mut u8) -> Result;
+ pub fn DSP_FlushDataCache(address: *const c_void,
+ size: u32) -> Result;
+ pub fn DSP_InvalidateDataCache(address: *const c_void,
+ size: u32) -> Result;
+ pub fn DSP_GetSemaphoreHandle(semaphore: *mut Handle) -> Result;
+ pub fn DSP_SetSemaphore(value: u16) -> Result;
+ pub fn DSP_SetSemaphoreMask(mask: u16) -> Result;
+ pub fn DSP_LoadComponent(component: *const c_void,
+ size: u32, prog_mask: u16, data_mask: u16,
+ is_loaded: *mut u8) -> Result;
+ pub fn DSP_UnloadComponent() -> Result;
+ pub fn DSP_RegisterInterruptEvents(handle: Handle, interrupt: u32,
+ channel: u32) -> Result;
+ pub fn DSP_ReadPipeIfPossible(channel: u32, peer: u32,
+ buffer: *mut c_void,
+ length: u16, length_read: *mut u16)
+ -> Result;
+ pub fn DSP_WriteProcessPipe(channel: u32,
+ buffer: *const c_void,
+ length: u32) -> Result;
+ pub fn DSP_ConvertProcessAddressFromDspDram(dsp_address: u32,
+ arm_address: *mut u32)
+ -> Result;
+ pub fn DSP_RecvData(regNo: u16, value: *mut u16) -> Result;
+ pub fn DSP_RecvDataIsReady(regNo: u16, is_ready: *mut u8) -> Result;
+ pub fn DSP_SendData(regNo: u16, value: u16) -> Result;
+ pub fn DSP_SendDataIsEmpty(regNo: u16, is_empty: *mut u8) -> Result;
+}
diff --git a/ctru-sys/src/services/fs.rs b/ctru-sys/src/services/fs.rs
new file mode 100644
index 0000000..4cd767c
--- /dev/null
+++ b/ctru-sys/src/services/fs.rs
@@ -0,0 +1,536 @@
+// TODO: Determine if anonymous enums are properly represented (they probably aren't)
+
+use ::{Handle, Result};
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ FS_OPEN_READ = 1,
+ FS_OPEN_WRITE = 2,
+ FS_OPEN_CREATE = 4,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed2 {
+ FS_WRITE_FLUSH = 1,
+ FS_WRITE_UPDATE_TIME = 256,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed3 {
+ FS_ATTRIBUTE_DIRECTORY = 1,
+ FS_ATTRIBUTE_HIDDEN = 256,
+ FS_ATTRIBUTE_ARCHIVE = 65536,
+ FS_ATTRIBUTE_READ_ONLY = 16777216,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed4 {
+ MEDIATYPE_NAND = 0,
+ MEDIATYPE_SD = 1,
+ MEDIATYPE_GAME_CARD = 2,
+}
+
+pub type FS_MediaType = Enum_Unnamed4;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed5 {
+ ARCHIVE_ROMFS = 3,
+ ARCHIVE_SAVEDATA = 4,
+ ARCHIVE_EXTDATA = 6,
+ ARCHIVE_SHARED_EXTDATA = 7,
+ ARCHIVE_SYSTEM_SAVEDATA = 8,
+ ARCHIVE_SDMC = 9,
+ ARCHIVE_SDMC_WRITE_ONLY = 10,
+ ARCHIVE_BOSS_EXTDATA = 305419896,
+ ARCHIVE_CARD_SPIFS = 305419897,
+ ARCHIVE_EXTDATA_AND_BOSS_EXTDATA = 305419899,
+ ARCHIVE_SYSTEM_SAVEDATA2 = 305419900,
+ ARCHIVE_NAND_RW = 305419901,
+ ARCHIVE_NAND_RO = 305419902,
+ ARCHIVE_NAND_RO_WRITE_ACCESS = 305419903,
+ ARCHIVE_SAVEDATA_AND_CONTENT = 591751050,
+ ARCHIVE_SAVEDATA_AND_CONTENT2 = 591751054,
+ ARCHIVE_NAND_CTR_FS = 1450741931,
+ ARCHIVE_TWL_PHOTO = 1450741932,
+ ARCHIVE_NAND_TWL_FS = 1450741934,
+ ARCHIVE_NAND_W_FS = 1450741935,
+ ARCHIVE_GAMECARD_SAVEDATA = 1450741937,
+ ARCHIVE_USER_SAVEDATA = 1450741938,
+ ARCHIVE_DEMO_SAVEDATA = 1450741940,
+}
+pub type FS_ArchiveID = Enum_Unnamed5;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed6 {
+ PATH_INVALID = 0,
+ PATH_EMPTY = 1,
+ PATH_BINARY = 2,
+ PATH_ASCII = 3,
+ PATH_UTF16 = 4,
+}
+pub type FS_PathType = Enum_Unnamed6;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed7 { SECUREVALUE_SLOT_SD = 4096, }
+pub type FS_SecureValueSlot = Enum_Unnamed7;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed8 {
+ BAUDRATE_512KHZ = 0,
+ BAUDRATE_1MHZ = 1,
+ BAUDRATE_2MHZ = 2,
+ BAUDRATE_4MHZ = 3,
+ BAUDRATE_8MHZ = 4,
+ BAUDRATE_16MHZ = 5,
+}
+pub type FS_CardSpiBaudRate = Enum_Unnamed8;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed9 {
+ BUSMODE_1BIT = 0,
+ BUSMODE_4BIT = 1,
+}
+pub type FS_CardSpiBusMode = Enum_Unnamed9;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed10 {
+ SPECIALCONTENT_UPDATE = 1,
+ SPECIALCONTENT_MANUAL = 2,
+ SPECIALCONTENT_DLP_CHILD = 3,
+}
+pub type FS_SpecialContentType = Enum_Unnamed10;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed11 { CARD_CTR = 0, CARD_TWL = 1, }
+pub type FS_CardType = Enum_Unnamed11;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed12 { FS_ACTION_UNKNOWN = 0, }
+pub type FS_Action = Enum_Unnamed12;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed13 {
+ ARCHIVE_ACTION_COMMIT_SAVE_DATA = 0,
+ ARCHIVE_ACTION_GET_TIMESTAMP = 1,
+}
+pub type FS_ArchiveAction = Enum_Unnamed13;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed14 {
+ SECURESAVE_ACTION_DELETE = 0,
+ SECURESAVE_ACTION_FORMAT = 1,
+}
+pub type FS_SecureSaveAction = Enum_Unnamed14;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed15 { FILE_ACTION_UNKNOWN = 0, }
+pub type FS_FileAction = Enum_Unnamed15;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed16 { DIRECTORY_ACTION_UNKNOWN = 0, }
+pub type FS_DirectoryAction = Enum_Unnamed16;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed17 {
+ pub name: [u16; 262usize],
+ pub shortName: [u8; 10usize],
+ pub shortExt: [u8; 4usize],
+ pub valid: u8,
+ pub reserved: u8,
+ pub attributes: u32,
+ pub fileSize: u64,
+}
+impl ::core::clone::Clone for Struct_Unnamed17 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed17 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_DirectoryEntry = Struct_Unnamed17;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed18 {
+ pub sectorSize: u32,
+ pub clusterSize: u32,
+ pub totalClusters: u32,
+ pub freeClusters: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed18 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed18 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_ArchiveResource = Struct_Unnamed18;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed19 {
+ pub programId: u64,
+ pub _bindgen_bitfield_1_: FS_MediaType,
+ pub padding: [u8; 7usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed19 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed19 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_ProgramInfo = Struct_Unnamed19;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed20 {
+ pub productCode: [u8; 16usize],
+ pub companyCode: [u8; 2usize],
+ pub remasterVersion: u16,
+}
+impl ::core::clone::Clone for Struct_Unnamed20 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed20 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_ProductInfo = Struct_Unnamed20;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed21 {
+ pub aesCbcMac: [u8; 16usize],
+ pub movableSed: [u8; 288usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed21 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed21 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_IntegrityVerificationSeed = Struct_Unnamed21;
+
+#[repr(C, packed)]
+#[derive(Copy)]
+pub struct Struct_Unnamed22 {
+ pub _bindgen_bitfield_1_: FS_MediaType,
+ pub unknown: u8,
+ pub reserved1: u16,
+ pub saveId: u64,
+ pub reserved2: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed22 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed22 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_ExtSaveDataInfo = Struct_Unnamed22;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed23 {
+ pub _bindgen_bitfield_1_: FS_MediaType,
+ pub unknown: u8,
+ pub reserved: u16,
+ pub saveId: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed23 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed23 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_SystemSaveDataInfo = Struct_Unnamed23;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed24 {
+ pub ivs: [u8; 16usize],
+ pub encryptParameter: [u8; 16usize],
+}
+impl ::core::clone::Clone for Struct_Unnamed24 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed24 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_DeviceMoveContext = Struct_Unnamed24;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed25 {
+ pub _type: FS_PathType,
+ pub size: u32,
+ pub data: *const ::c_void,
+}
+impl ::core::clone::Clone for Struct_Unnamed25 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed25 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_Path = Struct_Unnamed25;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed26 {
+ pub id: u32,
+ pub lowPath: FS_Path,
+ pub handle: u64,
+}
+impl ::core::clone::Clone for Struct_Unnamed26 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed26 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type FS_Archive = Struct_Unnamed26;
+extern "C" {
+ pub fn fsInit() -> Result;
+ pub fn fsExit();
+ pub fn fsUseSession(session: Handle, sdmc: u8);
+ pub fn fsEndUseSession();
+ pub fn fsMakePath(_type: FS_PathType, path: *const ::c_void)
+ -> FS_Path;
+ pub fn fsGetSessionHandle() -> *mut Handle;
+ pub fn FSUSER_Control(action: FS_Action,
+ input: *mut ::c_void, inputSize: u32,
+ output: *mut ::c_void,
+ outputSize: u32) -> Result;
+ pub fn FSUSER_Initialize(session: Handle) -> Result;
+ pub fn FSUSER_OpenFile(out: *mut Handle, archive: FS_Archive,
+ path: FS_Path, openFlags: u32, attributes: u32)
+ -> Result;
+ pub fn FSUSER_OpenFileDirectly(out: *mut Handle, archive: FS_Archive,
+ path: FS_Path, openFlags: u32,
+ attributes: u32) -> Result;
+ pub fn FSUSER_DeleteFile(archive: FS_Archive, path: FS_Path) -> Result;
+ pub fn FSUSER_RenameFile(srcArchive: FS_Archive, srcPath: FS_Path,
+ dstArchive: FS_Archive, dstPath: FS_Path)
+ -> Result;
+ pub fn FSUSER_DeleteDirectory(archive: FS_Archive, path: FS_Path)
+ -> Result;
+ pub fn FSUSER_DeleteDirectoryRecursively(archive: FS_Archive,
+ path: FS_Path) -> Result;
+ pub fn FSUSER_CreateFile(archive: FS_Archive, path: FS_Path,
+ attributes: u32, fileSize: u64) -> Result;
+ pub fn FSUSER_CreateDirectory(archive: FS_Archive, path: FS_Path,
+ attributes: u32) -> Result;
+ pub fn FSUSER_RenameDirectory(srcArchive: FS_Archive, srcPath: FS_Path,
+ dstArchive: FS_Archive, dstPath: FS_Path)
+ -> Result;
+ pub fn FSUSER_OpenDirectory(out: *mut Handle, archive: FS_Archive,
+ path: FS_Path) -> Result;
+ pub fn FSUSER_OpenArchive(archive: *mut FS_Archive) -> Result;
+ pub fn FSUSER_ControlArchive(archive: FS_Archive,
+ action: FS_ArchiveAction,
+ input: *mut ::c_void,
+ inputSize: u32,
+ output: *mut ::c_void,
+ outputSize: u32) -> Result;
+ pub fn FSUSER_CloseArchive(archive: *mut FS_Archive) -> Result;
+ pub fn FSUSER_GetFreeBytes(freeBytes: *mut u64, archive: FS_Archive)
+ -> Result;
+ pub fn FSUSER_GetCardType(_type: *mut FS_CardType) -> Result;
+ pub fn FSUSER_GetSdmcArchiveResource(archiveResource:
+ *mut FS_ArchiveResource)
+ -> Result;
+ pub fn FSUSER_GetNandArchiveResource(archiveResource:
+ *mut FS_ArchiveResource)
+ -> Result;
+ pub fn FSUSER_GetSdmcFatfsError(error: *mut u32) -> Result;
+ pub fn FSUSER_IsSdmcDetected(detected: *mut u8) -> Result;
+ pub fn FSUSER_IsSdmcWritable(writable: *mut u8) -> Result;
+ pub fn FSUSER_GetSdmcCid(out: *mut u8, length: u32) -> Result;
+ pub fn FSUSER_GetNandCid(out: *mut u8, length: u32) -> Result;
+ pub fn FSUSER_GetSdmcSpeedInfo(speedInfo: *mut u32) -> Result;
+ pub fn FSUSER_GetNandSpeedInfo(speedInfo: *mut u32) -> Result;
+ pub fn FSUSER_GetSdmcLog(out: *mut u8, length: u32) -> Result;
+ pub fn FSUSER_GetNandLog(out: *mut u8, length: u32) -> Result;
+ pub fn FSUSER_ClearSdmcLog() -> Result;
+ pub fn FSUSER_ClearNandLog() -> Result;
+ pub fn FSUSER_CardSlotIsInserted(inserted: *mut u8) -> Result;
+ pub fn FSUSER_CardSlotPowerOn(status: *mut u8) -> Result;
+ pub fn FSUSER_CardSlotPowerOff(status: *mut u8) -> Result;
+ pub fn FSUSER_CardSlotGetCardIFPowerStatus(status: *mut u8) -> Result;
+ pub fn FSUSER_CardNorDirectCommand(commandId: u8) -> Result;
+ pub fn FSUSER_CardNorDirectCommandWithAddress(commandId: u8,
+ address: u32) -> Result;
+ pub fn FSUSER_CardNorDirectRead(commandId: u8, size: u32,
+ output: *mut u8) -> Result;
+ pub fn FSUSER_CardNorDirectReadWithAddress(commandId: u8, address: u32,
+ size: u32, output: *mut u8)
+ -> Result;
+ pub fn FSUSER_CardNorDirectWrite(commandId: u8, size: u32,
+ input: *mut u8) -> Result;
+ pub fn FSUSER_CardNorDirectWriteWithAddress(commandId: u8, address: u32,
+ size: u32, input: *mut u8)
+ -> Result;
+ pub fn FSUSER_CardNorDirectRead_4xIO(commandId: u8, address: u32,
+ size: u32, output: *mut u8)
+ -> Result;
+ pub fn FSUSER_CardNorDirectCpuWriteWithoutVerify(address: u32,
+ size: u32,
+ input: *mut u8)
+ -> Result;
+ pub fn FSUSER_CardNorDirectSectorEraseWithoutVerify(address: u32)
+ -> Result;
+ pub fn FSUSER_GetProductInfo(info: *mut FS_ProductInfo, processId: u32)
+ -> Result;
+ pub fn FSUSER_GetProgramLaunchInfo(info: *mut FS_ProgramInfo,
+ processId: u32) -> Result;
+ pub fn FSUSER_SetCardSpiBaudRate(baudRate: FS_CardSpiBaudRate) -> Result;
+ pub fn FSUSER_SetCardSpiBusMode(busMode: FS_CardSpiBusMode) -> Result;
+ pub fn FSUSER_SendInitializeInfoTo9() -> Result;
+ pub fn FSUSER_GetSpecialContentIndex(index: *mut u16,
+ mediaType: FS_MediaType,
+ programId: u64,
+ _type: FS_SpecialContentType)
+ -> Result;
+ pub fn FSUSER_GetLegacyRomHeader(mediaType: FS_MediaType, programId: u64,
+ header: *mut u8) -> Result;
+ pub fn FSUSER_GetLegacyBannerData(mediaType: FS_MediaType, programId: u64,
+ banner: *mut u8) -> Result;
+ pub fn FSUSER_CheckAuthorityToAccessExtSaveData(access: *mut u8,
+ mediaType: FS_MediaType,
+ saveId: u64,
+ processId: u32)
+ -> Result;
+ pub fn FSUSER_QueryTotalQuotaSize(quotaSize: *mut u64, directories: u32,
+ files: u32, fileSizeCount: u32,
+ fileSizes: *mut u64) -> Result;
+ pub fn FSUSER_AbnegateAccessRight(accessRight: u32) -> Result;
+ pub fn FSUSER_DeleteSdmcRoot() -> Result;
+ pub fn FSUSER_DeleteAllExtSaveDataOnNand() -> Result;
+ pub fn FSUSER_InitializeCtrFileSystem() -> Result;
+ pub fn FSUSER_CreateSeed() -> Result;
+ pub fn FSUSER_GetFormatInfo(totalSize: *mut u32, directories: *mut u32,
+ files: *mut u32, duplicateData: *mut u8,
+ archiveId: FS_ArchiveID, path: FS_Path)
+ -> Result;
+ pub fn FSUSER_GetLegacyRomHeader2(headerSize: u32,
+ mediaType: FS_MediaType, programId: u64,
+ header: *mut u8) -> Result;
+ pub fn FSUSER_GetSdmcCtrRootPath(out: *mut u8, length: u32) -> Result;
+ pub fn FSUSER_GetArchiveResource(archiveResource: *mut FS_ArchiveResource,
+ mediaType: FS_MediaType) -> Result;
+ pub fn FSUSER_ExportIntegrityVerificationSeed(seed:
+ *mut FS_IntegrityVerificationSeed)
+ -> Result;
+ pub fn FSUSER_ImportIntegrityVerificationSeed(seed:
+ *mut FS_IntegrityVerificationSeed)
+ -> Result;
+ pub fn FSUSER_FormatSaveData(archiveId: FS_ArchiveID, path: FS_Path,
+ blocks: u32, directories: u32, files: u32,
+ directoryBuckets: u32, fileBuckets: u32,
+ duplicateData: u8) -> Result;
+ pub fn FSUSER_GetLegacySubBannerData(bannerSize: u32,
+ mediaType: FS_MediaType,
+ programId: u64, banner: *mut u8)
+ -> Result;
+ pub fn FSUSER_ReadSpecialFile(bytesRead: *mut u32, fileOffset: u64,
+ size: u32, data: *mut u8) -> Result;
+ pub fn FSUSER_GetSpecialFileSize(fileSize: *mut u64) -> Result;
+ pub fn FSUSER_CreateExtSaveData(info: FS_ExtSaveDataInfo,
+ directories: u32, files: u32,
+ sizeLimit: u64, smdhSize: u32,
+ smdh: *mut u8) -> Result;
+ pub fn FSUSER_DeleteExtSaveData(info: FS_ExtSaveDataInfo) -> Result;
+ pub fn FSUSER_ReadExtSaveDataIcon(bytesRead: *mut u32,
+ info: FS_ExtSaveDataInfo,
+ smdhSize: u32, smdh: *mut u8)
+ -> Result;
+ pub fn FSUSER_GetExtDataBlockSize(totalBlocks: *mut u64,
+ freeBlocks: *mut u64,
+ blockSize: *mut u32,
+ info: FS_ExtSaveDataInfo) -> Result;
+ pub fn FSUSER_EnumerateExtSaveData(idsWritten: *mut u32, idsSize: u32,
+ mediaType: FS_MediaType, idSize: u32,
+ shared: u8, ids: *mut u8) -> Result;
+ pub fn FSUSER_CreateSystemSaveData(info: FS_SystemSaveDataInfo,
+ totalSize: u32, blockSize: u32,
+ directories: u32, files: u32,
+ directoryBuckets: u32,
+ fileBuckets: u32, duplicateData: u8)
+ -> Result;
+ pub fn FSUSER_DeleteSystemSaveData(info: FS_SystemSaveDataInfo) -> Result;
+ pub fn FSUSER_StartDeviceMoveAsSource(context: *mut FS_DeviceMoveContext)
+ -> Result;
+ pub fn FSUSER_StartDeviceMoveAsDestination(context: FS_DeviceMoveContext,
+ clear: u8) -> Result;
+ pub fn FSUSER_SetArchivePriority(archive: FS_Archive, priority: u32)
+ -> Result;
+ pub fn FSUSER_GetArchivePriority(priority: *mut u32, archive: FS_Archive)
+ -> Result;
+ pub fn FSUSER_SetCtrCardLatencyParameter(latency: u64,
+ emulateEndurance: u8) -> Result;
+ pub fn FSUSER_SwitchCleanupInvalidSaveData(enable: u8) -> Result;
+ pub fn FSUSER_EnumerateSystemSaveData(idsWritten: *mut u32,
+ idsSize: u32, ids: *mut u64)
+ -> Result;
+ pub fn FSUSER_InitializeWithSdkVersion(session: Handle, version: u32)
+ -> Result;
+ pub fn FSUSER_SetPriority(priority: u32) -> Result;
+ pub fn FSUSER_GetPriority(priority: *mut u32) -> Result;
+ pub fn FSUSER_SetSaveDataSecureValue(value: u64, slot: FS_SecureValueSlot,
+ titleUniqueId: u32,
+ titleVariation: u8) -> Result;
+ pub fn FSUSER_GetSaveDataSecureValue(exists: *mut u8, value: *mut u64,
+ slot: FS_SecureValueSlot,
+ titleUniqueId: u32,
+ titleVariation: u8) -> Result;
+ pub fn FSUSER_ControlSecureSave(action: FS_SecureSaveAction,
+ input: *mut ::c_void,
+ inputSize: u32,
+ output: *mut ::c_void,
+ outputSize: u32) -> Result;
+ pub fn FSUSER_GetMediaType(mediaType: *mut FS_MediaType) -> Result;
+ pub fn FSFILE_Control(handle: Handle, action: FS_FileAction,
+ input: *mut ::c_void, inputSize: u32,
+ output: *mut ::c_void,
+ outputSize: u32) -> Result;
+ pub fn FSFILE_OpenSubFile(handle: Handle, subFile: *mut Handle,
+ offset: u64, size: u64) -> Result;
+ pub fn FSFILE_Read(handle: Handle, bytesRead: *mut u32, offset: u64,
+ buffer: *mut ::c_void, size: u32)
+ -> Result;
+ pub fn FSFILE_Write(handle: Handle, bytesWritten: *mut u32, offset: u64,
+ buffer: *const ::c_void, size: u32,
+ flags: u32) -> Result;
+ pub fn FSFILE_GetSize(handle: Handle, size: *mut u64) -> Result;
+ pub fn FSFILE_SetSize(handle: Handle, size: u64) -> Result;
+ pub fn FSFILE_GetAttributes(handle: Handle, attributes: *mut u32)
+ -> Result;
+ pub fn FSFILE_SetAttributes(handle: Handle, attributes: u32) -> Result;
+ pub fn FSFILE_Close(handle: Handle) -> Result;
+ pub fn FSFILE_Flush(handle: Handle) -> Result;
+ pub fn FSFILE_SetPriority(handle: Handle, priority: u32) -> Result;
+ pub fn FSFILE_GetPriority(handle: Handle, priority: *mut u32) -> Result;
+ pub fn FSFILE_OpenLinkFile(handle: Handle, linkFile: *mut Handle)
+ -> Result;
+ pub fn FSDIR_Control(handle: Handle, action: FS_DirectoryAction,
+ input: *mut ::c_void, inputSize: u32,
+ output: *mut ::c_void,
+ outputSize: u32) -> Result;
+ pub fn FSDIR_Read(handle: Handle, entriesRead: *mut u32,
+ entryCount: u32, entries: *mut FS_DirectoryEntry)
+ -> Result;
+ pub fn FSDIR_Close(handle: Handle) -> Result;
+ pub fn FSDIR_SetPriority(handle: Handle, priority: u32) -> Result;
+ pub fn FSDIR_GetPriority(handle: Handle, priority: *mut u32) -> Result;
+}
diff --git a/ctru-sys/src/services/gspgpu.rs b/ctru-sys/src/services/gspgpu.rs
new file mode 100644
index 0000000..7265812
--- /dev/null
+++ b/ctru-sys/src/services/gspgpu.rs
@@ -0,0 +1,120 @@
+use ::{Handle, Result};
+use ::c_void;
+use ::types::*;
+
+#[inline]
+pub fn GSPGPU_REBASE_REG(r: u32) {
+ ((r)-0x1EB00000);
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct GSPGPU_FramebufferInfo {
+ pub active_framebuf: u32,
+ pub framebuf0_vaddr: *mut u32,
+ pub framebuf1_vaddr: *mut u32,
+ pub framebuf_widthbytesize: u32,
+ pub format: u32,
+ pub framebuf_dispselect: u32,
+ pub unk: u32,
+}
+impl ::core::clone::Clone for GSPGPU_FramebufferInfo {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for GSPGPU_FramebufferInfo {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum GSPGPU_FramebufferFormats {
+ GSP_RGBA8_OES = 0,
+ GSP_BGR8_OES = 1,
+ GSP_RGB565_OES = 2,
+ GSP_RGB5_A1_OES = 3,
+ GSP_RGBA4_OES = 4,
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct GSPGPU_CaptureInfoEntry {
+ pub framebuf0_vaddr: *mut u32,
+ pub framebuf1_vaddr: *mut u32,
+ pub format: u32,
+ pub framebuf_widthbytesize: u32,
+}
+impl ::core::clone::Clone for GSPGPU_CaptureInfoEntry {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for GSPGPU_CaptureInfoEntry {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct GSPGPU_CaptureInfo {
+ pub screencapture: [GSPGPU_CaptureInfoEntry; 2usize],
+}
+impl ::core::clone::Clone for GSPGPU_CaptureInfo {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for GSPGPU_CaptureInfo {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[repr(C)]
+pub enum GSPGPU_Event {
+ GSPGPU_EVENT_PSC0 = 0,
+ GSPGPU_EVENT_PSC1 = 1,
+ GSPGPU_EVENT_VBlank0 = 2,
+ GSPGPU_EVENT_VBlank1 = 3,
+ GSPGPU_EVENT_PPF = 4,
+ GSPGPU_EVENT_P3D = 5,
+ GSPGPU_EVENT_DMA = 6,
+ GSPGPU_EVENT_MAX = 7,
+}
+
+use ThreadFunc;
+
+extern "C" {
+ pub fn gspInit() -> Result;
+ pub fn gspExit();
+ pub fn gspSetEventCallback(id: GSPGPU_Event, cb: ThreadFunc,
+ data: *mut c_void,
+ oneShot: u8);
+ pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8,
+ gspThreadId: u8) -> Result;
+ pub fn gspExitEventHandler();
+ pub fn gspWaitForEvent(id: GSPGPU_Event, nextEvent: u8);
+ pub fn gspWaitForAnyEvent() -> GSPGPU_Event;
+ pub fn gspSubmitGxCommand(sharedGspCmdBuf: *mut u32,
+ gxCommand: *mut u32) -> Result;
+ pub fn GSPGPU_AcquireRight(flags: u8) -> Result;
+ pub fn GSPGPU_ReleaseRight() -> Result;
+ pub fn GSPGPU_ImportDisplayCaptureInfo(captureinfo:
+ *mut GSPGPU_CaptureInfo)
+ -> Result;
+ pub fn GSPGPU_SaveVramSysArea() -> Result;
+ pub fn GSPGPU_RestoreVramSysArea() -> Result;
+ pub fn GSPGPU_SetLcdForceBlack(flags: u8) -> Result;
+ pub fn GSPGPU_SetBufferSwap(screenid: u32,
+ framebufinfo: *mut GSPGPU_FramebufferInfo)
+ -> Result;
+ pub fn GSPGPU_FlushDataCache(adr: *const c_void,
+ size: u32) -> Result;
+ pub fn GSPGPU_InvalidateDataCache(adr: *const c_void,
+ size: u32) -> Result;
+ pub fn GSPGPU_WriteHWRegs(regAddr: u32, data: *mut u32, size: u8)
+ -> Result;
+ pub fn GSPGPU_WriteHWRegsWithMask(regAddr: u32, data: *mut u32,
+ datasize: u8, maskdata: *mut u32,
+ masksize: u8) -> Result;
+ pub fn GSPGPU_ReadHWRegs(regAddr: u32, data: *mut u32, size: u8)
+ -> Result;
+ pub fn GSPGPU_RegisterInterruptRelayQueue(eventHandle: Handle,
+ flags: u32,
+ outMemHandle: *mut Handle,
+ threadID: *mut u8) -> Result;
+ pub fn GSPGPU_UnregisterInterruptRelayQueue() -> Result;
+ pub fn GSPGPU_TriggerCmdReqQueue() -> Result;
+}
diff --git a/ctru-sys/src/services/gsplcd.rs b/ctru-sys/src/services/gsplcd.rs
new file mode 100644
index 0000000..332ebef
--- /dev/null
+++ b/ctru-sys/src/services/gsplcd.rs
@@ -0,0 +1,17 @@
+//TODO: Verify if anonymous enum is properly represented
+
+use ::Result;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ GSPLCD_SCREEN_TOP = 1,
+ GSPLCD_SCREEN_BOTTOM = 2,
+ GSPLCD_SCREEN_BOTH = 3,
+}
+extern "C" {
+ pub fn gspLcdInit() -> Result;
+ pub fn gspLcdExit();
+ pub fn GSPLCD_PowerOnBacklight(screen: u32) -> Result;
+ pub fn GSPLCD_PowerOffBacklight(screen: u32) -> Result;
+}
diff --git a/ctru-sys/src/services/hb.rs b/ctru-sys/src/services/hb.rs
new file mode 100644
index 0000000..7bfe5fb
--- /dev/null
+++ b/ctru-sys/src/services/hb.rs
@@ -0,0 +1,13 @@
+use ::Result;
+use ::c_void;
+
+
+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;
+}
diff --git a/ctru-sys/src/services/hid.rs b/ctru-sys/src/services/hid.rs
new file mode 100644
index 0000000..8e3a025
--- /dev/null
+++ b/ctru-sys/src/services/hid.rs
@@ -0,0 +1,110 @@
+use ::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 = 16384,
+ KEY_ZR = 32768,
+ KEY_TOUCH = 1048576,
+ KEY_CSTICK_RIGHT = 16777216,
+ KEY_CSTICK_LEFT = 33554432,
+ KEY_CSTICK_UP = 67108864,
+ KEY_CSTICK_DOWN = 134217728,
+ KEY_CPAD_RIGHT = 268435456,
+ KEY_CPAD_LEFT = 536870912,
+ KEY_CPAD_UP = 1073741824,
+ KEY_CPAD_DOWN = -2147483648,
+ KEY_UP = 1073741888,
+ KEY_DOWN = -2147483520,
+ KEY_LEFT = 536870944,
+ KEY_RIGHT = 268435472,
+
+ // 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,
+ HIDEVENT_PAD1 = 1,
+ HIDEVENT_Accel = 2,
+ HIDEVENT_Gyro = 3,
+ HIDEVENT_DebugPad = 4,
+ HIDEVENT_MAX = 5,
+
+}
+
+
+extern "C" {
+ pub fn hidInit() -> 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;
+}
+
diff --git a/ctru-sys/src/services/httpc.rs b/ctru-sys/src/services/httpc.rs
new file mode 100644
index 0000000..ba4eba4
--- /dev/null
+++ b/ctru-sys/src/services/httpc.rs
@@ -0,0 +1,79 @@
+use ::{Handle, Result};
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct httpcContext {
+ pub servhandle: Handle,
+ pub httphandle: u32,
+}
+impl ::core::clone::Clone for httpcContext {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for httpcContext {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum HTTPC_RequestStatus {
+ HTTPC_STATUS_REQUEST_IN_PROGRESS = 5,
+ HTTPC_STATUS_DOWNLOAD_READY = 7,
+}
+
+extern "C" {
+ pub fn httpcInit() -> Result;
+ pub fn httpcExit();
+ pub fn httpcOpenContext(context: *mut httpcContext,
+ url: *mut u8,
+ use_defaultproxy: u32) -> Result;
+ pub fn httpcCloseContext(context: *mut httpcContext) -> Result;
+ pub fn httpcAddRequestHeaderField(context: *mut httpcContext,
+ name: *mut u8,
+ value: *mut u8)
+ -> Result;
+ pub fn httpcBeginRequest(context: *mut httpcContext) -> Result;
+ pub fn httpcReceiveData(context: *mut httpcContext, buffer: *mut u8,
+ size: u32) -> Result;
+ pub fn httpcGetRequestState(context: *mut httpcContext,
+ out: *mut HTTPC_RequestStatus) -> Result;
+ pub fn httpcGetDownloadSizeState(context: *mut httpcContext,
+ downloadedsize: *mut u32,
+ contentsize: *mut u32) -> Result;
+ pub fn httpcGetResponseStatusCode(context: *mut httpcContext,
+ out: *mut u32, delay: u64) -> Result;
+ pub fn httpcGetResponseHeader(context: *mut httpcContext,
+ name: *mut u8,
+ value: *mut u8,
+ valuebuf_maxsize: u32) -> Result;
+ pub fn httpcDownloadData(context: *mut httpcContext, buffer: *mut u8,
+ size: u32, downloadedsize: *mut u32) -> Result;
+ pub fn HTTPC_Initialize(handle: Handle) -> Result;
+ pub fn HTTPC_InitializeConnectionSession(handle: Handle,
+ contextHandle: Handle) -> Result;
+ pub fn HTTPC_CreateContext(handle: Handle,
+ url: *mut u8,
+ contextHandle: *mut Handle) -> Result;
+ pub fn HTTPC_CloseContext(handle: Handle, contextHandle: Handle)
+ -> Result;
+ pub fn HTTPC_SetProxyDefault(handle: Handle, contextHandle: Handle)
+ -> Result;
+ pub fn HTTPC_AddRequestHeaderField(handle: Handle, contextHandle: Handle,
+ name: *mut u8,
+ value: *mut u8)
+ -> Result;
+ pub fn HTTPC_BeginRequest(handle: Handle, contextHandle: Handle)
+ -> Result;
+ pub fn HTTPC_ReceiveData(handle: Handle, contextHandle: Handle,
+ buffer: *mut u8, size: u32) -> Result;
+ pub fn HTTPC_GetRequestState(handle: Handle, contextHandle: Handle,
+ out: *mut HTTPC_RequestStatus) -> Result;
+ pub fn HTTPC_GetDownloadSizeState(handle: Handle, contextHandle: Handle,
+ downloadedsize: *mut u32,
+ contentsize: *mut u32) -> Result;
+ pub fn HTTPC_GetResponseHeader(handle: Handle, contextHandle: Handle,
+ name: *mut u8,
+ value: *mut u8,
+ valuebuf_maxsize: u32) -> Result;
+ pub fn HTTPC_GetResponseStatusCode(handle: Handle, contextHandle: Handle,
+ out: *mut u32) -> Result;
+}
diff --git a/ctru-sys/src/services/ir.rs b/ctru-sys/src/services/ir.rs
new file mode 100644
index 0000000..94a626a
--- /dev/null
+++ b/ctru-sys/src/services/ir.rs
@@ -0,0 +1,21 @@
+use ::{Result, Handle};
+
+extern "C" {
+ pub fn iruInit(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result;
+ pub fn iruExit();
+ pub fn iruGetServHandle() -> Handle;
+ pub fn iruSendData(buf: *mut u8, size: u32, wait: u8) -> Result;
+ pub fn iruRecvData(buf: *mut u8, size: u32, flag: u8,
+ transfercount: *mut u32, wait: u8) -> Result;
+ pub fn IRU_Initialize() -> Result;
+ pub fn IRU_Shutdown() -> Result;
+ pub fn IRU_StartSendTransfer(buf: *mut u8, size: u32) -> Result;
+ pub fn IRU_WaitSendTransfer() -> Result;
+ pub fn IRU_StartRecvTransfer(size: u32, flag: u8) -> Result;
+ pub fn IRU_WaitRecvTransfer(transfercount: *mut 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;
+}
+
diff --git a/ctru-sys/src/services/irrst.rs b/ctru-sys/src/services/irrst.rs
new file mode 100644
index 0000000..2f4c6eb
--- /dev/null
+++ b/ctru-sys/src/services/irrst.rs
@@ -0,0 +1,21 @@
+use ::{Result, Handle};
+use ::types::*;
+
+use super::hid::circlePosition;
+
+extern "C" {
+ pub static mut irrstMemHandle: Handle;
+ pub static mut irrstSharedMem: *mut vu32;
+
+ pub fn irrstInit() -> 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;
+
+}
diff --git a/ctru-sys/src/services/mic.rs b/ctru-sys/src/services/mic.rs
new file mode 100644
index 0000000..1037698
--- /dev/null
+++ b/ctru-sys/src/services/mic.rs
@@ -0,0 +1,42 @@
+use ::{Handle, Result};
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum MICU_Encoding {
+ MICU_ENCODING_PCM8 = 0,
+ MICU_ENCODING_PCM16 = 1,
+ MICU_ENCODING_PCM8_SIGNED = 2,
+ MICU_ENCODING_PCM16_SIGNED = 3,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum MICU_SampleRate {
+ MICU_SAMPLE_RATE_32730 = 0,
+ MICU_SAMPLE_RATE_16360 = 1,
+ MICU_SAMPLE_RATE_10910 = 2,
+ MICU_SAMPLE_RATE_8180 = 3,
+}
+
+extern "C" {
+ pub fn micInit(buffer: *mut u8, bufferSize: u32) -> Result;
+ pub fn micExit();
+ pub fn micGetSampleDataSize() -> u32;
+ pub fn micGetLastSampleOffset() -> u32;
+ pub fn MICU_MapSharedMem(size: u32, handle: Handle) -> Result;
+ pub fn MICU_UnmapSharedMem() -> Result;
+ pub fn MICU_StartSampling(encoding: MICU_Encoding,
+ sampleRate: MICU_SampleRate, offset: u32,
+ size: u32, _loop: u8) -> Result;
+ pub fn MICU_AdjustSampling(sampleRate: MICU_SampleRate) -> Result;
+ pub fn MICU_StopSampling() -> Result;
+ pub fn MICU_IsSampling(sampling: *mut u8) -> Result;
+ pub fn MICU_GetEventHandle(handle: *mut Handle) -> Result;
+ pub fn MICU_SetGain(gain: u8) -> Result;
+ pub fn MICU_GetGain(gain: *mut u8) -> Result;
+ pub fn MICU_SetPower(power: u8) -> Result;
+ pub fn MICU_GetPower(power: *mut u8) -> Result;
+ pub fn MICU_SetClamp(clamp: u8) -> Result;
+ pub fn MICU_GetClamp(clamp: *mut u8) -> Result;
+ pub fn MICU_SetAllowShellClosed(allowShellClosed: u8) -> Result;
+}
diff --git a/ctru-sys/src/services/mod.rs b/ctru-sys/src/services/mod.rs
new file mode 100644
index 0000000..76b7c35
--- /dev/null
+++ b/ctru-sys/src/services/mod.rs
@@ -0,0 +1,27 @@
+pub mod ac;
+pub mod am;
+pub mod apt;
+pub mod cam;
+pub mod cfgnor;
+pub mod cfgu;
+pub mod dsp;
+pub mod fs;
+pub mod gspgpu;
+pub mod gsplcd;
+pub mod hb;
+pub mod hid;
+pub mod httpc;
+pub mod ir;
+pub mod irrst;
+pub mod mic;
+pub mod mvd;
+pub mod news;
+pub mod ns;
+pub mod pm;
+pub mod ps;
+pub mod ptmsysm;
+pub mod ptmu;
+pub mod qtm;
+pub mod soc;
+pub mod srvpm;
+pub mod y2r;
diff --git a/ctru-sys/src/services/mvd.rs b/ctru-sys/src/services/mvd.rs
new file mode 100644
index 0000000..fe8691c
--- /dev/null
+++ b/ctru-sys/src/services/mvd.rs
@@ -0,0 +1,67 @@
+use ::Result;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum MVDSTD_Mode {
+ MVDMODE_COLORFORMATCONV = 0,
+ MVDMODE_VIDEOPROCESSING = 1,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum MVDSTD_InputFormat {
+ MVD_INPUT_YUYV422 = 65537,
+ MVD_INPUT_H264 = 131073,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum MVDSTD_OutputFormat { MVD_OUTPUT_RGB565 = 262146, }
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct MVDSTD_Config {
+ pub input_type: MVDSTD_InputFormat,
+ pub unk_x04: u32,
+ pub unk_x08: u32,
+ pub inwidth: u32,
+ pub inheight: u32,
+ pub physaddr_colorconv_indata: u32,
+ pub unk_x18: [u32; 10usize],
+ pub flag_x40: u32,
+ pub unk_x44: u32,
+ pub unk_x48: u32,
+ pub outheight0: u32,
+ pub outwidth0: u32,
+ pub unk_x54: u32,
+ pub output_type: MVDSTD_OutputFormat,
+ pub outwidth1: u32,
+ pub outheight1: u32,
+ pub physaddr_outdata0: u32,
+ pub physaddr_outdata1_colorconv: u32,
+ pub unk_x6c: [u32; 44usize],
+}
+impl ::core::clone::Clone for MVDSTD_Config {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for MVDSTD_Config {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+extern "C" {
+ pub fn mvdstdInit(mode: MVDSTD_Mode, input_type: MVDSTD_InputFormat,
+ output_type: MVDSTD_OutputFormat, size: u32) -> Result;
+ pub fn mvdstdExit();
+ pub fn mvdstdGenerateDefaultConfig(config: *mut MVDSTD_Config,
+ input_width: u32, input_height: u32,
+ output_width: u32,
+ output_height: u32,
+ vaddr_colorconv_indata: *mut u32,
+ vaddr_outdata0: *mut u32,
+ vaddr_outdata1_colorconv: *mut u32);
+ pub fn mvdstdProcessFrame(config: *mut MVDSTD_Config,
+ h264_vaddr_inframe: *mut u32,
+ h264_inframesize: u32, h264_frameid: u32)
+ -> Result;
+ pub fn MVDSTD_SetConfig(config: *mut MVDSTD_Config) -> Result;
+}
diff --git a/ctru-sys/src/services/news.rs b/ctru-sys/src/services/news.rs
new file mode 100644
index 0000000..fc82784
--- /dev/null
+++ b/ctru-sys/src/services/news.rs
@@ -0,0 +1,11 @@
+use ::Result;
+use ::c_void;
+
+extern "C" {
+ pub fn newsInit() -> Result;
+ pub fn newsExit();
+ pub fn NEWS_AddNotification(title: *const u16, titleLength: u32,
+ message: *const u16, messageLength: u32,
+ imageData: *const c_void,
+ imageSize: u32, jpeg: u8) -> Result;
+}
diff --git a/ctru-sys/src/services/ns.rs b/ctru-sys/src/services/ns.rs
new file mode 100644
index 0000000..c48e176
--- /dev/null
+++ b/ctru-sys/src/services/ns.rs
@@ -0,0 +1,9 @@
+use ::Result;
+
+extern "C" {
+ pub fn nsInit() -> Result;
+ pub fn nsExit();
+ pub fn NS_LaunchTitle(titleid: u64, launch_flags: u32, procid: *mut u32) -> Result;
+ pub fn NS_RebootToTitle(mediatype: u8, titleid: u64) -> Result;
+}
+
diff --git a/ctru-sys/src/services/pm.rs b/ctru-sys/src/services/pm.rs
new file mode 100644
index 0000000..971fbb3
--- /dev/null
+++ b/ctru-sys/src/services/pm.rs
@@ -0,0 +1,24 @@
+use ::{Handle, Result};
+use ::c_void;
+
+extern "C" {
+ pub fn pmInit() -> Result;
+ pub fn pmExit();
+ 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;
+ pub fn srvPmInit() -> Result;
+ pub fn srvPmExit();
+ pub fn SRVPM_PublishToProcess(notificationId: u32, process: Handle)
+ -> Result;
+ pub fn SRVPM_PublishToAll(notificationId: u32) -> Result;
+ pub fn SRVPM_RegisterProcess(procid: u32, count: u32,
+ serviceaccesscontrol: c_void) -> Result;
+ pub fn SRVPM_UnregisterProcess(procid: u32) -> Result;
+}
+
diff --git a/ctru-sys/src/services/ps.rs b/ctru-sys/src/services/ps.rs
new file mode 100644
index 0000000..e59a08d
--- /dev/null
+++ b/ctru-sys/src/services/ps.rs
@@ -0,0 +1,46 @@
+use ::Result;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum PS_AESAlgorithm {
+ PS_ALGORITHM_CBC_ENC = 0,
+ PS_ALGORITHM_CBC_DEC = 1,
+ PS_ALGORITHM_CTR_ENC = 2,
+ PS_ALGORITHM_CTR_DEC = 3,
+ PS_ALGORITHM_CCM_ENC = 4,
+ PS_ALGORITHM_CCM_DEC = 5,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum PS_AESKeyType {
+ PS_KEYSLOT_0D = 0,
+ PS_KEYSLOT_2D = 1,
+ PS_KEYSLOT_31 = 2,
+ PS_KEYSLOT_38 = 3,
+ PS_KEYSLOT_32 = 4,
+ PS_KEYSLOT_39_DLP = 5,
+ PS_KEYSLOT_2E = 6,
+ PS_KEYSLOT_INVALID = 7,
+ PS_KEYSLOT_36 = 8,
+ PS_KEYSLOT_39_NFC = 9,
+}
+
+extern "C" {
+ pub fn psInit() -> Result;
+ pub fn psExit();
+ pub fn PS_EncryptDecryptAes(size: u32, _in: *mut u8, out: *mut u8,
+ aes_algo: PS_AESAlgorithm,
+ key_type: PS_AESKeyType, iv: *mut u8)
+ -> Result;
+ pub fn PS_EncryptSignDecryptVerifyAesCcm(_in: *mut u8, in_size: u32,
+ out: *mut u8, out_size: u32,
+ data_len: u32,
+ mac_data_len: u32,
+ mac_len: u32,
+ aes_algo: PS_AESAlgorithm,
+ key_type: PS_AESKeyType,
+ nonce: *mut u8) -> Result;
+ pub fn PS_GetLocalFriendCodeSeed(seed: *mut u64) -> Result;
+ pub fn PS_GetDeviceId(device_id: *mut u32) -> Result;
+}
diff --git a/ctru-sys/src/services/ptmsysm.rs b/ctru-sys/src/services/ptmsysm.rs
new file mode 100644
index 0000000..7507fd5
--- /dev/null
+++ b/ctru-sys/src/services/ptmsysm.rs
@@ -0,0 +1,7 @@
+use ::Result;
+
+extern "C" {
+ pub fn ptmSysmInit() -> Result;
+ pub fn ptmSysmExit();
+ pub fn PTMSYSM_ConfigureNew3DSCPU(value: u8) -> Result;
+}
diff --git a/ctru-sys/src/services/ptmu.rs b/ctru-sys/src/services/ptmu.rs
new file mode 100644
index 0000000..e230a37
--- /dev/null
+++ b/ctru-sys/src/services/ptmu.rs
@@ -0,0 +1,11 @@
+use ::Result;
+
+extern "C" {
+ pub fn ptmuInit() -> Result;
+ pub fn ptmuExit();
+ pub fn PTMU_GetShellState(out: *mut u8) -> Result;
+ pub fn PTMU_GetBatteryLevel(out: *mut u8) -> Result;
+ pub fn PTMU_GetBatteryChargeState(out: *mut u8) -> Result;
+ pub fn PTMU_GetPedometerState(out: *mut u8) -> Result;
+ pub fn PTMU_GetTotalStepCount(steps: *mut u32) -> Result;
+}
diff --git a/ctru-sys/src/services/qtm.rs b/ctru-sys/src/services/qtm.rs
new file mode 100644
index 0000000..30d7595
--- /dev/null
+++ b/ctru-sys/src/services/qtm.rs
@@ -0,0 +1,44 @@
+use ::Result;
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct QTM_HeadTrackingInfoCoord {
+ pub x: f32,
+ pub y: f32,
+}
+impl ::core::clone::Clone for QTM_HeadTrackingInfoCoord {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for QTM_HeadTrackingInfoCoord {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct QTM_HeadTrackingInfo {
+ pub flags: [u8; 5usize],
+ pub padding: [u8; 3usize],
+ pub floatdata_x08: f32,
+ pub coords0: [QTM_HeadTrackingInfoCoord; 4usize],
+ pub unk_x2c: [u32; 5usize],
+}
+impl ::core::clone::Clone for QTM_HeadTrackingInfo {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for QTM_HeadTrackingInfo {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+extern "C" {
+ pub fn qtmInit() -> Result;
+ pub fn qtmExit();
+ pub fn qtmCheckInitialized() -> u8;
+ pub fn qtmCheckHeadFullyDetected(info: *mut QTM_HeadTrackingInfo) -> u8;
+ pub fn qtmConvertCoordToScreen(coord: *mut QTM_HeadTrackingInfoCoord,
+ screen_width: *mut f32,
+ screen_height:
+ *mut f32,
+ x: *mut u32, y: *mut u32) -> Result;
+ pub fn QTM_GetHeadTrackingInfo(val: u64, out: *mut QTM_HeadTrackingInfo)
+ -> Result;
+}
diff --git a/ctru-sys/src/services/soc.rs b/ctru-sys/src/services/soc.rs
new file mode 100644
index 0000000..3a1e2ec
--- /dev/null
+++ b/ctru-sys/src/services/soc.rs
@@ -0,0 +1,7 @@
+use ::Result;
+
+extern "C" {
+ pub fn SOC_Init(context_addr: *mut u32, context_size: u32) -> Result;
+ pub fn SOC_Exit() -> Result;
+ pub fn gethostid() -> i32;
+}
diff --git a/ctru-sys/src/services/srvpm.rs b/ctru-sys/src/services/srvpm.rs
new file mode 100644
index 0000000..0141898
--- /dev/null
+++ b/ctru-sys/src/services/srvpm.rs
@@ -0,0 +1,12 @@
+use ::{Handle, Result};
+use ::c_void;
+
+extern "C" {
+ pub fn srvPmInit() -> Result;
+ pub fn srvPmExit();
+ pub fn SRVPM_PublishToProcess(notificationId: u32, process: Handle) -> Result;
+ pub fn SRVPM_PublishToAll(notificationId: u32) -> Result;
+ pub fn SRVPM_RegisterProcess(procid: u32, count: u32,
+ serviceaccesscontrol: c_void) -> Result;
+ pub fn SRVPM_UnregisterProcess(procid: u32) -> Result;
+}
diff --git a/ctru-sys/src/services/y2r.rs b/ctru-sys/src/services/y2r.rs
new file mode 100644
index 0000000..d3393d3
--- /dev/null
+++ b/ctru-sys/src/services/y2r.rs
@@ -0,0 +1,185 @@
+use ::{Handle, Result};
+use ::c_void;
+use ::types::*;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Y2RU_InputFormat {
+ INPUT_YUV422_INDIV_8 = 0,
+ INPUT_YUV420_INDIV_8 = 1,
+ INPUT_YUV422_INDIV_16 = 2,
+ INPUT_YUV420_INDIV_16 = 3,
+ INPUT_YUV422_BATCH = 4,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Y2RU_OutputFormat {
+ OUTPUT_RGB_32 = 0,
+ OUTPUT_RGB_24 = 1,
+ OUTPUT_RGB_16_555 = 2,
+ OUTPUT_RGB_16_565 = 3,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Y2RU_Rotation {
+ ROTATION_NONE = 0,
+ ROTATION_CLOCKWISE_90 = 1,
+ ROTATION_CLOCKWISE_180 = 2,
+ ROTATION_CLOCKWISE_270 = 3,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Y2RU_BlockAlignment {
+ BLOCK_LINE = 0,
+ BLOCK_8_BY_8 = 1,
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Y2RU_ColorCoefficients {
+ pub rgb_Y: u16,
+ pub r_V: u16,
+ pub g_V: u16,
+ pub g_U: u16,
+ pub b_U: u16,
+ pub r_offset: u16,
+ pub g_offset: u16,
+ pub b_offset: u16,
+}
+impl ::core::clone::Clone for Y2RU_ColorCoefficients {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Y2RU_ColorCoefficients {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Y2RU_StandardCoefficient {
+ COEFFICIENT_ITU_R_BT_601 = 0,
+ COEFFICIENT_ITU_R_BT_709 = 1,
+ COEFFICIENT_ITU_R_BT_601_SCALING = 2,
+ COEFFICIENT_ITU_R_BT_709_SCALING = 3,
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Y2RU_ConversionParams {
+ pub _bindgen_bitfield_1_: Y2RU_InputFormat,
+ pub _bindgen_bitfield_2_: Y2RU_OutputFormat,
+ pub _bindgen_bitfield_3_: Y2RU_Rotation,
+ pub _bindgen_bitfield_4_: Y2RU_BlockAlignment,
+ pub input_line_width: s16,
+ pub input_lines: s16,
+ pub _bindgen_bitfield_5_: Y2RU_StandardCoefficient,
+ pub unused: u8,
+ pub alpha: u16,
+}
+impl ::core::clone::Clone for Y2RU_ConversionParams {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Y2RU_ConversionParams {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+#[repr(C)]
+#[derive(Copy)]
+pub struct Y2RU_DitheringWeightParams {
+ pub w0_xEven_yEven: u16,
+ pub w0_xOdd_yEven: u16,
+ pub w0_xEven_yOdd: u16,
+ pub w0_xOdd_yOdd: u16,
+ pub w1_xEven_yEven: u16,
+ pub w1_xOdd_yEven: u16,
+ pub w1_xEven_yOdd: u16,
+ pub w1_xOdd_yOdd: u16,
+ pub w2_xEven_yEven: u16,
+ pub w2_xOdd_yEven: u16,
+ pub w2_xEven_yOdd: u16,
+ pub w2_xOdd_yOdd: u16,
+ pub w3_xEven_yEven: u16,
+ pub w3_xOdd_yEven: u16,
+ pub w3_xEven_yOdd: u16,
+ pub w3_xOdd_yOdd: u16,
+}
+impl ::core::clone::Clone for Y2RU_DitheringWeightParams {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Y2RU_DitheringWeightParams {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+
+extern "C" {
+ pub fn y2rInit() -> Result;
+ pub fn y2rExit();
+ pub fn Y2RU_SetInputFormat(format: Y2RU_InputFormat) -> Result;
+ pub fn Y2RU_GetInputFormat(format: *mut Y2RU_InputFormat) -> Result;
+ pub fn Y2RU_SetOutputFormat(format: Y2RU_OutputFormat) -> Result;
+ pub fn Y2RU_GetOutputFormat(format: *mut Y2RU_OutputFormat) -> Result;
+ pub fn Y2RU_SetRotation(rotation: Y2RU_Rotation) -> Result;
+ pub fn Y2RU_GetRotation(rotation: *mut Y2RU_Rotation) -> Result;
+ pub fn Y2RU_SetBlockAlignment(alignment: Y2RU_BlockAlignment) -> Result;
+ pub fn Y2RU_GetBlockAlignment(alignment: *mut Y2RU_BlockAlignment)
+ -> Result;
+ pub fn Y2RU_SetSpacialDithering(enable: u8) -> Result;
+ pub fn Y2RU_GetSpacialDithering(enabled: *mut u8) -> Result;
+ pub fn Y2RU_SetTemporalDithering(enable: u8) -> Result;
+ pub fn Y2RU_GetTemporalDithering(enabled: *mut u8) -> Result;
+ pub fn Y2RU_SetInputLineWidth(line_width: u16) -> Result;
+ pub fn Y2RU_GetInputLineWidth(line_width: *mut u16) -> Result;
+ pub fn Y2RU_SetInputLines(num_lines: u16) -> Result;
+ pub fn Y2RU_GetInputLines(num_lines: *mut u16) -> Result;
+ pub fn Y2RU_SetCoefficients(coefficients: *const Y2RU_ColorCoefficients)
+ -> Result;
+ pub fn Y2RU_GetCoefficients(coefficients: *mut Y2RU_ColorCoefficients)
+ -> Result;
+ pub fn Y2RU_SetStandardCoefficient(coefficient: Y2RU_StandardCoefficient)
+ -> Result;
+ pub fn Y2RU_GetStandardCoefficient(coefficients:
+ *mut Y2RU_ColorCoefficients,
+ standardCoeff:
+ Y2RU_StandardCoefficient)
+ -> Result;
+ pub fn Y2RU_SetAlpha(alpha: u16) -> Result;
+ pub fn Y2RU_GetAlpha(alpha: *mut u16) -> Result;
+ pub fn Y2RU_SetTransferEndInterrupt(should_interrupt: u8) -> Result;
+ pub fn Y2RU_GetTransferEndInterrupt(should_interrupt: *mut u8) -> Result;
+ pub fn Y2RU_GetTransferEndEvent(end_event: *mut Handle) -> Result;
+ pub fn Y2RU_SetSendingY(src_buf: *const c_void,
+ image_size: u32, transfer_unit: s16,
+ transfer_gap: s16) -> Result;
+ pub fn Y2RU_SetSendingU(src_buf: *const c_void,
+ image_size: u32, transfer_unit: s16,
+ transfer_gap: s16) -> Result;
+ pub fn Y2RU_SetSendingV(src_buf: *const c_void,
+ image_size: u32, transfer_unit: s16,
+ transfer_gap: s16) -> Result;
+ pub fn Y2RU_SetSendingYUYV(src_buf: *const c_void,
+ image_size: u32, transfer_unit: s16,
+ transfer_gap: s16) -> Result;
+ pub fn Y2RU_SetReceiving(dst_buf: *mut c_void,
+ image_size: u32, transfer_unit: s16,
+ transfer_gap: s16) -> Result;
+ pub fn Y2RU_IsDoneSendingY(is_done: *mut u8) -> Result;
+ pub fn Y2RU_IsDoneSendingU(is_done: *mut u8) -> Result;
+ pub fn Y2RU_IsDoneSendingV(is_done: *mut u8) -> Result;
+ pub fn Y2RU_IsDoneSendingYUYV(is_done: *mut u8) -> Result;
+ pub fn Y2RU_IsDoneReceiving(is_done: *mut u8) -> Result;
+ pub fn Y2RU_SetDitheringWeightParams(params:
+ *const Y2RU_DitheringWeightParams)
+ -> Result;
+ pub fn Y2RU_GetDitheringWeightParams(params:
+ *mut Y2RU_DitheringWeightParams)
+ -> Result;
+ pub fn Y2RU_SetConversionParams(params: *const Y2RU_ConversionParams)
+ -> Result;
+ pub fn Y2RU_StartConversion() -> Result;
+ pub fn Y2RU_StopConversion() -> Result;
+ pub fn Y2RU_IsBusyConversion(is_busy: *mut u8) -> Result;
+ pub fn Y2RU_PingProcess(ping: *mut u8) -> Result;
+ pub fn Y2RU_DriverInitialize() -> Result;
+ pub fn Y2RU_DriverFinalize() -> Result;
+}
diff --git a/ctru-sys/src/srv.rs b/ctru-sys/src/srv.rs
new file mode 100644
index 0000000..e465b8a
--- /dev/null
+++ b/ctru-sys/src/srv.rs
@@ -0,0 +1,15 @@
+use {Result, Handle};
+use c_void;
+
+extern "C" {
+ pub fn srvInit() -> Result;
+ pub fn srvExit() -> Result;
+ pub fn srvGetSessionHandle() -> * const Handle;
+ pub fn srvRegisterClient() -> Result;
+ pub fn srvGetServiceHandle(out: *mut Handle, name: * const u8) -> Result;
+ pub fn srvRegisterService(out: *mut Handle, name: * const u8) -> Result;
+ pub fn srvUnregisterService(name: * const u8) -> Result;
+ pub fn srvPmInit() -> Result;
+ pub fn srvRegisterProcess(procid: u32, count: u32, serviceaccesscontrol: *mut c_void) -> Result;
+ pub fn srvUnregisterProcess(procid: u32) -> Result;
+}
diff --git a/ctru-sys/src/svc.rs b/ctru-sys/src/svc.rs
new file mode 100644
index 0000000..0ad3fc9
--- /dev/null
+++ b/ctru-sys/src/svc.rs
@@ -0,0 +1,450 @@
+//TODO: Implement static functions
+
+use {Handle, Result};
+use c_void;
+use ThreadFunc;
+use types::*;
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed1 {
+ MEMOP_FREE = 1,
+ MEMOP_RESERVE = 2,
+ MEMOP_ALLOC = 3,
+ MEMOP_MAP = 4,
+ MEMOP_UNMAP = 5,
+ MEMOP_PROT = 6,
+ MEMOP_REGION_APP = 256,
+ MEMOP_REGION_SYSTEM = 512,
+ MEMOP_REGION_BASE = 768,
+ MEMOP_OP_MASK = 255,
+ MEMOP_REGION_MASK = 3840,
+ MEMOP_LINEAR_FLAG = 65536,
+ MEMOP_ALLOC_LINEAR = 65539,
+}
+pub type MemOp = Enum_Unnamed1;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed2 {
+ MEMSTATE_FREE = 0,
+ MEMSTATE_RESERVED = 1,
+ MEMSTATE_IO = 2,
+ MEMSTATE_STATIC = 3,
+ MEMSTATE_CODE = 4,
+ MEMSTATE_PRIVATE = 5,
+ MEMSTATE_SHARED = 6,
+ MEMSTATE_CONTINUOUS = 7,
+ MEMSTATE_ALIASED = 8,
+ MEMSTATE_ALIAS = 9,
+ MEMSTATE_ALIASCODE = 10,
+ MEMSTATE_LOCKED = 11,
+}
+pub type MemState = Enum_Unnamed2;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed3 {
+ MEMPERM_READ = 1,
+ MEMPERM_WRITE = 2,
+ MEMPERM_EXECUTE = 4,
+ MEMPERM_DONTCARE = 268435456,
+}
+pub type MemPerm = Enum_Unnamed3;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed4 {
+ pub base_addr: u32,
+ pub size: u32,
+ pub perm: u32,
+ pub state: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed4 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed4 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type MemInfo = Struct_Unnamed4;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed5 {
+ pub flags: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed5 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed5 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type PageInfo = Struct_Unnamed5;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed6 {
+ ARBITRATION_SIGNAL = 0,
+ ARBITRATION_WAIT_IF_LESS_THAN = 1,
+ ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN = 2,
+ ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT = 3,
+ ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT = 4,
+}
+pub type ArbitrationType = Enum_Unnamed6;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed7 { THREADINFO_TYPE_UNKNOWN = 0, }
+pub type ThreadInfoType = Enum_Unnamed7;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed8 { REASON_CREATE = 1, REASON_ATTACH = 2, }
+pub type ProcessEventReason = Enum_Unnamed8;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed9 {
+ pub program_id: u64,
+ pub process_name: [u8; 8usize],
+ pub process_id: u32,
+ pub reason: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed9 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed9 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ProcessEvent = Struct_Unnamed9;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed10 {
+ EXITPROCESS_EVENT_NONE = 0,
+ EXITPROCESS_EVENT_TERMINATE = 1,
+ EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2,
+}
+pub type ExitProcessEventReason = Enum_Unnamed10;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed11 {
+ pub reason: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed11 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed11 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ExitProcessEvent = Struct_Unnamed11;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed12 {
+ pub creator_thread_id: u32,
+ pub base_addr: u32,
+ pub entry_point: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed12 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed12 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type CreateThreadEvent = Struct_Unnamed12;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed13 {
+ EXITTHREAD_EVENT_NONE = 0,
+ EXITTHREAD_EVENT_TERMINATE = 1,
+ EXITTHREAD_EVENT_UNHANDLED_EXC = 2,
+ EXITTHREAD_EVENT_TERMINATE_PROCESS = 3,
+}
+pub type ExitThreadEventReason = Enum_Unnamed13;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed14 {
+ pub reason: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed14 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed14 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ExitThreadEvent = Struct_Unnamed14;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed15 {
+ USERBREAK_PANIC = 0,
+ USERBREAK_ASSERT = 1,
+ USERBREAK_USER = 2,
+}
+pub type UserBreakType = Enum_Unnamed15;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed16 {
+ EXC_EVENT_UNDEFINED_INSTRUCTION = 0,
+ EXC_EVENT_UNKNOWN1 = 1,
+ EXC_EVENT_UNKNOWN2 = 2,
+ EXC_EVENT_UNKNOWN3 = 3,
+ EXC_EVENT_ATTACH_BREAK = 4,
+ EXC_EVENT_BREAKPOINT = 5,
+ EXC_EVENT_USER_BREAK = 6,
+ EXC_EVENT_DEBUGGER_BREAK = 7,
+ EXC_EVENT_UNDEFINED_SYSCALL = 8,
+}
+pub type ExceptionEventType = Enum_Unnamed16;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed17 {
+ pub _type: u32,
+ pub address: u32,
+ pub argument: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed17 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed17 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ExceptionEvent = Struct_Unnamed17;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed18 {
+ pub clock_tick: u64,
+}
+impl ::core::clone::Clone for Struct_Unnamed18 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed18 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type SchedulerInOutEvent = Struct_Unnamed18;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed19 {
+ pub clock_tick: u64,
+ pub syscall: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed19 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed19 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type SyscallInOutEvent = Struct_Unnamed19;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed20 {
+ pub string_addr: u32,
+ pub string_size: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed20 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed20 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type OutputStringEvent = Struct_Unnamed20;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed21 {
+ pub mapped_addr: u32,
+ pub mapped_size: u32,
+ pub memperm: u32,
+ pub memstate: u32,
+}
+impl ::core::clone::Clone for Struct_Unnamed21 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed21 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type MapEvent = Struct_Unnamed21;
+#[derive(Clone, Copy)]
+#[repr(C)]
+pub enum Enum_Unnamed22 {
+ DBG_EVENT_PROCESS = 0,
+ DBG_EVENT_CREATE_THREAD = 1,
+ DBG_EVENT_EXIT_THREAD = 2,
+ DBG_EVENT_EXIT_PROCESS = 3,
+ DBG_EVENT_EXCEPTION = 4,
+ DBG_EVENT_DLL_LOAD = 5,
+ DBG_EVENT_DLL_UNLOAD = 6,
+ DBG_EVENT_SCHEDULE_IN = 7,
+ DBG_EVENT_SCHEDULE_OUT = 8,
+ DBG_EVENT_SYSCALL_IN = 9,
+ DBG_EVENT_SYSCALL_OUT = 10,
+ DBG_EVENT_OUTPUT_STRING = 11,
+ DBG_EVENT_MAP = 12,
+}
+pub type DebugEventType = Enum_Unnamed22;
+#[repr(C)]
+#[derive(Copy)]
+pub struct Struct_Unnamed23 {
+ pub _type: u32,
+ pub thread_id: u32,
+ pub unknown: [u32; 2usize],
+ pub _bindgen_data_1_: [u64; 3usize],
+}
+impl Struct_Unnamed23 {
+ pub unsafe fn process(&mut self) -> *mut ProcessEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn create_thread(&mut self) -> *mut CreateThreadEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn exit_thread(&mut self) -> *mut ExitThreadEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn exit_process(&mut self) -> *mut ExitProcessEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn exception(&mut self) -> *mut ExceptionEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn scheduler(&mut self) -> *mut SchedulerInOutEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn syscall(&mut self) -> *mut SyscallInOutEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn output_string(&mut self) -> *mut OutputStringEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn map(&mut self) -> *mut MapEvent {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+}
+impl ::core::clone::Clone for Struct_Unnamed23 {
+ fn clone(&self) -> Self { *self }
+}
+impl ::core::default::Default for Struct_Unnamed23 {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type DebugEventInfo = Struct_Unnamed23;
+extern "C" {
+ pub fn svcControlMemory(addr_out: *mut u32, addr0: u32, addr1: u32,
+ size: u32, op: MemOp, perm: MemPerm) -> Result;
+ pub fn svcControlProcessMemory(process: Handle, addr0: u32, addr1: u32,
+ size: u32, _type: u32, perm: u32)
+ -> Result;
+ pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32,
+ my_perm: MemPerm, other_perm: MemPerm)
+ -> Result;
+ pub fn svcMapMemoryBlock(memblock: Handle, addr: u32, my_perm: MemPerm,
+ other_perm: MemPerm) -> Result;
+ pub fn svcMapProcessMemory(process: Handle, startAddr: u32,
+ endAddr: u32) -> Result;
+ pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32,
+ endAddr: u32) -> Result;
+ pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> Result;
+ pub fn svcStartInterProcessDma(dma: *mut Handle, dstProcess: Handle,
+ dst: *mut c_void,
+ srcProcess: Handle,
+ src: *const c_void,
+ size: u32,
+ dmaConfig: *mut c_void)
+ -> Result;
+ pub fn svcStopDma(dma: Handle) -> Result;
+ pub fn svcGetDmaState(dmaState: *mut c_void, dma: Handle)
+ -> Result;
+ pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32)
+ -> Result;
+ pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo,
+ process: Handle, addr: u32) -> Result;
+ pub fn svcInvalidateProcessDataCache(process: Handle,
+ addr: *mut c_void,
+ size: u32) -> Result;
+ pub fn svcFlushProcessDataCache(process: Handle,
+ addr: *const c_void,
+ size: u32) -> Result;
+ pub fn svcReadProcessMemory(buffer: *mut c_void,
+ debug: Handle, addr: u32, size: u32)
+ -> Result;
+ pub fn svcWriteProcessMemory(debug: Handle,
+ buffer: *const c_void,
+ addr: u32, size: u32) -> Result;
+ pub fn svcOpenProcess(process: *mut Handle, processId: u32) -> Result;
+ pub fn svcExitProcess();
+ pub fn svcTerminateProcess(process: Handle) -> Result;
+ pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: u32)
+ -> Result;
+ pub fn svcGetProcessId(out: *mut u32, handle: Handle) -> Result;
+ pub fn svcGetProcessList(processCount: *mut s32, processIds: *mut u32,
+ processIdMaxCount: s32) -> Result;
+ pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle,
+ name: *const u8,
+ maxSessions: s32) -> Result;
+ pub fn svcConnectToPort(out: *mut Handle,
+ portName: *const u8)
+ -> Result;
+ pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc,
+ arg: u32, stack_top: *mut u32,
+ thread_priority: s32, processor_id: s32) -> Result;
+ pub fn svcOpenThread(thread: *mut Handle, process: Handle, threadId: u32)
+ -> Result;
+ pub fn svcExitThread();
+ pub fn svcSleepThread(ns: s64);
+ pub fn svcGetThreadPriority(out: *mut s32, handle: Handle) -> Result;
+ pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> Result;
+ pub fn svcGetThreadAffinityMask(affinitymask: *mut u8, thread: Handle,
+ processorcount: s32) -> Result;
+ pub fn svcSetThreadAffinityMask(thread: Handle, affinitymask: *mut u8,
+ processorcount: s32) -> Result;
+ pub fn svcGetThreadIdealProcessor(processorid: *mut s32, thread: Handle)
+ -> Result;
+ pub fn svcSetThreadIdealProcessor(thread: Handle, processorid: s32)
+ -> Result;
+ pub fn svcGetProcessorID() -> s32;
+ pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> Result;
+ pub fn svcGetProcessIdOfThread(out: *mut u32, handle: Handle) -> Result;
+ pub fn svcGetThreadInfo(out: *mut s64, thread: Handle,
+ _type: ThreadInfoType) -> Result;
+ pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> Result;
+ pub fn svcReleaseMutex(handle: Handle) -> Result;
+ pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32,
+ max_count: s32) -> Result;
+ pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle,
+ release_count: s32) -> Result;
+ pub fn svcCreateEvent(event: *mut Handle, reset_type: u8) -> Result;
+ pub fn svcSignalEvent(handle: Handle) -> Result;
+ pub fn svcClearEvent(handle: Handle) -> Result;
+ pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> Result;
+ pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle,
+ handles_num: s32, wait_all: u8,
+ nanoseconds: s64) -> Result;
+ pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> Result;
+ pub fn svcArbitrateAddress(arbiter: Handle, addr: u32,
+ _type: ArbitrationType, value: s32,
+ nanoseconds: s64) -> Result;
+ pub fn svcSendSyncRequest(session: Handle) -> Result;
+ pub fn svcAcceptSession(session: *mut Handle, port: Handle) -> Result;
+ pub fn svcReplyAndReceive(index: *mut s32, handles: *mut Handle,
+ handleCount: s32, replyTarget: Handle)
+ -> Result;
+ pub fn svcCreateTimer(timer: *mut Handle, reset_type: u8) -> Result;
+ pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> Result;
+ pub fn svcCancelTimer(timer: Handle) -> Result;
+ pub fn svcClearTimer(timer: Handle) -> Result;
+ pub fn svcGetSystemTick() -> u64;
+ pub fn svcCloseHandle(handle: Handle) -> Result;
+ pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> Result;
+ pub fn svcGetSystemInfo(out: *mut s64, _type: u32, param: s32) -> Result;
+ pub fn svcKernelSetState(_type: u32, param0: u32, param1: u32,
+ param2: u32) -> Result;
+ pub fn svcBreak(breakReason: UserBreakType);
+ pub fn svcOutputDebugString(str: *const u8,
+ length: i32) -> Result;
+ pub fn svcDebugActiveProcess(debug: *mut Handle, processId: u32)
+ -> Result;
+ pub fn svcBreakDebugProcess(debug: Handle) -> Result;
+ pub fn svcTerminateDebugProcess(debug: Handle) -> Result;
+ pub fn svcGetProcessDebugEvent(info: *mut DebugEventInfo, debug: Handle)
+ -> Result;
+ pub fn svcContinueDebugEvent(debug: Handle, flags: u32) -> Result;
+ pub fn svcBackdoor(callback:
+ ::core::option::Option<extern "C" fn() -> s32>)
+ -> Result;
+}
diff --git a/ctru-sys/src/synchronization.rs b/ctru-sys/src/synchronization.rs
new file mode 100644
index 0000000..6715d53
--- /dev/null
+++ b/ctru-sys/src/synchronization.rs
@@ -0,0 +1,19 @@
+//TODO: Implement stuff that bindgen doesn't catch
+
+use Handle;
+
+use super::lock::*;
+
+pub type LightLock = _LOCK_T;
+pub type RecursiveLock = _LOCK_RECURSIVE_T;
+extern "C" {
+ pub fn __sync_get_arbiter() -> Handle;
+ pub fn LightLock_Init(lock: *mut LightLock);
+ pub fn LightLock_Lock(lock: *mut LightLock);
+ pub fn LightLock_TryLock(lock: *mut LightLock) -> i32;
+ pub fn LightLock_Unlock(lock: *mut LightLock);
+ pub fn RecursiveLock_Init(lock: *mut RecursiveLock);
+ pub fn RecursiveLock_Lock(lock: *mut RecursiveLock);
+ pub fn RecursiveLock_TryLock(lock: *mut RecursiveLock) -> i32;
+ pub fn RecursiveLock_Unlock(lock: *mut RecursiveLock);
+}
diff --git a/ctru-sys/src/thread.rs b/ctru-sys/src/thread.rs
new file mode 100644
index 0000000..960807b
--- /dev/null
+++ b/ctru-sys/src/thread.rs
@@ -0,0 +1,19 @@
+use {Handle, Result};
+use c_void;
+use ThreadFunc;
+
+pub enum Struct_Thread_tag { }
+pub type Thread = *mut Struct_Thread_tag;
+extern "C" {
+ pub fn threadCreate(entrypoint: ThreadFunc,
+ arg: *mut c_void, stack_size: usize,
+ prio: i32,
+ affinity: i32, detached: u8)
+ -> Thread;
+ pub fn threadGetHandle(thread: Thread) -> Handle;
+ pub fn threadGetExitCode(thread: Thread) -> i32;
+ pub fn threadFree(thread: Thread);
+ pub fn threadJoin(thread: Thread, timeout_ns: u64) -> Result;
+ pub fn threadGetCurrent() -> Thread;
+ pub fn threadExit(rc: i32);
+}
diff --git a/ctru-sys/src/types.rs b/ctru-sys/src/types.rs
new file mode 100644
index 0000000..3861e72
--- /dev/null
+++ b/ctru-sys/src/types.rs
@@ -0,0 +1,35 @@
+#[repr(C)]
+pub enum mediatypes_enum {
+ mediatype_NAND = 0,
+ mediatype_SDMC = 1,
+ mediatype_GAMECARD = 2,
+}
+
+pub type s8 = i8;
+pub type s16 = i16;
+pub type s32 = i32;
+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;
+// typedef uint32_t u32;
+// typedef uint64_t u64;
+//
+// typedef int8_t s8;
+// typedef int16_t s16;
+// typedef int32_t s32;
+// typedef int64_t s64;
+//
+// typedef volatile u8 vu8;
+// typedef volatile u16 vu16;
+// typedef volatile u32 vu32;
+// typedef volatile u64 vu64;
+//
+// typedef volatile s8 vs8;
+// typedef volatile s16 vs16;
+// typedef volatile s32 vs32;
+// typedef volatile s64 vs64;
diff --git a/ctru-sys/src/vram.rs b/ctru-sys/src/vram.rs
new file mode 100644
index 0000000..2de9e2f
--- /dev/null
+++ b/ctru-sys/src/vram.rs
@@ -0,0 +1,10 @@
+use super::types::*;
+
+
+extern "C" {
+ pub fn vramAlloc(size: isize) -> *mut c_void;
+ pub fn vramMemAlign(size: isize, alignment: isize) -> *mut c_void;
+ pub fn vramRealloc(mem: *mut isize, size: isize) -> *mut c_void;
+ pub fn vramFree(mem: *mut c_void) -> ();
+ pub fn vramSpaceFree() -> u32;
+}