Browse Source

Cleanup and lang items.

Lang items may be removed if we get a libstd.
pull/10/head
Ronald Kinard 9 years ago
parent
commit
581d24ca25
  1. 3
      Cargo.toml
  2. 5
      src/lib.rs
  3. 2
      src/raw/console.rs
  4. 2
      src/raw/gfx.rs
  5. 2
      src/raw/gpu/gpu.rs
  6. 2
      src/raw/gpu/gx.rs
  7. 2
      src/raw/gpu/shader_program.rs
  8. 2
      src/raw/gpu/shbin.rs
  9. 2
      src/raw/linear.rs
  10. 2
      src/raw/os.rs
  11. 2
      src/raw/sdmc.rs
  12. 2
      src/raw/services/ac.rs
  13. 2
      src/raw/services/am.rs
  14. 2
      src/raw/services/apt.rs
  15. 2
      src/raw/services/cfgnor.rs
  16. 2
      src/raw/services/cfgu.rs
  17. 2
      src/raw/services/gsp.rs
  18. 2
      src/raw/services/hb.rs
  19. 2
      src/raw/services/hid.rs
  20. 2
      src/raw/services/ir.rs
  21. 2
      src/raw/services/irrst.rs
  22. 2
      src/raw/services/mic.rs
  23. 2
      src/raw/services/ns.rs
  24. 2
      src/raw/services/pm.rs
  25. 2
      src/raw/services/ptm.rs
  26. 2
      src/raw/services/soc.rs
  27. 2
      src/raw/vram.rs
  28. 7
      src/services/apt.rs

3
Cargo.toml

@ -9,6 +9,3 @@ build = "build.rs"
[lib] [lib]
name = "ctru" name = "ctru"
crate-type = ["rlib"] crate-type = ["rlib"]
[dependencies.core]
git="https://github.com/hackndev/rust-libcore"

5
src/lib.rs

@ -1,4 +1,5 @@
#![feature(no_std)] #![feature(no_std)]
#![feature(lang_items)]
#![no_std] #![no_std]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_name = "ctru"] #![crate_name = "ctru"]
@ -11,3 +12,7 @@ pub type Handle = u32;
pub mod srv; pub mod srv;
pub mod gfx; pub mod gfx;
pub mod services; pub mod services;
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }

2
src/raw/console.rs

