From 2bd6509b4f647f0669374dfc0352fcf782da8b41 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Wed, 27 Apr 2016 19:27:52 -0700 Subject: [PATCH 1/6] Compatibility fixes for Rust nightly (1.10.0) --- 3ds.json | 2 +- Cargo.toml | 4 ++-- src/lib.rs | 2 -- src/raw/console.rs | 1 - src/raw/mod.rs | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/3ds.json b/3ds.json index 0e863d1..a54295d 100644 --- a/3ds.json +++ b/3ds.json @@ -1,5 +1,5 @@ { - "data-layout": "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a:0:64-n32-m:e", + "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "llvm-target": "arm-none-eabihf", "linker": "arm-none-eabi-g++", "ar": "arm-none-eabi-ar", diff --git a/Cargo.toml b/Cargo.toml index f026c1c..df91803 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "ctru-rs" -version = "0.1.0" +version = "0.1.1" description = "A safe wrapper around smealum's ctrulib." -authors = ["Ronald Kinard "] +authors = ["Ronald Kinard ", "FenrirWolf "] links = "ctru" build = "build.rs" license = "https://en.wikipedia.org/wiki/Zlib_License" diff --git a/src/lib.rs b/src/lib.rs index 65fbda3..767f03d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(no_std)] #![feature(lang_items)] #![no_std] #![crate_type = "rlib"] @@ -19,6 +18,5 @@ pub use srv::Srv; pub use gfx::Gfx; pub use sdmc::Sdmc; -#[lang = "stack_exhausted"] extern fn stack_exhausted() {} #[lang = "eh_personality"] extern fn eh_personality() {} #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } diff --git a/src/raw/console.rs b/src/raw/console.rs index 8871c7f..bbf3a30 100644 --- a/src/raw/console.rs +++ b/src/raw/console.rs @@ -10,7 +10,6 @@ pub struct ConsoleFont { pub numChars: u16, } -#[repr(C)] pub type ConsolePrint = extern "C" fn(con: *mut c_void, c: i32) -> u8; #[repr(C)] diff --git a/src/raw/mod.rs b/src/raw/mod.rs index f4947a7..0975001 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -1,7 +1,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(overflowing_literals)] -#![allow(raw_pointer_derive)] pub mod console; pub mod gfx; From 225334fcce6230a56cf4255779ee64f0f7997dfb Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sat, 30 Apr 2016 18:29:50 -0700 Subject: [PATCH 2/6] Split raw bindings into a separate crate --- ctru-sys/Cargo.toml | 5 + ctru-sys/src/console.rs | 63 +++ ctru-sys/src/gfx.rs | 43 ++ ctru-sys/src/gpu/gpu.rs | 294 ++++++++++++ ctru-sys/src/gpu/gx.rs | 73 +++ ctru-sys/src/gpu/mod.rs | 11 + ctru-sys/src/gpu/registers.rs | 726 +++++++++++++++++++++++++++++ ctru-sys/src/gpu/shader_program.rs | 42 ++ ctru-sys/src/gpu/shbin.rs | 105 +++++ ctru-sys/src/lib.rs | 28 ++ ctru-sys/src/linear.rs | 10 + ctru-sys/src/os.rs | 14 + ctru-sys/src/sdmc.rs | 7 + ctru-sys/src/services/ac.rs | 9 + ctru-sys/src/services/am.rs | 30 ++ ctru-sys/src/services/apt.rs | 125 +++++ ctru-sys/src/services/cfgnor.rs | 10 + ctru-sys/src/services/cfgu.rs | 15 + ctru-sys/src/services/gsp.rs | 83 ++++ ctru-sys/src/services/hb.rs | 11 + ctru-sys/src/services/hid.rs | 103 ++++ ctru-sys/src/services/ir.rs | 14 + ctru-sys/src/services/irrst.rs | 21 + ctru-sys/src/services/mic.rs | 19 + ctru-sys/src/services/mod.rs | 15 + ctru-sys/src/services/ns.rs | 9 + ctru-sys/src/services/pm.rs | 12 + ctru-sys/src/services/ptm.rs | 12 + ctru-sys/src/services/soc.rs | 7 + ctru-sys/src/srv.rs | 15 + ctru-sys/src/svc.rs | 312 +++++++++++++ ctru-sys/src/types.rs | 35 ++ ctru-sys/src/vram.rs | 10 + 33 files changed, 2288 insertions(+) create mode 100644 ctru-sys/Cargo.toml create mode 100644 ctru-sys/src/console.rs create mode 100644 ctru-sys/src/gfx.rs create mode 100644 ctru-sys/src/gpu/gpu.rs create mode 100644 ctru-sys/src/gpu/gx.rs create mode 100644 ctru-sys/src/gpu/mod.rs create mode 100644 ctru-sys/src/gpu/registers.rs create mode 100644 ctru-sys/src/gpu/shader_program.rs create mode 100644 ctru-sys/src/gpu/shbin.rs create mode 100644 ctru-sys/src/lib.rs create mode 100644 ctru-sys/src/linear.rs create mode 100644 ctru-sys/src/os.rs create mode 100644 ctru-sys/src/sdmc.rs create mode 100644 ctru-sys/src/services/ac.rs create mode 100644 ctru-sys/src/services/am.rs create mode 100644 ctru-sys/src/services/apt.rs create mode 100644 ctru-sys/src/services/cfgnor.rs create mode 100644 ctru-sys/src/services/cfgu.rs create mode 100644 ctru-sys/src/services/gsp.rs create mode 100644 ctru-sys/src/services/hb.rs create mode 100644 ctru-sys/src/services/hid.rs create mode 100644 ctru-sys/src/services/ir.rs create mode 100644 ctru-sys/src/services/irrst.rs create mode 100644 ctru-sys/src/services/mic.rs create mode 100644 ctru-sys/src/services/mod.rs create mode 100644 ctru-sys/src/services/ns.rs create mode 100644 ctru-sys/src/services/pm.rs create mode 100644 ctru-sys/src/services/ptm.rs create mode 100644 ctru-sys/src/services/soc.rs create mode 100644 ctru-sys/src/srv.rs create mode 100644 ctru-sys/src/svc.rs create mode 100644 ctru-sys/src/types.rs create mode 100644 ctru-sys/src/vram.rs diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml new file mode 100644 index 0000000..5597f9b --- /dev/null +++ b/ctru-sys/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "ctru-sys" +version = "0.1.0" +authors = ["Ronald Kinard ", "FenrirWolf "] +license = "https://en.wikipedia.org/wiki/Zlib_License" 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/gfx.rs b/ctru-sys/src/gfx.rs new file mode 100644 index 0000000..ed40baf --- /dev/null +++ b/ctru-sys/src/gfx.rs @@ -0,0 +1,43 @@ +use services::gsp::*; + +#[inline] +pub fn RGB565(r: u32, g: u32, b: u32) { + (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11)); +} + +#[inline] +pub fn RGB8_to_565(r: u32, g: u32, b: 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 static mut gxCmdBuf: *mut u32; + + pub fn gfxInitDefault() -> (); + pub fn gfxInit(topFormat: GSP_FramebufferFormats, bottomFormat: GSP_FramebufferFormats, vrambuffers: u8) -> (); + pub fn gfxExit() -> (); + pub fn gfxSet3D(enable: u8) -> (); + pub fn gfxSetScreenFormat(screen: gfxScreen_t, format: GSP_FramebufferFormats) -> (); + pub fn gfxGetScreenFormat(screen: gfxScreen_t) -> GSP_FramebufferFormats; + pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8) -> (); + pub fn gfxFlushBuffers() -> (); + 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..24f2f90 --- /dev/null +++ b/ctru-sys/src/gpu/gpu.rs @@ -0,0 +1,294 @@ +use ctru::Handle; + +#[inline] +pub fn GPUCMD_HEADER(incremental: i32, mask: i32, reg: i32) { + (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)); +} + +#[inline] +pub fn GPU_TEXTURE_MAG_FILTER(v: i32) { + (((v)&0x1)<<1); //takes a GPU_TEXTURE_FILTER_PARAM +} + +#[inline] +pub fn GPU_TEXTURE_MIN_FILTER(v: i32) { + (((v)&0x1)<<2); //takes a GPU_TEXTURE_FILTER_PARAM +} + +#[inline] +pub fn GPU_TEXTURE_WRAP_S(v: i32) { + (((v)&0x3)<<8); //takes a GPU_TEXTURE_WRAP_PARAM +} + +#[inline] +pub fn GPU_TEXTURE_WRAP_T(v: i32) { + (((v)&0x3)<<12); //takes a GPU_TEXTURE_WRAP_PARAM +} + +#[repr(C)] +pub enum GPU_TEXTURE_FILTER_PARAM { + GPU_NEAREST = 0x0, + GPU_LINEAR = 0x1 +} + +#[repr(C)] +pub enum GPU_TEXTURE_WRAP_PARAM { + GPU_CLAMP_TO_EDGE = 0x0, + GPU_REPEAT = 0x1 +} + +#[repr(C)] +pub enum GPU_TEXUNIT { + GPU_TEXUNIT0 = 0x1, + GPU_TEXUNIT1 = 0x2, + GPU_TEXUNIT2 = 0x4 +} + +#[repr(C)] +pub enum GPU_TEXCOLOR { + GPU_RGBA8=0x0, + GPU_RGB8=0x1, + GPU_RGBA5551=0x2, + GPU_RGB565=0x3, + GPU_RGBA4=0x4, + GPU_LA8=0x5, + GPU_HILO8=0x6, + GPU_L8=0x7, + GPU_A8=0x8, + GPU_LA4=0x9, + GPU_L4=0xA, + GPU_ETC1=0xB, + GPU_ETC1A4=0xC +} + +#[repr(C)] +pub enum GPU_TESTFUNC { + GPU_NEVER = 0, + GPU_ALWAYS = 1, + GPU_EQUAL = 2, + GPU_NOTEQUAL = 3, + GPU_LESS = 4, + GPU_LEQUAL = 5, + GPU_GREATER = 6, + GPU_GEQUAL = 7 +} + +#[repr(C)] +pub enum GPU_SCISSORMODE { + GPU_SCISSOR_DISABLE = 0, // disable scissor test + GPU_SCISSOR_INVERT = 1, // exclude pixels inside the scissor box + // 2 is the same as 0 + GPU_SCISSOR_NORMAL = 3, // exclude pixels outside of the scissor box +} + +#[repr(C)] +pub enum GPU_STENCILOP { + GPU_KEEP = 0, // keep destination value + GPU_AND_NOT = 1, // destination & ~source + GPU_XOR = 5, // destination ^ source + // 2 is the same as 1. Other values are too weird to even be usable. +} + +#[repr(C)] +pub enum GPU_WRITEMASK { + GPU_WRITE_RED = 0x01, + GPU_WRITE_GREEN = 0x02, + GPU_WRITE_BLUE = 0x04, + GPU_WRITE_ALPHA = 0x08, + GPU_WRITE_DEPTH = 0x10, + + GPU_WRITE_COLOR = 0x0F, + GPU_WRITE_ALL = 0x1F +} + +#[repr(C)] +pub enum GPU_BLENDEQUATION { + GPU_BLEND_ADD = 0, + GPU_BLEND_SUBTRACT = 1, + GPU_BLEND_REVERSE_SUBTRACT = 2, + GPU_BLEND_MIN = 3, + GPU_BLEND_MAX = 4 +} + +#[repr(C)] +pub enum GPU_BLENDFACTOR { + GPU_ZERO = 0, + GPU_ONE = 1, + GPU_SRC_COLOR = 2, + GPU_ONE_MINUS_SRC_COLOR = 3, + GPU_DST_COLOR = 4, + GPU_ONE_MINUS_DST_COLOR = 5, + GPU_SRC_ALPHA = 6, + GPU_ONE_MINUS_SRC_ALPHA = 7, + GPU_DST_ALPHA = 8, + GPU_ONE_MINUS_DST_ALPHA = 9, + GPU_CONSTANT_COLOR = 10, + GPU_ONE_MINUS_CONSTANT_COLOR = 11, + GPU_CONSTANT_ALPHA = 12, + GPU_ONE_MINUS_CONSTANT_ALPHA = 13, + GPU_SRC_ALPHA_SATURATE = 14 +} + +#[repr(C)] +pub enum GPU_LOGICOP { + GPU_LOGICOP_CLEAR = 0, + GPU_LOGICOP_AND = 1, + GPU_LOGICOP_AND_REVERSE = 2, + GPU_LOGICOP_COPY = 3, + GPU_LOGICOP_SET = 4, + GPU_LOGICOP_COPY_INVERTED = 5, + GPU_LOGICOP_NOOP = 6, + GPU_LOGICOP_INVERT = 7, + GPU_LOGICOP_NAND = 8, + GPU_LOGICOP_OR = 9, + GPU_LOGICOP_NOR = 10, + GPU_LOGICOP_XOR = 11, + GPU_LOGICOP_EQUIV = 12, + GPU_LOGICOP_AND_INVERTED = 13, + GPU_LOGICOP_OR_REVERSE = 14, + GPU_LOGICOP_OR_INVERTED = 15 +} + +#[repr(C)] +pub enum GPU_FORMATS { + GPU_BYTE = 0, + GPU_UNSIGNED_BYTE = 1, + GPU_SHORT = 2, + GPU_FLOAT = 3 +} + +//defines for CW ? +#[repr(C)] +pub enum GPU_CULLMODE { + GPU_CULL_NONE = 0, + GPU_CULL_FRONT_CCW = 1, + GPU_CULL_BACK_CCW = 2 +} + +#[inline] +pub fn GU_ATTRIBFMT(i: i32, n: i32, f: i32) { + (((((n)-1)<<2)|((f)&3))<<((i)*4)); +} + +/** +* Texture combiners sources +*/ +#[repr(C)] +pub enum GPU_TEVSRC{ + GPU_PRIMARY_COLOR = 0x00, + GPU_TEXTURE0 = 0x03, + GPU_TEXTURE1 = 0x04, + GPU_TEXTURE2 = 0x05, + GPU_TEXTURE3 = 0x06, + GPU_CONSTANT = 0x0E, + GPU_PREVIOUS = 0x0F, +} + +/** +* Texture RGB combiners operands +*/ +#[repr(C)] +pub enum GPU_TEVOP_RGB{ + GPU_TEVOP_RGB_SRC_COLOR = 0x00, + GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR = 0x01, + GPU_TEVOP_RGB_SRC_ALPHA = 0x02, + GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA = 0x03, + GPU_TEVOP_RGB_SRC0_RGB = 0x04, + GPU_TEVOP_RGB_0x05 = 0x05, + GPU_TEVOP_RGB_0x06 = 0x06, + GPU_TEVOP_RGB_0x07 = 0x07, + GPU_TEVOP_RGB_SRC1_RGB = 0x08, + GPU_TEVOP_RGB_0x09 = 0x09, + GPU_TEVOP_RGB_0x0A = 0x0A, + GPU_TEVOP_RGB_0x0B = 0x0B, + GPU_TEVOP_RGB_SRC2_RGB = 0x0C, + GPU_TEVOP_RGB_0x0D = 0x0D, + GPU_TEVOP_RGB_0x0E = 0x0E, + GPU_TEVOP_RGB_0x0F = 0x0F, +}; + +/** +* Texture ALPHA combiners operands +*/ +#[repr(C)] +pub enum GPU_TEVOP_A { + GPU_TEVOP_A_SRC_ALPHA = 0x00, + GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA = 0x01, + GPU_TEVOP_A_SRC0_RGB = 0x02, + GPU_TEVOP_A_SRC1_RGB = 0x04, + GPU_TEVOP_A_SRC2_RGB = 0x06, +} + +/** +* Texture combiner functions +*/ +pub enum GPU_COMBINEFUNC { + GPU_REPLACE = 0x00, + GPU_MODULATE = 0x01, + GPU_ADD = 0x02, + GPU_ADD_SIGNED = 0x03, + GPU_INTERPOLATE = 0x04, + GPU_SUBTRACT = 0x05, + GPU_DOT3_RGB = 0x06 //RGB only +} + +#[inline] +pub fn GPU_TEVSOURCES(a, b, c) { + (((a))|((b)<<4)|((c)<<8)); +} + +#[inline] +pub fn GPU_TEVOPERANDS(a, b, c) { + (((a))|((b)<<4)|((c)<<8)); +} + +#[repr(C)] +pub enum GPU_Primitive_t { + GPU_TRIANGLES = 0x0000, + GPU_TRIANGLE_STRIP = 0x0100, + GPU_TRIANGLE_FAN = 0x0200, + GPU_UNKPRIM = 0x0300 // ? +} + +#[repr(C)] +pub enum GPU_SHADER_TYPE { + GPU_VERTEX_SHADER=0x0, + GPU_GEOMETRY_SHADER=0x1 +} + + +extern "C" { + pub fn GPU_Init(gsphandle: *mut Handle) -> (); + pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: 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(gxbuf: *mut u32) -> (); + pub fn GPUCMD_FlushAndRun(gxbuf: *mut u32) -> (); + pub fn GPUCMD_Add(header: u32, param: *mut u32, paramlength: u32) -> (); + pub fn GPUCMD_Finalize() -> (); + pub fn GPU_SetFloatUniform(_type: GPU_SHADER_TYPE, startreg: u32, data: *mut u32, numreg: u32) -> (); + pub fn GPU_SetViewport(depthBuffer: *mut u32, colorBuffer: *mut u32, x: u32, y: u32, w: u32, h: u32) -> (); + pub fn GPU_SetScissorTest(mode: GPU_SCISSORMODE, x: u32, y: u32, w: u32, h: u32) -> (); + pub fn GPU_DepthMap(zScale: f32, zOffset: f32) -> (); + pub fn GPU_SetAlphaTest(enable: u8, function: GPU_TESTFUNC, _ref: u8) -> (); + pub fn GPU_SetDepthTestAndWriteMask(enable: u8, function: GPU_TESTFUNC, writemask: GPU_WRITEMASK) -> (); + pub fn GPU_SetStencilTest(enable: u8, function: GPU_TESTFUNC, _ref: _u8, mask: _u8, replace: _u8) -> (); + pub fn GPU_SetStencilOp(sfail: GPU_STENCILOP, dfail: GPU_STENCILOP, pass: GPU_STENCILOP) -> (); + pub fn GPU_SetFaceCulling(mode: GPU_CULLMODE) -> (); + pub fn GPU_SetAlphaBlending(colorEquation: GPU_BLENDEQUATION, alphaEquation: GPU_BLENDEQUATION, colorSrc: GPU_BLENDFACTOR, colorDst: GPU_BLENDFACTOR, alphaSrc: GPU_BLENDFACTOR, alphaDst: GPU_BLENDFACTOR) -> (); + pub fn GPU_SetColorLogicOp(op: GPU_LOGICOP) -> (); + pub fn GPU_SetBlendingColor(r: u8, g: u8, b: u8, a: u8) -> (); + pub fn GPU_SetAttributeBuffers(totalAttributes: u8, baseAddress: *mut u32, attributeFormats: u64, attributeMask: u16, attributePermutation: u64, numBuffers: u8, bufferOffsets: *mut u32, bufferPermutations: *mut u64, bufferNumAttributes: *mut u8) -> (); + pub fn GPU_SetTextureEnable(units: GPU_TEXUNIT) -> (); + pub fn GPU_SetTexture(unit: GPU_TEXUNIT, data: *mut u32, width: u16, height: u16, param: u32, colorType: GPU_TEXCOLOR) -> (); + pub fn GPU_SetTexEnv(id: u8, rgbSources: u16, alphaSources: u16, rgbOperands: u16, alphaOperands: u16, rgbCombine: GPU_COMBINEFUNC, alphaCombine: GPU_COMBINEFUNC, constantColor: u32) -> (); + pub fn GPU_DrawArray(primitive: GPU_Primitive_t, n: u32) -> (); + pub fn GPU_DrawElements(primitive: GPU_Primitive_t, indexArray: *mut u32, n: u32) -> (); + pub fn GPU_FinishDrawing() -> (); + pub fn GPU_SetShaderOutmap(outmapData: *mut u32) -> (); + pub fn GPU_SendShaderCode(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); + pub fn GPU_SendOperandDescriptors(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); +} diff --git a/ctru-sys/src/gpu/gx.rs b/ctru-sys/src/gpu/gx.rs new file mode 100644 index 0000000..d26c9ab --- /dev/null +++ b/ctru-sys/src/gpu/gx.rs @@ -0,0 +1,73 @@ +#[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) { + ((x)<<0); +} + +#[inline] +pub fn GX_TRANSFER_OUT_TILED(x) { + ((x)<<1); +} + +#[inline] +pub fn GX_TRANSFER_RAW_COPY(x) { + ((x)<<3) +} + +#[inline] +pub fn GX_TRANSFER_IN_FORMAT(x) { + ((x)<<8); +} + +#[inline] +pub fn GX_TRANSFER_OUT_FORMAT(x) { + ((x)<<12) +} + +#[inline] +pub fn GX_TRANSFER_SCALING(x) { + ((x)<<24); +} + +use ctru::Result; + + +extern "C" { + pub fn GX_RequestDma(gxbuf: *mut u32, src: *mut u32, dst: *mut u32, length: u32) -> Result; + pub fn GX_SetCommandList_Last(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, flags: u8) -> Result; + pub fn GX_SetMemoryFill(gxbuf: *mut u32, buf0a: *mut u32, buf0v: u32, buf0e: *mut u32, width0: u16, buf1a: *mut u32, buf1v: u32, buf1e: *mut u32, width1: u16) -> Result; + pub fn GX_SetDisplayTransfer(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, flags: u32) -> Result; + pub fn GX_SetTextureCopy(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, size: u32, flags: u32) -> Result; + pub fn GX_SetCommandList_First(gxbuf: *mut u32, 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..8d71046 --- /dev/null +++ b/ctru-sys/src/gpu/mod.rs @@ -0,0 +1,11 @@ +pub mod gpu; +pub mod gx; +pub mod registers; +pub mod shader_program; +pub mod shbin; + +use self::gpu::*; +use self::gx::*; +use self::registers::*; +use self::shader_program::*; +use self::shbin::*; diff --git a/ctru-sys/src/gpu/registers.rs b/ctru-sys/src/gpu/registers.rs new file mode 100644 index 0000000..739a50a --- /dev/null +++ b/ctru-sys/src/gpu/registers.rs @@ -0,0 +1,726 @@ +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; +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; +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; +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; +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; +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; +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; +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; +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/shader_program.rs b/ctru-sys/src/gpu/shader_program.rs new file mode 100644 index 0000000..bf373e1 --- /dev/null +++ b/ctru-sys/src/gpu/shader_program.rs @@ -0,0 +1,42 @@ +use super::shbin::*; + +#[repr(C)] +#[derive(Copy)] +pub struct float24Uniform_s { + id: u32, + data: [u32; 3usize] +} + +#[repr(C)] +#[derive(Copy)] +pub struct shaderInstance_s { + pub dvle: *mut DVLE_s; + pub boolUniforms: u16, + pub intUniforms: [u32; 4usize], + pub float24Uniforms: *mut float24Uniform_s, + pub numFloat24Uniforms: u8, +} + +#[repr(C)] +#[derive(Copy)] +pub struct shaderProgram_s { + pub vertexShader: *mut shaderInstance_s, + pub geometryShader: *mut shaderInstance_s, + pub geometryShaderInputStride: u8, +} + +use ctru::Result; + + +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: ::libc::c_int, value: u8) -> Result; + pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, id: ::libc::c_int, value: *mut u8) -> Result; + pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s, name: *const ::libc::c_char) -> Result; + 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 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..db400d9 --- /dev/null +++ b/ctru-sys/src/gpu/shbin.rs @@ -0,0 +1,105 @@ +typedef enum{ + VERTEX_SHDR=GPU_VERTEX_SHADER, + GEOMETRY_SHDR=GPU_GEOMETRY_SHADER +}DVLE_type; + +#[repr(C)] +pub enum DVLE_type { + VERTEX_SHDR=GPU_VERTEX_SHADER, + GEOMETRY_SHDR=GPU_GEOMETRY_SHADER, +} + +typedef enum{ + DVLE_CONST_BOOL=0x0, + DVLE_CONST_u8=0x1, + DVLE_CONST_FLOAT24=0x2, +}DVLE_constantType; + +#[repr(C)] +pub enum DVLE_constantType { + DVLE_CONST_BOOL = 0x0, + DVLE_CONST_u8 = 0x1, + DVLE_CONST_FLOAT24 = 0x2, +} + +#[repr(C)] +pub enum DVLE_outputAttribute_t { + RESULT_POSITION = 0x0, + RESULT_NORMALQUAT = 0x1, + RESULT_COLOR = 0x2, + RESULT_TEXCOORD0 = 0x3, + RESULT_TEXCOORD0W = 0x4, + RESULT_TEXCOORD1 = 0x5, + RESULT_TEXCOORD2 = 0x6, + RESULT_VIEW = 0x8 +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLP_s { + codeSize: u32, + codeData: *mut u32, + opdescSize: u32, + opcdescData: *mut u32 +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLE_constEntry_s { + type: u16, + id: u16, + data: [u32; 4usize] +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLE_outEntry_s { + type: u16, + regID: u16, + mask: u8, + unk: [u8; 3usize] +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLE_uniformEntry_s{ + symbolOffset: u32, + startReg: u16, + endReg: u16, +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLE_s { + DVLE_type type: DVLE_type, + DVLP_s* dvlp: *mut DVLP_s, + mainOffset: u32, + endmainOffset: u32, + constTableSize: u32, + constTableData: *mut DVLE_constEntry_s, + outTableSize: u32, + outTableData: *mut DVLE_outEntry_s, + uniformTableSize: u32, + uniformTableData: *mut DVLE_uniformEntry_s, + symbolTableData: *mut u8, + outmapMask: u8, + outmapData: [u32; 8usize] +} + +#[repr(C)] +#[derive(Copy)] +pub struct DVLB_s { + numDVLE: u32, + DVLP: DVLP_s, + DVLE: *mut DVLE_s +} + +use ctru::raw::types::*; + + +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/lib.rs b/ctru-sys/src/lib.rs new file mode 100644 index 0000000..7f7c1c8 --- /dev/null +++ b/ctru-sys/src/lib.rs @@ -0,0 +1,28 @@ +#![no_std] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(overflowing_literals)] + +pub mod console; +pub mod gfx; +pub mod linear; +pub mod os; +pub mod sdmc; +pub mod srv; +pub mod svc; +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 ()>; diff --git a/ctru-sys/src/linear.rs b/ctru-sys/src/linear.rs new file mode 100644 index 0000000..e663439 --- /dev/null +++ b/ctru-sys/src/linear.rs @@ -0,0 +1,10 @@ +use c_void; + + +extern "C" { + pub fn linearAlloc(size: i32) -> *mut c_void; + pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void; + pub fn linearRealloc(mem: *mut c_void, size: i32) -> *mut c_void; + pub fn linearFree(mem: *mut c_void) -> (); + pub fn linearSpaceFree() -> u32; +} diff --git a/ctru-sys/src/os.rs b/ctru-sys/src/os.rs new file mode 100644 index 0000000..eaff6e2 --- /dev/null +++ b/ctru-sys/src/os.rs @@ -0,0 +1,14 @@ +#[inline] +pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) { + (((major)<<24)|((minor)<<16)|((revision)<<8)); +} + + +extern "C" { + pub fn osConvertVirtToPhys(vaddr: u32) -> u32; + pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32; + pub fn osStrError(error: u32) -> *const u8; + pub fn osGetFirmVersion() -> u32; + pub fn osGetKernelVersion() -> u32; + pub fn osGetTime() -> u64; +} 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..0b07ec6 --- /dev/null +++ b/ctru-sys/src/services/ac.rs @@ -0,0 +1,9 @@ +use ::{Handle, Result}; + + +extern "C" { + pub fn acInit() -> Result; + pub fn acExit() -> Result; + pub fn ACU_GetWifiStatus(servhandle: *mut Handle, out: *mut u32) -> Result; + pub fn ACU_WaitInternetConnection() -> Result; +} diff --git a/ctru-sys/src/services/am.rs b/ctru-sys/src/services/am.rs new file mode 100644 index 0000000..340261f --- /dev/null +++ b/ctru-sys/src/services/am.rs @@ -0,0 +1,30 @@ +use ::c_void; +use ::{Result, Handle}; + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct TitleList { + titleID: u64, + size: u64, + titleVersion: u16, + unknown2: [u8; 6usize] +} + + +extern "C" { + pub fn amInit() -> Result; + pub fn amExit() -> Result; + pub fn amGetSessionHandle() -> *mut Handle; + pub fn AM_GetTitleCount(mediatype: u8, count: *mut u32) -> Result; + pub fn AM_GetTitleIdList(mediatype: u8, count: u32, titleIDs: *mut u64) -> Result; + pub fn AM_GetDeviceId(deviceID: *mut u32) -> Result; + pub fn AM_ListTitles(mediatype: u8, titleCount: u32, titleIdList: *mut u64, titleList: *mut TitleList) -> Result; + pub fn AM_StartCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result; + pub fn AM_StartDlpChildCiaInstall(ciaHandle: *mut Handle) -> Result; + pub fn AM_CancelCIAInstall(ciaHandle: *mut Handle) -> Result; + pub fn AM_FinishCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result; + pub fn AM_DeleteTitle(mediatype: u8, titleID: u64) -> Result; + pub fn AM_DeleteAppTitle(mediatype: u8, titleID: u64) -> Result; + pub fn AM_InstallFIRM(titleID: u64) -> Result; + pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64, productCode: *mut c_void) -> Result; +} diff --git a/ctru-sys/src/services/apt.rs b/ctru-sys/src/services/apt.rs new file mode 100644 index 0000000..4eba65f --- /dev/null +++ b/ctru-sys/src/services/apt.rs @@ -0,0 +1,125 @@ +use ::{Handle, Result}; +use ::c_void; + +pub const RUNFLAG_APTWORKAROUND: u32 = 1; +pub const RUNFLAG_APTREINIT: u32 = 2; + +#[repr(C)] +pub enum NS_APPID { + APPID_HOMEMENU = 0x101, // Home Menu + APPID_CAMERA = 0x110, // Camera applet + APPID_FRIENDS_LIST = 0x112, // Friends List applet + APPID_GAME_NOTES = 0x113, // Game Notes applet + APPID_WEB = 0x114, // Internet Browser + APPID_INSTRUCTION_MANUAL = 0x115, // Instruction Manual applet + APPID_NOTIFICATIONS = 0x116, // Notifications applet + APPID_MIIVERSE = 0x117, // Miiverse applet + APPID_APPLICATION = 0x300, // Application + APPID_SOFTWARE_KEYBOARD = 0x401, // Software Keyboard + APPID_APPLETED = 0x402, // appletEd + APPID_PNOTE_AP = 0x404, // PNOTE_AP + APPID_SNOTE_AP = 0x405, // SNOTE_AP + APPID_ERROR = 0x406, // error + APPID_MINT = 0x407, // mint + APPID_EXTRAPAD = 0x408, // extrapad + APPID_MEMOLIB = 0x409, // memolib +} // cf http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs + +#[repr(C)] +pub enum APP_STATUS { + APP_NOTINITIALIZED, + APP_RUNNING, + APP_SUSPENDED, + APP_EXITING, + APP_SUSPENDING, + APP_SLEEPMODE, + APP_PREPARE_SLEEPMODE, + APP_APPLETSTARTED, + APP_APPLETCLOSED +} + +#[repr(C)] +pub enum APTSIGNAL { + APTSIGNAL_HOMEBUTTON = 1, + // 2: sleep-mode related? + APTSIGNAL_PREPARESLEEP = 3, + // 4: triggered when ptm:s GetShellStatus() returns 5. + APTSIGNAL_ENTERSLEEP = 5, + APTSIGNAL_WAKEUP = 6, + APTSIGNAL_ENABLE = 7, + APTSIGNAL_POWERBUTTON = 8, + APTSIGNAL_UTILITY = 9, + APTSIGNAL_SLEEPSYSTEM = 10, + APTSIGNAL_ERROR = 11 +} + +#[repr(C)] +pub enum APTHOOK { + APTHOOK_ONSUSPEND = 0, + APTHOOK_ONRESTORE, + APTHOOK_ONSLEEP, + APTHOOK_ONWAKEUP, + APTHOOK_ONEXIT, + + APTHOOK_COUNT, +} + +type aptHookFn = Option ()>; + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct aptHookCookie { + next: *mut aptHookCookie, + callback: aptHookFn, + param: *mut c_void, +} + + +extern "C" { + pub static mut aptEvents: [Handle; 3usize]; + + pub fn aptInit() -> Result; + pub fn aptExit() -> (); + pub fn aptOpenSession() -> (); + pub fn aptCloseSession() -> (); + pub fn aptSetStatus(status: APP_STATUS) -> (); + pub fn aptGetStatus() -> APP_STATUS; + pub fn aptGetStatusPower() -> u32; + pub fn aptSetStatusPower(status: u32) -> (); + pub fn aptReturnToMenu() -> (); + pub fn aptWaitStatusEvent() -> (); + pub fn aptSignalReadyForSleep() -> (); + pub fn aptGetMenuAppID() -> NS_APPID; + pub fn aptMainLoop() -> u8; + pub fn APT_GetLockHandle(handle: *mut Handle, flags: u16, lockHandle: *mut Handle) -> Result; + pub fn APT_Initialize(handle: *mut Handle, appId: NS_APPID, eventHandle1: *mut Handle, eventHandle2: *mut Handle) -> Result; + pub fn APT_HardwareResetAsync(handle: *mut Handle) -> Result; + pub fn APT_Enable(handle: *mut Handle, a: u32) -> Result; + pub fn APT_GetAppletManInfo(handle: *mut Handle, inval: u8, outval8: *mut u8, outval32: *mut u32, menu_appid: *mut NS_APPID, active_appid: *mut NS_APPID) -> Result; + pub fn APT_PrepareToJumpToHomeMenu(handle: *mut Handle) -> Result; + pub fn APT_JumpToHomeMenu(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; + pub fn APT_IsRegistered(handle: *mut Handle, appID: NS_APPID, out: *mut u8) -> Result; + pub fn APT_InquireNotification(handle: *mut Handle, appID: u32, signalType: *mut u8) -> Result; + pub fn APT_NotifyToWait(handle: *mut Handle, appID: NS_APPID) -> Result; + pub fn APT_AppletUtility(handle: *mut Handle, out: *mut u32, a: u32, size1: u32, buf1: *mut u8, size2: u32, buf2: *mut u8) -> Result; + pub fn APT_GlanceParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; + pub fn APT_ReceiveParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; + pub fn APT_SendParameter(handle: *mut Handle, src_appID: NS_APPID, dst_appID: NS_APPID, bufferSize: u32, buffer: *mut u32, paramhandle: Handle, signalType: u8) -> Result; + pub fn APT_SendCaptureBufferInfo(handle: *mut Handle, bufferSize: u32, buffer: *mut u32) -> Result; + pub fn APT_ReplySleepQuery(handle: *mut Handle, appID: NS_APPID, a: u32) -> Result; + pub fn APT_ReplySleepNotificationComplete(handle: *mut Handle, appID: NS_APPID) -> Result; + pub fn APT_PrepareToCloseApplication(handle: *mut Handle, a: u8) -> Result; + pub fn APT_CloseApplication(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; + pub fn APT_SetAppCpuTimeLimit(handle: *mut Handle, percent: u32) -> Result; + pub fn APT_GetAppCpuTimeLimit(handle: *mut Handle, percent: *mut u32) -> Result; + pub fn APT_CheckNew3DS_Application(handle: *mut Handle, out: *mut u8) -> Result; + pub fn APT_CheckNew3DS_System(handle: *mut Handle, out: *mut u8) -> Result; + pub fn APT_CheckNew3DS(handle: *mut Handle, out: *mut u8) -> Result; + pub fn APT_PrepareToDoAppJump(handle: *mut Handle, flags: u8, programID: u64, mediatype: u8) -> Result; + pub fn APT_DoAppJump(handle: *mut Handle, NSbuf0Size: u32, NSbuf1Size: u32, NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result; + pub fn APT_PrepareToStartLibraryApplet(handle: *mut Handle, appID: NS_APPID) -> Result; + pub fn APT_StartLibraryApplet(handle: *mut Handle, appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; + pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; + pub fn APT_PrepareToStartSystemApplet(handle: *mut Handle, appID: NS_APPID) -> Result; + pub fn APT_StartSystemApplet(handle: *mut Handle, appID: NS_APPID, bufSize: u32, applHandle: Handle, buf: *mut u8) -> Result; +} diff --git a/ctru-sys/src/services/cfgnor.rs b/ctru-sys/src/services/cfgnor.rs new file mode 100644 index 0000000..4883642 --- /dev/null +++ b/ctru-sys/src/services/cfgnor.rs @@ -0,0 +1,10 @@ +use ::Result; + +extern "C" { + pub fn CFGNOR_Initialize(value: u8) -> Result; + pub fn CFGNOR_Shutdown() -> Result; + pub fn CFGNOR_ReadData(offset: u32, buf: *mut u32, size: u32) -> Result; + pub fn CFGNOR_WriteData(offset: u32, buf: *mut u32, size: u32) -> Result; + pub fn CFGNOR_DumpFlash(buf: *mut u32, size: u32) -> Result; + pub fn CFGNOR_WriteFlash(buf: *mut u32, size: u32) -> Result; +} diff --git a/ctru-sys/src/services/cfgu.rs b/ctru-sys/src/services/cfgu.rs new file mode 100644 index 0000000..4c51db4 --- /dev/null +++ b/ctru-sys/src/services/cfgu.rs @@ -0,0 +1,15 @@ +use ::Result; + +extern "C" { + pub fn initCfgu() -> Result; + pub fn exitCfgu() -> Result; + pub fn CFGU_SecureInfoGetRegion(region: *mut u8) -> Result; + pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32, hash: *mut u64) -> Result; + pub fn CFGU_GetRegionCanadaUSA(value: *mut u8) -> Result; + pub fn CFGU_GetSystemModel(model: *mut u8) -> Result; + pub fn CFGU_GetModelNintendo2DS(value: *mut u8) -> Result; + pub fn CFGU_GetCountryCodeString(code: u16, string: *mut u16) -> Result; + pub fn CFGU_GetCountryCodeID(string: u16, code: *mut u16) -> Result; + pub fn CFGU_GetConfigInfoBlk2(size: u32, blkID: u32, outData: *mut u8) -> Result; + pub fn CFGU_GetSystemLanguage(language: *mut u8) -> Result; +} diff --git a/ctru-sys/src/services/gsp.rs b/ctru-sys/src/services/gsp.rs new file mode 100644 index 0000000..9f8cf20 --- /dev/null +++ b/ctru-sys/src/services/gsp.rs @@ -0,0 +1,83 @@ +use super::super::types::*; + +#[inline] +pub fn GSP_REBASE_REG(r: u32) { + ((r)-0x1EB00000); +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct GSP_FramebufferInfo { + active_framebuf: u32, //"0=first, 1=second" + framebuf0_vaddr: *mut u32, //"Framebuffer virtual address, for the main screen this is the 3D left framebuffer" + framebuf1_vaddr: *mut u32,//"For the main screen: 3D right framebuffer address" + framebuf_widthbytesize: u32, //"Value for 0x1EF00X90, controls framebuffer width" + format: u32,//"Framebuffer format, this u16 is written to the low u16 for LCD register 0x1EF00X70." + framebuf_dispselect: u32, //"Value for 0x1EF00X78, controls which framebuffer is displayed" + unk: u32 //"?" +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub enum GSP_FramebufferFormats { + GSP_RGBA8_OES=0, //pixel_size = 4-bytes + GSP_BGR8_OES=1, //pixel_size = 3-bytes + GSP_RGB565_OES=2, //pixel_size = 2-bytes + GSP_RGB5_A1_OES=3, //pixel_size = 2-bytes + GSP_RGBA4_OES=4 //pixel_size = 2-bytes +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct GSP_CaptureInfoEntry { //See this for GSP_CaptureInfoEntry and GSP_CaptureInfo: http://3dbrew.org/wiki/GSPGPU:ImportDisplayCaptureInfo + framebuf0_vaddr: *mut u32, + framebuf1_vaddr: *mut u32, + format: u32, + framebuf_widthbytesize: u32, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct GSP_CaptureInfo { + screencapture: [GSP_CaptureInfoEntry; 2usize] +} + +#[repr(C)] +pub enum GSP_Event { + GSPEVENT_PSC0 = 0, // memory fill completed + GSPEVENT_PSC1, + GSPEVENT_VBlank0, + GSPEVENT_VBlank1, + GSPEVENT_PPF, // display transfer finished + GSPEVENT_P3D, // command list processing finished + GSPEVENT_DMA, + + GSPEVENT_MAX, // used to know how many events there are +} + +use super::super::{Result, Handle}; + + +extern "C" { + pub fn gspInit() -> Result; + pub fn gspExit() -> (); + pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8, gspThreadId: u8) -> Result; + pub fn gspExitEventHandler() -> (); + pub fn gspWaitForEvent(id: GSP_Event, nextEvent: u8) -> (); + pub fn GSPGPU_AcquireRight(handle: *mut Handle, flags: u8) -> Result; + pub fn GSPGPU_ReleaseRight(handle: *mut Handle) -> Result; + pub fn GSPGPU_ImportDisplayCaptureInfo(handle: *mut Handle, captureinfo: *mut GSP_CaptureInfo) -> Result; + pub fn GSPGPU_SaveVramSysArea(handle: *mut Handle) -> Result; + pub fn GSPGPU_RestoreVramSysArea(handle: *mut Handle) -> Result; + pub fn GSPGPU_SetLcdForceBlack(handle: *mut Handle, flags: u8) -> Result; + pub fn GSPGPU_SetBufferSwap(handle: *mut Handle, screenid: u32, framebufinfo: *mut GSP_FramebufferInfo) -> Result; + pub fn GSPGPU_FlushDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; + pub fn GSPGPU_InvalidateDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; + pub fn GSPGPU_WriteHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; + pub fn GSPGPU_WriteHWRegsWithMask(handle: *mut Handle, regAddr: u32, data: *mut u32, datasize: u8, maskdata: *mut u32, masksize: u8) -> Result; + pub fn GSPGPU_ReadHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; + pub fn GSPGPU_RegisterInterruptRelayQueue(handle: *mut Handle, eventHandle: Handle, flags: u32, outMemHandle: *mut Handle, threadID: *mut u8) -> Result; + pub fn GSPGPU_UnregisterInterruptRelayQueue(handle: *mut Handle) -> Result; + pub fn GSPGPU_TriggerCmdReqQueue(handle: *mut Handle) -> Result; + pub fn GSPGPU_SubmitGxCommand(sharedGspCmdBuf: *mut u32, gxCommand: *mut u32, handle: *mut Handle) -> Result; +} diff --git a/ctru-sys/src/services/hb.rs b/ctru-sys/src/services/hb.rs new file mode 100644 index 0000000..6cd2128 --- /dev/null +++ b/ctru-sys/src/services/hb.rs @@ -0,0 +1,11 @@ +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..f48f26b --- /dev/null +++ b/ctru-sys/src/services/hid.rs @@ -0,0 +1,103 @@ +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 = 4096, // (new 3DS only) + KEY_ZR = 8192, // (new 3DS only) + KEY_TOUCH = 1048576, // Not actually provided by HID + KEY_CSTICK_RIGHT = 16777216, // c-stick (new 3DS only) + KEY_CSTICK_LEFT = 33554432, // c-stick (new 3DS only) + KEY_CSTICK_UP = 67108864, // c-stick (new 3DS only) + KEY_CSTICK_DOWN = 134217728, // c-stick (new 3DS only) + KEY_CPAD_RIGHT = 268435456, // circle pad + KEY_CPAD_LEFT = 536870912, // circle pad + KEY_CPAD_UP = 1073741824, // circle pad + KEY_CPAD_DOWN = 2147483648, // circle pad + + // Generic catch-all directions + /*KEY_UP = KEY_DUP | KEY_CPAD_UP, + KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN, + KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT, + KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT,*/ +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct touchPosition { + px: u16, + py: u16, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct circlePosition { + dx: s16, + dy: s16, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct accelVector { + x: s16, + y: s16, + z: s16 +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct angularRate { + x: s16, //roll + z: s16, //yaw + y: s16, //pitch +} + +#[repr(C)] +pub enum HID_Event { + HIDEVENT_PAD0 = 0, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." + HIDEVENT_PAD1, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." + HIDEVENT_Accel, //"Event signaled by HID-module, when the sharedmem accelerometer state was updated." + HIDEVENT_Gyro, //"Event signaled by HID-module, when the sharedmem gyroscope state was updated." + HIDEVENT_DebugPad, //"Event signaled by HID-module, when the sharedmem DebugPad state was updated." + + HIDEVENT_MAX, // used to know how many events there are +} + + +extern "C" { + pub static hidMemHandle: Handle; + pub static hidSharedMem: *mut vu32; + + pub fn hidInit(sharedMem: *mut u32) -> Result; + pub fn hidExit() -> (); + pub fn hidScanInput() -> (); + pub fn hidKeysHeld() -> u32; + pub fn hidKeysDown() -> u32; + pub fn hidKeysUp() -> u32; + pub fn hidTouchRead(pos: *mut touchPosition) -> (); + pub fn hidCircleRead(pos: *mut circlePosition) -> (); + pub fn hidAccelRead(vector: *mut accelVector) -> (); + pub fn hidGyroRead(rate: *mut angularRate) -> (); + pub fn hidWaitForEvent(id: HID_Event, nextEvent: u8) -> (); + pub fn HIDUSER_GetHandles(outMemHandle: *mut Handle, eventpad0: *mut Handle, eventpad1: *mut Handle, eventaccel: *mut Handle, eventgyro: *mut Handle, eventdebugpad: *mut Handle) -> Result; + pub fn HIDUSER_EnableAccelerometer() -> Result; + pub fn HIDUSER_DisableAccelerometer() -> Result; + pub fn HIDUSER_EnableGyroscope() -> Result; + pub fn HIDUSER_DisableGyroscope() -> Result; + pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: *mut f32) -> Result; + pub fn HIDUSER_GetSoundVolume(volume: *mut u8) -> Result; +} diff --git a/ctru-sys/src/services/ir.rs b/ctru-sys/src/services/ir.rs new file mode 100644 index 0000000..3affb65 --- /dev/null +++ b/ctru-sys/src/services/ir.rs @@ -0,0 +1,14 @@ +use ::{Result, Handle}; + + +extern "C" { + pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result; + pub fn IRU_Shutdown() -> Result; + pub fn IRU_GetServHandle() -> Handle; + pub fn IRU_SendData(buf: *mut u8, size: u32, wait: u32) -> Result; + pub fn IRU_RecvData(buf: *mut u8, size: u32, flag: u8, transfercount: *mut u32, wait: u32) -> Result; + pub fn IRU_SetBitRate(value: u8) -> Result; + pub fn IRU_GetBitRate(out: *mut u8) -> Result; + pub fn IRU_SetIRLEDState(value: u32) -> Result; + pub fn IRU_GetIRLEDRecvState(out: *mut u32) -> Result; +} diff --git a/ctru-sys/src/services/irrst.rs b/ctru-sys/src/services/irrst.rs new file mode 100644 index 0000000..b986270 --- /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 irrstMemHandle: Handle; + pub static irrstSharedMem: *mut vu32; + + pub fn irrstInit(sharedMem: *mut u32) -> Result; + pub fn irrstExit() -> (); + pub fn irrstScanInput() -> (); + pub fn irrstKeysHeld() -> u32; + pub fn irrstCstickRead(pos: *mut circlePosition) -> (); + pub fn irrstWaitForEvent(nextEvent: u8) -> (); + pub fn IRRST_GetHandles(outMemHandle: *mut Handle, + outEventHandle: *mut Handle) -> Result; + pub fn IRRST_Initialize(unk1: u32, unk2: u8) -> Result; + pub fn IRRST_Shutdown() -> Result; +} diff --git a/ctru-sys/src/services/mic.rs b/ctru-sys/src/services/mic.rs new file mode 100644 index 0000000..64e7746 --- /dev/null +++ b/ctru-sys/src/services/mic.rs @@ -0,0 +1,19 @@ +use ::{Result, Handle}; + + +extern "C" { + pub fn MIC_Initialize(sharedmem: *mut u32, sharedmem_size: u32, control: u8, recording: u8, unk0: u8, unk1: u8, unk2: u8) -> Result; + pub fn MIC_Shutdown() -> Result; + pub fn MIC_GetSharedMemOffsetValue() -> u32; + pub fn MIC_ReadAudioData(outbuf: *mut u8, readsize: u32, waitforevent: u32) -> u32; + pub fn MIC_MapSharedMem(handle: Handle, size: u32) -> Result; + pub fn MIC_UnmapSharedMem() -> Result; + pub fn MIC_cmd3_Initialize(unk0: u8, unk1: u8, sharedmem_baseoffset: u32, sharedmem_endoffset: u32, unk2: u8) -> Result; + pub fn MIC_cmd5() -> Result; + pub fn MIC_GetCNTBit15(out: *mut u8) -> Result; + pub fn MIC_GetEventHandle(handle: *mut Handle) -> Result; + pub fn MIC_SetControl(value: u8) -> Result; + pub fn MIC_GetControl(value: *mut u8) -> Result; + pub fn MIC_SetRecording(value: u8) -> Result; + pub fn MIC_IsRecoding(value: *mut u8) -> Result; +} diff --git a/ctru-sys/src/services/mod.rs b/ctru-sys/src/services/mod.rs new file mode 100644 index 0000000..ec2d270 --- /dev/null +++ b/ctru-sys/src/services/mod.rs @@ -0,0 +1,15 @@ +pub mod ac; +pub mod am; +pub mod apt; +pub mod cfgnor; +pub mod cfgu; +pub mod gsp; +pub mod hb; +pub mod hid; +pub mod ir; +pub mod irrst; +pub mod mic; +pub mod ns; +pub mod pm; +pub mod ptm; +pub mod soc; diff --git a/ctru-sys/src/services/ns.rs b/ctru-sys/src/services/ns.rs new file mode 100644 index 0000000..68a58c2 --- /dev/null +++ b/ctru-sys/src/services/ns.rs @@ -0,0 +1,9 @@ +use ::Result; + + +extern "C" { + pub fn nsInit() -> Result; + pub fn nsExit() -> Result; + pub fn NS_LaunchTitle(titleid: u64, launch_flags: u32, procid: *mut u32) -> Result; + pub fn NS_RebootToTitle(mediatype: u8, titleid: u64) -> Result; +} diff --git a/ctru-sys/src/services/pm.rs b/ctru-sys/src/services/pm.rs new file mode 100644 index 0000000..78eb3fd --- /dev/null +++ b/ctru-sys/src/services/pm.rs @@ -0,0 +1,12 @@ +use ::Result; + + +extern "C" { + pub fn pmInit() -> Result; + pub fn pmExit() -> Result; + pub fn PM_LaunchTitle(mediatype: u8, titleid: u64, launch_flags: u32) -> Result; + pub fn PM_GetTitleExheaderFlags(mediatype: u8, titleid: u64, out: *mut u8) -> Result; + pub fn PM_SetFIRMLaunchParams(size: u32, _in: *mut u8) -> Result; + pub fn PM_GetFIRMLaunchParams(size: u32, out: *mut u8) -> Result; + pub fn PM_LaunchFIRMSetParams(firm_titleid_low: u32, size: u32, _in: *mut u8) -> Result; +} diff --git a/ctru-sys/src/services/ptm.rs b/ctru-sys/src/services/ptm.rs new file mode 100644 index 0000000..2743648 --- /dev/null +++ b/ctru-sys/src/services/ptm.rs @@ -0,0 +1,12 @@ +use ::{Result, Handle}; + + +extern "C" { + pub fn ptmInit() -> Result; + pub fn ptmExit() -> Result; + pub fn PTMU_GetShellState(servhandle: *mut Handle, out: *mut u8) -> Result; + pub fn PTMU_GetBatteryLevel(servhandle: *mut Handle, out: *mut u8) -> Result; + pub fn PTMU_GetBatteryChargeState(servhandle: *mut Handle, out: *mut u8) -> Result; + pub fn PTMU_GetPedometerState(servhandle: *mut Handle, out: *mut u8) -> Result; + pub fn PTMU_GetTotalStepCount(servhandle: *mut Handle, steps: *mut u32) -> Result; +} diff --git a/ctru-sys/src/services/soc.rs b/ctru-sys/src/services/soc.rs new file mode 100644 index 0000000..aff4f1d --- /dev/null +++ b/ctru-sys/src/services/soc.rs @@ -0,0 +1,7 @@ +use ::Result; + + +extern "C" { + pub fn SOC_Initialize(context_addr: *mut u32, context_size: u32) -> Result; + pub fn SOC_Shutdown() -> 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..a370104 --- /dev/null +++ b/ctru-sys/src/svc.rs @@ -0,0 +1,312 @@ +use {Handle, Result}; +use types::*; + +#[repr(C)] +pub enum MemOp { + MEMOP_FREE = 1, + MEMOP_ALLOC = 3, + MEMOP_MAP = 4, + MEMOP_UNMAP = 5, + MEMOP_PROT = 6, + + MEMOP_ALLOC_LINEAR = 0x10003, +} + +#[repr(C)] +pub enum MemState { + 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 +} + +#[repr(C)] +pub enum MemPerm { + MEMPERM_READ = 1, + MEMPERM_WRITE = 2, + MEMPERM_EXECUTE = 4, + MEMPERM_DONTCARE = 0x10000000, + MEMPERM_MAX = 0xFFFFFFFF //force 4-byte +} + +#[repr(C)] +pub struct MemInfo { + pub base_addr: u32, + pub size: u32, + pub perm: u32, + pub state: u32, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct PageInfo { + pub flags: u32, +} + +#[repr(C)] +pub enum ArbitrationType { + ARBITER_FREE =0, + ARBITER_ACQUIRE =1, + ARBITER_KERNEL2 =2, + ARBITER_ACQUIRE_TIMEOUT=3, + ARBITER_KERNEL4 =4, +} + +#[repr(C)] +pub enum DebugEventType { + 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 +} + +#[repr(C)] +pub enum ProcessEventReason { + REASON_CREATE = 1, + REASON_ATTACH = 2 +} + +#[repr(C)] +#[derive(Copy)] +pub struct ProcessEvent { + pub program_id: u64, + pub process_name: [u8; 8usize], + pub process_id: u32, + pub reason: u32 +} + +impl Clone for ProcessEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct CreateThreadEvent { + pub creator_thread_id: u32, + pub base_addr: u32, + pub entry_point: u32 +} + +impl Clone for CreateThreadEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +pub enum ExitThreadEventReason { + EXITTHREAD_EVENT_NONE = 0, + EXITTHREAD_EVENT_TERMINATE = 1, + EXITTHREAD_EVENT_UNHANDLED_EXC = 2, + EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 +} + +#[repr(C)] +pub enum ExitProcessEventReason { + EXITPROCESS_EVENT_NONE = 0, + EXITPROCESS_EVENT_TERMINATE = 1, + EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 +} + +#[repr(C)] +#[derive(Copy)] +pub struct ExitProcessEvent { + pub reason: u32 +} + +impl Clone for ExitProcessEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct ExitThreadEvent { + pub reason: u32 +} + +impl Clone for ExitThreadEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct ExceptionEvent { + pub _type: u32, + pub address: u32, + pub argument: u32 +} + +impl Clone for ExceptionEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +pub enum ExceptionEventType { + EXC_EVENT_UNDEFINED_INSTRUCTION = 0, // arg: (None) + EXC_EVENT_UNKNOWN1 = 1, // arg: (None) + EXC_EVENT_UNKNOWN2 = 2, // arg: address + EXC_EVENT_UNKNOWN3 = 3, // arg: address + EXC_EVENT_ATTACH_BREAK = 4, // arg: (None) + EXC_EVENT_BREAKPOINT = 5, // arg: (None) + EXC_EVENT_USER_BREAK = 6, // arg: user break type + EXC_EVENT_DEBUGGER_BREAK = 7, // arg: (None) + EXC_EVENT_UNDEFINED_SYSCALL = 8 // arg: attempted syscall +} + +#[repr(C)] +pub enum UserBreakType { + USERBREAK_PANIC = 0, + USERBREAK_ASSERT = 1, + USERBREAK_USER = 2 +} + +/** +* Type of the query for svcGetThreadInfo +*/ +#[repr(C)] +pub enum ThreadInfoType { + THREADINFO_TYPE_UNKNOWN = 0, + VARIANT2 = 1, // needed because enums must have 2+ variants for C representation +} + +#[repr(C)] +#[derive(Copy)] +pub struct SchedulerInOutEvent { + pub clock_tick: u64 +} + +impl Clone for SchedulerInOutEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct SyscallInOutEvent { + pub clock_tick: u64, + pub syscall: u32, +} + +impl Clone for SyscallInOutEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct OutputStringEvent { + pub string_addr: u32, + pub string_size: u32 +} + +impl Clone for OutputStringEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct MapEvent { + pub mapped_addr: u32, + pub mapped_size: u32, + pub memperm: u32, + pub memstate: u32 +} + +impl Clone for MapEvent { + fn clone(&self) -> Self { *self } +} + +#[repr(C)] +#[derive(Copy)] +pub struct DebugEventInfo { + pub _type: u32, + pub thread_id: u32, + pub unknown: [u32; 2usize], + pub eventUnion: [u64; 3usize], // must use transmutes to access contents + // union { + // ProcessEvent process; + // CreateThreadEvent create_thread; + // ExitThreadEvent exit_thread; + // ExitProcessEvent exit_process; + // ExceptionEvent exception; + // /* TODO: DLL_LOAD */ + // /* TODO: DLL_UNLOAD */ + // SchedulerInOutEvent scheduler; + // SyscallInOutEvent syscall; + // OutputStringEvent output_string; + // MapEvent map; + // }; +} + +impl Clone for DebugEventInfo { + fn clone(&self) -> Self { *self } +} + +// getLocalThreadStorage and getThreadCommandBuffer can't be implemented +// due to asm. Custom build step may be necessary. + +use ThreadFunc; + +extern "C" { + pub fn svcControlMemory(addr_out: *mut u32, addr0: u32, addr1: u32, size: u32, op: MemOp, perm: MemPerm) -> s32; + pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32) -> s32; + pub fn svcExitProcess() -> (); + pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc, arg: u32, stack_top: *mut u32, thread_priority: s32, processor_id: s32) -> s32; + pub fn svcExitThread() -> (); + pub fn svcSleepThread(ns: s64) -> (); + pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> s32; + pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> s32; + pub fn svcReleaseMutex(handle: Handle) -> s32; + pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32, max_count: s32) -> s32; + pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle, release_count: s32) -> s32; + pub fn svcCreateEvent(event: *mut Handle, reset_type: u8) -> s32; + pub fn svcSignalEvent(handle: Handle) -> s32; + pub fn svcClearEvent(handle: Handle) -> s32; + pub fn svcCreateTimer(timer: *mut Handle, reset_type: u8) -> s32; + pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> s32; + pub fn svcCancelTimer(timer: Handle) -> s32; + pub fn svcClearTimer(timer: Handle) -> s32; + pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; + pub fn svcMapMemoryBlock(memblock: Handle, addr: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; + pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> s32; + pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> s32; + pub fn svcArbitrateAddress(arbiter: Handle, addr: u32, _type: ArbitrationType, value: s32, nanoseconds: s64) -> s32; + pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> s32; + pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle, handles_num: s32, wait_all: u8, nanoseconds: s64) -> s32; + pub fn svcCloseHandle(handle: Handle) -> s32; + pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> s32; + pub fn svcGetSystemTick() -> u64; + pub fn svcGetSystemInfo(out: *mut s64, _type: u32, param: s32) -> s32; + pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: u32) -> s32; + pub fn svcConnectToPort(out: *mut Handle, portName: *const u8) -> s32; + pub fn svcSendSyncRequest(session: Handle) -> s32; + pub fn svcOpenProcess(process: *mut Handle, processId: u32) -> Result; + pub fn svcGetProcessId(out: *mut u32, handle: Handle) -> s32; + pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> s32; + pub fn svcOutputDebugString(string: *const u8, length: i32) -> s32; + pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle, name: *const u8, maxSessions: s32) -> 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 svcGetProcessList(processCount: *mut s32, processIds: *mut u32, processIdMaxCount: s32) -> Result; + pub fn svcReadProcessMemory(buffer: *mut u8, debug: Handle, addr: u32, size: u32) -> Result; + pub fn svcMapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; + pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; + pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo, process: Handle, addr: u32) -> Result; + pub fn svcGetProcessorID() -> s32; +} 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; +} From 184ec0b247bbec0748d7888f36ccdae076a2d9cb Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sat, 30 Apr 2016 18:39:26 -0700 Subject: [PATCH 3/6] Deleted old files --- Cargo.toml | 5 +- src/gfx.rs | 10 +- src/lib.rs | 4 +- src/raw/console.rs | 63 --- src/raw/gfx.rs | 44 --- src/raw/gpu/gpu.rs | 294 -------------- src/raw/gpu/gx.rs | 73 ---- src/raw/gpu/mod.rs | 11 - src/raw/gpu/registers.rs | 726 ---------------------------------- src/raw/gpu/shader_program.rs | 42 -- src/raw/gpu/shbin.rs | 105 ----- src/raw/linear.rs | 10 - src/raw/mod.rs | 24 -- src/raw/os.rs | 15 - src/raw/sdmc.rs | 7 - src/raw/services/ac.rs | 9 - src/raw/services/am.rs | 30 -- src/raw/services/apt.rs | 125 ------ src/raw/services/cfgnor.rs | 11 - src/raw/services/cfgu.rs | 16 - src/raw/services/gsp.rs | 83 ---- src/raw/services/hb.rs | 11 - src/raw/services/hid.rs | 103 ----- src/raw/services/ir.rs | 14 - src/raw/services/irrst.rs | 21 - src/raw/services/mic.rs | 19 - src/raw/services/mod.rs | 15 - src/raw/services/ns.rs | 9 - src/raw/services/pm.rs | 12 - src/raw/services/ptm.rs | 12 - src/raw/services/soc.rs | 7 - src/raw/srv.rs | 15 - src/raw/svc.rs | 310 --------------- src/raw/types.rs | 35 -- src/raw/vram.rs | 10 - src/sdmc.rs | 2 +- src/services/apt.rs | 2 +- src/services/gsp.rs | 8 +- src/services/hid.rs | 4 +- src/srv.rs | 2 +- 40 files changed, 20 insertions(+), 2298 deletions(-) delete mode 100644 src/raw/console.rs delete mode 100644 src/raw/gfx.rs delete mode 100644 src/raw/gpu/gpu.rs delete mode 100644 src/raw/gpu/gx.rs delete mode 100644 src/raw/gpu/mod.rs delete mode 100644 src/raw/gpu/registers.rs delete mode 100644 src/raw/gpu/shader_program.rs delete mode 100644 src/raw/gpu/shbin.rs delete mode 100644 src/raw/linear.rs delete mode 100644 src/raw/mod.rs delete mode 100644 src/raw/os.rs delete mode 100644 src/raw/sdmc.rs delete mode 100644 src/raw/services/ac.rs delete mode 100644 src/raw/services/am.rs delete mode 100644 src/raw/services/apt.rs delete mode 100644 src/raw/services/cfgnor.rs delete mode 100644 src/raw/services/cfgu.rs delete mode 100644 src/raw/services/gsp.rs delete mode 100644 src/raw/services/hb.rs delete mode 100644 src/raw/services/hid.rs delete mode 100644 src/raw/services/ir.rs delete mode 100644 src/raw/services/irrst.rs delete mode 100644 src/raw/services/mic.rs delete mode 100644 src/raw/services/mod.rs delete mode 100644 src/raw/services/ns.rs delete mode 100644 src/raw/services/pm.rs delete mode 100644 src/raw/services/ptm.rs delete mode 100644 src/raw/services/soc.rs delete mode 100644 src/raw/srv.rs delete mode 100644 src/raw/svc.rs delete mode 100644 src/raw/types.rs delete mode 100644 src/raw/vram.rs diff --git a/Cargo.toml b/Cargo.toml index df91803..8ed07f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctru-rs" -version = "0.1.1" +version = "0.2.0" description = "A safe wrapper around smealum's ctrulib." authors = ["Ronald Kinard ", "FenrirWolf "] links = "ctru" @@ -10,3 +10,6 @@ license = "https://en.wikipedia.org/wiki/Zlib_License" [lib] name = "ctru" crate-type = ["rlib"] + +[dependencies] +ctru-sys = { path = "ctru-sys" } diff --git a/src/gfx.rs b/src/gfx.rs index 316c173..7417a7a 100644 --- a/src/gfx.rs +++ b/src/gfx.rs @@ -1,4 +1,4 @@ -use ::raw::gfx; +use libctru::gfx; use core::default::Default; use core::marker::PhantomData; @@ -25,7 +25,7 @@ pub enum Side { impl From for Screen { #[inline] fn from(g: gfx::gfxScreen_t) -> Screen { - use ::raw::gfx::gfxScreen_t::*; + use libctru::gfx::gfxScreen_t::*; use self::Screen::*; match g { GFX_TOP => Top, @@ -36,7 +36,7 @@ impl From for Screen { impl From for gfx::gfxScreen_t { #[inline] fn from(g: Screen) -> gfx::gfxScreen_t { - use ::raw::gfx::gfxScreen_t::*; + use libctru::gfx::gfxScreen_t::*; use self::Screen::*; match g { Top => GFX_TOP, @@ -47,7 +47,7 @@ impl From for gfx::gfxScreen_t { impl From for Side { #[inline] fn from(s: gfx::gfx3dSide_t) -> Side { - use ::raw::gfx::gfx3dSide_t::*; + use libctru::gfx::gfx3dSide_t::*; use self::Side::*; match s { GFX_LEFT => Left, @@ -58,7 +58,7 @@ impl From for Side { impl From for gfx::gfx3dSide_t { #[inline] fn from(s: Side) -> gfx::gfx3dSide_t { - use ::raw::gfx::gfx3dSide_t::*; + use libctru::gfx::gfx3dSide_t::*; use self::Side::*; match s { Left => GFX_LEFT, diff --git a/src/lib.rs b/src/lib.rs index 767f03d..3ba65e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,9 @@ -#![feature(lang_items)] #![no_std] +#![feature(lang_items)] #![crate_type = "rlib"] #![crate_name = "ctru"] -pub mod raw; +extern crate ctru_sys as libctru; pub type Result = i32; pub type Handle = u32; diff --git a/src/raw/console.rs b/src/raw/console.rs deleted file mode 100644 index bbf3a30..0000000 --- a/src/raw/console.rs +++ /dev/null @@ -1,63 +0,0 @@ -use super::c_void; - -use super::gfx::*; - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct ConsoleFont { - pub gfx: *mut u8, - pub asciiOffset: u16, - pub numChars: u16, -} - -pub type ConsolePrint = 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/src/raw/gfx.rs b/src/raw/gfx.rs deleted file mode 100644 index 4a20028..0000000 --- a/src/raw/gfx.rs +++ /dev/null @@ -1,44 +0,0 @@ - -use super::services::gsp::*; - -#[inline] -pub fn RGB565(r: u32, g: u32, b: u32) { - (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11)); -} - -#[inline] -pub fn RGB8_to_565(r: u32, g: u32, b: 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 static mut gxCmdBuf: *mut u32; - - pub fn gfxInitDefault() -> (); - pub fn gfxInit(topFormat: GSP_FramebufferFormats, bottomFormat: GSP_FramebufferFormats, vrambuffers: u8) -> (); - pub fn gfxExit() -> (); - pub fn gfxSet3D(enable: u8) -> (); - pub fn gfxSetScreenFormat(screen: gfxScreen_t, format: GSP_FramebufferFormats) -> (); - pub fn gfxGetScreenFormat(screen: gfxScreen_t) -> GSP_FramebufferFormats; - pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8) -> (); - pub fn gfxFlushBuffers() -> (); - 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/src/raw/gpu/gpu.rs b/src/raw/gpu/gpu.rs deleted file mode 100644 index 24f2f90..0000000 --- a/src/raw/gpu/gpu.rs +++ /dev/null @@ -1,294 +0,0 @@ -use ctru::Handle; - -#[inline] -pub fn GPUCMD_HEADER(incremental: i32, mask: i32, reg: i32) { - (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)); -} - -#[inline] -pub fn GPU_TEXTURE_MAG_FILTER(v: i32) { - (((v)&0x1)<<1); //takes a GPU_TEXTURE_FILTER_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_MIN_FILTER(v: i32) { - (((v)&0x1)<<2); //takes a GPU_TEXTURE_FILTER_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_WRAP_S(v: i32) { - (((v)&0x3)<<8); //takes a GPU_TEXTURE_WRAP_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_WRAP_T(v: i32) { - (((v)&0x3)<<12); //takes a GPU_TEXTURE_WRAP_PARAM -} - -#[repr(C)] -pub enum GPU_TEXTURE_FILTER_PARAM { - GPU_NEAREST = 0x0, - GPU_LINEAR = 0x1 -} - -#[repr(C)] -pub enum GPU_TEXTURE_WRAP_PARAM { - GPU_CLAMP_TO_EDGE = 0x0, - GPU_REPEAT = 0x1 -} - -#[repr(C)] -pub enum GPU_TEXUNIT { - GPU_TEXUNIT0 = 0x1, - GPU_TEXUNIT1 = 0x2, - GPU_TEXUNIT2 = 0x4 -} - -#[repr(C)] -pub enum GPU_TEXCOLOR { - GPU_RGBA8=0x0, - GPU_RGB8=0x1, - GPU_RGBA5551=0x2, - GPU_RGB565=0x3, - GPU_RGBA4=0x4, - GPU_LA8=0x5, - GPU_HILO8=0x6, - GPU_L8=0x7, - GPU_A8=0x8, - GPU_LA4=0x9, - GPU_L4=0xA, - GPU_ETC1=0xB, - GPU_ETC1A4=0xC -} - -#[repr(C)] -pub enum GPU_TESTFUNC { - GPU_NEVER = 0, - GPU_ALWAYS = 1, - GPU_EQUAL = 2, - GPU_NOTEQUAL = 3, - GPU_LESS = 4, - GPU_LEQUAL = 5, - GPU_GREATER = 6, - GPU_GEQUAL = 7 -} - -#[repr(C)] -pub enum GPU_SCISSORMODE { - GPU_SCISSOR_DISABLE = 0, // disable scissor test - GPU_SCISSOR_INVERT = 1, // exclude pixels inside the scissor box - // 2 is the same as 0 - GPU_SCISSOR_NORMAL = 3, // exclude pixels outside of the scissor box -} - -#[repr(C)] -pub enum GPU_STENCILOP { - GPU_KEEP = 0, // keep destination value - GPU_AND_NOT = 1, // destination & ~source - GPU_XOR = 5, // destination ^ source - // 2 is the same as 1. Other values are too weird to even be usable. -} - -#[repr(C)] -pub enum GPU_WRITEMASK { - GPU_WRITE_RED = 0x01, - GPU_WRITE_GREEN = 0x02, - GPU_WRITE_BLUE = 0x04, - GPU_WRITE_ALPHA = 0x08, - GPU_WRITE_DEPTH = 0x10, - - GPU_WRITE_COLOR = 0x0F, - GPU_WRITE_ALL = 0x1F -} - -#[repr(C)] -pub enum GPU_BLENDEQUATION { - GPU_BLEND_ADD = 0, - GPU_BLEND_SUBTRACT = 1, - GPU_BLEND_REVERSE_SUBTRACT = 2, - GPU_BLEND_MIN = 3, - GPU_BLEND_MAX = 4 -} - -#[repr(C)] -pub enum GPU_BLENDFACTOR { - GPU_ZERO = 0, - GPU_ONE = 1, - GPU_SRC_COLOR = 2, - GPU_ONE_MINUS_SRC_COLOR = 3, - GPU_DST_COLOR = 4, - GPU_ONE_MINUS_DST_COLOR = 5, - GPU_SRC_ALPHA = 6, - GPU_ONE_MINUS_SRC_ALPHA = 7, - GPU_DST_ALPHA = 8, - GPU_ONE_MINUS_DST_ALPHA = 9, - GPU_CONSTANT_COLOR = 10, - GPU_ONE_MINUS_CONSTANT_COLOR = 11, - GPU_CONSTANT_ALPHA = 12, - GPU_ONE_MINUS_CONSTANT_ALPHA = 13, - GPU_SRC_ALPHA_SATURATE = 14 -} - -#[repr(C)] -pub enum GPU_LOGICOP { - GPU_LOGICOP_CLEAR = 0, - GPU_LOGICOP_AND = 1, - GPU_LOGICOP_AND_REVERSE = 2, - GPU_LOGICOP_COPY = 3, - GPU_LOGICOP_SET = 4, - GPU_LOGICOP_COPY_INVERTED = 5, - GPU_LOGICOP_NOOP = 6, - GPU_LOGICOP_INVERT = 7, - GPU_LOGICOP_NAND = 8, - GPU_LOGICOP_OR = 9, - GPU_LOGICOP_NOR = 10, - GPU_LOGICOP_XOR = 11, - GPU_LOGICOP_EQUIV = 12, - GPU_LOGICOP_AND_INVERTED = 13, - GPU_LOGICOP_OR_REVERSE = 14, - GPU_LOGICOP_OR_INVERTED = 15 -} - -#[repr(C)] -pub enum GPU_FORMATS { - GPU_BYTE = 0, - GPU_UNSIGNED_BYTE = 1, - GPU_SHORT = 2, - GPU_FLOAT = 3 -} - -//defines for CW ? -#[repr(C)] -pub enum GPU_CULLMODE { - GPU_CULL_NONE = 0, - GPU_CULL_FRONT_CCW = 1, - GPU_CULL_BACK_CCW = 2 -} - -#[inline] -pub fn GU_ATTRIBFMT(i: i32, n: i32, f: i32) { - (((((n)-1)<<2)|((f)&3))<<((i)*4)); -} - -/** -* Texture combiners sources -*/ -#[repr(C)] -pub enum GPU_TEVSRC{ - GPU_PRIMARY_COLOR = 0x00, - GPU_TEXTURE0 = 0x03, - GPU_TEXTURE1 = 0x04, - GPU_TEXTURE2 = 0x05, - GPU_TEXTURE3 = 0x06, - GPU_CONSTANT = 0x0E, - GPU_PREVIOUS = 0x0F, -} - -/** -* Texture RGB combiners operands -*/ -#[repr(C)] -pub enum GPU_TEVOP_RGB{ - GPU_TEVOP_RGB_SRC_COLOR = 0x00, - GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR = 0x01, - GPU_TEVOP_RGB_SRC_ALPHA = 0x02, - GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA = 0x03, - GPU_TEVOP_RGB_SRC0_RGB = 0x04, - GPU_TEVOP_RGB_0x05 = 0x05, - GPU_TEVOP_RGB_0x06 = 0x06, - GPU_TEVOP_RGB_0x07 = 0x07, - GPU_TEVOP_RGB_SRC1_RGB = 0x08, - GPU_TEVOP_RGB_0x09 = 0x09, - GPU_TEVOP_RGB_0x0A = 0x0A, - GPU_TEVOP_RGB_0x0B = 0x0B, - GPU_TEVOP_RGB_SRC2_RGB = 0x0C, - GPU_TEVOP_RGB_0x0D = 0x0D, - GPU_TEVOP_RGB_0x0E = 0x0E, - GPU_TEVOP_RGB_0x0F = 0x0F, -}; - -/** -* Texture ALPHA combiners operands -*/ -#[repr(C)] -pub enum GPU_TEVOP_A { - GPU_TEVOP_A_SRC_ALPHA = 0x00, - GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA = 0x01, - GPU_TEVOP_A_SRC0_RGB = 0x02, - GPU_TEVOP_A_SRC1_RGB = 0x04, - GPU_TEVOP_A_SRC2_RGB = 0x06, -} - -/** -* Texture combiner functions -*/ -pub enum GPU_COMBINEFUNC { - GPU_REPLACE = 0x00, - GPU_MODULATE = 0x01, - GPU_ADD = 0x02, - GPU_ADD_SIGNED = 0x03, - GPU_INTERPOLATE = 0x04, - GPU_SUBTRACT = 0x05, - GPU_DOT3_RGB = 0x06 //RGB only -} - -#[inline] -pub fn GPU_TEVSOURCES(a, b, c) { - (((a))|((b)<<4)|((c)<<8)); -} - -#[inline] -pub fn GPU_TEVOPERANDS(a, b, c) { - (((a))|((b)<<4)|((c)<<8)); -} - -#[repr(C)] -pub enum GPU_Primitive_t { - GPU_TRIANGLES = 0x0000, - GPU_TRIANGLE_STRIP = 0x0100, - GPU_TRIANGLE_FAN = 0x0200, - GPU_UNKPRIM = 0x0300 // ? -} - -#[repr(C)] -pub enum GPU_SHADER_TYPE { - GPU_VERTEX_SHADER=0x0, - GPU_GEOMETRY_SHADER=0x1 -} - - -extern "C" { - pub fn GPU_Init(gsphandle: *mut Handle) -> (); - pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: 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(gxbuf: *mut u32) -> (); - pub fn GPUCMD_FlushAndRun(gxbuf: *mut u32) -> (); - pub fn GPUCMD_Add(header: u32, param: *mut u32, paramlength: u32) -> (); - pub fn GPUCMD_Finalize() -> (); - pub fn GPU_SetFloatUniform(_type: GPU_SHADER_TYPE, startreg: u32, data: *mut u32, numreg: u32) -> (); - pub fn GPU_SetViewport(depthBuffer: *mut u32, colorBuffer: *mut u32, x: u32, y: u32, w: u32, h: u32) -> (); - pub fn GPU_SetScissorTest(mode: GPU_SCISSORMODE, x: u32, y: u32, w: u32, h: u32) -> (); - pub fn GPU_DepthMap(zScale: f32, zOffset: f32) -> (); - pub fn GPU_SetAlphaTest(enable: u8, function: GPU_TESTFUNC, _ref: u8) -> (); - pub fn GPU_SetDepthTestAndWriteMask(enable: u8, function: GPU_TESTFUNC, writemask: GPU_WRITEMASK) -> (); - pub fn GPU_SetStencilTest(enable: u8, function: GPU_TESTFUNC, _ref: _u8, mask: _u8, replace: _u8) -> (); - pub fn GPU_SetStencilOp(sfail: GPU_STENCILOP, dfail: GPU_STENCILOP, pass: GPU_STENCILOP) -> (); - pub fn GPU_SetFaceCulling(mode: GPU_CULLMODE) -> (); - pub fn GPU_SetAlphaBlending(colorEquation: GPU_BLENDEQUATION, alphaEquation: GPU_BLENDEQUATION, colorSrc: GPU_BLENDFACTOR, colorDst: GPU_BLENDFACTOR, alphaSrc: GPU_BLENDFACTOR, alphaDst: GPU_BLENDFACTOR) -> (); - pub fn GPU_SetColorLogicOp(op: GPU_LOGICOP) -> (); - pub fn GPU_SetBlendingColor(r: u8, g: u8, b: u8, a: u8) -> (); - pub fn GPU_SetAttributeBuffers(totalAttributes: u8, baseAddress: *mut u32, attributeFormats: u64, attributeMask: u16, attributePermutation: u64, numBuffers: u8, bufferOffsets: *mut u32, bufferPermutations: *mut u64, bufferNumAttributes: *mut u8) -> (); - pub fn GPU_SetTextureEnable(units: GPU_TEXUNIT) -> (); - pub fn GPU_SetTexture(unit: GPU_TEXUNIT, data: *mut u32, width: u16, height: u16, param: u32, colorType: GPU_TEXCOLOR) -> (); - pub fn GPU_SetTexEnv(id: u8, rgbSources: u16, alphaSources: u16, rgbOperands: u16, alphaOperands: u16, rgbCombine: GPU_COMBINEFUNC, alphaCombine: GPU_COMBINEFUNC, constantColor: u32) -> (); - pub fn GPU_DrawArray(primitive: GPU_Primitive_t, n: u32) -> (); - pub fn GPU_DrawElements(primitive: GPU_Primitive_t, indexArray: *mut u32, n: u32) -> (); - pub fn GPU_FinishDrawing() -> (); - pub fn GPU_SetShaderOutmap(outmapData: *mut u32) -> (); - pub fn GPU_SendShaderCode(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); - pub fn GPU_SendOperandDescriptors(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); -} diff --git a/src/raw/gpu/gx.rs b/src/raw/gpu/gx.rs deleted file mode 100644 index d26c9ab..0000000 --- a/src/raw/gpu/gx.rs +++ /dev/null @@ -1,73 +0,0 @@ -#[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) { - ((x)<<0); -} - -#[inline] -pub fn GX_TRANSFER_OUT_TILED(x) { - ((x)<<1); -} - -#[inline] -pub fn GX_TRANSFER_RAW_COPY(x) { - ((x)<<3) -} - -#[inline] -pub fn GX_TRANSFER_IN_FORMAT(x) { - ((x)<<8); -} - -#[inline] -pub fn GX_TRANSFER_OUT_FORMAT(x) { - ((x)<<12) -} - -#[inline] -pub fn GX_TRANSFER_SCALING(x) { - ((x)<<24); -} - -use ctru::Result; - - -extern "C" { - pub fn GX_RequestDma(gxbuf: *mut u32, src: *mut u32, dst: *mut u32, length: u32) -> Result; - pub fn GX_SetCommandList_Last(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, flags: u8) -> Result; - pub fn GX_SetMemoryFill(gxbuf: *mut u32, buf0a: *mut u32, buf0v: u32, buf0e: *mut u32, width0: u16, buf1a: *mut u32, buf1v: u32, buf1e: *mut u32, width1: u16) -> Result; - pub fn GX_SetDisplayTransfer(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, flags: u32) -> Result; - pub fn GX_SetTextureCopy(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, size: u32, flags: u32) -> Result; - pub fn GX_SetCommandList_First(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, buf1a: *mut u32, buf1s: u32, buf2a: *mut u32, buf2s: u32) -> Result; -} diff --git a/src/raw/gpu/mod.rs b/src/raw/gpu/mod.rs deleted file mode 100644 index 8d71046..0000000 --- a/src/raw/gpu/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod gpu; -pub mod gx; -pub mod registers; -pub mod shader_program; -pub mod shbin; - -use self::gpu::*; -use self::gx::*; -use self::registers::*; -use self::shader_program::*; -use self::shbin::*; diff --git a/src/raw/gpu/registers.rs b/src/raw/gpu/registers.rs deleted file mode 100644 index 739a50a..0000000 --- a/src/raw/gpu/registers.rs +++ /dev/null @@ -1,726 +0,0 @@ -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; -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; -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; -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; -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; -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; -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; -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; -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/src/raw/gpu/shader_program.rs b/src/raw/gpu/shader_program.rs deleted file mode 100644 index bf373e1..0000000 --- a/src/raw/gpu/shader_program.rs +++ /dev/null @@ -1,42 +0,0 @@ -use super::shbin::*; - -#[repr(C)] -#[derive(Copy)] -pub struct float24Uniform_s { - id: u32, - data: [u32; 3usize] -} - -#[repr(C)] -#[derive(Copy)] -pub struct shaderInstance_s { - pub dvle: *mut DVLE_s; - pub boolUniforms: u16, - pub intUniforms: [u32; 4usize], - pub float24Uniforms: *mut float24Uniform_s, - pub numFloat24Uniforms: u8, -} - -#[repr(C)] -#[derive(Copy)] -pub struct shaderProgram_s { - pub vertexShader: *mut shaderInstance_s, - pub geometryShader: *mut shaderInstance_s, - pub geometryShaderInputStride: u8, -} - -use ctru::Result; - - -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: ::libc::c_int, value: u8) -> Result; - pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, id: ::libc::c_int, value: *mut u8) -> Result; - pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s, name: *const ::libc::c_char) -> Result; - 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 shaderProgramUse(sp: *mut shaderProgram_s) -> Result; -} diff --git a/src/raw/gpu/shbin.rs b/src/raw/gpu/shbin.rs deleted file mode 100644 index db400d9..0000000 --- a/src/raw/gpu/shbin.rs +++ /dev/null @@ -1,105 +0,0 @@ -typedef enum{ - VERTEX_SHDR=GPU_VERTEX_SHADER, - GEOMETRY_SHDR=GPU_GEOMETRY_SHADER -}DVLE_type; - -#[repr(C)] -pub enum DVLE_type { - VERTEX_SHDR=GPU_VERTEX_SHADER, - GEOMETRY_SHDR=GPU_GEOMETRY_SHADER, -} - -typedef enum{ - DVLE_CONST_BOOL=0x0, - DVLE_CONST_u8=0x1, - DVLE_CONST_FLOAT24=0x2, -}DVLE_constantType; - -#[repr(C)] -pub enum DVLE_constantType { - DVLE_CONST_BOOL = 0x0, - DVLE_CONST_u8 = 0x1, - DVLE_CONST_FLOAT24 = 0x2, -} - -#[repr(C)] -pub enum DVLE_outputAttribute_t { - RESULT_POSITION = 0x0, - RESULT_NORMALQUAT = 0x1, - RESULT_COLOR = 0x2, - RESULT_TEXCOORD0 = 0x3, - RESULT_TEXCOORD0W = 0x4, - RESULT_TEXCOORD1 = 0x5, - RESULT_TEXCOORD2 = 0x6, - RESULT_VIEW = 0x8 -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLP_s { - codeSize: u32, - codeData: *mut u32, - opdescSize: u32, - opcdescData: *mut u32 -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLE_constEntry_s { - type: u16, - id: u16, - data: [u32; 4usize] -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLE_outEntry_s { - type: u16, - regID: u16, - mask: u8, - unk: [u8; 3usize] -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLE_uniformEntry_s{ - symbolOffset: u32, - startReg: u16, - endReg: u16, -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLE_s { - DVLE_type type: DVLE_type, - DVLP_s* dvlp: *mut DVLP_s, - mainOffset: u32, - endmainOffset: u32, - constTableSize: u32, - constTableData: *mut DVLE_constEntry_s, - outTableSize: u32, - outTableData: *mut DVLE_outEntry_s, - uniformTableSize: u32, - uniformTableData: *mut DVLE_uniformEntry_s, - symbolTableData: *mut u8, - outmapMask: u8, - outmapData: [u32; 8usize] -} - -#[repr(C)] -#[derive(Copy)] -pub struct DVLB_s { - numDVLE: u32, - DVLP: DVLP_s, - DVLE: *mut DVLE_s -} - -use ctru::raw::types::*; - - -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/src/raw/linear.rs b/src/raw/linear.rs deleted file mode 100644 index 691baef..0000000 --- a/src/raw/linear.rs +++ /dev/null @@ -1,10 +0,0 @@ -use super::c_void; - - -extern "C" { - pub fn linearAlloc(size: i32) -> *mut c_void; - pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void; - pub fn linearRealloc(mem: *mut c_void, size: i32) -> *mut c_void; - pub fn linearFree(mem: *mut c_void) -> (); - pub fn linearSpaceFree() -> u32; -} diff --git a/src/raw/mod.rs b/src/raw/mod.rs deleted file mode 100644 index 0975001..0000000 --- a/src/raw/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(overflowing_literals)] - -pub mod console; -pub mod gfx; -pub mod linear; -pub mod os; -pub mod sdmc; -pub mod srv; -pub mod svc; -pub mod types; - -pub mod services; - -pub use self::types::*; - -#[repr(u8)] -pub enum c_void { - __variant1, - __variant2 -} - -pub type ThreadFunc = Option ()>; diff --git a/src/raw/os.rs b/src/raw/os.rs deleted file mode 100644 index 3ba7022..0000000 --- a/src/raw/os.rs +++ /dev/null @@ -1,15 +0,0 @@ - -#[inline] -pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) { - (((major)<<24)|((minor)<<16)|((revision)<<8)); -} - - -extern "C" { - pub fn osConvertVirtToPhys(vaddr: u32) -> u32; - pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32; - pub fn osStrError(error: u32) -> *const u8; - pub fn osGetFirmVersion() -> u32; - pub fn osGetKernelVersion() -> u32; - pub fn osGetTime() -> u64; -} diff --git a/src/raw/sdmc.rs b/src/raw/sdmc.rs deleted file mode 100644 index 17b2cc8..0000000 --- a/src/raw/sdmc.rs +++ /dev/null @@ -1,7 +0,0 @@ -use super::super::Result; - - -extern "C" { - pub fn sdmcInit() -> Result; - pub fn sdmcExit() -> Result; -} diff --git a/src/raw/services/ac.rs b/src/raw/services/ac.rs deleted file mode 100644 index 0b07ec6..0000000 --- a/src/raw/services/ac.rs +++ /dev/null @@ -1,9 +0,0 @@ -use ::{Handle, Result}; - - -extern "C" { - pub fn acInit() -> Result; - pub fn acExit() -> Result; - pub fn ACU_GetWifiStatus(servhandle: *mut Handle, out: *mut u32) -> Result; - pub fn ACU_WaitInternetConnection() -> Result; -} diff --git a/src/raw/services/am.rs b/src/raw/services/am.rs deleted file mode 100644 index 69f0e17..0000000 --- a/src/raw/services/am.rs +++ /dev/null @@ -1,30 +0,0 @@ -use ::raw::c_void; -use ::{Result, Handle}; - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct TitleList { - titleID: u64, - size: u64, - titleVersion: u16, - unknown2: [u8; 6usize] -} - - -extern "C" { - pub fn amInit() -> Result; - pub fn amExit() -> Result; - pub fn amGetSessionHandle() -> *mut Handle; - pub fn AM_GetTitleCount(mediatype: u8, count: *mut u32) -> Result; - pub fn AM_GetTitleIdList(mediatype: u8, count: u32, titleIDs: *mut u64) -> Result; - pub fn AM_GetDeviceId(deviceID: *mut u32) -> Result; - pub fn AM_ListTitles(mediatype: u8, titleCount: u32, titleIdList: *mut u64, titleList: *mut TitleList) -> Result; - pub fn AM_StartCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result; - pub fn AM_StartDlpChildCiaInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_CancelCIAInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_FinishCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result; - pub fn AM_DeleteTitle(mediatype: u8, titleID: u64) -> Result; - pub fn AM_DeleteAppTitle(mediatype: u8, titleID: u64) -> Result; - pub fn AM_InstallFIRM(titleID: u64) -> Result; - pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64, productCode: *mut c_void) -> Result; -} diff --git a/src/raw/services/apt.rs b/src/raw/services/apt.rs deleted file mode 100644 index 180c2dc..0000000 --- a/src/raw/services/apt.rs +++ /dev/null @@ -1,125 +0,0 @@ -use ::{Handle, Result}; -use ::raw::c_void; - -pub const RUNFLAG_APTWORKAROUND: u32 = 1; -pub const RUNFLAG_APTREINIT: u32 = 2; - -#[repr(C)] -pub enum NS_APPID { - APPID_HOMEMENU = 0x101, // Home Menu - APPID_CAMERA = 0x110, // Camera applet - APPID_FRIENDS_LIST = 0x112, // Friends List applet - APPID_GAME_NOTES = 0x113, // Game Notes applet - APPID_WEB = 0x114, // Internet Browser - APPID_INSTRUCTION_MANUAL = 0x115, // Instruction Manual applet - APPID_NOTIFICATIONS = 0x116, // Notifications applet - APPID_MIIVERSE = 0x117, // Miiverse applet - APPID_APPLICATION = 0x300, // Application - APPID_SOFTWARE_KEYBOARD = 0x401, // Software Keyboard - APPID_APPLETED = 0x402, // appletEd - APPID_PNOTE_AP = 0x404, // PNOTE_AP - APPID_SNOTE_AP = 0x405, // SNOTE_AP - APPID_ERROR = 0x406, // error - APPID_MINT = 0x407, // mint - APPID_EXTRAPAD = 0x408, // extrapad - APPID_MEMOLIB = 0x409, // memolib -} // cf http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs - -#[repr(C)] -pub enum APP_STATUS { - APP_NOTINITIALIZED, - APP_RUNNING, - APP_SUSPENDED, - APP_EXITING, - APP_SUSPENDING, - APP_SLEEPMODE, - APP_PREPARE_SLEEPMODE, - APP_APPLETSTARTED, - APP_APPLETCLOSED -} - -#[repr(C)] -pub enum APTSIGNAL { - APTSIGNAL_HOMEBUTTON = 1, - // 2: sleep-mode related? - APTSIGNAL_PREPARESLEEP = 3, - // 4: triggered when ptm:s GetShellStatus() returns 5. - APTSIGNAL_ENTERSLEEP = 5, - APTSIGNAL_WAKEUP = 6, - APTSIGNAL_ENABLE = 7, - APTSIGNAL_POWERBUTTON = 8, - APTSIGNAL_UTILITY = 9, - APTSIGNAL_SLEEPSYSTEM = 10, - APTSIGNAL_ERROR = 11 -} - -#[repr(C)] -pub enum APTHOOK { - APTHOOK_ONSUSPEND = 0, - APTHOOK_ONRESTORE, - APTHOOK_ONSLEEP, - APTHOOK_ONWAKEUP, - APTHOOK_ONEXIT, - - APTHOOK_COUNT, -} - -type aptHookFn = Option ()>; - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct aptHookCookie { - next: *mut aptHookCookie, - callback: aptHookFn, - param: *mut c_void, -} - - -extern "C" { - pub static mut aptEvents: [Handle; 3usize]; - - pub fn aptInit() -> Result; - pub fn aptExit() -> (); - pub fn aptOpenSession() -> (); - pub fn aptCloseSession() -> (); - pub fn aptSetStatus(status: APP_STATUS) -> (); - pub fn aptGetStatus() -> APP_STATUS; - pub fn aptGetStatusPower() -> u32; - pub fn aptSetStatusPower(status: u32) -> (); - pub fn aptReturnToMenu() -> (); - pub fn aptWaitStatusEvent() -> (); - pub fn aptSignalReadyForSleep() -> (); - pub fn aptGetMenuAppID() -> NS_APPID; - pub fn aptMainLoop() -> u8; - pub fn APT_GetLockHandle(handle: *mut Handle, flags: u16, lockHandle: *mut Handle) -> Result; - pub fn APT_Initialize(handle: *mut Handle, appId: NS_APPID, eventHandle1: *mut Handle, eventHandle2: *mut Handle) -> Result; - pub fn APT_HardwareResetAsync(handle: *mut Handle) -> Result; - pub fn APT_Enable(handle: *mut Handle, a: u32) -> Result; - pub fn APT_GetAppletManInfo(handle: *mut Handle, inval: u8, outval8: *mut u8, outval32: *mut u32, menu_appid: *mut NS_APPID, active_appid: *mut NS_APPID) -> Result; - pub fn APT_PrepareToJumpToHomeMenu(handle: *mut Handle) -> Result; - pub fn APT_JumpToHomeMenu(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; - pub fn APT_IsRegistered(handle: *mut Handle, appID: NS_APPID, out: *mut u8) -> Result; - pub fn APT_InquireNotification(handle: *mut Handle, appID: u32, signalType: *mut u8) -> Result; - pub fn APT_NotifyToWait(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_AppletUtility(handle: *mut Handle, out: *mut u32, a: u32, size1: u32, buf1: *mut u8, size2: u32, buf2: *mut u8) -> Result; - pub fn APT_GlanceParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; - pub fn APT_ReceiveParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; - pub fn APT_SendParameter(handle: *mut Handle, src_appID: NS_APPID, dst_appID: NS_APPID, bufferSize: u32, buffer: *mut u32, paramhandle: Handle, signalType: u8) -> Result; - pub fn APT_SendCaptureBufferInfo(handle: *mut Handle, bufferSize: u32, buffer: *mut u32) -> Result; - pub fn APT_ReplySleepQuery(handle: *mut Handle, appID: NS_APPID, a: u32) -> Result; - pub fn APT_ReplySleepNotificationComplete(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_PrepareToCloseApplication(handle: *mut Handle, a: u8) -> Result; - pub fn APT_CloseApplication(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; - pub fn APT_SetAppCpuTimeLimit(handle: *mut Handle, percent: u32) -> Result; - pub fn APT_GetAppCpuTimeLimit(handle: *mut Handle, percent: *mut u32) -> Result; - pub fn APT_CheckNew3DS_Application(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_CheckNew3DS_System(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_CheckNew3DS(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_PrepareToDoAppJump(handle: *mut Handle, flags: u8, programID: u64, mediatype: u8) -> Result; - pub fn APT_DoAppJump(handle: *mut Handle, NSbuf0Size: u32, NSbuf1Size: u32, NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result; - pub fn APT_PrepareToStartLibraryApplet(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_StartLibraryApplet(handle: *mut Handle, appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; - pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; - pub fn APT_PrepareToStartSystemApplet(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_StartSystemApplet(handle: *mut Handle, appID: NS_APPID, bufSize: u32, applHandle: Handle, buf: *mut u8) -> Result; -} diff --git a/src/raw/services/cfgnor.rs b/src/raw/services/cfgnor.rs deleted file mode 100644 index 1993267..0000000 --- a/src/raw/services/cfgnor.rs +++ /dev/null @@ -1,11 +0,0 @@ -use ::Result; - - -extern "C" { - pub fn CFGNOR_Initialize(value: u8) -> Result; - pub fn CFGNOR_Shutdown() -> Result; - pub fn CFGNOR_ReadData(offset: u32, buf: *mut u32, size: u32) -> Result; - pub fn CFGNOR_WriteData(offset: u32, buf: *mut u32, size: u32) -> Result; - pub fn CFGNOR_DumpFlash(buf: *mut u32, size: u32) -> Result; - pub fn CFGNOR_WriteFlash(buf: *mut u32, size: u32) -> Result; -} diff --git a/src/raw/services/cfgu.rs b/src/raw/services/cfgu.rs deleted file mode 100644 index 6adccf1..0000000 --- a/src/raw/services/cfgu.rs +++ /dev/null @@ -1,16 +0,0 @@ -use ::Result; - - -extern "C" { - pub fn initCfgu() -> Result; - pub fn exitCfgu() -> Result; - pub fn CFGU_SecureInfoGetRegion(region: *mut u8) -> Result; - pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32, hash: *mut u64) -> Result; - pub fn CFGU_GetRegionCanadaUSA(value: *mut u8) -> Result; - pub fn CFGU_GetSystemModel(model: *mut u8) -> Result; - pub fn CFGU_GetModelNintendo2DS(value: *mut u8) -> Result; - pub fn CFGU_GetCountryCodeString(code: u16, string: *mut u16) -> Result; - pub fn CFGU_GetCountryCodeID(string: u16, code: *mut u16) -> Result; - pub fn CFGU_GetConfigInfoBlk2(size: u32, blkID: u32, outData: *mut u8) -> Result; - pub fn CFGU_GetSystemLanguage(language: *mut u8) -> Result; -} diff --git a/src/raw/services/gsp.rs b/src/raw/services/gsp.rs deleted file mode 100644 index 7a4fd8c..0000000 --- a/src/raw/services/gsp.rs +++ /dev/null @@ -1,83 +0,0 @@ -use super::super::types::*; - -#[inline] -pub fn GSP_REBASE_REG(r: u32) { - ((r)-0x1EB00000); -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_FramebufferInfo { - active_framebuf: u32, //"0=first, 1=second" - framebuf0_vaddr: *mut u32, //"Framebuffer virtual address, for the main screen this is the 3D left framebuffer" - framebuf1_vaddr: *mut u32,//"For the main screen: 3D right framebuffer address" - framebuf_widthbytesize: u32, //"Value for 0x1EF00X90, controls framebuffer width" - format: u32,//"Framebuffer format, this u16 is written to the low u16 for LCD register 0x1EF00X70." - framebuf_dispselect: u32, //"Value for 0x1EF00X78, controls which framebuffer is displayed" - unk: u32 //"?" -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub enum GSP_FramebufferFormats { - GSP_RGBA8_OES=0, //pixel_size = 4-bytes - GSP_BGR8_OES=1, //pixel_size = 3-bytes - GSP_RGB565_OES=2, //pixel_size = 2-bytes - GSP_RGB5_A1_OES=3, //pixel_size = 2-bytes - GSP_RGBA4_OES=4 //pixel_size = 2-bytes -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_CaptureInfoEntry { //See this for GSP_CaptureInfoEntry and GSP_CaptureInfo: http://3dbrew.org/wiki/GSPGPU:ImportDisplayCaptureInfo - framebuf0_vaddr: *mut u32, - framebuf1_vaddr: *mut u32, - format: u32, - framebuf_widthbytesize: u32, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_CaptureInfo { - screencapture: [GSP_CaptureInfoEntry; 2usize] -} - -#[repr(C)] -pub enum GSP_Event { - GSPEVENT_PSC0 = 0, // memory fill completed - GSPEVENT_PSC1, - GSPEVENT_VBlank0, - GSPEVENT_VBlank1, - GSPEVENT_PPF, // display transfer finished - GSPEVENT_P3D, // command list processing finished - GSPEVENT_DMA, - - GSPEVENT_MAX, // used to know how many events there are -} - -use super::super::super::{Result, Handle}; - - -extern "C" { - pub fn gspInit() -> Result; - pub fn gspExit() -> (); - pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8, gspThreadId: u8) -> Result; - pub fn gspExitEventHandler() -> (); - pub fn gspWaitForEvent(id: GSP_Event, nextEvent: u8) -> (); - pub fn GSPGPU_AcquireRight(handle: *mut Handle, flags: u8) -> Result; - pub fn GSPGPU_ReleaseRight(handle: *mut Handle) -> Result; - pub fn GSPGPU_ImportDisplayCaptureInfo(handle: *mut Handle, captureinfo: *mut GSP_CaptureInfo) -> Result; - pub fn GSPGPU_SaveVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_RestoreVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_SetLcdForceBlack(handle: *mut Handle, flags: u8) -> Result; - pub fn GSPGPU_SetBufferSwap(handle: *mut Handle, screenid: u32, framebufinfo: *mut GSP_FramebufferInfo) -> Result; - pub fn GSPGPU_FlushDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; - pub fn GSPGPU_InvalidateDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; - pub fn GSPGPU_WriteHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; - pub fn GSPGPU_WriteHWRegsWithMask(handle: *mut Handle, regAddr: u32, data: *mut u32, datasize: u8, maskdata: *mut u32, masksize: u8) -> Result; - pub fn GSPGPU_ReadHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; - pub fn GSPGPU_RegisterInterruptRelayQueue(handle: *mut Handle, eventHandle: Handle, flags: u32, outMemHandle: *mut Handle, threadID: *mut u8) -> Result; - pub fn GSPGPU_UnregisterInterruptRelayQueue(handle: *mut Handle) -> Result; - pub fn GSPGPU_TriggerCmdReqQueue(handle: *mut Handle) -> Result; - pub fn GSPGPU_SubmitGxCommand(sharedGspCmdBuf: *mut u32, gxCommand: *mut u32, handle: *mut Handle) -> Result; -} diff --git a/src/raw/services/hb.rs b/src/raw/services/hb.rs deleted file mode 100644 index c2a23a6..0000000 --- a/src/raw/services/hb.rs +++ /dev/null @@ -1,11 +0,0 @@ -use ::Result; -use ::raw::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/src/raw/services/hid.rs b/src/raw/services/hid.rs deleted file mode 100644 index 28bc672..0000000 --- a/src/raw/services/hid.rs +++ /dev/null @@ -1,103 +0,0 @@ -use ::raw::types::*; -use ::{Result, Handle}; - -pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000; - -#[repr(C)] -pub enum PAD_KEY { - KEY_A = 1, - KEY_B = 2, - KEY_SELECT = 4, - KEY_START = 8, - KEY_DRIGHT = 16, - KEY_DLEFT = 32, - KEY_DUP = 64, - KEY_DDOWN = 128, - KEY_R = 256, - KEY_L = 512, - KEY_X = 1024, - KEY_Y = 2048, - KEY_ZL = 4096, // (new 3DS only) - KEY_ZR = 8192, // (new 3DS only) - KEY_TOUCH = 1048576, // Not actually provided by HID - KEY_CSTICK_RIGHT = 16777216, // c-stick (new 3DS only) - KEY_CSTICK_LEFT = 33554432, // c-stick (new 3DS only) - KEY_CSTICK_UP = 67108864, // c-stick (new 3DS only) - KEY_CSTICK_DOWN = 134217728, // c-stick (new 3DS only) - KEY_CPAD_RIGHT = 268435456, // circle pad - KEY_CPAD_LEFT = 536870912, // circle pad - KEY_CPAD_UP = 1073741824, // circle pad - KEY_CPAD_DOWN = 2147483648, // circle pad - - // Generic catch-all directions - /*KEY_UP = KEY_DUP | KEY_CPAD_UP, - KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN, - KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT, - KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT,*/ -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct touchPosition { - px: u16, - py: u16, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct circlePosition { - dx: s16, - dy: s16, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct accelVector { - x: s16, - y: s16, - z: s16 -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct angularRate { - x: s16, //roll - z: s16, //yaw - y: s16, //pitch -} - -#[repr(C)] -pub enum HID_Event { - HIDEVENT_PAD0 = 0, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." - HIDEVENT_PAD1, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." - HIDEVENT_Accel, //"Event signaled by HID-module, when the sharedmem accelerometer state was updated." - HIDEVENT_Gyro, //"Event signaled by HID-module, when the sharedmem gyroscope state was updated." - HIDEVENT_DebugPad, //"Event signaled by HID-module, when the sharedmem DebugPad state was updated." - - HIDEVENT_MAX, // used to know how many events there are -} - - -extern "C" { - pub static hidMemHandle: Handle; - pub static hidSharedMem: *mut vu32; - - pub fn hidInit(sharedMem: *mut u32) -> Result; - pub fn hidExit() -> (); - pub fn hidScanInput() -> (); - pub fn hidKeysHeld() -> u32; - pub fn hidKeysDown() -> u32; - pub fn hidKeysUp() -> u32; - pub fn hidTouchRead(pos: *mut touchPosition) -> (); - pub fn hidCircleRead(pos: *mut circlePosition) -> (); - pub fn hidAccelRead(vector: *mut accelVector) -> (); - pub fn hidGyroRead(rate: *mut angularRate) -> (); - pub fn hidWaitForEvent(id: HID_Event, nextEvent: u8) -> (); - pub fn HIDUSER_GetHandles(outMemHandle: *mut Handle, eventpad0: *mut Handle, eventpad1: *mut Handle, eventaccel: *mut Handle, eventgyro: *mut Handle, eventdebugpad: *mut Handle) -> Result; - pub fn HIDUSER_EnableAccelerometer() -> Result; - pub fn HIDUSER_DisableAccelerometer() -> Result; - pub fn HIDUSER_EnableGyroscope() -> Result; - pub fn HIDUSER_DisableGyroscope() -> Result; - pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: *mut f32) -> Result; - pub fn HIDUSER_GetSoundVolume(volume: *mut u8) -> Result; -} diff --git a/src/raw/services/ir.rs b/src/raw/services/ir.rs deleted file mode 100644 index 3affb65..0000000 --- a/src/raw/services/ir.rs +++ /dev/null @@ -1,14 +0,0 @@ -use ::{Result, Handle}; - - -extern "C" { - pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result; - pub fn IRU_Shutdown() -> Result; - pub fn IRU_GetServHandle() -> Handle; - pub fn IRU_SendData(buf: *mut u8, size: u32, wait: u32) -> Result; - pub fn IRU_RecvData(buf: *mut u8, size: u32, flag: u8, transfercount: *mut u32, wait: u32) -> Result; - pub fn IRU_SetBitRate(value: u8) -> Result; - pub fn IRU_GetBitRate(out: *mut u8) -> Result; - pub fn IRU_SetIRLEDState(value: u32) -> Result; - pub fn IRU_GetIRLEDRecvState(out: *mut u32) -> Result; -} diff --git a/src/raw/services/irrst.rs b/src/raw/services/irrst.rs deleted file mode 100644 index 4187260..0000000 --- a/src/raw/services/irrst.rs +++ /dev/null @@ -1,21 +0,0 @@ -use ::{Result, Handle}; -use ::raw::types::*; - -use super::hid::circlePosition; - - -extern "C" { - pub static irrstMemHandle: Handle; - pub static irrstSharedMem: *mut vu32; - - pub fn irrstInit(sharedMem: *mut u32) -> Result; - pub fn irrstExit() -> (); - pub fn irrstScanInput() -> (); - pub fn irrstKeysHeld() -> u32; - pub fn irrstCstickRead(pos: *mut circlePosition) -> (); - pub fn irrstWaitForEvent(nextEvent: u8) -> (); - pub fn IRRST_GetHandles(outMemHandle: *mut Handle, - outEventHandle: *mut Handle) -> Result; - pub fn IRRST_Initialize(unk1: u32, unk2: u8) -> Result; - pub fn IRRST_Shutdown() -> Result; -} diff --git a/src/raw/services/mic.rs b/src/raw/services/mic.rs deleted file mode 100644 index 64e7746..0000000 --- a/src/raw/services/mic.rs +++ /dev/null @@ -1,19 +0,0 @@ -use ::{Result, Handle}; - - -extern "C" { - pub fn MIC_Initialize(sharedmem: *mut u32, sharedmem_size: u32, control: u8, recording: u8, unk0: u8, unk1: u8, unk2: u8) -> Result; - pub fn MIC_Shutdown() -> Result; - pub fn MIC_GetSharedMemOffsetValue() -> u32; - pub fn MIC_ReadAudioData(outbuf: *mut u8, readsize: u32, waitforevent: u32) -> u32; - pub fn MIC_MapSharedMem(handle: Handle, size: u32) -> Result; - pub fn MIC_UnmapSharedMem() -> Result; - pub fn MIC_cmd3_Initialize(unk0: u8, unk1: u8, sharedmem_baseoffset: u32, sharedmem_endoffset: u32, unk2: u8) -> Result; - pub fn MIC_cmd5() -> Result; - pub fn MIC_GetCNTBit15(out: *mut u8) -> Result; - pub fn MIC_GetEventHandle(handle: *mut Handle) -> Result; - pub fn MIC_SetControl(value: u8) -> Result; - pub fn MIC_GetControl(value: *mut u8) -> Result; - pub fn MIC_SetRecording(value: u8) -> Result; - pub fn MIC_IsRecoding(value: *mut u8) -> Result; -} diff --git a/src/raw/services/mod.rs b/src/raw/services/mod.rs deleted file mode 100644 index ec2d270..0000000 --- a/src/raw/services/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub mod ac; -pub mod am; -pub mod apt; -pub mod cfgnor; -pub mod cfgu; -pub mod gsp; -pub mod hb; -pub mod hid; -pub mod ir; -pub mod irrst; -pub mod mic; -pub mod ns; -pub mod pm; -pub mod ptm; -pub mod soc; diff --git a/src/raw/services/ns.rs b/src/raw/services/ns.rs deleted file mode 100644 index 68a58c2..0000000 --- a/src/raw/services/ns.rs +++ /dev/null @@ -1,9 +0,0 @@ -use ::Result; - - -extern "C" { - pub fn nsInit() -> Result; - pub fn nsExit() -> Result; - pub fn NS_LaunchTitle(titleid: u64, launch_flags: u32, procid: *mut u32) -> Result; - pub fn NS_RebootToTitle(mediatype: u8, titleid: u64) -> Result; -} diff --git a/src/raw/services/pm.rs b/src/raw/services/pm.rs deleted file mode 100644 index 78eb3fd..0000000 --- a/src/raw/services/pm.rs +++ /dev/null @@ -1,12 +0,0 @@ -use ::Result; - - -extern "C" { - pub fn pmInit() -> Result; - pub fn pmExit() -> Result; - pub fn PM_LaunchTitle(mediatype: u8, titleid: u64, launch_flags: u32) -> Result; - pub fn PM_GetTitleExheaderFlags(mediatype: u8, titleid: u64, out: *mut u8) -> Result; - pub fn PM_SetFIRMLaunchParams(size: u32, _in: *mut u8) -> Result; - pub fn PM_GetFIRMLaunchParams(size: u32, out: *mut u8) -> Result; - pub fn PM_LaunchFIRMSetParams(firm_titleid_low: u32, size: u32, _in: *mut u8) -> Result; -} diff --git a/src/raw/services/ptm.rs b/src/raw/services/ptm.rs deleted file mode 100644 index 2743648..0000000 --- a/src/raw/services/ptm.rs +++ /dev/null @@ -1,12 +0,0 @@ -use ::{Result, Handle}; - - -extern "C" { - pub fn ptmInit() -> Result; - pub fn ptmExit() -> Result; - pub fn PTMU_GetShellState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetBatteryLevel(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetBatteryChargeState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetPedometerState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetTotalStepCount(servhandle: *mut Handle, steps: *mut u32) -> Result; -} diff --git a/src/raw/services/soc.rs b/src/raw/services/soc.rs deleted file mode 100644 index aff4f1d..0000000 --- a/src/raw/services/soc.rs +++ /dev/null @@ -1,7 +0,0 @@ -use ::Result; - - -extern "C" { - pub fn SOC_Initialize(context_addr: *mut u32, context_size: u32) -> Result; - pub fn SOC_Shutdown() -> Result; -} diff --git a/src/raw/srv.rs b/src/raw/srv.rs deleted file mode 100644 index c327973..0000000 --- a/src/raw/srv.rs +++ /dev/null @@ -1,15 +0,0 @@ -use ::raw::*; -use ::{Result, Handle}; - -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/src/raw/svc.rs b/src/raw/svc.rs deleted file mode 100644 index 6fcce62..0000000 --- a/src/raw/svc.rs +++ /dev/null @@ -1,310 +0,0 @@ -use super::*; -use super::super::{Handle, Result}; - -#[repr(C)] -pub enum MemOp { - MEMOP_FREE = 1, - MEMOP_ALLOC = 3, - MEMOP_MAP = 4, - MEMOP_UNMAP = 5, - MEMOP_PROT = 6, - - MEMOP_ALLOC_LINEAR = 0x10003, -} - -#[repr(C)] -pub enum MemState { - 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 -} - -#[repr(C)] -pub enum MemPerm { - MEMPERM_READ = 1, - MEMPERM_WRITE = 2, - MEMPERM_EXECUTE = 4, - MEMPERM_DONTCARE = 0x10000000, - MEMPERM_MAX = 0xFFFFFFFF //force 4-byte -} - -#[repr(C)] -pub struct MemInfo { - pub base_addr: u32, - pub size: u32, - pub perm: u32, - pub state: u32, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct PageInfo { - pub flags: u32, -} - -#[repr(C)] -pub enum ArbitrationType { - ARBITER_FREE =0, - ARBITER_ACQUIRE =1, - ARBITER_KERNEL2 =2, - ARBITER_ACQUIRE_TIMEOUT=3, - ARBITER_KERNEL4 =4, -} - -#[repr(C)] -pub enum DebugEventType { - 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 -} - -#[repr(C)] -pub enum ProcessEventReason { - REASON_CREATE = 1, - REASON_ATTACH = 2 -} - -#[repr(C)] -#[derive(Copy)] -pub struct ProcessEvent { - pub program_id: u64, - pub process_name: [u8; 8usize], - pub process_id: u32, - pub reason: u32 -} - -impl Clone for ProcessEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct CreateThreadEvent { - pub creator_thread_id: u32, - pub base_addr: u32, - pub entry_point: u32 -} - -impl Clone for CreateThreadEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -pub enum ExitThreadEventReason { - EXITTHREAD_EVENT_NONE = 0, - EXITTHREAD_EVENT_TERMINATE = 1, - EXITTHREAD_EVENT_UNHANDLED_EXC = 2, - EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 -} - -#[repr(C)] -pub enum ExitProcessEventReason { - EXITPROCESS_EVENT_NONE = 0, - EXITPROCESS_EVENT_TERMINATE = 1, - EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 -} - -#[repr(C)] -#[derive(Copy)] -pub struct ExitProcessEvent { - pub reason: u32 -} - -impl Clone for ExitProcessEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct ExitThreadEvent { - pub reason: u32 -} - -impl Clone for ExitThreadEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct ExceptionEvent { - pub _type: u32, - pub address: u32, - pub argument: u32 -} - -impl Clone for ExceptionEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -pub enum ExceptionEventType { - EXC_EVENT_UNDEFINED_INSTRUCTION = 0, // arg: (None) - EXC_EVENT_UNKNOWN1 = 1, // arg: (None) - EXC_EVENT_UNKNOWN2 = 2, // arg: address - EXC_EVENT_UNKNOWN3 = 3, // arg: address - EXC_EVENT_ATTACH_BREAK = 4, // arg: (None) - EXC_EVENT_BREAKPOINT = 5, // arg: (None) - EXC_EVENT_USER_BREAK = 6, // arg: user break type - EXC_EVENT_DEBUGGER_BREAK = 7, // arg: (None) - EXC_EVENT_UNDEFINED_SYSCALL = 8 // arg: attempted syscall -} - -#[repr(C)] -pub enum UserBreakType { - USERBREAK_PANIC = 0, - USERBREAK_ASSERT = 1, - USERBREAK_USER = 2 -} - -/** -* Type of the query for svcGetThreadInfo -*/ -#[repr(C)] -pub enum ThreadInfoType { - THREADINFO_TYPE_UNKNOWN = 0, - VARIANT2 = 1, // needed because enums must have 2+ variants for C representation -} - -#[repr(C)] -#[derive(Copy)] -pub struct SchedulerInOutEvent { - pub clock_tick: u64 -} - -impl Clone for SchedulerInOutEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct SyscallInOutEvent { - pub clock_tick: u64, - pub syscall: u32, -} - -impl Clone for SyscallInOutEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct OutputStringEvent { - pub string_addr: u32, - pub string_size: u32 -} - -impl Clone for OutputStringEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct MapEvent { - pub mapped_addr: u32, - pub mapped_size: u32, - pub memperm: u32, - pub memstate: u32 -} - -impl Clone for MapEvent { - fn clone(&self) -> Self { *self } -} - -#[repr(C)] -#[derive(Copy)] -pub struct DebugEventInfo { - pub _type: u32, - pub thread_id: u32, - pub unknown: [u32; 2usize], - pub eventUnion: [u64; 3usize], // must use transmutes to access contents - // union { - // ProcessEvent process; - // CreateThreadEvent create_thread; - // ExitThreadEvent exit_thread; - // ExitProcessEvent exit_process; - // ExceptionEvent exception; - // /* TODO: DLL_LOAD */ - // /* TODO: DLL_UNLOAD */ - // SchedulerInOutEvent scheduler; - // SyscallInOutEvent syscall; - // OutputStringEvent output_string; - // MapEvent map; - // }; -} - -impl Clone for DebugEventInfo { - fn clone(&self) -> Self { *self } -} - -// getLocalThreadStorage and getThreadCommandBuffer can't be implemented -// due to asm. Custom build step may be necessary. - -extern "C" { - pub fn svcControlMemory(addr_out: *mut u32, addr0: u32, addr1: u32, size: u32, op: MemOp, perm: MemPerm) -> s32; - pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32) -> s32; - pub fn svcExitProcess() -> (); - pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc, arg: u32, stack_top: *mut u32, thread_priority: s32, processor_id: s32) -> s32; - pub fn svcExitThread() -> (); - pub fn svcSleepThread(ns: s64) -> (); - pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> s32; - pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> s32; - pub fn svcReleaseMutex(handle: Handle) -> s32; - pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32, max_count: s32) -> s32; - pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle, release_count: s32) -> s32; - pub fn svcCreateEvent(event: *mut Handle, reset_type: u8) -> s32; - pub fn svcSignalEvent(handle: Handle) -> s32; - pub fn svcClearEvent(handle: Handle) -> s32; - pub fn svcCreateTimer(timer: *mut Handle, reset_type: u8) -> s32; - pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> s32; - pub fn svcCancelTimer(timer: Handle) -> s32; - pub fn svcClearTimer(timer: Handle) -> s32; - pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; - pub fn svcMapMemoryBlock(memblock: Handle, addr: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; - pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> s32; - pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> s32; - pub fn svcArbitrateAddress(arbiter: Handle, addr: u32, _type: ArbitrationType, value: s32, nanoseconds: s64) -> s32; - pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> s32; - pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle, handles_num: s32, wait_all: u8, nanoseconds: s64) -> s32; - pub fn svcCloseHandle(handle: Handle) -> s32; - pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> s32; - pub fn svcGetSystemTick() -> u64; - pub fn svcGetSystemInfo(out: *mut s64, _type: u32, param: s32) -> s32; - pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: u32) -> s32; - pub fn svcConnectToPort(out: *mut Handle, portName: *const u8) -> s32; - pub fn svcSendSyncRequest(session: Handle) -> s32; - pub fn svcOpenProcess(process: *mut Handle, processId: u32) -> Result; - pub fn svcGetProcessId(out: *mut u32, handle: Handle) -> s32; - pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> s32; - pub fn svcOutputDebugString(string: *const u8, length: i32) -> s32; - pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle, name: *const u8, maxSessions: s32) -> 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 svcGetProcessList(processCount: *mut s32, processIds: *mut u32, processIdMaxCount: s32) -> Result; - pub fn svcReadProcessMemory(buffer: *mut u8, debug: Handle, addr: u32, size: u32) -> Result; - pub fn svcMapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; - pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; - pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo, process: Handle, addr: u32) -> Result; - pub fn svcGetProcessorID() -> s32; -} diff --git a/src/raw/types.rs b/src/raw/types.rs deleted file mode 100644 index 3861e72..0000000 --- a/src/raw/types.rs +++ /dev/null @@ -1,35 +0,0 @@ -#[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/src/raw/vram.rs b/src/raw/vram.rs deleted file mode 100644 index 2de9e2f..0000000 --- a/src/raw/vram.rs +++ /dev/null @@ -1,10 +0,0 @@ -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; -} diff --git a/src/sdmc.rs b/src/sdmc.rs index e023010..4579789 100644 --- a/src/sdmc.rs +++ b/src/sdmc.rs @@ -1,6 +1,6 @@ use core::marker::PhantomData; -use ::raw::sdmc::*; +use libctru::sdmc::*; pub struct Sdmc { pd: PhantomData diff --git a/src/services/apt.rs b/src/services/apt.rs index c37ac23..68da008 100644 --- a/src/services/apt.rs +++ b/src/services/apt.rs @@ -1,6 +1,6 @@ use core::marker::PhantomData; -use ::raw::services::apt; +use libctru::services::apt; pub enum AppStatus { NotInitialized, diff --git a/src/services/gsp.rs b/src/services/gsp.rs index fb5b6fe..8b4b7f3 100644 --- a/src/services/gsp.rs +++ b/src/services/gsp.rs @@ -1,4 +1,4 @@ -use ::raw::services::gsp; +use libctru::services::gsp; use core::convert::From; @@ -36,7 +36,7 @@ impl FramebufferFormat { impl From for FramebufferFormat { #[inline] fn from(g: gsp::GSP_FramebufferFormats) -> FramebufferFormat { - use ::raw::services::gsp::GSP_FramebufferFormats::*; + use libctru::services::gsp::GSP_FramebufferFormats::*; use self::FramebufferFormat::*; match g { GSP_RGBA8_OES => Rgba8, @@ -50,7 +50,7 @@ impl From for FramebufferFormat { impl From for gsp::GSP_FramebufferFormats { #[inline] fn from(g: FramebufferFormat) -> gsp::GSP_FramebufferFormats { - use ::raw::services::gsp::GSP_FramebufferFormats::*; + use libctru::services::gsp::GSP_FramebufferFormats::*; use self::FramebufferFormat::*; match g { Rgba8 => GSP_RGBA8_OES, @@ -63,7 +63,7 @@ impl From for gsp::GSP_FramebufferFormats { } fn to_raw_event(ev: Event) -> gsp::GSP_Event { - use ::raw::services::gsp::GSP_Event::*; + use libctru::services::gsp::GSP_Event::*; use self::Event::*; match ev { diff --git a/src/services/hid.rs b/src/services/hid.rs index c0f1ed7..8f785d0 100644 --- a/src/services/hid.rs +++ b/src/services/hid.rs @@ -1,7 +1,7 @@ use core::convert::Into; use core::marker::PhantomData; -use ::raw::services::hid; +use libctru::services::hid; pub enum PadKey { A, @@ -37,7 +37,7 @@ pub enum PadKey { impl From for u32 { fn from(p: PadKey) -> u32 { - use ::raw::services::hid::PAD_KEY::*; + use libctru::services::hid::PAD_KEY::*; use self::PadKey::*; match p { diff --git a/src/srv.rs b/src/srv.rs index 3999458..5cafed3 100644 --- a/src/srv.rs +++ b/src/srv.rs @@ -1,4 +1,4 @@ -use ::raw::srv::*; +use libctru::srv::*; use core::marker::PhantomData; From c314c0098ec01aa5f806ce4fd31410e74ad686d9 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Mon, 2 May 2016 21:10:45 -0700 Subject: [PATCH 4/6] Added new bindings --- Cargo.toml | 2 +- ctru-sys/Cargo.toml | 4 +- ctru-sys/src/env.rs | 14 + ctru-sys/src/gfx.rs | 41 +- ctru-sys/src/gpu/gpu.rs | 308 +---- ctru-sys/src/gpu/gx.rs | 55 +- ctru-sys/src/gpu/mod.rs | 8 +- ctru-sys/src/gpu/registers.rs | 19 +- ctru-sys/src/gpu/shaderProgram.rs | 89 ++ ctru-sys/src/gpu/shader_program.rs | 42 - ctru-sys/src/gpu/shbin.rs | 193 +-- ctru-sys/src/ipc.rs | 10 + ctru-sys/src/lib.rs | 14 +- ctru-sys/src/linear.rs | 10 - ctru-sys/src/lock.rs | 33 + ctru-sys/src/os.rs | 49 +- ctru-sys/src/services/ac.rs | 9 +- ctru-sys/src/services/am.rs | 49 +- ctru-sys/src/services/apt.rs | 242 ++-- ctru-sys/src/services/cam.rs | 410 ++++++ ctru-sys/src/services/cfgnor.rs | 12 +- ctru-sys/src/services/cfgu.rs | 39 +- ctru-sys/src/services/dsp.rs | 48 + ctru-sys/src/services/fs.rs | 536 ++++++++ ctru-sys/src/services/gsp.rs | 83 -- ctru-sys/src/services/gspgpu.rs | 120 ++ ctru-sys/src/services/gsplcd.rs | 17 + ctru-sys/src/services/hb.rs | 6 +- ctru-sys/src/services/hid.rs | 101 +- ctru-sys/src/services/httpc.rs | 79 ++ ctru-sys/src/services/ir.rs | 17 +- ctru-sys/src/services/irrst.rs | 16 +- ctru-sys/src/services/mic.rs | 53 +- ctru-sys/src/services/mod.rs | 16 +- ctru-sys/src/services/mvd.rs | 67 + ctru-sys/src/services/news.rs | 11 + ctru-sys/src/services/ns.rs | 4 +- ctru-sys/src/services/pm.rs | 24 +- ctru-sys/src/services/ps.rs | 46 + ctru-sys/src/services/ptm.rs | 12 - ctru-sys/src/services/ptmsysm.rs | 7 + ctru-sys/src/services/ptmu.rs | 11 + ctru-sys/src/services/qtm.rs | 44 + ctru-sys/src/services/soc.rs | 6 +- ctru-sys/src/services/srvpm.rs | 12 + ctru-sys/src/services/y2r.rs | 185 +++ ctru-sys/src/svc.rs | 570 +++++--- ctru-sys/src/synchronization.rs | 19 + ctru-sys/src/thread.rs | 19 + rawunused.rs | 1987 ---------------------------- src/lib.rs | 3 - src/services/apt.rs | 44 +- src/services/gsp.rs | 34 +- src/services/hid.rs | 2 +- 54 files changed, 2819 insertions(+), 3032 deletions(-) create mode 100644 ctru-sys/src/env.rs create mode 100644 ctru-sys/src/gpu/shaderProgram.rs delete mode 100644 ctru-sys/src/gpu/shader_program.rs create mode 100644 ctru-sys/src/ipc.rs delete mode 100644 ctru-sys/src/linear.rs create mode 100644 ctru-sys/src/lock.rs create mode 100644 ctru-sys/src/services/cam.rs create mode 100644 ctru-sys/src/services/dsp.rs create mode 100644 ctru-sys/src/services/fs.rs delete mode 100644 ctru-sys/src/services/gsp.rs create mode 100644 ctru-sys/src/services/gspgpu.rs create mode 100644 ctru-sys/src/services/gsplcd.rs create mode 100644 ctru-sys/src/services/httpc.rs create mode 100644 ctru-sys/src/services/mvd.rs create mode 100644 ctru-sys/src/services/news.rs create mode 100644 ctru-sys/src/services/ps.rs delete mode 100644 ctru-sys/src/services/ptm.rs create mode 100644 ctru-sys/src/services/ptmsysm.rs create mode 100644 ctru-sys/src/services/ptmu.rs create mode 100644 ctru-sys/src/services/qtm.rs create mode 100644 ctru-sys/src/services/srvpm.rs create mode 100644 ctru-sys/src/services/y2r.rs create mode 100644 ctru-sys/src/synchronization.rs create mode 100644 ctru-sys/src/thread.rs delete mode 100644 rawunused.rs diff --git a/Cargo.toml b/Cargo.toml index 8ed07f3..0316b5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ctru-rs" version = "0.2.0" description = "A safe wrapper around smealum's ctrulib." -authors = ["Ronald Kinard ", "FenrirWolf "] +authors = ["Ronald Kinard "] links = "ctru" build = "build.rs" license = "https://en.wikipedia.org/wiki/Zlib_License" diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml index 5597f9b..578ee82 100644 --- a/ctru-sys/Cargo.toml +++ b/ctru-sys/Cargo.toml @@ -1,5 +1,5 @@ [package] name = "ctru-sys" -version = "0.1.0" -authors = ["Ronald Kinard ", "FenrirWolf "] +version = "0.2.0" +authors = ["Ronald Kinard "] license = "https://en.wikipedia.org/wiki/Zlib_License" 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 index ed40baf..1af87ee 100644 --- a/ctru-sys/src/gfx.rs +++ b/ctru-sys/src/gfx.rs @@ -1,13 +1,13 @@ -use services::gsp::*; +use services::gspgpu::*; #[inline] -pub fn RGB565(r: u32, g: u32, b: u32) { - (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11)); +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) { - (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11); +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)] @@ -22,22 +22,27 @@ pub enum gfx3dSide_t { 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 static mut gxCmdBuf: *mut u32; - pub fn gfxInitDefault() -> (); - pub fn gfxInit(topFormat: GSP_FramebufferFormats, bottomFormat: GSP_FramebufferFormats, vrambuffers: u8) -> (); - pub fn gfxExit() -> (); - pub fn gfxSet3D(enable: u8) -> (); - pub fn gfxSetScreenFormat(screen: gfxScreen_t, format: GSP_FramebufferFormats) -> (); - pub fn gfxGetScreenFormat(screen: gfxScreen_t) -> GSP_FramebufferFormats; - pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8) -> (); - pub fn gfxFlushBuffers() -> (); - pub fn gfxSwapBuffers() -> (); - pub fn gfxSwapBuffersGpu() -> (); - pub fn gfxGetFramebuffer(screen: gfxScreen_t, side: gfx3dSide_t, width: *mut u16, height: *mut u16) -> *mut u8; + 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 index 24f2f90..30e7a03 100644 --- a/ctru-sys/src/gpu/gpu.rs +++ b/ctru-sys/src/gpu/gpu.rs @@ -1,294 +1,26 @@ -use ctru::Handle; +/* automatically generated by rust-bindgen */ #[inline] -pub fn GPUCMD_HEADER(incremental: i32, mask: i32, reg: i32) { - (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)); +pub fn GPUCMD_HEADER(incremental: u32, mask: u32, reg: u32) -> u32{ + (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)) } -#[inline] -pub fn GPU_TEXTURE_MAG_FILTER(v: i32) { - (((v)&0x1)<<1); //takes a GPU_TEXTURE_FILTER_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_MIN_FILTER(v: i32) { - (((v)&0x1)<<2); //takes a GPU_TEXTURE_FILTER_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_WRAP_S(v: i32) { - (((v)&0x3)<<8); //takes a GPU_TEXTURE_WRAP_PARAM -} - -#[inline] -pub fn GPU_TEXTURE_WRAP_T(v: i32) { - (((v)&0x3)<<12); //takes a GPU_TEXTURE_WRAP_PARAM -} - -#[repr(C)] -pub enum GPU_TEXTURE_FILTER_PARAM { - GPU_NEAREST = 0x0, - GPU_LINEAR = 0x1 -} - -#[repr(C)] -pub enum GPU_TEXTURE_WRAP_PARAM { - GPU_CLAMP_TO_EDGE = 0x0, - GPU_REPEAT = 0x1 -} - -#[repr(C)] -pub enum GPU_TEXUNIT { - GPU_TEXUNIT0 = 0x1, - GPU_TEXUNIT1 = 0x2, - GPU_TEXUNIT2 = 0x4 -} - -#[repr(C)] -pub enum GPU_TEXCOLOR { - GPU_RGBA8=0x0, - GPU_RGB8=0x1, - GPU_RGBA5551=0x2, - GPU_RGB565=0x3, - GPU_RGBA4=0x4, - GPU_LA8=0x5, - GPU_HILO8=0x6, - GPU_L8=0x7, - GPU_A8=0x8, - GPU_LA4=0x9, - GPU_L4=0xA, - GPU_ETC1=0xB, - GPU_ETC1A4=0xC -} - -#[repr(C)] -pub enum GPU_TESTFUNC { - GPU_NEVER = 0, - GPU_ALWAYS = 1, - GPU_EQUAL = 2, - GPU_NOTEQUAL = 3, - GPU_LESS = 4, - GPU_LEQUAL = 5, - GPU_GREATER = 6, - GPU_GEQUAL = 7 -} - -#[repr(C)] -pub enum GPU_SCISSORMODE { - GPU_SCISSOR_DISABLE = 0, // disable scissor test - GPU_SCISSOR_INVERT = 1, // exclude pixels inside the scissor box - // 2 is the same as 0 - GPU_SCISSOR_NORMAL = 3, // exclude pixels outside of the scissor box -} - -#[repr(C)] -pub enum GPU_STENCILOP { - GPU_KEEP = 0, // keep destination value - GPU_AND_NOT = 1, // destination & ~source - GPU_XOR = 5, // destination ^ source - // 2 is the same as 1. Other values are too weird to even be usable. -} - -#[repr(C)] -pub enum GPU_WRITEMASK { - GPU_WRITE_RED = 0x01, - GPU_WRITE_GREEN = 0x02, - GPU_WRITE_BLUE = 0x04, - GPU_WRITE_ALPHA = 0x08, - GPU_WRITE_DEPTH = 0x10, - - GPU_WRITE_COLOR = 0x0F, - GPU_WRITE_ALL = 0x1F -} - -#[repr(C)] -pub enum GPU_BLENDEQUATION { - GPU_BLEND_ADD = 0, - GPU_BLEND_SUBTRACT = 1, - GPU_BLEND_REVERSE_SUBTRACT = 2, - GPU_BLEND_MIN = 3, - GPU_BLEND_MAX = 4 -} - -#[repr(C)] -pub enum GPU_BLENDFACTOR { - GPU_ZERO = 0, - GPU_ONE = 1, - GPU_SRC_COLOR = 2, - GPU_ONE_MINUS_SRC_COLOR = 3, - GPU_DST_COLOR = 4, - GPU_ONE_MINUS_DST_COLOR = 5, - GPU_SRC_ALPHA = 6, - GPU_ONE_MINUS_SRC_ALPHA = 7, - GPU_DST_ALPHA = 8, - GPU_ONE_MINUS_DST_ALPHA = 9, - GPU_CONSTANT_COLOR = 10, - GPU_ONE_MINUS_CONSTANT_COLOR = 11, - GPU_CONSTANT_ALPHA = 12, - GPU_ONE_MINUS_CONSTANT_ALPHA = 13, - GPU_SRC_ALPHA_SATURATE = 14 -} - -#[repr(C)] -pub enum GPU_LOGICOP { - GPU_LOGICOP_CLEAR = 0, - GPU_LOGICOP_AND = 1, - GPU_LOGICOP_AND_REVERSE = 2, - GPU_LOGICOP_COPY = 3, - GPU_LOGICOP_SET = 4, - GPU_LOGICOP_COPY_INVERTED = 5, - GPU_LOGICOP_NOOP = 6, - GPU_LOGICOP_INVERT = 7, - GPU_LOGICOP_NAND = 8, - GPU_LOGICOP_OR = 9, - GPU_LOGICOP_NOR = 10, - GPU_LOGICOP_XOR = 11, - GPU_LOGICOP_EQUIV = 12, - GPU_LOGICOP_AND_INVERTED = 13, - GPU_LOGICOP_OR_REVERSE = 14, - GPU_LOGICOP_OR_INVERTED = 15 -} - -#[repr(C)] -pub enum GPU_FORMATS { - GPU_BYTE = 0, - GPU_UNSIGNED_BYTE = 1, - GPU_SHORT = 2, - GPU_FLOAT = 3 -} - -//defines for CW ? -#[repr(C)] -pub enum GPU_CULLMODE { - GPU_CULL_NONE = 0, - GPU_CULL_FRONT_CCW = 1, - GPU_CULL_BACK_CCW = 2 -} - -#[inline] -pub fn GU_ATTRIBFMT(i: i32, n: i32, f: i32) { - (((((n)-1)<<2)|((f)&3))<<((i)*4)); -} - -/** -* Texture combiners sources -*/ -#[repr(C)] -pub enum GPU_TEVSRC{ - GPU_PRIMARY_COLOR = 0x00, - GPU_TEXTURE0 = 0x03, - GPU_TEXTURE1 = 0x04, - GPU_TEXTURE2 = 0x05, - GPU_TEXTURE3 = 0x06, - GPU_CONSTANT = 0x0E, - GPU_PREVIOUS = 0x0F, -} - -/** -* Texture RGB combiners operands -*/ -#[repr(C)] -pub enum GPU_TEVOP_RGB{ - GPU_TEVOP_RGB_SRC_COLOR = 0x00, - GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR = 0x01, - GPU_TEVOP_RGB_SRC_ALPHA = 0x02, - GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA = 0x03, - GPU_TEVOP_RGB_SRC0_RGB = 0x04, - GPU_TEVOP_RGB_0x05 = 0x05, - GPU_TEVOP_RGB_0x06 = 0x06, - GPU_TEVOP_RGB_0x07 = 0x07, - GPU_TEVOP_RGB_SRC1_RGB = 0x08, - GPU_TEVOP_RGB_0x09 = 0x09, - GPU_TEVOP_RGB_0x0A = 0x0A, - GPU_TEVOP_RGB_0x0B = 0x0B, - GPU_TEVOP_RGB_SRC2_RGB = 0x0C, - GPU_TEVOP_RGB_0x0D = 0x0D, - GPU_TEVOP_RGB_0x0E = 0x0E, - GPU_TEVOP_RGB_0x0F = 0x0F, -}; - -/** -* Texture ALPHA combiners operands -*/ -#[repr(C)] -pub enum GPU_TEVOP_A { - GPU_TEVOP_A_SRC_ALPHA = 0x00, - GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA = 0x01, - GPU_TEVOP_A_SRC0_RGB = 0x02, - GPU_TEVOP_A_SRC1_RGB = 0x04, - GPU_TEVOP_A_SRC2_RGB = 0x06, -} - -/** -* Texture combiner functions -*/ -pub enum GPU_COMBINEFUNC { - GPU_REPLACE = 0x00, - GPU_MODULATE = 0x01, - GPU_ADD = 0x02, - GPU_ADD_SIGNED = 0x03, - GPU_INTERPOLATE = 0x04, - GPU_SUBTRACT = 0x05, - GPU_DOT3_RGB = 0x06 //RGB only -} - -#[inline] -pub fn GPU_TEVSOURCES(a, b, c) { - (((a))|((b)<<4)|((c)<<8)); -} - -#[inline] -pub fn GPU_TEVOPERANDS(a, b, c) { - (((a))|((b)<<4)|((c)<<8)); -} - -#[repr(C)] -pub enum GPU_Primitive_t { - GPU_TRIANGLES = 0x0000, - GPU_TRIANGLE_STRIP = 0x0100, - GPU_TRIANGLE_FAN = 0x0200, - GPU_UNKPRIM = 0x0300 // ? -} - -#[repr(C)] -pub enum GPU_SHADER_TYPE { - GPU_VERTEX_SHADER=0x0, - GPU_GEOMETRY_SHADER=0x1 -} - - extern "C" { - pub fn GPU_Init(gsphandle: *mut Handle) -> (); - pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: 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(gxbuf: *mut u32) -> (); - pub fn GPUCMD_FlushAndRun(gxbuf: *mut u32) -> (); - pub fn GPUCMD_Add(header: u32, param: *mut u32, paramlength: u32) -> (); - pub fn GPUCMD_Finalize() -> (); - pub fn GPU_SetFloatUniform(_type: GPU_SHADER_TYPE, startreg: u32, data: *mut u32, numreg: u32) -> (); - pub fn GPU_SetViewport(depthBuffer: *mut u32, colorBuffer: *mut u32, x: u32, y: u32, w: u32, h: u32) -> (); - pub fn GPU_SetScissorTest(mode: GPU_SCISSORMODE, x: u32, y: u32, w: u32, h: u32) -> (); - pub fn GPU_DepthMap(zScale: f32, zOffset: f32) -> (); - pub fn GPU_SetAlphaTest(enable: u8, function: GPU_TESTFUNC, _ref: u8) -> (); - pub fn GPU_SetDepthTestAndWriteMask(enable: u8, function: GPU_TESTFUNC, writemask: GPU_WRITEMASK) -> (); - pub fn GPU_SetStencilTest(enable: u8, function: GPU_TESTFUNC, _ref: _u8, mask: _u8, replace: _u8) -> (); - pub fn GPU_SetStencilOp(sfail: GPU_STENCILOP, dfail: GPU_STENCILOP, pass: GPU_STENCILOP) -> (); - pub fn GPU_SetFaceCulling(mode: GPU_CULLMODE) -> (); - pub fn GPU_SetAlphaBlending(colorEquation: GPU_BLENDEQUATION, alphaEquation: GPU_BLENDEQUATION, colorSrc: GPU_BLENDFACTOR, colorDst: GPU_BLENDFACTOR, alphaSrc: GPU_BLENDFACTOR, alphaDst: GPU_BLENDFACTOR) -> (); - pub fn GPU_SetColorLogicOp(op: GPU_LOGICOP) -> (); - pub fn GPU_SetBlendingColor(r: u8, g: u8, b: u8, a: u8) -> (); - pub fn GPU_SetAttributeBuffers(totalAttributes: u8, baseAddress: *mut u32, attributeFormats: u64, attributeMask: u16, attributePermutation: u64, numBuffers: u8, bufferOffsets: *mut u32, bufferPermutations: *mut u64, bufferNumAttributes: *mut u8) -> (); - pub fn GPU_SetTextureEnable(units: GPU_TEXUNIT) -> (); - pub fn GPU_SetTexture(unit: GPU_TEXUNIT, data: *mut u32, width: u16, height: u16, param: u32, colorType: GPU_TEXCOLOR) -> (); - pub fn GPU_SetTexEnv(id: u8, rgbSources: u16, alphaSources: u16, rgbOperands: u16, alphaOperands: u16, rgbCombine: GPU_COMBINEFUNC, alphaCombine: GPU_COMBINEFUNC, constantColor: u32) -> (); - pub fn GPU_DrawArray(primitive: GPU_Primitive_t, n: u32) -> (); - pub fn GPU_DrawElements(primitive: GPU_Primitive_t, indexArray: *mut u32, n: u32) -> (); - pub fn GPU_FinishDrawing() -> (); - pub fn GPU_SetShaderOutmap(outmapData: *mut u32) -> (); - pub fn GPU_SendShaderCode(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); - pub fn GPU_SendOperandDescriptors(_type: GPU_SHADER_TYPE, data: *mut u32, offset: u16, length: u16) -> (); + 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 index d26c9ab..69eeddf 100644 --- a/ctru-sys/src/gpu/gx.rs +++ b/ctru-sys/src/gpu/gx.rs @@ -1,3 +1,5 @@ +use ::Result; + #[inline] pub fn GX_BUFFER_DIM(w: u32, h: u32) { (((h)<<16)|((w)&0xFFFF)); @@ -10,7 +12,7 @@ pub enum GX_TRANSFER_FORMAT GX_TRANSFER_FMT_RGB8 = 1, GX_TRANSFER_FMT_RGB565 = 2, GX_TRANSFER_FMT_RGB5A1 = 3, - GX_TRANSFER_FMT_RGBA4 = 4 + GX_TRANSFER_FMT_RGBA4 = 4, } #[repr(C)] @@ -18,7 +20,7 @@ pub enum GX_TRANSFER_SCALE { GX_TRANSFER_SCALE_NO = 0, GX_TRANSFER_SCALE_X = 1, - GX_TRANSFER_SCALE_Y = 2 + GX_TRANSFER_SCALE_Y = 2, } #[repr(C)] @@ -31,43 +33,62 @@ pub enum GX_FILL_CONTROL { } #[inline] -pub fn GX_TRANSFER_FLIP_VERT(x) { +pub fn GX_TRANSFER_FLIP_VERT(x: i32) { ((x)<<0); } #[inline] -pub fn GX_TRANSFER_OUT_TILED(x) { +pub fn GX_TRANSFER_OUT_TILED(x: i32) { ((x)<<1); } #[inline] -pub fn GX_TRANSFER_RAW_COPY(x) { - ((x)<<3) +pub fn GX_TRANSFER_RAW_COPY(x: i32) { + ((x)<<3); } #[inline] -pub fn GX_TRANSFER_IN_FORMAT(x) { +pub fn GX_TRANSFER_IN_FORMAT(x: i32) { ((x)<<8); } #[inline] -pub fn GX_TRANSFER_OUT_FORMAT(x) { - ((x)<<12) +pub fn GX_TRANSFER_OUT_FORMAT(x: i32) { + ((x)<<12); } #[inline] -pub fn GX_TRANSFER_SCALING(x) { +pub fn GX_TRANSFER_SCALING(x: i32) { ((x)<<24); } -use ctru::Result; +#[inline] +pub fn GX_CMDLIST_BIT0() { + (1u32<<(0)); +} +#[inline] +pub fn GX_CMNDLIST_FLUSH() { + (1u32<<(1)); +} extern "C" { - pub fn GX_RequestDma(gxbuf: *mut u32, src: *mut u32, dst: *mut u32, length: u32) -> Result; - pub fn GX_SetCommandList_Last(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, flags: u8) -> Result; - pub fn GX_SetMemoryFill(gxbuf: *mut u32, buf0a: *mut u32, buf0v: u32, buf0e: *mut u32, width0: u16, buf1a: *mut u32, buf1v: u32, buf1e: *mut u32, width1: u16) -> Result; - pub fn GX_SetDisplayTransfer(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, flags: u32) -> Result; - pub fn GX_SetTextureCopy(gxbuf: *mut u32, inadr: *mut u32, indim: u32, outadr: *mut u32, outdim: u32, size: u32, flags: u32) -> Result; - pub fn GX_SetCommandList_First(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, buf1a: *mut u32, buf1s: u32, buf2a: *mut u32, buf2s: u32) -> Result; + 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 index 8d71046..2b9cb99 100644 --- a/ctru-sys/src/gpu/mod.rs +++ b/ctru-sys/src/gpu/mod.rs @@ -1,11 +1,5 @@ pub mod gpu; pub mod gx; pub mod registers; -pub mod shader_program; +pub mod shaderProgram; pub mod shbin; - -use self::gpu::*; -use self::gx::*; -use self::registers::*; -use self::shader_program::*; -use self::shbin::*; diff --git a/ctru-sys/src/gpu/registers.rs b/ctru-sys/src/gpu/registers.rs index 739a50a..98b2a3b 100644 --- a/ctru-sys/src/gpu/registers.rs +++ b/ctru-sys/src/gpu/registers.rs @@ -1,3 +1,4 @@ +//Miscellaneous registers (0x000-0x03F) pub const GPUREG_0000: i32 = 0x0000; pub const GPUREG_0001: i32 = 0x0001; pub const GPUREG_0002: i32 = 0x0002; @@ -62,6 +63,8 @@ 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; @@ -126,6 +129,8 @@ 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; @@ -254,6 +259,8 @@ 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; @@ -318,6 +325,8 @@ 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; @@ -510,6 +519,8 @@ 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; @@ -638,6 +649,8 @@ 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; @@ -665,6 +678,8 @@ 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; @@ -692,6 +707,8 @@ 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; @@ -723,4 +740,4 @@ 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 +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/shader_program.rs b/ctru-sys/src/gpu/shader_program.rs deleted file mode 100644 index bf373e1..0000000 --- a/ctru-sys/src/gpu/shader_program.rs +++ /dev/null @@ -1,42 +0,0 @@ -use super::shbin::*; - -#[repr(C)] -#[derive(Copy)] -pub struct float24Uniform_s { - id: u32, - data: [u32; 3usize] -} - -#[repr(C)] -#[derive(Copy)] -pub struct shaderInstance_s { - pub dvle: *mut DVLE_s; - pub boolUniforms: u16, - pub intUniforms: [u32; 4usize], - pub float24Uniforms: *mut float24Uniform_s, - pub numFloat24Uniforms: u8, -} - -#[repr(C)] -#[derive(Copy)] -pub struct shaderProgram_s { - pub vertexShader: *mut shaderInstance_s, - pub geometryShader: *mut shaderInstance_s, - pub geometryShaderInputStride: u8, -} - -use ctru::Result; - - -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: ::libc::c_int, value: u8) -> Result; - pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, id: ::libc::c_int, value: *mut u8) -> Result; - pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s, name: *const ::libc::c_char) -> Result; - 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 shaderProgramUse(sp: *mut shaderProgram_s) -> Result; -} diff --git a/ctru-sys/src/gpu/shbin.rs b/ctru-sys/src/gpu/shbin.rs index db400d9..1c5a453 100644 --- a/ctru-sys/src/gpu/shbin.rs +++ b/ctru-sys/src/gpu/shbin.rs @@ -1,105 +1,136 @@ -typedef enum{ - VERTEX_SHDR=GPU_VERTEX_SHADER, - GEOMETRY_SHDR=GPU_GEOMETRY_SHADER -}DVLE_type; +use ::types::*; -#[repr(C)] -pub enum DVLE_type { - VERTEX_SHDR=GPU_VERTEX_SHADER, - GEOMETRY_SHDR=GPU_GEOMETRY_SHADER, +#[derive(Clone, Copy)] +#[repr(u32)] +pub enum Enum_Unnamed1 { + VERTEX_SHDR = 0, + GEOMETRY_SHDR = 1, } - -typedef enum{ - DVLE_CONST_BOOL=0x0, - DVLE_CONST_u8=0x1, - DVLE_CONST_FLOAT24=0x2, -}DVLE_constantType; - -#[repr(C)] -pub enum DVLE_constantType { - DVLE_CONST_BOOL = 0x0, - DVLE_CONST_u8 = 0x1, - DVLE_CONST_FLOAT24 = 0x2, +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, } - -#[repr(C)] -pub enum DVLE_outputAttribute_t { - RESULT_POSITION = 0x0, - RESULT_NORMALQUAT = 0x1, - RESULT_COLOR = 0x2, - RESULT_TEXCOORD0 = 0x3, - RESULT_TEXCOORD0W = 0x4, - RESULT_TEXCOORD1 = 0x5, - RESULT_TEXCOORD2 = 0x6, - RESULT_VIEW = 0x8 +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 DVLP_s { - codeSize: u32, - codeData: *mut u32, - opdescSize: u32, - opcdescData: *mut u32 +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 DVLE_constEntry_s { - type: u16, - id: u16, - data: [u32; 4usize] +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 DVLE_outEntry_s { - type: u16, - regID: u16, - mask: u8, - unk: [u8; 3usize] +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 DVLE_uniformEntry_s{ - symbolOffset: u32, - startReg: u16, - endReg: u16, +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 DVLE_s { - DVLE_type type: DVLE_type, - DVLP_s* dvlp: *mut DVLP_s, - mainOffset: u32, - endmainOffset: u32, - constTableSize: u32, - constTableData: *mut DVLE_constEntry_s, - outTableSize: u32, - outTableData: *mut DVLE_outEntry_s, - uniformTableSize: u32, - uniformTableData: *mut DVLE_uniformEntry_s, - symbolTableData: *mut u8, - outmapMask: u8, - outmapData: [u32; 8usize] +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 DVLB_s { - numDVLE: u32, - DVLP: DVLP_s, - DVLE: *mut DVLE_s +pub struct Struct_Unnamed9 { + pub numDVLE: u32, + pub DVLP: DVLP_s, + pub DVLE: *mut DVLE_s, } - -use ctru::raw::types::*; - - +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) -> (); + 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 index 7f7c1c8..4b212a5 100644 --- a/ctru-sys/src/lib.rs +++ b/ctru-sys/src/lib.rs @@ -1,15 +1,25 @@ +/* + * 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 linear; +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; @@ -22,7 +32,7 @@ pub type Handle = u32; #[repr(u8)] pub enum c_void { __variant1, - __variant2 + __variant2, } pub type ThreadFunc = Option ()>; diff --git a/ctru-sys/src/linear.rs b/ctru-sys/src/linear.rs deleted file mode 100644 index e663439..0000000 --- a/ctru-sys/src/linear.rs +++ /dev/null @@ -1,10 +0,0 @@ -use c_void; - - -extern "C" { - pub fn linearAlloc(size: i32) -> *mut c_void; - pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void; - pub fn linearRealloc(mem: *mut c_void, size: i32) -> *mut c_void; - pub fn linearFree(mem: *mut c_void) -> (); - pub fn linearSpaceFree() -> u32; -} 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 @@ +// 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 index eaff6e2..7dbe3be 100644 --- a/ctru-sys/src/os.rs +++ b/ctru-sys/src/os.rs @@ -1,14 +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: u32) -> u32; - pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32; + 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 osGetFirmVersion() -> u32; - pub fn osGetKernelVersion() -> u32; + 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/services/ac.rs b/ctru-sys/src/services/ac.rs index 0b07ec6..f23369f 100644 --- a/ctru-sys/src/services/ac.rs +++ b/ctru-sys/src/services/ac.rs @@ -1,9 +1,8 @@ -use ::{Handle, Result}; - +use ::Result; extern "C" { pub fn acInit() -> Result; - pub fn acExit() -> Result; - pub fn ACU_GetWifiStatus(servhandle: *mut Handle, out: *mut u32) -> Result; - pub fn ACU_WaitInternetConnection() -> Result; + 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 index 340261f..971829e 100644 --- a/ctru-sys/src/services/am.rs +++ b/ctru-sys/src/services/am.rs @@ -1,30 +1,49 @@ -use ::c_void; -use ::{Result, Handle}; +use ::{Handle, Result}; #[repr(C)] -#[derive(Clone, Copy)] -pub struct TitleList { - titleID: u64, - size: u64, - titleVersion: u16, - unknown2: [u8; 6usize] +#[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() -> 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_GetTitleIdList(mediatype: u8, count: u32, titleIDs: *mut u64) + -> Result; pub fn AM_GetDeviceId(deviceID: *mut u32) -> Result; - pub fn AM_ListTitles(mediatype: u8, titleCount: u32, titleIdList: *mut u64, titleList: *mut TitleList) -> Result; - pub fn AM_StartCiaInstall(mediatype: u8, ciaHandle: *mut Handle) -> Result; + pub fn AM_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_FinishCiaInstall(mediatype: u8, ciaHandle: *mut Handle) + -> Result; pub fn AM_DeleteTitle(mediatype: u8, titleID: u64) -> Result; pub fn AM_DeleteAppTitle(mediatype: u8, titleID: u64) -> Result; - pub fn AM_InstallFIRM(titleID: u64) -> Result; - pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64, productCode: *mut c_void) -> Result; + 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 index 4eba65f..a6ee0c0 100644 --- a/ctru-sys/src/services/apt.rs +++ b/ctru-sys/src/services/apt.rs @@ -1,125 +1,169 @@ -use ::{Handle, Result}; +use ::{Result, Handle}; use ::c_void; -pub const RUNFLAG_APTWORKAROUND: u32 = 1; -pub const RUNFLAG_APTREINIT: u32 = 2; - #[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_APPLICATION = 0x300, // Application - APPID_SOFTWARE_KEYBOARD = 0x401, // Software Keyboard - APPID_APPLETED = 0x402, // appletEd - APPID_PNOTE_AP = 0x404, // PNOTE_AP - APPID_SNOTE_AP = 0x405, // SNOTE_AP - APPID_ERROR = 0x406, // error - APPID_MINT = 0x407, // mint - APPID_EXTRAPAD = 0x408, // extrapad - APPID_MEMOLIB = 0x409, // memolib -} // cf http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs + 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)] -pub enum APP_STATUS { - APP_NOTINITIALIZED, - APP_RUNNING, - APP_SUSPENDED, - APP_EXITING, - APP_SUSPENDING, - APP_SLEEPMODE, - APP_PREPARE_SLEEPMODE, - APP_APPLETSTARTED, - APP_APPLETCLOSED +#[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)] -pub enum APTSIGNAL { - APTSIGNAL_HOMEBUTTON = 1, - // 2: sleep-mode related? - APTSIGNAL_PREPARESLEEP = 3, - // 4: triggered when ptm:s GetShellStatus() returns 5. - APTSIGNAL_ENTERSLEEP = 5, - APTSIGNAL_WAKEUP = 6, - APTSIGNAL_ENABLE = 7, - APTSIGNAL_POWERBUTTON = 8, - APTSIGNAL_UTILITY = 9, - APTSIGNAL_SLEEPSYSTEM = 10, - APTSIGNAL_ERROR = 11 +#[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)] -pub enum APTHOOK { - APTHOOK_ONSUSPEND = 0, - APTHOOK_ONRESTORE, - APTHOOK_ONSLEEP, - APTHOOK_ONWAKEUP, - APTHOOK_ONEXIT, - - APTHOOK_COUNT, +#[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, } -type aptHookFn = Option ()>; +pub type aptHookFn = Option; #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy)] pub struct aptHookCookie { - next: *mut aptHookCookie, - callback: aptHookFn, - param: *mut c_void, + 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: APP_STATUS) -> (); - pub fn aptGetStatus() -> APP_STATUS; + 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 aptSetStatusPower(status: u32); + pub fn aptReturnToMenu(); + pub fn aptWaitStatusEvent(); + pub fn aptSignalReadyForSleep(); pub fn aptGetMenuAppID() -> NS_APPID; pub fn aptMainLoop() -> u8; - pub fn APT_GetLockHandle(handle: *mut Handle, flags: u16, lockHandle: *mut Handle) -> Result; - pub fn APT_Initialize(handle: *mut Handle, appId: NS_APPID, eventHandle1: *mut Handle, eventHandle2: *mut Handle) -> Result; - pub fn APT_HardwareResetAsync(handle: *mut Handle) -> Result; - pub fn APT_Enable(handle: *mut Handle, a: u32) -> Result; - pub fn APT_GetAppletManInfo(handle: *mut Handle, inval: u8, outval8: *mut u8, outval32: *mut u32, menu_appid: *mut NS_APPID, active_appid: *mut NS_APPID) -> Result; - pub fn APT_PrepareToJumpToHomeMenu(handle: *mut Handle) -> Result; - pub fn APT_JumpToHomeMenu(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; - pub fn APT_IsRegistered(handle: *mut Handle, appID: NS_APPID, out: *mut u8) -> Result; - pub fn APT_InquireNotification(handle: *mut Handle, appID: u32, signalType: *mut u8) -> Result; - pub fn APT_NotifyToWait(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_AppletUtility(handle: *mut Handle, out: *mut u32, a: u32, size1: u32, buf1: *mut u8, size2: u32, buf2: *mut u8) -> Result; - pub fn APT_GlanceParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; - pub fn APT_ReceiveParameter(handle: *mut Handle, appID: NS_APPID, bufferSize: u32, buffer: *mut u32, actualSize: *mut u32, signalType: *mut u8) -> Result; - pub fn APT_SendParameter(handle: *mut Handle, src_appID: NS_APPID, dst_appID: NS_APPID, bufferSize: u32, buffer: *mut u32, paramhandle: Handle, signalType: u8) -> Result; - pub fn APT_SendCaptureBufferInfo(handle: *mut Handle, bufferSize: u32, buffer: *mut u32) -> Result; - pub fn APT_ReplySleepQuery(handle: *mut Handle, appID: NS_APPID, a: u32) -> Result; - pub fn APT_ReplySleepNotificationComplete(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_PrepareToCloseApplication(handle: *mut Handle, a: u8) -> Result; - pub fn APT_CloseApplication(handle: *mut Handle, a: u32, b: u32, c: u32) -> Result; - pub fn APT_SetAppCpuTimeLimit(handle: *mut Handle, percent: u32) -> Result; - pub fn APT_GetAppCpuTimeLimit(handle: *mut Handle, percent: *mut u32) -> Result; - pub fn APT_CheckNew3DS_Application(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_CheckNew3DS_System(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_CheckNew3DS(handle: *mut Handle, out: *mut u8) -> Result; - pub fn APT_PrepareToDoAppJump(handle: *mut Handle, flags: u8, programID: u64, mediatype: u8) -> Result; - pub fn APT_DoAppJump(handle: *mut Handle, NSbuf0Size: u32, NSbuf1Size: u32, NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result; - pub fn APT_PrepareToStartLibraryApplet(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_StartLibraryApplet(handle: *mut Handle, appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; - pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, parambuf: *mut u32, parambufsize: u32) -> Result; - pub fn APT_PrepareToStartSystemApplet(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_StartSystemApplet(handle: *mut Handle, appID: NS_APPID, bufSize: u32, applHandle: Handle, buf: *mut u8) -> Result; + 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 index 4883642..c2c1e44 100644 --- a/ctru-sys/src/services/cfgnor.rs +++ b/ctru-sys/src/services/cfgnor.rs @@ -1,10 +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; - pub fn CFGNOR_DumpFlash(buf: *mut u32, size: u32) -> Result; - pub fn CFGNOR_WriteFlash(buf: *mut u32, size: u32) -> 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 index 4c51db4..f1663f0 100644 --- a/ctru-sys/src/services/cfgu.rs +++ b/ctru-sys/src/services/cfgu.rs @@ -1,15 +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 initCfgu() -> Result; - pub fn exitCfgu() -> Result; + 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_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_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/gsp.rs b/ctru-sys/src/services/gsp.rs deleted file mode 100644 index 9f8cf20..0000000 --- a/ctru-sys/src/services/gsp.rs +++ /dev/null @@ -1,83 +0,0 @@ -use super::super::types::*; - -#[inline] -pub fn GSP_REBASE_REG(r: u32) { - ((r)-0x1EB00000); -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_FramebufferInfo { - active_framebuf: u32, //"0=first, 1=second" - framebuf0_vaddr: *mut u32, //"Framebuffer virtual address, for the main screen this is the 3D left framebuffer" - framebuf1_vaddr: *mut u32,//"For the main screen: 3D right framebuffer address" - framebuf_widthbytesize: u32, //"Value for 0x1EF00X90, controls framebuffer width" - format: u32,//"Framebuffer format, this u16 is written to the low u16 for LCD register 0x1EF00X70." - framebuf_dispselect: u32, //"Value for 0x1EF00X78, controls which framebuffer is displayed" - unk: u32 //"?" -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub enum GSP_FramebufferFormats { - GSP_RGBA8_OES=0, //pixel_size = 4-bytes - GSP_BGR8_OES=1, //pixel_size = 3-bytes - GSP_RGB565_OES=2, //pixel_size = 2-bytes - GSP_RGB5_A1_OES=3, //pixel_size = 2-bytes - GSP_RGBA4_OES=4 //pixel_size = 2-bytes -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_CaptureInfoEntry { //See this for GSP_CaptureInfoEntry and GSP_CaptureInfo: http://3dbrew.org/wiki/GSPGPU:ImportDisplayCaptureInfo - framebuf0_vaddr: *mut u32, - framebuf1_vaddr: *mut u32, - format: u32, - framebuf_widthbytesize: u32, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GSP_CaptureInfo { - screencapture: [GSP_CaptureInfoEntry; 2usize] -} - -#[repr(C)] -pub enum GSP_Event { - GSPEVENT_PSC0 = 0, // memory fill completed - GSPEVENT_PSC1, - GSPEVENT_VBlank0, - GSPEVENT_VBlank1, - GSPEVENT_PPF, // display transfer finished - GSPEVENT_P3D, // command list processing finished - GSPEVENT_DMA, - - GSPEVENT_MAX, // used to know how many events there are -} - -use super::super::{Result, Handle}; - - -extern "C" { - pub fn gspInit() -> Result; - pub fn gspExit() -> (); - pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8, gspThreadId: u8) -> Result; - pub fn gspExitEventHandler() -> (); - pub fn gspWaitForEvent(id: GSP_Event, nextEvent: u8) -> (); - pub fn GSPGPU_AcquireRight(handle: *mut Handle, flags: u8) -> Result; - pub fn GSPGPU_ReleaseRight(handle: *mut Handle) -> Result; - pub fn GSPGPU_ImportDisplayCaptureInfo(handle: *mut Handle, captureinfo: *mut GSP_CaptureInfo) -> Result; - pub fn GSPGPU_SaveVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_RestoreVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_SetLcdForceBlack(handle: *mut Handle, flags: u8) -> Result; - pub fn GSPGPU_SetBufferSwap(handle: *mut Handle, screenid: u32, framebufinfo: *mut GSP_FramebufferInfo) -> Result; - pub fn GSPGPU_FlushDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; - pub fn GSPGPU_InvalidateDataCache(handle: *mut Handle, adr: *mut u8, size: u32) -> Result; - pub fn GSPGPU_WriteHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; - pub fn GSPGPU_WriteHWRegsWithMask(handle: *mut Handle, regAddr: u32, data: *mut u32, datasize: u8, maskdata: *mut u32, masksize: u8) -> Result; - pub fn GSPGPU_ReadHWRegs(handle: *mut Handle, regAddr: u32, data: *mut u32, size: u8) -> Result; - pub fn GSPGPU_RegisterInterruptRelayQueue(handle: *mut Handle, eventHandle: Handle, flags: u32, outMemHandle: *mut Handle, threadID: *mut u8) -> Result; - pub fn GSPGPU_UnregisterInterruptRelayQueue(handle: *mut Handle) -> Result; - pub fn GSPGPU_TriggerCmdReqQueue(handle: *mut Handle) -> Result; - pub fn GSPGPU_SubmitGxCommand(sharedGspCmdBuf: *mut u32, gxCommand: *mut u32, handle: *mut Handle) -> 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 index 6cd2128..7bfe5fb 100644 --- a/ctru-sys/src/services/hb.rs +++ b/ctru-sys/src/services/hb.rs @@ -6,6 +6,8 @@ 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; + 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 index f48f26b..8e3a025 100644 --- a/ctru-sys/src/services/hid.rs +++ b/ctru-sys/src/services/hid.rs @@ -5,35 +5,39 @@ pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000; #[repr(C)] pub enum PAD_KEY { - KEY_A = 1, - KEY_B = 2, - KEY_SELECT = 4, - KEY_START = 8, - KEY_DRIGHT = 16, - KEY_DLEFT = 32, - KEY_DUP = 64, - KEY_DDOWN = 128, - KEY_R = 256, - KEY_L = 512, - KEY_X = 1024, - KEY_Y = 2048, - KEY_ZL = 4096, // (new 3DS only) - KEY_ZR = 8192, // (new 3DS only) - KEY_TOUCH = 1048576, // Not actually provided by HID - KEY_CSTICK_RIGHT = 16777216, // c-stick (new 3DS only) - KEY_CSTICK_LEFT = 33554432, // c-stick (new 3DS only) - KEY_CSTICK_UP = 67108864, // c-stick (new 3DS only) - KEY_CSTICK_DOWN = 134217728, // c-stick (new 3DS only) - KEY_CPAD_RIGHT = 268435456, // circle pad - KEY_CPAD_LEFT = 536870912, // circle pad - KEY_CPAD_UP = 1073741824, // circle pad - KEY_CPAD_DOWN = 2147483648, // circle pad + 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,*/ + // 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)] @@ -68,36 +72,39 @@ pub struct angularRate { #[repr(C)] pub enum HID_Event { - HIDEVENT_PAD0 = 0, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." - HIDEVENT_PAD1, //"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated." - HIDEVENT_Accel, //"Event signaled by HID-module, when the sharedmem accelerometer state was updated." - HIDEVENT_Gyro, //"Event signaled by HID-module, when the sharedmem gyroscope state was updated." - HIDEVENT_DebugPad, //"Event signaled by HID-module, when the sharedmem DebugPad state was updated." + HIDEVENT_PAD0 = 0, + HIDEVENT_PAD1 = 1, + HIDEVENT_Accel = 2, + HIDEVENT_Gyro = 3, + HIDEVENT_DebugPad = 4, + HIDEVENT_MAX = 5, - HIDEVENT_MAX, // used to know how many events there are } extern "C" { - pub static hidMemHandle: Handle; - pub static hidSharedMem: *mut vu32; - - pub fn hidInit(sharedMem: *mut u32) -> Result; - pub fn hidExit() -> (); - pub fn hidScanInput() -> (); + pub fn 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 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_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 index 3affb65..94a626a 100644 --- a/ctru-sys/src/services/ir.rs +++ b/ctru-sys/src/services/ir.rs @@ -1,14 +1,21 @@ use ::{Result, Handle}; - extern "C" { - pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result; + 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_GetServHandle() -> Handle; - pub fn IRU_SendData(buf: *mut u8, size: u32, wait: u32) -> Result; - pub fn IRU_RecvData(buf: *mut u8, size: u32, flag: u8, transfercount: *mut u32, wait: u32) -> Result; + pub fn IRU_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 index b986270..2f4c6eb 100644 --- a/ctru-sys/src/services/irrst.rs +++ b/ctru-sys/src/services/irrst.rs @@ -3,19 +3,19 @@ use ::types::*; use super::hid::circlePosition; - extern "C" { - pub static irrstMemHandle: Handle; - pub static irrstSharedMem: *mut vu32; + pub static mut irrstMemHandle: Handle; + pub static mut irrstSharedMem: *mut vu32; - pub fn irrstInit(sharedMem: *mut u32) -> Result; - pub fn irrstExit() -> (); - pub fn irrstScanInput() -> (); + 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 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 index 64e7746..1037698 100644 --- a/ctru-sys/src/services/mic.rs +++ b/ctru-sys/src/services/mic.rs @@ -1,19 +1,42 @@ -use ::{Result, Handle}; +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 MIC_Initialize(sharedmem: *mut u32, sharedmem_size: u32, control: u8, recording: u8, unk0: u8, unk1: u8, unk2: u8) -> Result; - pub fn MIC_Shutdown() -> Result; - pub fn MIC_GetSharedMemOffsetValue() -> u32; - pub fn MIC_ReadAudioData(outbuf: *mut u8, readsize: u32, waitforevent: u32) -> u32; - pub fn MIC_MapSharedMem(handle: Handle, size: u32) -> Result; - pub fn MIC_UnmapSharedMem() -> Result; - pub fn MIC_cmd3_Initialize(unk0: u8, unk1: u8, sharedmem_baseoffset: u32, sharedmem_endoffset: u32, unk2: u8) -> Result; - pub fn MIC_cmd5() -> Result; - pub fn MIC_GetCNTBit15(out: *mut u8) -> Result; - pub fn MIC_GetEventHandle(handle: *mut Handle) -> Result; - pub fn MIC_SetControl(value: u8) -> Result; - pub fn MIC_GetControl(value: *mut u8) -> Result; - pub fn MIC_SetRecording(value: u8) -> Result; - pub fn MIC_IsRecoding(value: *mut u8) -> Result; + 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 index ec2d270..76b7c35 100644 --- a/ctru-sys/src/services/mod.rs +++ b/ctru-sys/src/services/mod.rs @@ -1,15 +1,27 @@ pub mod ac; pub mod am; pub mod apt; +pub mod cam; pub mod cfgnor; pub mod cfgu; -pub mod gsp; +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 ptm; +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 index 68a58c2..c48e176 100644 --- a/ctru-sys/src/services/ns.rs +++ b/ctru-sys/src/services/ns.rs @@ -1,9 +1,9 @@ use ::Result; - extern "C" { pub fn nsInit() -> Result; - pub fn nsExit() -> 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 index 78eb3fd..971fbb3 100644 --- a/ctru-sys/src/services/pm.rs +++ b/ctru-sys/src/services/pm.rs @@ -1,12 +1,24 @@ -use ::Result; - +use ::{Handle, Result}; +use ::c_void; extern "C" { pub fn pmInit() -> Result; - pub fn pmExit() -> Result; - pub fn PM_LaunchTitle(mediatype: u8, titleid: u64, launch_flags: u32) -> Result; - pub fn PM_GetTitleExheaderFlags(mediatype: u8, titleid: u64, out: *mut u8) -> Result; + pub fn 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 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/ptm.rs b/ctru-sys/src/services/ptm.rs deleted file mode 100644 index 2743648..0000000 --- a/ctru-sys/src/services/ptm.rs +++ /dev/null @@ -1,12 +0,0 @@ -use ::{Result, Handle}; - - -extern "C" { - pub fn ptmInit() -> Result; - pub fn ptmExit() -> Result; - pub fn PTMU_GetShellState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetBatteryLevel(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetBatteryChargeState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetPedometerState(servhandle: *mut Handle, out: *mut u8) -> Result; - pub fn PTMU_GetTotalStepCount(servhandle: *mut Handle, steps: *mut u32) -> Result; -} 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 index aff4f1d..3a1e2ec 100644 --- a/ctru-sys/src/services/soc.rs +++ b/ctru-sys/src/services/soc.rs @@ -1,7 +1,7 @@ use ::Result; - extern "C" { - pub fn SOC_Initialize(context_addr: *mut u32, context_size: u32) -> Result; - pub fn SOC_Shutdown() -> Result; + 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/svc.rs b/ctru-sys/src/svc.rs index a370104..0ad3fc9 100644 --- a/ctru-sys/src/svc.rs +++ b/ctru-sys/src/svc.rs @@ -1,312 +1,450 @@ +//TODO: Implement static functions + use {Handle, Result}; +use c_void; +use ThreadFunc; use types::*; +#[derive(Clone, Copy)] #[repr(C)] -pub enum MemOp { +pub enum Enum_Unnamed1 { MEMOP_FREE = 1, + MEMOP_RESERVE = 2, MEMOP_ALLOC = 3, MEMOP_MAP = 4, MEMOP_UNMAP = 5, MEMOP_PROT = 6, - - MEMOP_ALLOC_LINEAR = 0x10003, -} - + 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 MemState { - 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 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 MemPerm { - MEMPERM_READ = 1, - MEMPERM_WRITE = 2, - MEMPERM_EXECUTE = 4, - MEMPERM_DONTCARE = 0x10000000, - MEMPERM_MAX = 0xFFFFFFFF //force 4-byte +pub enum Enum_Unnamed3 { + MEMPERM_READ = 1, + MEMPERM_WRITE = 2, + MEMPERM_EXECUTE = 4, + MEMPERM_DONTCARE = 268435456, } - +pub type MemPerm = Enum_Unnamed3; #[repr(C)] -pub struct MemInfo { +#[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(Clone, Copy)] -pub struct PageInfo { +#[derive(Copy)] +pub struct Struct_Unnamed5 { pub flags: u32, } - -#[repr(C)] -pub enum ArbitrationType { - ARBITER_FREE =0, - ARBITER_ACQUIRE =1, - ARBITER_KERNEL2 =2, - ARBITER_ACQUIRE_TIMEOUT=3, - ARBITER_KERNEL4 =4, +impl ::core::clone::Clone for Struct_Unnamed5 { + fn clone(&self) -> Self { *self } } - -#[repr(C)] -pub enum DebugEventType { - 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 +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 ProcessEventReason { - REASON_CREATE = 1, - REASON_ATTACH = 2 -} - +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 ProcessEvent { +pub struct Struct_Unnamed9 { pub program_id: u64, pub process_name: [u8; 8usize], pub process_id: u32, - pub reason: u32 + pub reason: u32, } - -impl Clone for ProcessEvent { +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 CreateThreadEvent { +pub struct Struct_Unnamed12 { pub creator_thread_id: u32, pub base_addr: u32, - pub entry_point: u32 + pub entry_point: u32, } - -impl Clone for CreateThreadEvent { +impl ::core::clone::Clone for Struct_Unnamed12 { fn clone(&self) -> Self { *self } } - -#[repr(C)] -pub enum ExitThreadEventReason { - EXITTHREAD_EVENT_NONE = 0, - EXITTHREAD_EVENT_TERMINATE = 1, - EXITTHREAD_EVENT_UNHANDLED_EXC = 2, - EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 +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 ExitProcessEventReason { - EXITPROCESS_EVENT_NONE = 0, - EXITPROCESS_EVENT_TERMINATE = 1, - EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 +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 ExitProcessEvent { - pub reason: u32 +pub struct Struct_Unnamed14 { + pub reason: u32, } - -impl Clone for ExitProcessEvent { +impl ::core::clone::Clone for Struct_Unnamed14 { fn clone(&self) -> Self { *self } } - -#[repr(C)] -#[derive(Copy)] -pub struct ExitThreadEvent { - pub reason: u32 +impl ::core::default::Default for Struct_Unnamed14 { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - -impl Clone for ExitThreadEvent { - fn clone(&self) -> Self { *self } +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 ExceptionEvent { +pub struct Struct_Unnamed17 { pub _type: u32, pub address: u32, - pub argument: u32 + pub argument: u32, } - -impl Clone for ExceptionEvent { +impl ::core::clone::Clone for Struct_Unnamed17 { fn clone(&self) -> Self { *self } } - -#[repr(C)] -pub enum ExceptionEventType { - EXC_EVENT_UNDEFINED_INSTRUCTION = 0, // arg: (None) - EXC_EVENT_UNKNOWN1 = 1, // arg: (None) - EXC_EVENT_UNKNOWN2 = 2, // arg: address - EXC_EVENT_UNKNOWN3 = 3, // arg: address - EXC_EVENT_ATTACH_BREAK = 4, // arg: (None) - EXC_EVENT_BREAKPOINT = 5, // arg: (None) - EXC_EVENT_USER_BREAK = 6, // arg: user break type - EXC_EVENT_DEBUGGER_BREAK = 7, // arg: (None) - EXC_EVENT_UNDEFINED_SYSCALL = 8 // arg: attempted syscall -} - -#[repr(C)] -pub enum UserBreakType { - USERBREAK_PANIC = 0, - USERBREAK_ASSERT = 1, - USERBREAK_USER = 2 -} - -/** -* Type of the query for svcGetThreadInfo -*/ -#[repr(C)] -pub enum ThreadInfoType { - THREADINFO_TYPE_UNKNOWN = 0, - VARIANT2 = 1, // needed because enums must have 2+ variants for C representation +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 SchedulerInOutEvent { - pub clock_tick: u64 +pub struct Struct_Unnamed18 { + pub clock_tick: u64, } - -impl Clone for SchedulerInOutEvent { +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 SyscallInOutEvent { +pub struct Struct_Unnamed19 { pub clock_tick: u64, pub syscall: u32, } - -impl Clone for SyscallInOutEvent { +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 OutputStringEvent { +pub struct Struct_Unnamed20 { pub string_addr: u32, - pub string_size: u32 + pub string_size: u32, } - -impl Clone for OutputStringEvent { +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 MapEvent { +pub struct Struct_Unnamed21 { pub mapped_addr: u32, pub mapped_size: u32, pub memperm: u32, - pub memstate: u32 + pub memstate: u32, } - -impl Clone for MapEvent { +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 DebugEventInfo { +pub struct Struct_Unnamed23 { pub _type: u32, pub thread_id: u32, pub unknown: [u32; 2usize], - pub eventUnion: [u64; 3usize], // must use transmutes to access contents - // union { - // ProcessEvent process; - // CreateThreadEvent create_thread; - // ExitThreadEvent exit_thread; - // ExitProcessEvent exit_process; - // ExceptionEvent exception; - // /* TODO: DLL_LOAD */ - // /* TODO: DLL_UNLOAD */ - // SchedulerInOutEvent scheduler; - // SyscallInOutEvent syscall; - // OutputStringEvent output_string; - // MapEvent map; - // }; -} - -impl Clone for DebugEventInfo { + 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 } } - -// getLocalThreadStorage and getThreadCommandBuffer can't be implemented -// due to asm. Custom build step may be necessary. - -use ThreadFunc; - +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) -> s32; - pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32) -> s32; - pub fn svcExitProcess() -> (); - pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc, arg: u32, stack_top: *mut u32, thread_priority: s32, processor_id: s32) -> s32; - pub fn svcExitThread() -> (); - pub fn svcSleepThread(ns: s64) -> (); - pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> s32; - pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> s32; - pub fn svcReleaseMutex(handle: Handle) -> s32; - pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32, max_count: s32) -> s32; - pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle, release_count: s32) -> s32; - pub fn svcCreateEvent(event: *mut Handle, reset_type: u8) -> s32; - pub fn svcSignalEvent(handle: Handle) -> s32; - pub fn svcClearEvent(handle: Handle) -> s32; - pub fn svcCreateTimer(timer: *mut Handle, reset_type: u8) -> s32; - pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> s32; - pub fn svcCancelTimer(timer: Handle) -> s32; - pub fn svcClearTimer(timer: Handle) -> s32; - pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; - pub fn svcMapMemoryBlock(memblock: Handle, addr: u32, my_perm: MemPerm, other_perm: MemPerm) -> s32; - pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> s32; - pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> s32; - pub fn svcArbitrateAddress(arbiter: Handle, addr: u32, _type: ArbitrationType, value: s32, nanoseconds: s64) -> s32; - pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> s32; - pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle, handles_num: s32, wait_all: u8, nanoseconds: s64) -> s32; - pub fn svcCloseHandle(handle: Handle) -> s32; - pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> s32; - pub fn svcGetSystemTick() -> u64; - pub fn svcGetSystemInfo(out: *mut s64, _type: u32, param: s32) -> s32; - pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: u32) -> s32; - pub fn svcConnectToPort(out: *mut Handle, portName: *const u8) -> s32; - pub fn svcSendSyncRequest(session: Handle) -> s32; + 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 svcGetProcessId(out: *mut u32, handle: Handle) -> s32; - pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> s32; - pub fn svcOutputDebugString(string: *const u8, length: i32) -> s32; - pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle, name: *const u8, maxSessions: s32) -> Result; - pub fn svcDebugActiveProcess(debug: *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 svcGetProcessDebugEvent(info: *mut DebugEventInfo, debug: Handle) + -> Result; pub fn svcContinueDebugEvent(debug: Handle, flags: u32) -> Result; - pub fn svcGetProcessList(processCount: *mut s32, processIds: *mut u32, processIdMaxCount: s32) -> Result; - pub fn svcReadProcessMemory(buffer: *mut u8, debug: Handle, addr: u32, size: u32) -> Result; - pub fn svcMapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; - pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32, endAddr: u32) -> Result; - pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo, process: Handle, addr: u32) -> Result; - pub fn svcGetProcessorID() -> s32; + pub fn svcBackdoor(callback: + ::core::option::Option 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/rawunused.rs b/rawunused.rs deleted file mode 100644 index 7f3fc2e..0000000 --- a/rawunused.rs +++ /dev/null @@ -1,1987 +0,0 @@ -/* automatically generated by rust-bindgen */ - -pub type __int8_t = ::libc::c_char; -pub type __uint8_t = ::libc::c_uchar; -pub type __int16_t = ::libc::c_short; -pub type __uint16_t = ::libc::c_ushort; -pub type __int32_t = ::libc::c_int; -pub type __uint32_t = ::libc::c_uint; -pub type __int64_t = ::libc::c_longlong; -pub type __uint64_t = ::libc::c_ulonglong; -pub type __int_least8_t = ::libc::c_char; -pub type __uint_least8_t = ::libc::c_uchar; -pub type __int_least16_t = ::libc::c_short; -pub type __uint_least16_t = ::libc::c_ushort; -pub type __int_least32_t = ::libc::c_int; -pub type __uint_least32_t = ::libc::c_uint; -pub type __int_least64_t = ::libc::c_long; -pub type __uint_least64_t = ::libc::c_ulong; -pub type __intptr_t = ::libc::c_long; -pub type __uintptr_t = ::libc::c_ulong; -pub type int8_t = __int8_t; -pub type uint8_t = __uint8_t; -pub type int_least8_t = __int_least8_t; -pub type uint_least8_t = __uint_least8_t; -pub type int16_t = __int16_t; -pub type uint16_t = __uint16_t; -pub type int_least16_t = __int_least16_t; -pub type uint_least16_t = __uint_least16_t; -pub type int32_t = __int32_t; -pub type uint32_t = __uint32_t; -pub type int_least32_t = __int_least32_t; -pub type uint_least32_t = __uint_least32_t; -pub type int64_t = __int64_t; -pub type uint64_t = __uint64_t; -pub type int_least64_t = __int_least64_t; -pub type uint_least64_t = __uint_least64_t; -pub type int_fast8_t = ::libc::c_char; -pub type uint_fast8_t = ::libc::c_uchar; -pub type int_fast16_t = ::libc::c_short; -pub type uint_fast16_t = ::libc::c_ushort; -pub type int_fast32_t = ::libc::c_int; -pub type uint_fast32_t = ::libc::c_uint; -pub type int_fast64_t = ::libc::c_long; -pub type uint_fast64_t = ::libc::c_ulong; -pub type intmax_t = ::libc::c_long; -pub type uintmax_t = ::libc::c_ulong; -pub type intptr_t = __intptr_t; -pub type uintptr_t = __uintptr_t; -pub type ptrdiff_t = ::libc::c_long; -pub type size_t = ::libc::c_ulong; -pub type wchar_t = ::libc::c_int; -pub type Enum_Unnamed1 = ::libc::c_uint; -pub const mediatype_NAND: ::libc::c_uint = 0; -pub const mediatype_SDMC: ::libc::c_uint = 1; -pub const mediatype_GAMECARD: ::libc::c_uint = 2; -pub type mediatypes_enum = Enum_Unnamed1; -pub type _u8 = uint8_t; -pub type _u16 = uint16_t; -pub type _u32 = uint32_t; -pub type u64 = uint64_t; -pub type s8 = int8_t; -pub type s16 = int16_t; -pub type s32 = int32_t; -pub type s64 = int64_t; -pub type vu8 = _u8; -pub type vu16 = _u16; -pub type vu32 = _u32; -pub type vu64 = u64; -pub type vs8 = s8; -pub type vs16 = s16; -pub type vs32 = s32; -pub type vs64 = s64; -pub type Handle = _u32; -pub type Result = s32; -pub type ThreadFunc = - ::std::option::Option ()>; -pub type Enum_Unnamed2 = ::libc::c_uint; -pub const MEMOP_FREE: ::libc::c_uint = 1; -pub const MEMOP_ALLOC: ::libc::c_uint = 3; -pub const MEMOP_MAP: ::libc::c_uint = 4; -pub const MEMOP_UNMAP: ::libc::c_uint = 5; -pub const MEMOP_PROT: ::libc::c_uint = 6; -pub const MEMOP_FREE_LINEAR: ::libc::c_uint = 65537; -pub const MEMOP_ALLOC_LINEAR: ::libc::c_uint = 65539; -pub type MemOp = Enum_Unnamed2; -pub type Enum_Unnamed3 = ::libc::c_uint; -pub const MEMSTATE_FREE: ::libc::c_uint = 0; -pub const MEMSTATE_RESERVED: ::libc::c_uint = 1; -pub const MEMSTATE_IO: ::libc::c_uint = 2; -pub const MEMSTATE_STATIC: ::libc::c_uint = 3; -pub const MEMSTATE_CODE: ::libc::c_uint = 4; -pub const MEMSTATE_PRIVATE: ::libc::c_uint = 5; -pub const MEMSTATE_SHARED: ::libc::c_uint = 6; -pub const MEMSTATE_CONTINUOUS: ::libc::c_uint = 7; -pub const MEMSTATE_ALIASED: ::libc::c_uint = 8; -pub const MEMSTATE_ALIAS: ::libc::c_uint = 9; -pub const MEMSTATE_ALIASCODE: ::libc::c_uint = 10; -pub const MEMSTATE_LOCKED: ::libc::c_uint = 11; -pub type MemState = Enum_Unnamed3; -pub type Enum_Unnamed4 = ::libc::c_uint; -pub const MEMPERM_READ: ::libc::c_uint = 1; -pub const MEMPERM_WRITE: ::libc::c_uint = 2; -pub const MEMPERM_EXECUTE: ::libc::c_uint = 4; -pub const MEMPERM_DONTCARE: ::libc::c_uint = 268435456; -pub const MEMPERM_MAX: ::libc::c_uint = -1; -pub type MemPerm = Enum_Unnamed4; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed5 { - pub base_addr: _u32, - pub size: _u32, - pub perm: _u32, - pub state: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed5 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed5 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type MemInfo = Struct_Unnamed5; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed6 { - pub flags: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed6 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed6 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type PageInfo = Struct_Unnamed6; -pub type Enum_Unnamed7 = ::libc::c_uint; -pub const ARBITER_FREE: ::libc::c_uint = 0; -pub const ARBITER_ACQUIRE: ::libc::c_uint = 1; -pub const ARBITER_KERNEL2: ::libc::c_uint = 2; -pub const ARBITER_ACQUIRE_TIMEOUT: ::libc::c_uint = 3; -pub const ARBITER_KERNEL4: ::libc::c_uint = 4; -pub type ArbitrationType = Enum_Unnamed7; -pub type Enum_Unnamed8 = ::libc::c_uint; -pub const DBG_EVENT_PROCESS: ::libc::c_uint = 0; -pub const DBG_EVENT_CREATE_THREAD: ::libc::c_uint = 1; -pub const DBG_EVENT_EXIT_THREAD: ::libc::c_uint = 2; -pub const DBG_EVENT_EXIT_PROCESS: ::libc::c_uint = 3; -pub const DBG_EVENT_EXCEPTION: ::libc::c_uint = 4; -pub const DBG_EVENT_DLL_LOAD: ::libc::c_uint = 5; -pub const DBG_EVENT_DLL_UNLOAD: ::libc::c_uint = 6; -pub const DBG_EVENT_SCHEDULE_IN: ::libc::c_uint = 7; -pub const DBG_EVENT_SCHEDULE_OUT: ::libc::c_uint = 8; -pub const DBG_EVENT_SYSCALL_IN: ::libc::c_uint = 9; -pub const DBG_EVENT_SYSCALL_OUT: ::libc::c_uint = 10; -pub const DBG_EVENT_OUTPUT_STRING: ::libc::c_uint = 11; -pub const DBG_EVENT_MAP: ::libc::c_uint = 12; -pub type DebugEventType = Enum_Unnamed8; -pub type Enum_Unnamed9 = ::libc::c_uint; -pub const REASON_CREATE: ::libc::c_uint = 1; -pub const REASON_ATTACH: ::libc::c_uint = 2; -pub type ProcessEventReason = Enum_Unnamed9; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed10 { - pub program_id: u64, - pub process_name: [_u8; 8usize], - pub process_id: _u32, - pub reason: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed10 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed10 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type ProcessEvent = Struct_Unnamed10; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed11 { - pub creator_thread_id: _u32, - pub base_addr: _u32, - pub entry_point: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed11 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed11 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type CreateThreadEvent = Struct_Unnamed11; -pub type Enum_Unnamed12 = ::libc::c_uint; -pub const EXITTHREAD_EVENT_NONE: ::libc::c_uint = 0; -pub const EXITTHREAD_EVENT_TERMINATE: ::libc::c_uint = 1; -pub const EXITTHREAD_EVENT_UNHANDLED_EXC: ::libc::c_uint = 2; -pub const EXITTHREAD_EVENT_TERMINATE_PROCESS: ::libc::c_uint = 3; -pub type ExitThreadEventReason = Enum_Unnamed12; -pub type Enum_Unnamed13 = ::libc::c_uint; -pub const EXITPROCESS_EVENT_NONE: ::libc::c_uint = 0; -pub const EXITPROCESS_EVENT_TERMINATE: ::libc::c_uint = 1; -pub const EXITPROCESS_EVENT_UNHANDLED_EXCEPTION: ::libc::c_uint = 2; -pub type ExitProcessEventReason = Enum_Unnamed13; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed14 { - pub reason: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed14 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed14 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type ExitProcessEvent = Struct_Unnamed14; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed15 { - pub reason: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed15 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed15 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type ExitThreadEvent = Struct_Unnamed15; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed16 { - pub _type: _u32, - pub address: _u32, - pub argument: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed16 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed16 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type ExceptionEvent = Struct_Unnamed16; -pub type Enum_Unnamed17 = ::libc::c_uint; -pub const EXC_EVENT_UNDEFINED_INSTRUCTION: ::libc::c_uint = 0; -pub const EXC_EVENT_UNKNOWN1: ::libc::c_uint = 1; -pub const EXC_EVENT_UNKNOWN2: ::libc::c_uint = 2; -pub const EXC_EVENT_UNKNOWN3: ::libc::c_uint = 3; -pub const EXC_EVENT_ATTACH_BREAK: ::libc::c_uint = 4; -pub const EXC_EVENT_BREAKPOINT: ::libc::c_uint = 5; -pub const EXC_EVENT_USER_BREAK: ::libc::c_uint = 6; -pub const EXC_EVENT_DEBUGGER_BREAK: ::libc::c_uint = 7; -pub const EXC_EVENT_UNDEFINED_SYSCALL: ::libc::c_uint = 8; -pub type ExceptionEventType = Enum_Unnamed17; -pub type Enum_Unnamed18 = ::libc::c_uint; -pub const USERBREAK_PANIC: ::libc::c_uint = 0; -pub const USERBREAK_ASSERT: ::libc::c_uint = 1; -pub const USERBREAK_USER: ::libc::c_uint = 2; -pub type UserBreakType = Enum_Unnamed18; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed19 { - pub clock_tick: u64, -} -impl ::std::clone::Clone for Struct_Unnamed19 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed19 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type SchedulerInOutEvent = Struct_Unnamed19; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed20 { - pub clock_tick: u64, - pub syscall: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed20 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed20 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type SyscallInOutEvent = Struct_Unnamed20; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed21 { - pub string_addr: _u32, - pub string_size: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed21 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed21 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type OutputStringEvent = Struct_Unnamed21; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed22 { - pub mapped_addr: _u32, - pub mapped_size: _u32, - pub memperm: _u32, - pub memstate: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed22 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed22 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type MapEvent = Struct_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 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn create_thread(&mut self) -> *mut CreateThreadEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn exit_thread(&mut self) -> *mut ExitThreadEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn exit_process(&mut self) -> *mut ExitProcessEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn exception(&mut self) -> *mut ExceptionEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn scheduler(&mut self) -> *mut SchedulerInOutEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn syscall(&mut self) -> *mut SyscallInOutEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn output_string(&mut self) -> *mut OutputStringEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn map(&mut self) -> *mut MapEvent { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_); - ::std::mem::transmute(raw.offset(0)) - } -} -impl ::std::clone::Clone for Struct_Unnamed23 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed23 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DebugEventInfo = Struct_Unnamed23; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed24 { - 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 ::std::clone::Clone for Struct_Unnamed24 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed24 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type GSP_FramebufferInfo = Struct_Unnamed24; -pub type Enum_Unnamed25 = ::libc::c_uint; -pub const GSP_RGBA8_OES: ::libc::c_uint = 0; -pub const GSP_BGR8_OES: ::libc::c_uint = 1; -pub const GSP_RGB565_OES: ::libc::c_uint = 2; -pub const GSP_RGB5_A1_OES: ::libc::c_uint = 3; -pub const GSP_RGBA4_OES: ::libc::c_uint = 4; -pub type GSP_FramebufferFormats = Enum_Unnamed25; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed26 { - pub framebuf0_vaddr: *mut _u32, - pub framebuf1_vaddr: *mut _u32, - pub format: _u32, - pub framebuf_widthbytesize: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed26 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed26 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type GSP_CaptureInfoEntry = Struct_Unnamed26; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed27 { - pub screencapture: [GSP_CaptureInfoEntry; 2usize], -} -impl ::std::clone::Clone for Struct_Unnamed27 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed27 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type GSP_CaptureInfo = Struct_Unnamed27; -pub type Enum_Unnamed28 = ::libc::c_uint; -pub const GSPEVENT_PSC0: ::libc::c_uint = 0; -pub const GSPEVENT_PSC1: ::libc::c_uint = 1; -pub const GSPEVENT_VBlank0: ::libc::c_uint = 2; -pub const GSPEVENT_VBlank1: ::libc::c_uint = 3; -pub const GSPEVENT_PPF: ::libc::c_uint = 4; -pub const GSPEVENT_P3D: ::libc::c_uint = 5; -pub const GSPEVENT_DMA: ::libc::c_uint = 6; -pub const GSPEVENT_MAX: ::libc::c_uint = 7; -pub type GSP_Event = Enum_Unnamed28; -pub type Enum_Unnamed29 = ::libc::c_uint; -pub const GFX_TOP: ::libc::c_uint = 0; -pub const GFX_BOTTOM: ::libc::c_uint = 1; -pub type gfxScreen_t = Enum_Unnamed29; -pub type Enum_Unnamed30 = ::libc::c_uint; -pub const GFX_LEFT: ::libc::c_uint = 0; -pub const GFX_RIGHT: ::libc::c_uint = 1; -pub type gfx3dSide_t = Enum_Unnamed30; -pub type ConsolePrint = - ::std::option::Option u8>; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_ConsoleFont { - pub gfx: *mut _u8, - pub asciiOffset: _u16, - pub numChars: _u16, -} -impl ::std::clone::Clone for Struct_ConsoleFont { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_ConsoleFont { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type ConsoleFont = Struct_ConsoleFont; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_PrintConsole { - pub font: ConsoleFont, - pub frameBuffer: *mut _u16, - pub cursorX: ::libc::c_int, - pub cursorY: ::libc::c_int, - pub prevCursorX: ::libc::c_int, - pub prevCursorY: ::libc::c_int, - pub consoleWidth: ::libc::c_int, - pub consoleHeight: ::libc::c_int, - pub windowX: ::libc::c_int, - pub windowY: ::libc::c_int, - pub windowWidth: ::libc::c_int, - pub windowHeight: ::libc::c_int, - pub tabSize: ::libc::c_int, - pub fg: ::libc::c_int, - pub bg: ::libc::c_int, - pub flags: ::libc::c_int, - pub PrintChar: ConsolePrint, - pub consoleInitialised: u8, -} -impl ::std::clone::Clone for Struct_PrintConsole { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_PrintConsole { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type PrintConsole = Struct_PrintConsole; -pub type Enum_Unnamed31 = ::libc::c_uint; -pub const debugDevice_NULL: ::libc::c_uint = 0; -pub const debugDevice_3DMOO: ::libc::c_uint = 1; -pub const debugDevice_CONSOLE: ::libc::c_uint = 2; -pub type debugDevice = Enum_Unnamed31; -pub type _LOCK_T = ::libc::c_int; -pub type _LOCK_RECURSIVE_T = ::libc::c_int; -pub type _off_t = ::libc::c_long; -pub type __dev_t = ::libc::c_int; -pub type __uid_t = ::libc::c_ushort; -pub type __gid_t = ::libc::c_ushort; -pub type _off64_t = ::libc::c_longlong; -pub type _fpos_t = ::libc::c_long; -pub type _ssize_t = ::libc::c_long; -pub type wint_t = ::libc::c_int; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed32 { - pub __count: ::libc::c_int, - pub __value: Union_Unnamed33, -} -impl ::std::clone::Clone for Struct_Unnamed32 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed32 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -#[repr(C)] -#[derive(Copy)] -pub struct Union_Unnamed33 { - pub _bindgen_data_: [u32; 1usize], -} -impl Union_Unnamed33 { - pub unsafe fn __wch(&mut self) -> *mut wint_t { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn __wchb(&mut self) -> *mut [::libc::c_uchar; 4usize] { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(0)) - } -} -impl ::std::clone::Clone for Union_Unnamed33 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Union_Unnamed33 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type _mbstate_t = Struct_Unnamed32; -pub type _flock_t = _LOCK_RECURSIVE_T; -pub type _iconv_t = *mut ::libc::c_void; -pub type __off_t = ::libc::c_long; -pub type __pid_t = ::libc::c_int; -pub type __loff_t = ::libc::c_longlong; -pub type u_char = ::libc::c_uchar; -pub type u_short = ::libc::c_ushort; -pub type u_int = ::libc::c_uint; -pub type u_long = ::libc::c_ulong; -pub type ushort = ::libc::c_ushort; -pub type _uint = ::libc::c_uint; -pub type ulong = ::libc::c_ulong; -pub type clock_t = ::libc::c_ulong; -pub type time_t = ::libc::c_long; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_timespec { - pub tv_sec: time_t, - pub tv_nsec: ::libc::c_long, -} -impl ::std::clone::Clone for Struct_timespec { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_timespec { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -#[repr(C)] -#[derive(Copy)] -pub struct Struct_itimerspec { - pub it_interval: Struct_timespec, - pub it_value: Struct_timespec, -} -impl ::std::clone::Clone for Struct_itimerspec { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_itimerspec { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type daddr_t = ::libc::c_long; -pub type caddr_t = *mut ::libc::c_char; -pub type ino_t = ::libc::c_uint; -pub type off_t = _off_t; -pub type dev_t = __dev_t; -pub type uid_t = __uid_t; -pub type gid_t = __gid_t; -pub type pid_t = ::libc::c_int; -pub type key_t = ::libc::c_long; -pub type ssize_t = _ssize_t; -pub type mode_t = ::libc::c_uint; -pub type nlink_t = ::libc::c_ushort; -pub type fd_mask = ::libc::c_long; -#[repr(C)] -#[derive(Copy)] -pub struct Struct__types_fd_set { - pub fds_bits: [fd_mask; 1usize], -} -impl ::std::clone::Clone for Struct__types_fd_set { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct__types_fd_set { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type _types_fd_set = Struct__types_fd_set; -pub type clockid_t = ::libc::c_ulong; -pub type timer_t = ::libc::c_ulong; -pub type useconds_t = ::libc::c_ulong; -pub type suseconds_t = ::libc::c_long; -pub type fsblkcnt_t = __uint32_t; -pub type fsfilcnt_t = __uint32_t; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed34 { - pub titleID: u64, - pub size: u64, - pub titleVersion: _u16, - pub unknown2: [_u8; 6usize], -} -impl ::std::clone::Clone for Struct_Unnamed34 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed34 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type TitleList = Struct_Unnamed34; -pub type Enum_Unnamed35 = ::libc::c_uint; -pub const APPID_HOMEMENU: ::libc::c_uint = 257; -pub const APPID_CAMERA: ::libc::c_uint = 272; -pub const APPID_WEB: ::libc::c_uint = 276; -pub const APPID_APPLICATION: ::libc::c_uint = 768; -pub type NS_APPID = Enum_Unnamed35; -pub type Enum_Unnamed36 = ::libc::c_uint; -pub const APP_NOTINITIALIZED: ::libc::c_uint = 0; -pub const APP_RUNNING: ::libc::c_uint = 1; -pub const APP_SUSPENDED: ::libc::c_uint = 2; -pub const APP_EXITING: ::libc::c_uint = 3; -pub const APP_SUSPENDING: ::libc::c_uint = 4; -pub const APP_SLEEPMODE: ::libc::c_uint = 5; -pub const APP_PREPARE_SLEEPMODE: ::libc::c_uint = 6; -pub const APP_APPLETSTARTED: ::libc::c_uint = 7; -pub const APP_APPLETCLOSED: ::libc::c_uint = 8; -pub type APP_STATUS = Enum_Unnamed36; -pub type Enum_Unnamed37 = ::libc::c_uint; -pub const APTSIGNAL_HOMEBUTTON: ::libc::c_uint = 1; -pub const APTSIGNAL_PREPARESLEEP: ::libc::c_uint = 3; -pub const APTSIGNAL_ENTERSLEEP: ::libc::c_uint = 5; -pub const APTSIGNAL_WAKEUP: ::libc::c_uint = 6; -pub const APTSIGNAL_ENABLE: ::libc::c_uint = 7; -pub const APTSIGNAL_POWERBUTTON: ::libc::c_uint = 8; -pub const APTSIGNAL_UTILITY: ::libc::c_uint = 9; -pub const APTSIGNAL_SLEEPSYSTEM: ::libc::c_uint = 10; -pub const APTSIGNAL_ERROR: ::libc::c_uint = 11; -pub type Enum_Unnamed38 = ::libc::c_uint; -pub const CSND_ENCODING_PCM8: ::libc::c_uint = 0; -pub const CSND_ENCODING_PCM16: ::libc::c_uint = 1; -pub const CSND_ENCODING_ADPCM: ::libc::c_uint = 2; -pub const CSND_ENCODING_PSG: ::libc::c_uint = 3; -pub type Enum_Unnamed39 = ::libc::c_uint; -pub const CSND_LOOPMODE_MANUAL: ::libc::c_uint = 0; -pub const CSND_LOOPMODE_NORMAL: ::libc::c_uint = 1; -pub const CSND_LOOPMODE_ONESHOT: ::libc::c_uint = 2; -pub const CSND_LOOPMODE_NORELOAD: ::libc::c_uint = 3; -pub type Enum_Unnamed40 = ::libc::c_uint; -pub const SOUND_LINEAR_INTERP: ::libc::c_uint = 64; -pub const SOUND_REPEAT: ::libc::c_uint = 1024; -pub const SOUND_ONE_SHOT: ::libc::c_uint = 2048; -pub const SOUND_FORMAT_8BIT: ::libc::c_uint = 0; -pub const SOUND_FORMAT_16BIT: ::libc::c_uint = 4096; -pub const SOUND_FORMAT_ADPCM: ::libc::c_uint = 8192; -pub const SOUND_FORMAT_PSG: ::libc::c_uint = 12288; -pub const SOUND_ENABLE: ::libc::c_uint = 16384; -pub type Enum_Unnamed41 = ::libc::c_uint; -pub const DutyCycle_0: ::libc::c_uint = 7; -pub const DutyCycle_12: ::libc::c_uint = 0; -pub const DutyCycle_25: ::libc::c_uint = 1; -pub const DutyCycle_37: ::libc::c_uint = 2; -pub const DutyCycle_50: ::libc::c_uint = 3; -pub const DutyCycle_62: ::libc::c_uint = 4; -pub const DutyCycle_75: ::libc::c_uint = 5; -pub const DutyCycle_87: ::libc::c_uint = 6; -#[repr(C)] -#[derive(Copy)] -pub struct Union_Unnamed42 { - pub _bindgen_data_: [u32; 3usize], -} -impl Union_Unnamed42 { - pub unsafe fn value(&mut self) -> *mut [_u32; 3usize] { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn active(&mut self) -> *mut _u8 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(0)) - } - pub unsafe fn _pad1(&mut self) -> *mut _u8 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(1)) - } - pub unsafe fn _pad2(&mut self) -> *mut _u16 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(2)) - } - pub unsafe fn adpcmSample(&mut self) -> *mut s16 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(4)) - } - pub unsafe fn adpcmIndex(&mut self) -> *mut _u8 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(6)) - } - pub unsafe fn _pad3(&mut self) -> *mut _u8 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(7)) - } - pub unsafe fn samplePAddr(&mut self) -> *mut _u32 { - let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); - ::std::mem::transmute(raw.offset(8)) - } -} -impl ::std::clone::Clone for Union_Unnamed42 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Union_Unnamed42 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type CSND_ChnInfo = Union_Unnamed42; -pub type Enum_Unnamed43 = ::libc::c_uint; -pub const PATH_INVALID: ::libc::c_uint = 0; -pub const PATH_EMPTY: ::libc::c_uint = 1; -pub const PATH_BINARY: ::libc::c_uint = 2; -pub const PATH_CHAR: ::libc::c_uint = 3; -pub const PATH_WCHAR: ::libc::c_uint = 4; -pub type FS_pathType = Enum_Unnamed43; -pub type Enum_Unnamed44 = ::libc::c_uint; -pub const ARCH_ROMFS: ::libc::c_uint = 3; -pub const ARCH_SAVEDATA: ::libc::c_uint = 4; -pub const ARCH_EXTDATA: ::libc::c_uint = 6; -pub const ARCH_SHARED_EXTDATA: ::libc::c_uint = 7; -pub const ARCH_SYSTEM_SAVEDATA: ::libc::c_uint = 8; -pub const ARCH_SDMC: ::libc::c_uint = 9; -pub const ARCH_SDMC_WRITE_ONLY: ::libc::c_uint = 10; -pub const ARCH_BOSS_EXTDATA: ::libc::c_uint = 305419896; -pub const ARCH_CARD_SPIFS: ::libc::c_uint = 305419897; -pub const ARCH_NAND_RW: ::libc::c_uint = 305419901; -pub const ARCH_NAND_RO: ::libc::c_uint = 305419902; -pub const ARCH_NAND_RO_WRITE_ACCESS: ::libc::c_uint = 305419903; -pub type FS_archiveIds = Enum_Unnamed44; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed45 { - pub _type: FS_pathType, - pub size: _u32, - pub data: *const _u8, -} -impl ::std::clone::Clone for Struct_Unnamed45 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed45 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type FS_path = Struct_Unnamed45; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed46 { - pub id: _u32, - pub lowPath: FS_path, - pub handleLow: Handle, - pub handleHigh: Handle, -} -impl ::std::clone::Clone for Struct_Unnamed46 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed46 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type FS_archive = Struct_Unnamed46; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed47 { - pub name: [_u16; 262usize], - pub shortName: [_u8; 9usize], - pub unknown1: _u8, - pub shortExt: [_u8; 4usize], - pub unknown2: _u8, - pub unknown3: _u8, - pub isDirectory: _u8, - pub isHidden: _u8, - pub isArchive: _u8, - pub isReadOnly: _u8, - pub fileSize: u64, -} -impl ::std::clone::Clone for Struct_Unnamed47 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed47 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type FS_dirent = Struct_Unnamed47; -pub type Enum_Unnamed48 = ::libc::c_uint; -pub const KEY_A: ::libc::c_uint = 1; -pub const KEY_B: ::libc::c_uint = 2; -pub const KEY_SELECT: ::libc::c_uint = 4; -pub const KEY_START: ::libc::c_uint = 8; -pub const KEY_DRIGHT: ::libc::c_uint = 16; -pub const KEY_DLEFT: ::libc::c_uint = 32; -pub const KEY_DUP: ::libc::c_uint = 64; -pub const KEY_DDOWN: ::libc::c_uint = 128; -pub const KEY_R: ::libc::c_uint = 256; -pub const KEY_L: ::libc::c_uint = 512; -pub const KEY_X: ::libc::c_uint = 1024; -pub const KEY_Y: ::libc::c_uint = 2048; -pub const KEY_ZL: ::libc::c_uint = 16384; -pub const KEY_ZR: ::libc::c_uint = 32768; -pub const KEY_TOUCH: ::libc::c_uint = 1048576; -pub const KEY_CSTICK_RIGHT: ::libc::c_uint = 16777216; -pub const KEY_CSTICK_LEFT: ::libc::c_uint = 33554432; -pub const KEY_CSTICK_UP: ::libc::c_uint = 67108864; -pub const KEY_CSTICK_DOWN: ::libc::c_uint = 134217728; -pub const KEY_CPAD_RIGHT: ::libc::c_uint = 268435456; -pub const KEY_CPAD_LEFT: ::libc::c_uint = 536870912; -pub const KEY_CPAD_UP: ::libc::c_uint = 1073741824; -pub const KEY_CPAD_DOWN: ::libc::c_uint = -2147483648; -pub const KEY_UP: ::libc::c_uint = 1073741888; -pub const KEY_DOWN: ::libc::c_uint = -2147483520; -pub const KEY_LEFT: ::libc::c_uint = 536870944; -pub const KEY_RIGHT: ::libc::c_uint = 268435472; -pub type PAD_KEY = Enum_Unnamed48; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed49 { - pub px: _u16, - pub py: _u16, -} -impl ::std::clone::Clone for Struct_Unnamed49 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed49 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type touchPosition = Struct_Unnamed49; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed50 { - pub dx: s16, - pub dy: s16, -} -impl ::std::clone::Clone for Struct_Unnamed50 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed50 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type circlePosition = Struct_Unnamed50; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed51 { - pub x: s16, - pub y: s16, - pub z: s16, -} -impl ::std::clone::Clone for Struct_Unnamed51 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed51 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type accelVector = Struct_Unnamed51; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed52 { - pub x: s16, - pub z: s16, - pub y: s16, -} -impl ::std::clone::Clone for Struct_Unnamed52 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed52 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type angularRate = Struct_Unnamed52; -pub type Enum_Unnamed53 = ::libc::c_uint; -pub const HIDEVENT_PAD0: ::libc::c_uint = 0; -pub const HIDEVENT_PAD1: ::libc::c_uint = 1; -pub const HIDEVENT_Accel: ::libc::c_uint = 2; -pub const HIDEVENT_Gyro: ::libc::c_uint = 3; -pub const HIDEVENT_DebugPad: ::libc::c_uint = 4; -pub const HIDEVENT_MAX: ::libc::c_uint = 5; -pub type HID_Event = Enum_Unnamed53; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed54 { - pub servhandle: Handle, - pub httphandle: _u32, -} -impl ::std::clone::Clone for Struct_Unnamed54 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed54 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type httpcContext = Struct_Unnamed54; -pub type Enum_Unnamed55 = ::libc::c_uint; -pub const HTTPCREQSTAT_INPROGRESS_REQSENT: ::libc::c_uint = 5; -pub const HTTPCREQSTAT_DLREADY: ::libc::c_uint = 7; -pub type httpcReqStatus = Enum_Unnamed55; -pub type Enum_Unnamed56 = ::libc::c_uint; -pub const ps_CBC_ENC: ::libc::c_uint = 0; -pub const ps_CBC_DEC: ::libc::c_uint = 1; -pub const ps_CTR_ENC: ::libc::c_uint = 2; -pub const ps_CTR_DEC: ::libc::c_uint = 3; -pub const ps_CCM_ENC: ::libc::c_uint = 4; -pub const ps_CCM_DEC: ::libc::c_uint = 5; -pub type ps_aes_algo = Enum_Unnamed56; -pub type Enum_Unnamed57 = ::libc::c_uint; -pub const ps_KEYSLOT_0D: ::libc::c_uint = 0; -pub const ps_KEYSLOT_2D: ::libc::c_uint = 1; -pub const ps_KEYSLOT_31: ::libc::c_uint = 2; -pub const ps_KEYSLOT_38: ::libc::c_uint = 3; -pub const ps_KEYSLOT_32: ::libc::c_uint = 4; -pub const ps_KEYSLOT_39: ::libc::c_uint = 5; -pub const ps_KEYSLOT_2E: ::libc::c_uint = 6; -pub const ps_KEYSLOT_INVALID: ::libc::c_uint = 7; -pub const ps_KEYSLOT_36: ::libc::c_uint = 8; -pub type ps_aes_keytypes = Enum_Unnamed57; -pub type Enum_Unnamed58 = ::libc::c_uint; -pub const MVDMODE_COLORFORMATCONV: ::libc::c_uint = 0; -pub const MVDMODE_VIDEOPROCESSING: ::libc::c_uint = 1; -pub type mvdstdMode = Enum_Unnamed58; -pub type Enum_Unnamed59 = ::libc::c_uint; -pub const MVDTYPEIN_YUYV422: ::libc::c_uint = 65537; -pub const MVDTYPEIN_H264: ::libc::c_uint = 131073; -pub type mvdstdTypeInput = Enum_Unnamed59; -pub type Enum_Unnamed60 = ::libc::c_uint; -pub const MVDTYPEOUT_RGB565: ::libc::c_uint = 262146; -pub type mvdstdTypeOutput = Enum_Unnamed60; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed61 { - pub input_type: mvdstdTypeInput, - 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: mvdstdTypeOutput, - pub outwidth1: _u32, - pub outheight1: _u32, - pub physaddr_outdata0: _u32, - pub physaddr_outdata1_colorconv: _u32, - pub unk_x6c: [_u32; 44usize], -} -impl ::std::clone::Clone for Struct_Unnamed61 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed61 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type mvdstdConfig = Struct_Unnamed61; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed62 { - pub x: ::libc::c_float, - pub y: ::libc::c_float, -} -impl ::std::clone::Clone for Struct_Unnamed62 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed62 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type qtmHeadtrackingInfoCoord = Struct_Unnamed62; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed63 { - pub flags: [_u8; 5usize], - pub padding: [_u8; 3usize], - pub floatdata_x08: ::libc::c_float, - pub coords0: [qtmHeadtrackingInfoCoord; 4usize], - pub unk_x2c: [_u32; 5usize], -} -impl ::std::clone::Clone for Struct_Unnamed63 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed63 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type qtmHeadtrackingInfo = Struct_Unnamed63; -pub type Enum_Unnamed64 = ::libc::c_uint; -pub const GPU_NEAREST: ::libc::c_uint = 0; -pub const GPU_LINEAR: ::libc::c_uint = 1; -pub type GPU_TEXTURE_FILTER_PARAM = Enum_Unnamed64; -pub type Enum_Unnamed65 = ::libc::c_uint; -pub const GPU_CLAMP_TO_EDGE: ::libc::c_uint = 0; -pub const GPU_REPEAT: ::libc::c_uint = 2; -pub type GPU_TEXTURE_WRAP_PARAM = Enum_Unnamed65; -pub type Enum_Unnamed66 = ::libc::c_uint; -pub const GPU_TEXUNIT0: ::libc::c_uint = 1; -pub const GPU_TEXUNIT1: ::libc::c_uint = 2; -pub const GPU_TEXUNIT2: ::libc::c_uint = 4; -pub type GPU_TEXUNIT = Enum_Unnamed66; -pub type Enum_Unnamed67 = ::libc::c_uint; -pub const GPU_RGBA8: ::libc::c_uint = 0; -pub const GPU_RGB8: ::libc::c_uint = 1; -pub const GPU_RGBA5551: ::libc::c_uint = 2; -pub const GPU_RGB565: ::libc::c_uint = 3; -pub const GPU_RGBA4: ::libc::c_uint = 4; -pub const GPU_LA8: ::libc::c_uint = 5; -pub const GPU_HILO8: ::libc::c_uint = 6; -pub const GPU_L8: ::libc::c_uint = 7; -pub const GPU_A8: ::libc::c_uint = 8; -pub const GPU_LA4: ::libc::c_uint = 9; -pub const GPU_L4: ::libc::c_uint = 10; -pub const GPU_ETC1: ::libc::c_uint = 11; -pub const GPU_ETC1A4: ::libc::c_uint = 12; -pub type GPU_TEXCOLOR = Enum_Unnamed67; -pub type Enum_Unnamed68 = ::libc::c_uint; -pub const GPU_NEVER: ::libc::c_uint = 0; -pub const GPU_ALWAYS: ::libc::c_uint = 1; -pub const GPU_EQUAL: ::libc::c_uint = 2; -pub const GPU_NOTEQUAL: ::libc::c_uint = 3; -pub const GPU_LESS: ::libc::c_uint = 4; -pub const GPU_LEQUAL: ::libc::c_uint = 5; -pub const GPU_GREATER: ::libc::c_uint = 6; -pub const GPU_GEQUAL: ::libc::c_uint = 7; -pub type GPU_TESTFUNC = Enum_Unnamed68; -pub type Enum_Unnamed69 = ::libc::c_uint; -pub const GPU_SCISSOR_DISABLE: ::libc::c_uint = 0; -pub const GPU_SCISSOR_INVERT: ::libc::c_uint = 1; -pub const GPU_SCISSOR_NORMAL: ::libc::c_uint = 3; -pub type GPU_SCISSORMODE = Enum_Unnamed69; -pub type Enum_Unnamed70 = ::libc::c_uint; -pub const GPU_KEEP: ::libc::c_uint = 0; -pub const GPU_AND_NOT: ::libc::c_uint = 1; -pub const GPU_XOR: ::libc::c_uint = 5; -pub type GPU_STENCILOP = Enum_Unnamed70; -pub type Enum_Unnamed71 = ::libc::c_uint; -pub const GPU_WRITE_RED: ::libc::c_uint = 1; -pub const GPU_WRITE_GREEN: ::libc::c_uint = 2; -pub const GPU_WRITE_BLUE: ::libc::c_uint = 4; -pub const GPU_WRITE_ALPHA: ::libc::c_uint = 8; -pub const GPU_WRITE_DEPTH: ::libc::c_uint = 16; -pub const GPU_WRITE_COLOR: ::libc::c_uint = 15; -pub const GPU_WRITE_ALL: ::libc::c_uint = 31; -pub type GPU_WRITEMASK = Enum_Unnamed71; -pub type Enum_Unnamed72 = ::libc::c_uint; -pub const GPU_BLEND_ADD: ::libc::c_uint = 0; -pub const GPU_BLEND_SUBTRACT: ::libc::c_uint = 1; -pub const GPU_BLEND_REVERSE_SUBTRACT: ::libc::c_uint = 2; -pub const GPU_BLEND_MIN: ::libc::c_uint = 3; -pub const GPU_BLEND_MAX: ::libc::c_uint = 4; -pub type GPU_BLENDEQUATION = Enum_Unnamed72; -pub type Enum_Unnamed73 = ::libc::c_uint; -pub const GPU_ZERO: ::libc::c_uint = 0; -pub const GPU_ONE: ::libc::c_uint = 1; -pub const GPU_SRC_COLOR: ::libc::c_uint = 2; -pub const GPU_ONE_MINUS_SRC_COLOR: ::libc::c_uint = 3; -pub const GPU_DST_COLOR: ::libc::c_uint = 4; -pub const GPU_ONE_MINUS_DST_COLOR: ::libc::c_uint = 5; -pub const GPU_SRC_ALPHA: ::libc::c_uint = 6; -pub const GPU_ONE_MINUS_SRC_ALPHA: ::libc::c_uint = 7; -pub const GPU_DST_ALPHA: ::libc::c_uint = 8; -pub const GPU_ONE_MINUS_DST_ALPHA: ::libc::c_uint = 9; -pub const GPU_CONSTANT_COLOR: ::libc::c_uint = 10; -pub const GPU_ONE_MINUS_CONSTANT_COLOR: ::libc::c_uint = 11; -pub const GPU_CONSTANT_ALPHA: ::libc::c_uint = 12; -pub const GPU_ONE_MINUS_CONSTANT_ALPHA: ::libc::c_uint = 13; -pub const GPU_SRC_ALPHA_SATURATE: ::libc::c_uint = 14; -pub type GPU_BLENDFACTOR = Enum_Unnamed73; -pub type Enum_Unnamed74 = ::libc::c_uint; -pub const GPU_LOGICOP_CLEAR: ::libc::c_uint = 0; -pub const GPU_LOGICOP_AND: ::libc::c_uint = 1; -pub const GPU_LOGICOP_AND_REVERSE: ::libc::c_uint = 2; -pub const GPU_LOGICOP_COPY: ::libc::c_uint = 3; -pub const GPU_LOGICOP_SET: ::libc::c_uint = 4; -pub const GPU_LOGICOP_COPY_INVERTED: ::libc::c_uint = 5; -pub const GPU_LOGICOP_NOOP: ::libc::c_uint = 6; -pub const GPU_LOGICOP_INVERT: ::libc::c_uint = 7; -pub const GPU_LOGICOP_NAND: ::libc::c_uint = 8; -pub const GPU_LOGICOP_OR: ::libc::c_uint = 9; -pub const GPU_LOGICOP_NOR: ::libc::c_uint = 10; -pub const GPU_LOGICOP_XOR: ::libc::c_uint = 11; -pub const GPU_LOGICOP_EQUIV: ::libc::c_uint = 12; -pub const GPU_LOGICOP_AND_INVERTED: ::libc::c_uint = 13; -pub const GPU_LOGICOP_OR_REVERSE: ::libc::c_uint = 14; -pub const GPU_LOGICOP_OR_INVERTED: ::libc::c_uint = 15; -pub type GPU_LOGICOP = Enum_Unnamed74; -pub type Enum_Unnamed75 = ::libc::c_uint; -pub const GPU_BYTE: ::libc::c_uint = 0; -pub const GPU_UNSIGNED_BYTE: ::libc::c_uint = 1; -pub const GPU_SHORT: ::libc::c_uint = 2; -pub const GPU_FLOAT: ::libc::c_uint = 3; -pub type GPU_FORMATS = Enum_Unnamed75; -pub type Enum_Unnamed76 = ::libc::c_uint; -pub const GPU_CULL_NONE: ::libc::c_uint = 0; -pub const GPU_CULL_FRONT_CCW: ::libc::c_uint = 1; -pub const GPU_CULL_BACK_CCW: ::libc::c_uint = 2; -pub type GPU_CULLMODE = Enum_Unnamed76; -pub type Enum_Unnamed77 = ::libc::c_uint; -pub const GPU_PRIMARY_COLOR: ::libc::c_uint = 0; -pub const GPU_TEXTURE0: ::libc::c_uint = 3; -pub const GPU_TEXTURE1: ::libc::c_uint = 4; -pub const GPU_TEXTURE2: ::libc::c_uint = 5; -pub const GPU_TEXTURE3: ::libc::c_uint = 6; -pub const GPU_CONSTANT: ::libc::c_uint = 14; -pub const GPU_PREVIOUS: ::libc::c_uint = 15; -pub type GPU_TEVSRC = Enum_Unnamed77; -pub type Enum_Unnamed78 = ::libc::c_uint; -pub const GPU_REPLACE: ::libc::c_uint = 0; -pub const GPU_MODULATE: ::libc::c_uint = 1; -pub const GPU_ADD: ::libc::c_uint = 2; -pub const GPU_ADD_SIGNED: ::libc::c_uint = 3; -pub const GPU_INTERPOLATE: ::libc::c_uint = 4; -pub const GPU_SUBTRACT: ::libc::c_uint = 5; -pub const GPU_DOT3_RGB: ::libc::c_uint = 6; -pub type GPU_COMBINEFUNC = Enum_Unnamed78; -pub type Enum_Unnamed79 = ::libc::c_uint; -pub const GPU_TRIANGLES: ::libc::c_uint = 0; -pub const GPU_TRIANGLE_STRIP: ::libc::c_uint = 256; -pub const GPU_TRIANGLE_FAN: ::libc::c_uint = 512; -pub const GPU_UNKPRIM: ::libc::c_uint = 768; -pub type GPU_Primitive_t = Enum_Unnamed79; -pub type Enum_Unnamed80 = ::libc::c_uint; -pub const GPU_VERTEX_SHADER: ::libc::c_uint = 0; -pub const GPU_GEOMETRY_SHADER: ::libc::c_uint = 1; -pub type GPU_SHADER_TYPE = Enum_Unnamed80; -pub type Enum_Unnamed81 = ::libc::c_uint; -pub const VERTEX_SHDR: ::libc::c_uint = 0; -pub const GEOMETRY_SHDR: ::libc::c_uint = 1; -pub type DVLE_type = Enum_Unnamed81; -pub type Enum_Unnamed82 = ::libc::c_uint; -pub const DVLE_CONST_BOOL: ::libc::c_uint = 0; -pub const DVLE_CONST_u8: ::libc::c_uint = 1; -pub const DVLE_CONST_FLOAT24: ::libc::c_uint = 2; -pub type DVLE_constantType = Enum_Unnamed82; -pub type Enum_Unnamed83 = ::libc::c_uint; -pub const RESULT_POSITION: ::libc::c_uint = 0; -pub const RESULT_NORMALQUAT: ::libc::c_uint = 1; -pub const RESULT_COLOR: ::libc::c_uint = 2; -pub const RESULT_TEXCOORD0: ::libc::c_uint = 3; -pub const RESULT_TEXCOORD0W: ::libc::c_uint = 4; -pub const RESULT_TEXCOORD1: ::libc::c_uint = 5; -pub const RESULT_TEXCOORD2: ::libc::c_uint = 6; -pub const RESULT_VIEW: ::libc::c_uint = 8; -pub type DVLE_outputAttribute_t = Enum_Unnamed83; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed84 { - pub codeSize: _u32, - pub codeData: *mut _u32, - pub opdescSize: _u32, - pub opcdescData: *mut _u32, -} -impl ::std::clone::Clone for Struct_Unnamed84 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed84 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLP_s = Struct_Unnamed84; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed85 { - pub _type: _u16, - pub id: _u16, - pub data: [_u32; 4usize], -} -impl ::std::clone::Clone for Struct_Unnamed85 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed85 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLE_constEntry_s = Struct_Unnamed85; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed86 { - pub _type: _u16, - pub regID: _u16, - pub mask: _u8, - pub unk: [_u8; 3usize], -} -impl ::std::clone::Clone for Struct_Unnamed86 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed86 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLE_outEntry_s = Struct_Unnamed86; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed87 { - pub symbolOffset: _u32, - pub startReg: _u16, - pub endReg: _u16, -} -impl ::std::clone::Clone for Struct_Unnamed87 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed87 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLE_uniformEntry_s = Struct_Unnamed87; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed88 { - 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 ::libc::c_char, - pub outmapMask: _u8, - pub outmapData: [_u32; 8usize], -} -impl ::std::clone::Clone for Struct_Unnamed88 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed88 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLE_s = Struct_Unnamed88; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed89 { - pub numDVLE: _u32, - pub DVLP: DVLP_s, - pub DVLE: *mut DVLE_s, -} -impl ::std::clone::Clone for Struct_Unnamed89 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed89 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type DVLB_s = Struct_Unnamed89; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed90 { - pub id: _u32, - pub data: [_u32; 3usize], -} -impl ::std::clone::Clone for Struct_Unnamed90 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed90 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type float24Uniform_s = Struct_Unnamed90; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed91 { - pub dvle: *mut DVLE_s, - pub boolUniforms: _u16, - pub intUniforms: [_u32; 4usize], - pub float24Uniforms: *mut float24Uniform_s, - pub numFloat24Uniforms: _u8, -} -impl ::std::clone::Clone for Struct_Unnamed91 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed91 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type shaderInstance_s = Struct_Unnamed91; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed92 { - pub vertexShader: *mut shaderInstance_s, - pub geometryShader: *mut shaderInstance_s, - pub geometryShaderInputStride: _u8, -} -impl ::std::clone::Clone for Struct_Unnamed92 { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for Struct_Unnamed92 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -pub type shaderProgram_s = Struct_Unnamed92; -extern "C" { - pub static mut gfxTopLeftFramebuffers: [*mut _u8; 2usize]; - pub static mut gfxTopRightFramebuffers: [*mut _u8; 2usize]; - pub static mut gfxBottomFramebuffers: [*mut _u8; 2usize]; - pub static mut gxCmdBuf: *mut _u32; - pub static mut aptEvents: [Handle; 3usize]; - pub static mut csndSharedMem: *mut vu32; - pub static mut csndSharedMemSize: _u32; - pub static mut csndChannels: _u32; - pub static mut hidMemHandle: Handle; - pub static mut hidSharedMem: *mut vu32; - pub static mut irrstMemHandle: Handle; - pub static mut irrstSharedMem: *mut vu32; -} -extern "C" { - pub fn svcControlMemory(addr_out: *mut _u32, addr0: _u32, addr1: _u32, - size: _u32, op: MemOp, perm: MemPerm) -> s32; - pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: _u32) - -> s32; - pub fn svcExitProcess() -> (); - pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc, - arg: _u32, stack_top: *mut _u32, - thread_priority: s32, processor_id: s32) -> s32; - pub fn svcExitThread() -> (); - pub fn svcSleepThread(ns: s64) -> (); - pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> s32; - pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> s32; - pub fn svcReleaseMutex(handle: Handle) -> s32; - pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32, - max_count: s32) -> s32; - pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle, - release_count: s32) -> s32; - pub fn svcCreateEvent(event: *mut Handle, reset_type: _u8) -> s32; - pub fn svcSignalEvent(handle: Handle) -> s32; - pub fn svcClearEvent(handle: Handle) -> s32; - pub fn svcCreateTimer(timer: *mut Handle, reset_type: _u8) -> s32; - pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> s32; - pub fn svcCancelTimer(timer: Handle) -> s32; - pub fn svcClearTimer(timer: Handle) -> s32; - pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: _u32, size: _u32, - my_perm: MemPerm, other_perm: MemPerm) -> s32; - pub fn svcMapMemoryBlock(memblock: Handle, addr: _u32, my_perm: MemPerm, - other_perm: MemPerm) -> s32; - pub fn svcUnmapMemoryBlock(memblock: Handle, addr: _u32) -> s32; - pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> s32; - pub fn svcArbitrateAddress(arbiter: Handle, addr: _u32, - _type: ArbitrationType, value: s32, - nanoseconds: s64) -> s32; - pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> s32; - pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle, - handles_num: s32, wait_all: u8, - nanoseconds: s64) -> s32; - pub fn svcCloseHandle(handle: Handle) -> s32; - pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> s32; - pub fn svcGetSystemTick() -> u64; - pub fn svcGetSystemInfo(out: *mut s64, _type: _u32, param: s32) -> s32; - pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: _u32) - -> s32; - pub fn svcConnectToPort(out: *mut Handle, portName: *const ::libc::c_char) - -> s32; - pub fn svcSendSyncRequest(session: Handle) -> s32; - pub fn svcOpenProcess(process: *mut Handle, processId: _u32) -> Result; - pub fn svcGetProcessId(out: *mut _u32, handle: Handle) -> s32; - pub fn svcGetThreadId(out: *mut _u32, handle: Handle) -> s32; - pub fn svcOutputDebugString(str: *const ::libc::c_char, - length: ::libc::c_int) -> s32; - pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle, - name: *const ::libc::c_char, maxSessions: s32) - -> 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 svcGetProcessList(processCount: *mut s32, processIds: *mut _u32, - processIdMaxCount: s32) -> Result; - pub fn svcReadProcessMemory(buffer: *mut ::libc::c_void, debug: Handle, - addr: _u32, size: _u32) -> Result; - pub fn svcMapProcessMemory(process: Handle, startAddr: _u32, - endAddr: _u32) -> Result; - pub fn svcUnmapProcessMemory(process: Handle, startAddr: _u32, - endAddr: _u32) -> Result; - pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo, - process: Handle, addr: _u32) -> Result; - pub fn svcGetProcessorID() -> s32; - pub fn srvInit() -> Result; - pub fn srvExit() -> Result; - pub fn srvRegisterClient() -> Result; - pub fn srvGetServiceHandle(out: *mut Handle, name: *const ::libc::c_char) - -> Result; - pub fn srvPmInit() -> Result; - pub fn srvRegisterProcess(procid: _u32, count: _u32, - serviceaccesscontrol: *mut ::libc::c_void) - -> Result; - pub fn srvUnregisterProcess(procid: _u32) -> Result; - pub fn linearAlloc(size: size_t) -> *mut ::libc::c_void; - pub fn linearMemAlign(size: size_t, alignment: size_t) - -> *mut ::libc::c_void; - pub fn linearRealloc(mem: *mut ::libc::c_void, size: size_t) - -> *mut ::libc::c_void; - pub fn linearFree(mem: *mut ::libc::c_void) -> (); - pub fn linearSpaceFree() -> _u32; - pub fn vramAlloc(size: size_t) -> *mut ::libc::c_void; - pub fn vramMemAlign(size: size_t, alignment: size_t) - -> *mut ::libc::c_void; - pub fn vramRealloc(mem: *mut ::libc::c_void, size: size_t) - -> *mut ::libc::c_void; - pub fn vramFree(mem: *mut ::libc::c_void) -> (); - pub fn vramSpaceFree() -> _u32; - pub fn osConvertVirtToPhys(vaddr: _u32) -> _u32; - pub fn osConvertOldLINEARMemToNew(addr: _u32) -> _u32; - pub fn osStrError(error: _u32) -> *const ::libc::c_char; - pub fn osGetFirmVersion() -> _u32; - pub fn osGetKernelVersion() -> _u32; - pub fn osGetTime() -> u64; - pub fn gspInit() -> Result; - pub fn gspExit() -> (); - pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8, - gspThreadId: _u8) -> Result; - pub fn gspExitEventHandler() -> (); - pub fn gspWaitForEvent(id: GSP_Event, nextEvent: u8) -> (); - pub fn GSPGPU_AcquireRight(handle: *mut Handle, flags: _u8) -> Result; - pub fn GSPGPU_ReleaseRight(handle: *mut Handle) -> Result; - pub fn GSPGPU_ImportDisplayCaptureInfo(handle: *mut Handle, - captureinfo: *mut GSP_CaptureInfo) - -> Result; - pub fn GSPGPU_SaveVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_RestoreVramSysArea(handle: *mut Handle) -> Result; - pub fn GSPGPU_SetLcdForceBlack(handle: *mut Handle, flags: _u8) -> Result; - pub fn GSPGPU_SetBufferSwap(handle: *mut Handle, screenid: _u32, - framebufinfo: *mut GSP_FramebufferInfo) - -> Result; - pub fn GSPGPU_FlushDataCache(handle: *mut Handle, adr: *mut _u8, - size: _u32) -> Result; - pub fn GSPGPU_InvalidateDataCache(handle: *mut Handle, adr: *mut _u8, - size: _u32) -> Result; - pub fn GSPGPU_WriteHWRegs(handle: *mut Handle, regAddr: _u32, - data: *mut _u32, size: _u8) -> Result; - pub fn GSPGPU_WriteHWRegsWithMask(handle: *mut Handle, regAddr: _u32, - data: *mut _u32, datasize: _u8, - maskdata: *mut _u32, masksize: _u8) - -> Result; - pub fn GSPGPU_ReadHWRegs(handle: *mut Handle, regAddr: _u32, - data: *mut _u32, size: _u8) -> Result; - pub fn GSPGPU_RegisterInterruptRelayQueue(handle: *mut Handle, - eventHandle: Handle, - flags: _u32, - outMemHandle: *mut Handle, - threadID: *mut _u8) -> Result; - pub fn GSPGPU_UnregisterInterruptRelayQueue(handle: *mut Handle) - -> Result; - pub fn GSPGPU_TriggerCmdReqQueue(handle: *mut Handle) -> Result; - pub fn GSPGPU_SubmitGxCommand(sharedGspCmdBuf: *mut _u32, - gxCommand: *mut _u32, handle: *mut Handle) - -> Result; - pub fn gfxInitDefault() -> (); - pub fn gfxInit(topFormat: GSP_FramebufferFormats, - bottomFormat: GSP_FramebufferFormats, vrambuffers: u8) - -> (); - pub fn gfxExit() -> (); - pub fn gfxSet3D(enable: u8) -> (); - pub fn gfxSetScreenFormat(screen: gfxScreen_t, - format: GSP_FramebufferFormats) -> (); - pub fn gfxGetScreenFormat(screen: gfxScreen_t) -> GSP_FramebufferFormats; - pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8) - -> (); - pub fn gfxFlushBuffers() -> (); - pub fn gfxSwapBuffers() -> (); - pub fn gfxSwapBuffersGpu() -> (); - pub fn gfxGetFramebuffer(screen: gfxScreen_t, side: gfx3dSide_t, - width: *mut _u16, height: *mut _u16) -> *mut _u8; - pub fn consoleSetFont(console: *mut PrintConsole, font: *mut ConsoleFont) - -> (); - pub fn consoleSetWindow(console: *mut PrintConsole, x: ::libc::c_int, - y: ::libc::c_int, width: ::libc::c_int, - height: ::libc::c_int) -> (); - 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() -> (); - pub fn decode_utf8(out: *mut uint32_t, _in: *const uint8_t) -> ssize_t; - pub fn decode_utf16(out: *mut uint32_t, _in: *const uint16_t) -> ssize_t; - pub fn encode_utf8(out: *mut uint8_t, _in: uint32_t) -> ssize_t; - pub fn encode_utf16(out: *mut uint16_t, _in: uint32_t) -> ssize_t; - pub fn utf8_to_utf16(out: *mut uint16_t, _in: *const uint8_t, len: size_t) - -> size_t; - pub fn utf8_to_utf32(out: *mut uint32_t, _in: *const uint8_t, len: size_t) - -> size_t; - pub fn utf16_to_utf8(out: *mut uint8_t, _in: *const uint16_t, len: size_t) - -> size_t; - pub fn utf16_to_utf32(out: *mut uint32_t, _in: *const uint16_t, - len: size_t) -> size_t; - pub fn utf32_to_utf8(out: *mut uint8_t, _in: *const uint32_t, len: size_t) - -> size_t; - pub fn utf32_to_utf16(out: *mut uint16_t, _in: *const uint32_t, - len: size_t) -> size_t; - pub fn acInit() -> Result; - pub fn acExit() -> Result; - pub fn ACU_GetWifiStatus(servhandle: *mut Handle, out: *mut _u32) - -> Result; - pub fn ACU_WaitInternetConnection() -> Result; - pub fn amInit() -> Result; - pub fn amExit() -> Result; - pub fn AM_GetTitleCount(mediatype: _u8, count: *mut _u32) -> Result; - pub fn AM_GetTitleIdList(mediatype: _u8, count: _u32, titleIDs: *mut u64) - -> Result; - pub fn AM_GetDeviceId(deviceID: *mut _u32) -> Result; - pub fn AM_ListTitles(mediatype: _u8, titleCount: _u32, - titleIdList: *mut u64, titleList: *mut TitleList) - -> Result; - pub fn AM_StartCiaInstall(mediatype: _u8, ciaHandle: *mut Handle) - -> Result; - pub fn AM_StartDlpChildCiaInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_CancelCIAInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_FinishCiaInstall(mediatype: _u8, ciaHandle: *mut Handle) - -> Result; - pub fn AM_DeleteTitle(mediatype: _u8, titleID: u64) -> Result; - pub fn AM_DeleteAppTitle(mediatype: _u8, titleID: u64) -> Result; - pub fn AM_InstallFIRM(titleID: u64) -> Result; - pub fn AM_GetTitleProductCode(mediatype: _u8, titleID: u64, - productCode: *mut ::libc::c_char) -> Result; - pub fn aptInit() -> Result; - pub fn aptExit() -> (); - pub fn aptOpenSession() -> (); - pub fn aptCloseSession() -> (); - pub fn aptSetStatus(status: APP_STATUS) -> (); - pub fn aptGetStatus() -> APP_STATUS; - pub fn aptGetStatusPower() -> _u32; - pub fn aptSetStatusPower(status: _u32) -> (); - pub fn aptReturnToMenu() -> (); - pub fn aptWaitStatusEvent() -> (); - pub fn aptSignalReadyForSleep() -> (); - pub fn aptGetMenuAppID() -> NS_APPID; - pub fn aptMainLoop() -> u8; - pub fn APT_GetLockHandle(handle: *mut Handle, flags: _u16, - lockHandle: *mut Handle) -> Result; - pub fn APT_Initialize(handle: *mut Handle, appId: NS_APPID, - eventHandle1: *mut Handle, - eventHandle2: *mut Handle) -> Result; - pub fn APT_HardwareResetAsync(handle: *mut Handle) -> Result; - pub fn APT_Enable(handle: *mut Handle, a: _u32) -> Result; - pub fn APT_GetAppletManInfo(handle: *mut Handle, inval: _u8, - outval8: *mut _u8, outval32: *mut _u32, - menu_appid: *mut NS_APPID, - active_appid: *mut NS_APPID) -> Result; - pub fn APT_PrepareToJumpToHomeMenu(handle: *mut Handle) -> Result; - pub fn APT_JumpToHomeMenu(handle: *mut Handle, a: _u32, b: _u32, c: _u32) - -> Result; - pub fn APT_IsRegistered(handle: *mut Handle, appID: NS_APPID, - out: *mut _u8) -> Result; - pub fn APT_InquireNotification(handle: *mut Handle, appID: _u32, - signalType: *mut _u8) -> Result; - pub fn APT_NotifyToWait(handle: *mut Handle, appID: NS_APPID) -> Result; - pub fn APT_AppletUtility(handle: *mut Handle, out: *mut _u32, a: _u32, - size1: _u32, buf1: *mut _u8, size2: _u32, - buf2: *mut _u8) -> Result; - pub fn APT_GlanceParameter(handle: *mut Handle, appID: NS_APPID, - bufferSize: _u32, buffer: *mut _u32, - actualSize: *mut _u32, signalType: *mut _u8) - -> Result; - pub fn APT_ReceiveParameter(handle: *mut Handle, appID: NS_APPID, - bufferSize: _u32, buffer: *mut _u32, - actualSize: *mut _u32, signalType: *mut _u8) - -> Result; - pub fn APT_SendParameter(handle: *mut Handle, src_appID: NS_APPID, - dst_appID: NS_APPID, bufferSize: _u32, - buffer: *mut _u32, paramhandle: Handle, - signalType: _u8) -> Result; - pub fn APT_SendCaptureBufferInfo(handle: *mut Handle, bufferSize: _u32, - buffer: *mut _u32) -> Result; - pub fn APT_ReplySleepQuery(handle: *mut Handle, appID: NS_APPID, a: _u32) - -> Result; - pub fn APT_ReplySleepNotificationComplete(handle: *mut Handle, - appID: NS_APPID) -> Result; - pub fn APT_PrepareToCloseApplication(handle: *mut Handle, a: _u8) - -> Result; - pub fn APT_CloseApplication(handle: *mut Handle, a: _u32, b: _u32, - c: _u32) -> Result; - pub fn APT_SetAppCpuTimeLimit(handle: *mut Handle, percent: _u32) - -> Result; - pub fn APT_GetAppCpuTimeLimit(handle: *mut Handle, percent: *mut _u32) - -> Result; - pub fn APT_CheckNew3DS_Application(handle: *mut Handle, out: *mut _u8) - -> Result; - pub fn APT_CheckNew3DS_System(handle: *mut Handle, out: *mut _u8) - -> Result; - pub fn APT_CheckNew3DS(handle: *mut Handle, out: *mut _u8) -> Result; - pub fn APT_PrepareToDoAppJump(handle: *mut Handle, flags: _u8, - programID: u64, mediatype: _u8) -> Result; - pub fn APT_DoAppJump(handle: *mut Handle, NSbuf0Size: _u32, - NSbuf1Size: _u32, NSbuf0Ptr: *mut _u8, - NSbuf1Ptr: *mut _u8) -> Result; - pub fn APT_PrepareToStartLibraryApplet(handle: *mut Handle, - appID: NS_APPID) -> Result; - pub fn APT_StartLibraryApplet(handle: *mut Handle, appID: NS_APPID, - inhandle: Handle, parambuf: *mut _u32, - parambufsize: _u32) -> Result; - pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, - parambuf: *mut _u32, parambufsize: _u32) - -> Result; - pub fn APT_PrepareToStartSystemApplet(handle: *mut Handle, - appID: NS_APPID) -> Result; - pub fn APT_StartSystemApplet(handle: *mut Handle, appID: NS_APPID, - bufSize: _u32, applHandle: Handle, - buf: *mut _u8) -> Result; - pub fn CFGNOR_Initialize(value: _u8) -> Result; - pub fn CFGNOR_Shutdown() -> Result; - pub fn CFGNOR_ReadData(offset: _u32, buf: *mut _u32, size: _u32) - -> Result; - pub fn CFGNOR_WriteData(offset: _u32, buf: *mut _u32, size: _u32) - -> Result; - pub fn CFGNOR_DumpFlash(buf: *mut _u32, size: _u32) -> Result; - pub fn CFGNOR_WriteFlash(buf: *mut _u32, size: _u32) -> Result; - pub fn initCfgu() -> Result; - pub fn exitCfgu() -> Result; - pub fn CFGU_SecureInfoGetRegion(region: *mut _u8) -> Result; - pub fn CFGU_GenHashConsoleUnique(appIDSalt: _u32, hash: *mut u64) - -> Result; - pub fn CFGU_GetRegionCanadaUSA(value: *mut _u8) -> Result; - pub fn CFGU_GetSystemModel(model: *mut _u8) -> Result; - pub fn CFGU_GetModelNintendo2DS(value: *mut _u8) -> Result; - pub fn CFGU_GetCountryCodeString(code: _u16, string: *mut _u16) -> Result; - pub fn CFGU_GetCountryCodeID(string: _u16, code: *mut _u16) -> Result; - pub fn CFGU_GetConfigInfoBlk2(size: _u32, blkID: _u32, outData: *mut _u8) - -> Result; - pub fn CFGU_GetSystemLanguage(language: *mut _u8) -> Result; - pub fn CSND_AcquireCapUnit(capUnit: *mut _u32) -> Result; - pub fn CSND_ReleaseCapUnit(capUnit: _u32) -> Result; - pub fn csndInit() -> Result; - pub fn csndExit() -> Result; - pub fn csndWriteCmd(cmdid: ::libc::c_int, cmdparams: *mut _u8) -> (); - pub fn csndExecCmds(waitDone: u8) -> Result; - pub fn CSND_SetPlayStateR(channel: _u32, value: _u32) -> (); - pub fn CSND_SetPlayState(channel: _u32, value: _u32) -> (); - pub fn CSND_SetBlock(channel: _u32, block: ::libc::c_int, physaddr: _u32, - size: _u32) -> (); - pub fn CSND_SetVol(channel: _u32, left: _u16, right: _u16) -> (); - pub fn CSND_SetTimer(channel: _u32, timer: _u32) -> (); - pub fn CSND_SetDuty(channel: _u32, duty: _u32) -> (); - pub fn CSND_SetAdpcmState(channel: _u32, block: ::libc::c_int, - sample: ::libc::c_int, index: ::libc::c_int) - -> (); - pub fn CSND_SetAdpcmReload(channel: _u32, reload: u8) -> (); - pub fn CSND_SetChnRegs(flags: _u32, physaddr0: _u32, physaddr1: _u32, - totalbytesize: _u32) -> (); - pub fn CSND_CapEnable(capUnit: _u32, enable: u8) -> (); - pub fn CSND_CapSetBit(capUnit: _u32, bit: ::libc::c_int, state: u8) -> (); - pub fn CSND_CapSetTimer(capUnit: _u32, timer: _u32) -> (); - pub fn CSND_CapSetBuffer(capUnit: _u32, paddr: _u32, size: _u32) -> (); - pub fn CSND_UpdateInfo(waitDone: u8) -> Result; - pub fn csndPlaySound(chn: ::libc::c_int, flags: _u32, sampleRate: _u32, - data0: *mut ::libc::c_void, - data1: *mut ::libc::c_void, size: _u32) -> Result; - pub fn csndGetChnInfo(channel: _u32) -> *mut CSND_ChnInfo; - pub fn csndGetState(channel: _u32, out: *mut CSND_ChnInfo) -> Result; - pub fn csndIsPlaying(channel: _u32, status: *mut _u8) -> Result; - pub fn fsInit() -> Result; - pub fn fsExit() -> Result; - pub fn FS_makePath(_type: FS_pathType, path: *const ::libc::c_char) - -> FS_path; - pub fn FSUSER_Initialize(handle: *mut Handle) -> Result; - pub fn FSUSER_OpenArchive(handle: *mut Handle, archive: *mut FS_archive) - -> Result; - pub fn FSUSER_OpenDirectory(handle: *mut Handle, out: *mut Handle, - archive: FS_archive, dirLowPath: FS_path) - -> Result; - pub fn FSUSER_OpenFile(handle: *mut Handle, out: *mut Handle, - archive: FS_archive, fileLowPath: FS_path, - openflags: _u32, attributes: _u32) -> Result; - pub fn FSUSER_OpenFileDirectly(handle: *mut Handle, out: *mut Handle, - archive: FS_archive, fileLowPath: FS_path, - openflags: _u32, attributes: _u32) - -> Result; - pub fn FSUSER_CloseArchive(handle: *mut Handle, archive: *mut FS_archive) - -> Result; - pub fn FSUSER_CreateFile(handle: *mut Handle, archive: FS_archive, - fileLowPath: FS_path, fileSize: _u32) -> Result; - pub fn FSUSER_CreateDirectory(handle: *mut Handle, archive: FS_archive, - dirLowPath: FS_path) -> Result; - pub fn FSUSER_DeleteFile(handle: *mut Handle, archive: FS_archive, - fileLowPath: FS_path) -> Result; - pub fn FSUSER_DeleteDirectory(handle: *mut Handle, archive: FS_archive, - dirLowPath: FS_path) -> Result; - pub fn FSUSER_RenameFile(handle: *mut Handle, srcArchive: FS_archive, - srcFileLowPath: FS_path, destArchive: FS_archive, - destFileLowPath: FS_path) -> Result; - pub fn FSUSER_RenameDirectory(handle: *mut Handle, srcArchive: FS_archive, - srcDirLowPath: FS_path, - destArchive: FS_archive, - destDirLowPath: FS_path) -> Result; - pub fn FSUSER_GetSdmcArchiveResource(handle: *mut Handle, - sectorSize: *mut _u32, - clusterSize: *mut _u32, - numClusters: *mut _u32, - freeClusters: *mut _u32) -> Result; - pub fn FSUSER_GetNandArchiveResource(handle: *mut Handle, - sectorSize: *mut _u32, - clusterSize: *mut _u32, - numClusters: *mut _u32, - freeClusters: *mut _u32) -> Result; - pub fn FSUSER_IsSdmcDetected(handle: *mut Handle, detected: *mut _u8) - -> Result; - pub fn FSUSER_IsSdmcWritable(handle: *mut Handle, writable: *mut _u8) - -> Result; - pub fn FSFILE_Close(handle: Handle) -> Result; - pub fn FSFILE_Read(handle: Handle, bytesRead: *mut _u32, offset: u64, - buffer: *mut ::libc::c_void, size: _u32) -> Result; - pub fn FSFILE_Write(handle: Handle, bytesWritten: *mut _u32, offset: u64, - buffer: *const ::libc::c_void, size: _u32, - flushFlags: _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_Flush(handle: Handle) -> Result; - pub fn FSDIR_Read(handle: Handle, entriesRead: *mut _u32, - entrycount: _u32, buffer: *mut FS_dirent) -> Result; - pub fn FSDIR_Close(handle: Handle) -> Result; - pub fn hidInit(sharedMem: *mut _u32) -> Result; - pub fn hidExit() -> (); - pub fn hidScanInput() -> (); - pub fn hidKeysHeld() -> _u32; - pub fn hidKeysDown() -> _u32; - pub fn hidKeysUp() -> _u32; - pub fn hidTouchRead(pos: *mut touchPosition) -> (); - pub fn hidCircleRead(pos: *mut circlePosition) -> (); - pub fn hidAccelRead(vector: *mut accelVector) -> (); - pub fn hidGyroRead(rate: *mut angularRate) -> (); - pub fn hidWaitForEvent(id: HID_Event, nextEvent: u8) -> (); - pub fn HIDUSER_GetHandles(outMemHandle: *mut Handle, - eventpad0: *mut Handle, eventpad1: *mut Handle, - eventaccel: *mut Handle, eventgyro: *mut Handle, - eventdebugpad: *mut Handle) -> Result; - pub fn HIDUSER_EnableAccelerometer() -> Result; - pub fn HIDUSER_DisableAccelerometer() -> Result; - pub fn HIDUSER_EnableGyroscope() -> Result; - pub fn HIDUSER_DisableGyroscope() -> Result; - pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: - *mut ::libc::c_float) - -> Result; - pub fn HIDUSER_GetSoundVolume(volume: *mut _u8) -> Result; - pub fn irrstInit(sharedMem: *mut _u32) -> Result; - pub fn irrstExit() -> (); - pub fn irrstScanInput() -> (); - pub fn irrstKeysHeld() -> _u32; - pub fn irrstCstickRead(pos: *mut circlePosition) -> (); - pub fn irrstWaitForEvent(nextEvent: u8) -> (); - pub fn IRRST_GetHandles(outMemHandle: *mut Handle, - outEventHandle: *mut Handle) -> Result; - pub fn IRRST_Initialize(unk1: _u32, unk2: _u8) -> Result; - pub fn IRRST_Shutdown() -> Result; - pub fn httpcInit() -> Result; - pub fn httpcExit() -> (); - pub fn httpcOpenContext(context: *mut httpcContext, - url: *mut ::libc::c_char, use_defaultproxy: _u32) - -> Result; - pub fn httpcCloseContext(context: *mut httpcContext) -> 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 httpcReqStatus) -> 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 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 ::libc::c_char, - 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 ::libc::c_char, - value: *mut ::libc::c_char) -> 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 httpcReqStatus) -> Result; - pub fn HTTPC_GetDownloadSizeState(handle: Handle, contextHandle: Handle, - downloadedsize: *mut _u32, - contentsize: *mut _u32) -> Result; - pub fn HTTPC_GetResponseStatusCode(handle: Handle, contextHandle: Handle, - out: *mut _u32) -> Result; - pub fn IRU_Initialize(sharedmem_addr: *mut _u32, sharedmem_size: _u32) - -> Result; - pub fn IRU_Shutdown() -> Result; - pub fn IRU_GetServHandle() -> Handle; - pub fn IRU_SendData(buf: *mut _u8, size: _u32, wait: _u32) -> Result; - pub fn IRU_RecvData(buf: *mut _u8, size: _u32, flag: _u8, - transfercount: *mut _u32, wait: _u32) -> Result; - pub fn IRU_SetBitRate(value: _u8) -> Result; - pub fn IRU_GetBitRate(out: *mut _u8) -> Result; - pub fn IRU_SetIRLEDState(value: _u32) -> Result; - pub fn IRU_GetIRLEDRecvState(out: *mut _u32) -> Result; - pub fn nsInit() -> Result; - pub fn nsExit() -> Result; - pub fn NS_LaunchTitle(titleid: u64, launch_flags: _u32, procid: *mut _u32) - -> Result; - pub fn NS_RebootToTitle(mediatype: _u8, titleid: u64) -> Result; - pub fn pmInit() -> Result; - pub fn pmExit() -> Result; - pub fn PM_LaunchTitle(mediatype: _u8, titleid: u64, launch_flags: _u32) - -> Result; - pub fn PM_GetTitleExheaderFlags(mediatype: _u8, titleid: u64, - out: *mut _u8) -> Result; - pub fn PM_SetFIRMLaunchParams(size: _u32, _in: *mut _u8) -> Result; - pub fn PM_GetFIRMLaunchParams(size: _u32, out: *mut _u8) -> Result; - pub fn PM_LaunchFIRMSetParams(firm_titleid_low: _u32, size: _u32, - _in: *mut _u8) -> Result; - pub fn psInit() -> Result; - pub fn psExit() -> Result; - pub fn PS_EncryptDecryptAes(size: _u32, _in: *mut _u8, out: *mut _u8, - aes_algo: _u32, key_type: _u32, 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: _u32, - key_type: _u32, nonce: *mut _u8) - -> Result; - pub fn PS_GetLocalFriendCodeSeed(seed: *mut u64) -> Result; - pub fn PS_GetDeviceId(device_id: *mut _u32) -> Result; - pub fn ptmInit() -> Result; - pub fn ptmExit() -> Result; - pub fn PTMU_GetShellState(servhandle: *mut Handle, out: *mut _u8) - -> Result; - pub fn PTMU_GetBatteryLevel(servhandle: *mut Handle, out: *mut _u8) - -> Result; - pub fn PTMU_GetBatteryChargeState(servhandle: *mut Handle, out: *mut _u8) - -> Result; - pub fn PTMU_GetPedometerState(servhandle: *mut Handle, out: *mut _u8) - -> Result; - pub fn PTMU_GetTotalStepCount(servhandle: *mut Handle, steps: *mut _u32) - -> Result; - pub fn SOC_Initialize(context_addr: *mut _u32, context_size: _u32) - -> Result; - pub fn SOC_Shutdown() -> Result; - pub fn gethostid() -> ::libc::c_long; - pub fn MIC_Initialize(sharedmem: *mut _u32, sharedmem_size: _u32, - control: _u8, recording: _u8, unk0: _u8, unk1: _u8, - unk2: _u8) -> Result; - pub fn MIC_Shutdown() -> Result; - pub fn MIC_GetSharedMemOffsetValue() -> _u32; - pub fn MIC_ReadAudioData(outbuf: *mut _u8, readsize: _u32, - waitforevent: _u32) -> _u32; - pub fn MIC_MapSharedMem(handle: Handle, size: _u32) -> Result; - pub fn MIC_UnmapSharedMem() -> Result; - pub fn MIC_cmd3_Initialize(unk0: _u8, unk1: _u8, - sharedmem_baseoffset: _u32, - sharedmem_endoffset: _u32, unk2: _u8) - -> Result; - pub fn MIC_cmd5() -> Result; - pub fn MIC_GetCNTBit15(out: *mut _u8) -> Result; - pub fn MIC_GetEventHandle(handle: *mut Handle) -> Result; - pub fn MIC_SetControl(value: _u8) -> Result; - pub fn MIC_GetControl(value: *mut _u8) -> Result; - pub fn MIC_SetRecording(value: _u8) -> Result; - pub fn MIC_IsRecoding(value: *mut _u8) -> Result; - pub fn mvdstdGenerateDefaultConfig(config: *mut mvdstdConfig, - 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 mvdstdInit(mode: mvdstdMode, input_type: mvdstdTypeInput, - output_type: mvdstdTypeOutput, size: _u32) -> Result; - pub fn mvdstdShutdown() -> Result; - pub fn mvdstdSetConfig(config: *mut mvdstdConfig) -> Result; - pub fn mvdstdProcessFrame(config: *mut mvdstdConfig, - h264_vaddr_inframe: *mut _u32, - h264_inframesize: _u32, h264_frameid: _u32) - -> Result; - pub fn qtmInit() -> Result; - pub fn qtmExit() -> (); - pub fn qtmCheckInitialized() -> u8; - pub fn qtmGetHeadtrackingInfo(val: u64, out: *mut qtmHeadtrackingInfo) - -> Result; - pub fn qtmCheckHeadFullyDetected(info: *mut qtmHeadtrackingInfo) -> u8; - pub fn qtmConvertCoordToScreen(coord: *mut qtmHeadtrackingInfoCoord, - screen_width: *mut ::libc::c_float, - screen_height: *mut ::libc::c_float, - x: *mut _u32, y: *mut _u32) -> Result; - pub fn hbInit() -> Result; - pub fn hbExit() -> (); - pub fn HB_FlushInvalidateCache() -> Result; - pub fn HB_GetBootloaderAddresses(load3dsx: *mut *mut ::libc::c_void, - setArgv: *mut *mut ::libc::c_void) - -> Result; - pub fn HB_ReprotectMemory(addr: *mut _u32, pages: _u32, mode: _u32, - reprotectedPages: *mut _u32) -> Result; - pub fn GX_RequestDma(gxbuf: *mut _u32, src: *mut _u32, dst: *mut _u32, - length: _u32) -> Result; - pub fn GX_SetCommandList_Last(gxbuf: *mut _u32, buf0a: *mut _u32, - buf0s: _u32, flags: _u8) -> Result; - pub fn GX_SetMemoryFill(gxbuf: *mut _u32, buf0a: *mut _u32, buf0v: _u32, - buf0e: *mut _u32, width0: _u16, buf1a: *mut _u32, - buf1v: _u32, buf1e: *mut _u32, width1: _u16) - -> Result; - pub fn GX_SetDisplayTransfer(gxbuf: *mut _u32, inadr: *mut _u32, - indim: _u32, outadr: *mut _u32, outdim: _u32, - flags: _u32) -> Result; - pub fn GX_SetTextureCopy(gxbuf: *mut _u32, inadr: *mut _u32, indim: _u32, - outadr: *mut _u32, outdim: _u32, size: _u32, - flags: _u32) -> Result; - pub fn GX_SetCommandList_First(gxbuf: *mut _u32, buf0a: *mut _u32, - buf0s: _u32, buf1a: *mut _u32, buf1s: _u32, - buf2a: *mut _u32, buf2s: _u32) -> Result; - pub fn GPU_Init(gsphandle: *mut Handle) -> (); - pub fn GPU_Reset(gxbuf: *mut _u32, gpuBuf: *mut _u32, gpuBufSize: _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(gxbuf: *mut _u32) -> (); - pub fn GPUCMD_FlushAndRun(gxbuf: *mut _u32) -> (); - pub fn GPUCMD_Add(header: _u32, param: *mut _u32, paramlength: _u32) - -> (); - pub fn GPUCMD_Finalize() -> (); - pub fn GPU_SetFloatUniform(_type: GPU_SHADER_TYPE, startreg: _u32, - data: *mut _u32, numreg: _u32) -> (); - pub fn GPU_SetViewport(depthBuffer: *mut _u32, colorBuffer: *mut _u32, - x: _u32, y: _u32, w: _u32, h: _u32) -> (); - pub fn GPU_SetScissorTest(mode: GPU_SCISSORMODE, x: _u32, y: _u32, - w: _u32, h: _u32) -> (); - pub fn GPU_DepthMap(zScale: ::libc::c_float, zOffset: ::libc::c_float) - -> (); - pub fn GPU_SetAlphaTest(enable: u8, function: GPU_TESTFUNC, _ref: _u8) - -> (); - pub fn GPU_SetDepthTestAndWriteMask(enable: u8, function: GPU_TESTFUNC, - writemask: GPU_WRITEMASK) -> (); - pub fn GPU_SetStencilTest(enable: u8, function: GPU_TESTFUNC, _ref: _u8, - mask: _u8, replace: _u8) -> (); - pub fn GPU_SetStencilOp(sfail: GPU_STENCILOP, dfail: GPU_STENCILOP, - pass: GPU_STENCILOP) -> (); - pub fn GPU_SetFaceCulling(mode: GPU_CULLMODE) -> (); - pub fn GPU_SetAlphaBlending(colorEquation: GPU_BLENDEQUATION, - alphaEquation: GPU_BLENDEQUATION, - colorSrc: GPU_BLENDFACTOR, - colorDst: GPU_BLENDFACTOR, - alphaSrc: GPU_BLENDFACTOR, - alphaDst: GPU_BLENDFACTOR) -> (); - pub fn GPU_SetColorLogicOp(op: GPU_LOGICOP) -> (); - pub fn GPU_SetBlendingColor(r: _u8, g: _u8, b: _u8, a: _u8) -> (); - pub fn GPU_SetAttributeBuffers(totalAttributes: _u8, - baseAddress: *mut _u32, - attributeFormats: u64, attributeMask: _u16, - attributePermutation: u64, numBuffers: _u8, - bufferOffsets: *mut _u32, - bufferPermutations: *mut u64, - bufferNumAttributes: *mut _u8) -> (); - pub fn GPU_SetTextureEnable(units: GPU_TEXUNIT) -> (); - pub fn GPU_SetTexture(unit: GPU_TEXUNIT, data: *mut _u32, width: _u16, - height: _u16, param: _u32, colorType: GPU_TEXCOLOR) - -> (); - pub fn GPU_SetTexEnv(id: _u8, rgbSources: _u16, alphaSources: _u16, - rgbOperands: _u16, alphaOperands: _u16, - rgbCombine: GPU_COMBINEFUNC, - alphaCombine: GPU_COMBINEFUNC, constantColor: _u32) - -> (); - pub fn GPU_DrawArray(primitive: GPU_Primitive_t, n: _u32) -> (); - pub fn GPU_DrawElements(primitive: GPU_Primitive_t, indexArray: *mut _u32, - n: _u32) -> (); - pub fn GPU_FinishDrawing() -> (); - pub fn GPU_SetShaderOutmap(outmapData: *mut _u32) -> (); - pub fn GPU_SendShaderCode(_type: GPU_SHADER_TYPE, data: *mut _u32, - offset: _u16, length: _u16) -> (); - pub fn GPU_SendOperandDescriptors(_type: GPU_SHADER_TYPE, data: *mut _u32, - offset: _u16, length: _u16) -> (); - 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 ::libc::c_char) -> s8; - pub fn DVLE_GenerateOutmap(dvle: *mut DVLE_s) -> (); - 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: ::libc::c_int, - value: u8) -> Result; - pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, id: ::libc::c_int, - value: *mut u8) -> Result; - pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s, - name: *const ::libc::c_char) - -> Result; - 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 shaderProgramUse(sp: *mut shaderProgram_s) -> Result; - pub fn sdmcInit() -> Result; - pub fn sdmcExit() -> Result; -} diff --git a/src/lib.rs b/src/lib.rs index 3ba65e4..9d9cbd5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,9 +5,6 @@ extern crate ctru_sys as libctru; -pub type Result = i32; -pub type Handle = u32; - pub mod srv; pub mod gfx; pub mod sdmc; diff --git a/src/services/apt.rs b/src/services/apt.rs index 68da008..5d3f04f 100644 --- a/src/services/apt.rs +++ b/src/services/apt.rs @@ -14,36 +14,36 @@ pub enum AppStatus { AppletClosed } -impl From for apt::APP_STATUS { - fn from(a: AppStatus) -> apt::APP_STATUS { +impl From for apt::APT_AppStatus { + fn from(a: AppStatus) -> apt::APT_AppStatus { use self::AppStatus::*; match a { - NotInitialized => apt::APP_STATUS::APP_NOTINITIALIZED, - Running => apt::APP_STATUS::APP_RUNNING, - Suspended => apt::APP_STATUS::APP_SUSPENDED, - Exiting => apt::APP_STATUS::APP_EXITING, - Suspending => apt::APP_STATUS::APP_SUSPENDING, - SleepMode => apt::APP_STATUS::APP_SLEEPMODE, - PrepareSleepMode => apt::APP_STATUS::APP_PREPARE_SLEEPMODE, - AppletStarted => apt::APP_STATUS::APP_APPLETSTARTED, - AppletClosed => apt::APP_STATUS::APP_APPLETCLOSED, + NotInitialized => apt::APT_AppStatus::APP_NOTINITIALIZED, + Running => apt::APT_AppStatus::APP_RUNNING, + Suspended => apt::APT_AppStatus::APP_SUSPENDED, + Exiting => apt::APT_AppStatus::APP_EXITING, + Suspending => apt::APT_AppStatus::APP_SUSPENDING, + SleepMode => apt::APT_AppStatus::APP_SLEEPMODE, + PrepareSleepMode => apt::APT_AppStatus::APP_PREPARE_SLEEPMODE, + AppletStarted => apt::APT_AppStatus::APP_APPLETSTARTED, + AppletClosed => apt::APT_AppStatus::APP_APPLETCLOSED, } } } -impl From for AppStatus { - fn from(a: apt::APP_STATUS) -> AppStatus { +impl From for AppStatus { + fn from(a: apt::APT_AppStatus) -> AppStatus { use self::AppStatus::*; match a { - apt::APP_STATUS::APP_NOTINITIALIZED => NotInitialized, - apt::APP_STATUS::APP_RUNNING => Running, - apt::APP_STATUS::APP_SUSPENDED => Suspended, - apt::APP_STATUS::APP_EXITING => Exiting, - apt::APP_STATUS::APP_SUSPENDING => Suspending, - apt::APP_STATUS::APP_SLEEPMODE => SleepMode, - apt::APP_STATUS::APP_PREPARE_SLEEPMODE => PrepareSleepMode, - apt::APP_STATUS::APP_APPLETSTARTED => AppletStarted, - apt::APP_STATUS::APP_APPLETCLOSED => AppletClosed + apt::APT_AppStatus::APP_NOTINITIALIZED => NotInitialized, + apt::APT_AppStatus::APP_RUNNING => Running, + apt::APT_AppStatus::APP_SUSPENDED => Suspended, + apt::APT_AppStatus::APP_EXITING => Exiting, + apt::APT_AppStatus::APP_SUSPENDING => Suspending, + apt::APT_AppStatus::APP_SLEEPMODE => SleepMode, + apt::APT_AppStatus::APP_PREPARE_SLEEPMODE => PrepareSleepMode, + apt::APT_AppStatus::APP_APPLETSTARTED => AppletStarted, + apt::APT_AppStatus::APP_APPLETCLOSED => AppletClosed } } } diff --git a/src/services/gsp.rs b/src/services/gsp.rs index 8b4b7f3..722bab6 100644 --- a/src/services/gsp.rs +++ b/src/services/gsp.rs @@ -1,4 +1,4 @@ -use libctru::services::gsp; +use libctru::services::gspgpu; use core::convert::From; @@ -34,9 +34,9 @@ impl FramebufferFormat { } } -impl From for FramebufferFormat { - #[inline] fn from(g: gsp::GSP_FramebufferFormats) -> FramebufferFormat { - use libctru::services::gsp::GSP_FramebufferFormats::*; +impl From for FramebufferFormat { + #[inline] fn from(g: gspgpu::GSPGPU_FramebufferFormats) -> FramebufferFormat { + use libctru::services::gspgpu::GSPGPU_FramebufferFormats::*; use self::FramebufferFormat::*; match g { GSP_RGBA8_OES => Rgba8, @@ -48,9 +48,9 @@ impl From for FramebufferFormat { } } -impl From for gsp::GSP_FramebufferFormats { - #[inline] fn from(g: FramebufferFormat) -> gsp::GSP_FramebufferFormats { - use libctru::services::gsp::GSP_FramebufferFormats::*; +impl From for gspgpu::GSPGPU_FramebufferFormats { + #[inline] fn from(g: FramebufferFormat) -> gspgpu::GSPGPU_FramebufferFormats { + use libctru::services::gspgpu::GSPGPU_FramebufferFormats::*; use self::FramebufferFormat::*; match g { Rgba8 => GSP_RGBA8_OES, @@ -62,18 +62,18 @@ impl From for gsp::GSP_FramebufferFormats { } } -fn to_raw_event(ev: Event) -> gsp::GSP_Event { - use libctru::services::gsp::GSP_Event::*; +fn to_raw_event(ev: Event) -> gspgpu::GSPGPU_Event { + use libctru::services::gspgpu::GSPGPU_Event::*; use self::Event::*; match ev { - Psc0 => GSPEVENT_PSC0, - Psc1 => GSPEVENT_PSC1, - VBlank0 => GSPEVENT_VBlank0, - VBlank1 => GSPEVENT_VBlank1, - PPF => GSPEVENT_PPF, - P3D => GSPEVENT_P3D, - DMA => GSPEVENT_DMA + Psc0 => GSPGPU_EVENT_PSC0, + Psc1 => GSPGPU_EVENT_PSC1, + VBlank0 => GSPGPU_EVENT_VBlank0, + VBlank1 => GSPGPU_EVENT_VBlank1, + PPF => GSPGPU_EVENT_PPF, + P3D => GSPGPU_EVENT_P3D, + DMA => GSPGPU_EVENT_DMA } } @@ -91,6 +91,6 @@ fn to_raw_event(ev: Event) -> gsp::GSP_Event { pub fn wait_for_event(ev: Event) -> () { unsafe { // TODO second argument? - gsp::gspWaitForEvent(to_raw_event(ev), 0); + gspgpu::gspWaitForEvent(to_raw_event(ev), 0); } } diff --git a/src/services/hid.rs b/src/services/hid.rs index 8f785d0..cb96c3a 100644 --- a/src/services/hid.rs +++ b/src/services/hid.rs @@ -80,7 +80,7 @@ pub struct Hid { impl Hid { pub fn new() -> Result { unsafe { - let r = hid::hidInit(hid::HID_SHAREDMEM_DEFAULT as *mut u32); + let r = hid::hidInit(); if r < 0 { Err(r) } else { From 9e0e25c68a64e090a7a12c33344b2e4a87f8d34a Mon Sep 17 00:00:00 2001 From: Fenrir Date: Mon, 2 May 2016 23:04:59 -0700 Subject: [PATCH 5/6] add AUTHORS.md --- AUTHORS.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 AUTHORS.md diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..e10f386 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,4 @@ +# Authors + + * FuryHunter + * FenrirWolf From aed2ceee0cd115228fe7cfb168f8b0fae5e4e3fb Mon Sep 17 00:00:00 2001 From: FenrirWolf Date: Mon, 2 May 2016 23:06:38 -0700 Subject: [PATCH 6/6] Update AUTHORS.md --- AUTHORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index e10f386..9542850 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,4 +1,4 @@ # Authors - * FuryHunter + * Furyhunter * FenrirWolf