Lang items may be removed if we get a libstd.
@ -9,6 +9,3 @@ build = "build.rs"
[lib]
name = "ctru"
crate-type = ["rlib"]
[dependencies.core]
git="https://github.com/hackndev/rust-libcore"
@ -1,4 +1,5 @@
#![feature(no_std)]
#![feature(lang_items)]
#![no_std]
#![crate_type = "rlib"]
#![crate_name = "ctru"]
@ -11,3 +12,7 @@ pub type Handle = u32;
pub mod srv;
pub mod gfx;
pub mod services;
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
@ -52,7 +52,7 @@ pub enum debugDevice {
CONSOLE = 2,
}
#[link(name = "ctru")]
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) -> ();
@ -23,7 +23,7 @@ pub enum gfx3dSide_t {
GFX_RIGHT = 1
pub static mut gfxTopLeftFramebuffers: [*mut u8; 2usize];
pub static mut gfxTopRightFramebuffers: [*mut u8; 2usize];
@ -256,7 +256,7 @@ pub enum GPU_SHADER_TYPE {
GPU_GEOMETRY_SHADER=0x1
pub fn GPU_Init(gsphandle: *mut Handle) -> ();
pub fn GPU_Reset(gxbuf: *mut u32, gpuBuf: *mut u32, gpuBufSize: u32) -> ();
@ -62,7 +62,7 @@ pub fn GX_TRANSFER_SCALING(x) {
use ctru::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;
@ -27,7 +27,7 @@ pub struct shaderProgram_s {
pub fn shaderInstanceInit(si: *mut shaderInstance_s, dvle: *mut DVLE_s) -> Result;
pub fn shaderInstanceFree(si: *mut shaderInstance_s) -> Result;
@ -96,7 +96,7 @@ pub struct DVLB_s {
use ctru::raw::types::*;
pub fn DVLB_ParseFile(shbinData: *mut u32, shbinSize: u32) -> *mut DVLB_s;
pub fn DVLB_Free(dvlb: *mut DVLB_s) -> ();
@ -1,6 +1,6 @@
use super::c_void;
pub fn linearAlloc(size: i32) -> *mut c_void;
pub fn linearMemAlign(size: i32, alignment: i32) -> *mut c_void;
@ -4,7 +4,7 @@ pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) {
(((major)<<24)|((minor)<<16)|((revision)<<8));
pub fn osConvertVirtToPhys(vaddr: u32) -> u32;
pub fn osConvertOldLINEARMemToNew(addr: u32) -> u32;
use super::super::Result;
pub fn sdmcInit() -> Result;
pub fn sdmcExit() -> Result;
use ::{Handle, Result};
pub fn acInit() -> Result;
pub fn acExit() -> Result;
@ -10,7 +10,7 @@ pub struct TitleList {
unknown2: [u8; 6usize]
pub fn amInit() -> Result;
pub fn amExit() -> Result;
@ -74,7 +74,7 @@ pub struct aptHookCookie {
param: *mut c_void,
pub static mut aptEvents: [Handle; 3usize];
use ::Result;
pub fn CFGNOR_Initialize(value: u8) -> Result;
pub fn CFGNOR_Shutdown() -> Result;
pub fn initCfgu() -> Result;
pub fn exitCfgu() -> Result;
@ -56,7 +56,7 @@ pub enum GSP_Event {
use super::super::super::{Result, Handle};
pub fn gspInit() -> Result;
pub fn gspExit() -> ();
@ -1,7 +1,7 @@
use ::raw::c_void;
pub fn hbInit() -> Result;
pub fn hbExit() -> ();
@ -77,7 +77,7 @@ pub enum HID_Event {
HIDEVENT_MAX, // used to know how many events there are
pub static hidMemHandle: Handle;
pub static hidSharedMem: *mut vu32;
use ::{Result, Handle};
pub fn IRU_Initialize(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result;
pub fn IRU_Shutdown() -> Result;
@ -3,7 +3,7 @@ use ::raw::types::*;
use super::hid::circlePosition;
pub static irrstMemHandle: Handle;
pub static irrstSharedMem: *mut vu32;
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 nsInit() -> Result;
pub fn nsExit() -> Result;
pub fn pmInit() -> Result;
pub fn pmExit() -> Result;
pub fn ptmInit() -> Result;
pub fn ptmExit() -> Result;
pub fn SOC_Initialize(context_addr: *mut u32, context_size: u32) -> Result;
pub fn SOC_Shutdown() -> Result;
use super::types::*;
pub fn vramAlloc(size: isize) -> *mut c_void;
pub fn vramMemAlign(size: isize, alignment: isize) -> *mut c_void;
@ -96,15 +96,16 @@ pub fn return_to_menu() -> () {
///
/// # Examples
/// ```
/// ```rust
/// main_loop(|| {
/// // 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 {
while apt::aptMainLoop() != 0 {
f();
if !f() { break; }