@ -52,7 +52,7 @@ pub enum debugDevice {
CONSOLE = 2, CONSOLE = 2,
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn consoleSetFont(console: *mut PrintConsole, font: *mut ConsoleFont) -> (); 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 consoleSetWindow(console: *mut PrintConsole, x: i32, y: i32, width: i32, height: i32) -> ();

2
src/raw/gfx.rs

@ -23,7 +23,7 @@ pub enum gfx3dSide_t {
GFX_RIGHT = 1 GFX_RIGHT = 1
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub static mut gfxTopLeftFramebuffers: [*mut u8; 2usize]; pub static mut gfxTopLeftFramebuffers: [*mut u8; 2usize];
pub static mut gfxTopRightFramebuffers: [*mut u8; 2usize]; pub static mut gfxTopRightFramebuffers: [*mut u8; 2usize];

2
src/raw/gpu/gpu.rs

@ -256,7 +256,7 @@ pub enum GPU_SHADER_TYPE {
GPU_GEOMETRY_SHADER=0x1 GPU_GEOMETRY_SHADER=0x1
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn GPU_Init(gsphandle: *mut Handle) -> (); pub fn GPU_Init(gsphandle: *mut Handle) -> ();
pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: u32) -> (); pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: u32) -> ();

2
src/raw/gpu/gx.rs

@ -62,7 +62,7 @@ pub fn GX_TRANSFER_SCALING(x) {
use ctru::Result; use ctru::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn GX_RequestDma(gxbuf: *mut u32, src: *mut u32, dst: *mut u32, length: 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_SetCommandList_Last(gxbuf: *mut u32, buf0a: *mut u32, buf0s: u32, flags: u8) -> Result;

2
src/raw/gpu/shader_program.rs

@ -27,7 +27,7 @@ pub struct shaderProgram_s {
use ctru::Result; use ctru::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn shaderInstanceInit(si: *mut shaderInstance_s, dvle: *mut DVLE_s) -> Result; pub fn shaderInstanceInit(si: *mut shaderInstance_s, dvle: *mut DVLE_s) -> Result;
pub fn shaderInstanceFree(si: *mut shaderInstance_s) -> Result; pub fn shaderInstanceFree(si: *mut shaderInstance_s) -> Result;

2
src/raw/gpu/shbin.rs

@ -96,7 +96,7 @@ pub struct DVLB_s {
use ctru::raw::types::*; use ctru::raw::types::*;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn DVLB_ParseFile(shbinData: *mut u32, shbinSize: u32) -> *mut DVLB_s; pub fn DVLB_ParseFile(shbinData: *mut u32, shbinSize: u32) -> *mut DVLB_s;
pub fn DVLB_Free(dvlb: *mut DVLB_s) -> (); pub fn DVLB_Free(dvlb: *mut DVLB_s) -> ();

2
src/raw/linear.rs

@ -1,6 +1,6 @@
use super::c_void; use super::c_void;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn linearAlloc(size: i32) -> *mut c_void; pub fn linearAlloc(size: i32) -> *mut c_void;
pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void; pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void;

2
src/raw/os.rs

@ -4,7 +4,7 @@ pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) {
(((major)<<24)|((minor)<<16)|((revision)<<8)); (((major)<<24)|((minor)<<16)|((revision)<<8));
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn osConvertVirtToPhys(vaddr: u32) -> u32; pub fn osConvertVirtToPhys(vaddr: u32) -> u32;
pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32; pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32;

2
src/raw/sdmc.rs

@ -1,6 +1,6 @@
use super::super::Result; use super::super::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn sdmcInit() -> Result; pub fn sdmcInit() -> Result;
pub fn sdmcExit() -> Result; pub fn sdmcExit() -> Result;

2
src/raw/services/ac.rs

@ -1,6 +1,6 @@
use ::{Handle, Result}; use ::{Handle, Result};
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn acInit() -> Result; pub fn acInit() -> Result;
pub fn acExit() -> Result; pub fn acExit() -> Result;

2
src/raw/services/am.rs

@ -10,7 +10,7 @@ pub struct TitleList {
unknown2: [u8; 6usize] unknown2: [u8; 6usize]
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn amInit() -> Result; pub fn amInit() -> Result;
pub fn amExit() -> Result; pub fn amExit() -> Result;

2
src/raw/services/apt.rs

@ -74,7 +74,7 @@ pub struct aptHookCookie {
param: *mut c_void, param: *mut c_void,
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub static mut aptEvents: [Handle; 3usize]; pub static mut aptEvents: [Handle; 3usize];

2
src/raw/services/cfgnor.rs

@ -1,6 +1,6 @@
use ::Result; use ::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn CFGNOR_Initialize(value: u8) -> Result; pub fn CFGNOR_Initialize(value: u8) -> Result;
pub fn CFGNOR_Shutdown() -> Result; pub fn CFGNOR_Shutdown() -> Result;

2
src/raw/services/cfgu.rs

@ -1,6 +1,6 @@
use ::Result; use ::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn initCfgu() -> Result; pub fn initCfgu() -> Result;
pub fn exitCfgu() -> Result; pub fn exitCfgu() -> Result;

2
src/raw/services/gsp.rs

@ -56,7 +56,7 @@ pub enum GSP_Event {
use super::super::super::{Result, Handle}; use super::super::super::{Result, Handle};
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn gspInit() -> Result; pub fn gspInit() -> Result;
pub fn gspExit() -> (); pub fn gspExit() -> ();

2
src/raw/services/hb.rs

@ -1,7 +1,7 @@
use ::Result; use ::Result;
use ::raw::c_void; use ::raw::c_void;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn hbInit() -> Result; pub fn hbInit() -> Result;
pub fn hbExit() -> (); pub fn hbExit() -> ();

2
src/raw/services/hid.rs

@ -77,7 +77,7 @@ pub enum HID_Event {
HIDEVENT_MAX, // used to know how many events there are HIDEVENT_MAX, // used to know how many events there are
} }
#[link(name = "ctru")]
extern "C" { extern "C" {
pub static hidMemHandle: Handle; pub static hidMemHandle: Handle;
pub static hidSharedMem: *mut vu32; pub static hidSharedMem: *mut vu32;

2
src/raw/services/ir.rs

@ -1,6 +1,6 @@
use ::{Result, Handle}; use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result; pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result;
pub fn IRU_Shutdown() -> Result; pub fn IRU_Shutdown() -> Result;

2
src/raw/services/irrst.rs

@ -3,7 +3,7 @@ use ::raw::types::*;
use super::hid::circlePosition; use super::hid::circlePosition;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub static irrstMemHandle: Handle; pub static irrstMemHandle: Handle;
pub static irrstSharedMem: *mut vu32; pub static irrstSharedMem: *mut vu32;

2
src/raw/services/mic.rs

@ -1,6 +1,6 @@
use ::{Result, Handle}; use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" { 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_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_Shutdown() -> Result;

2
src/raw/services/ns.rs

@ -1,6 +1,6 @@
use ::Result; use ::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn nsInit() -> Result; pub fn nsInit() -> Result;
pub fn nsExit() -> Result; pub fn nsExit() -> Result;

2
src/raw/services/pm.rs

@ -1,6 +1,6 @@
use ::Result; use ::Result;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn pmInit() -> Result; pub fn pmInit() -> Result;
pub fn pmExit() -> Result; pub fn pmExit() -> Result;

2
src/raw/services/ptm.rs

@ -1,6 +1,6 @@
use ::{Result, Handle}; use ::{Result, Handle};
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn ptmInit() -> Result; pub fn ptmInit() -> Result;
pub fn ptmExit() -> Result; pub fn ptmExit() -> Result;

2
src/raw/services/soc.rs

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

2
src/raw/vram.rs

@ -1,6 +1,6 @@
use super::types::*; use super::types::*;
#[link(name = "ctru")]
extern "C" { extern "C" {
pub fn vramAlloc(size: isize) -> *mut c_void; pub fn vramAlloc(size: isize) -> *mut c_void;
pub fn vramMemAlign(size: isize, alignment: isize) -> *mut c_void; pub fn vramMemAlign(size: isize, alignment: isize) -> *mut c_void;

7
src/services/apt.rs

@ -96,15 +96,16 @@ pub fn return_to_menu() -> () {
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```rust
/// main_loop(|| { /// main_loop(|| {
/// // do things here /// // do things here
/// false
/// }); /// });
/// ``` /// ```
pub fn main_loop<F>(f: F) -> () where F : Fn() -> () { pub fn main_loop<F>(f: F) -> () where F : Fn() -> bool {
unsafe { unsafe {
while apt::aptMainLoop() != 0 { while apt::aptMainLoop() != 0 {
f(); if !f() { break; }
} }
} }
} }

Loading…
Cancel
Save