Browse Source

Working condition

pull/1/head
Meziu 3 years ago
commit
48e3a6b75b
  1. 2
      .cargo/config.toml
  2. 3
      .gitignore
  3. 14
      Cargo.toml
  4. 13
      README.md
  5. 21
      src/lib.rs

2
.cargo/config.toml

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
[build]
rustc = "/home/andrea/Desktop/ProgrammingStuff/Rust/rust-3ds/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustc"

3
.gitignore vendored

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
target
Cargo.lock

14
Cargo.toml

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
[package]
name = "linker-fix-3ds"
authors = [ "Andrea Ciliberti <meziu210@icloud.com>" ]
version = "0.1.0"
license = "MIT/Apache 2.0"
edition = "2018"
[lib]
name = "linker_fix_3ds"
path = "src/lib.rs"
crate-type = ["staticlib"]
[dependencies.libc]
path = "../libc"

13
README.md

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
# rust3ds-hello-world
`Hello World` example of my Rust implementation for the Nintendo 3DS.
# Build
Make sure you have the latest Rust nightly toolchain and activate it (by defaulting it or overriding for the rust3ds-hello-world folder)
Do `rustup component add rust-src` to download the Rust source code.
Download the `ctru-sys` repository from my github profile and put it in the same directory as this git repo (support with crates.io may be thought of in the future).
Run `cargo +nightly build -Zbuild-std=core,alloc --target armv6k-nintendo-3ds.json --release` and it should build an .elf file in the target folder. Use the 3dsxtool from the devkitPRO toolchain to build it into a .3dsx and then transfer it to your console or run it in an emulator (Quicker building methods will be implemented, it just works for now).
STILL WIP.

21
src/lib.rs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
extern crate libc;
#[no_mangle]
extern "C" fn posix_memalign(memptr: *mut *mut libc::c_void, align: libc::size_t, size: libc::size_t) -> libc::c_int {
unsafe {
*memptr = libc::memalign(align, size);
}
0
}
#[no_mangle]
unsafe extern "C" fn realpath(
path: *const libc::c_char,
resolved_path: *mut libc::c_char
) -> *mut libc::c_char {
libc::memcpy(resolved_path as _, path as _, libc::strlen(path));
resolved_path
}
Loading…
Cancel
Save