mirror of
https://github.com/Conando025/libnds-rs.git
synced 2025-06-19 07:45:32 -04:00
Project restructuring
Set the project up to use cargo workspaces
This commit is contained in:
parent
8ce1ac6e87
commit
3f315a25c9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/target
|
||||
/.vscode
|
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -31,3 +31,10 @@ dependencies = [
|
||||
"libc-print",
|
||||
"libc_alloc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nitro-rs_examples"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"nitro-rs",
|
||||
]
|
||||
|
13
Cargo.toml
13
Cargo.toml
@ -1,11 +1,2 @@
|
||||
[package]
|
||||
name = "nitro-rs"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = {version = "0.2.121", default-features = true}
|
||||
libc_alloc = "1.0.4"
|
||||
libc-print = "0.1.20"
|
||||
[workspace]
|
||||
members = ["examples", "lib"]
|
10
examples/Cargo.toml
Normal file
10
examples/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "nitro-rs_examples"
|
||||
version = "0.0.1"
|
||||
|
||||
[[bin]]
|
||||
name = "mvp"
|
||||
path = "mpv/main.rs"
|
||||
|
||||
[dependencies]
|
||||
nitro-rs = { path = "../lib" }
|
49
examples/mvp/arm7.rs
Normal file
49
examples/mvp/arm7.rs
Normal file
@ -0,0 +1,49 @@
|
||||
use core::{ptr::read_volatile, sync::atomic::AtomicBool, sync::atomic::Ordering};
|
||||
|
||||
use nitro_rs::arm7::*;
|
||||
//use libnds_sys::bios_registers::*;
|
||||
|
||||
unsafe extern "C" fn vblank_handler() {
|
||||
Wifi_Update();
|
||||
}
|
||||
|
||||
unsafe extern "C" fn vcount_handler() {
|
||||
inputGetAndSend();
|
||||
}
|
||||
|
||||
static EXIT_FLAG: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
unsafe extern "C" fn power_button_cb() {
|
||||
EXIT_FLAG.store(true, core::sync::atomic::Ordering::Release);
|
||||
}
|
||||
|
||||
#[start]
|
||||
fn main(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
unsafe {
|
||||
readUserSettings();
|
||||
unimplemented!();
|
||||
irqInit();
|
||||
fifoInit();
|
||||
mmInstall(FIFO_MAXMOD as i32);
|
||||
// Start the RTC tracking IRQ
|
||||
initClockIRQ();
|
||||
|
||||
SetYtrigger(30);
|
||||
installWifiFIFO();
|
||||
installSoundFIFO();
|
||||
installSystemFIFO();
|
||||
irqSet(IRQ_VCOUNT as u32, Some(vcount_handler));
|
||||
irqSet(IRQ_VBLANK as u32, Some(vblank_handler));
|
||||
irqEnable((IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK) as u32);
|
||||
setPowerButtonCB(Some(power_button_cb));
|
||||
|
||||
// Keep the ARM7 mostly idle
|
||||
while !EXIT_FLAG.load(Ordering::Acquire) {
|
||||
let keyinput = read_volatile(REG_KEYINPUT);
|
||||
if (keyinput & KEY_START as u16) > 0 {
|
||||
EXIT_FLAG.store(true, Ordering::Release);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
17
examples/mvp/arm9.rs
Normal file
17
examples/mvp/arm9.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use nitro_rs::arm9::*;
|
||||
|
||||
#[start]
|
||||
fn main(_argc: isize, _argv: *const *const u8) -> isize
|
||||
{
|
||||
unsafe {
|
||||
loop {
|
||||
scanKeys();
|
||||
if (keysDown() & KEY_START) > 0
|
||||
{
|
||||
swiWaitForVBlank();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
19
examples/mvp/main.rs
Normal file
19
examples/mvp/main.rs
Normal file
@ -0,0 +1,19 @@
|
||||
#![no_std]
|
||||
#![feature(start)]
|
||||
|
||||
extern crate nitro_rs;
|
||||
|
||||
#[cfg(target_os = "nintendo_ds_arm7")]
|
||||
mod arm7;
|
||||
|
||||
#[cfg(target_os = "nintendo_ds_arm9")]
|
||||
mod arm9;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: libc_alloc::LibcAlloc = libc_alloc::LibcAlloc;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
loop {
|
||||
}
|
||||
}
|
11
lib/Cargo.toml
Normal file
11
lib/Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "nitro-rs"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = {version = "0.2.121", default-features = true}
|
||||
libc_alloc = "1.0.4"
|
||||
libc-print = "0.1.20"
|
Loading…
Reference in New Issue
Block a user