Skip to content

Commit

Permalink
Merge branch 'master' into fix/build-doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-h-chamberlain committed Apr 14, 2023
2 parents 3a8b050 + 7eaf973 commit a111268
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 96 deletions.
4 changes: 0 additions & 4 deletions AUTHORS.md

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (C) Rust 3DS Project authors, 2015-2016

As with the original ctrulib, this library is licensed under zlib. This
applies to every file in the tree, unless otherwise noted.

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.

Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
33 changes: 5 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,10 @@ This repository is organized as follows:
(displayed when built with `-vv`) will be issued if the build script detects
a mismatch or is unable to check the installed `libctru` version.

## License
## Original version

Copyright (C) Rust 3DS Project authors, 2015-2016

See AUTHORS.md.

As with the original ctrulib, this library is licensed under zlib. This
applies to every file in the tree, unless otherwise noted.

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.

Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See [LICENSE-APACHE](https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE), [LICENSE-MIT](https://github.com/rust-lang/rust/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/rust-lang/rust/blob/master/COPYRIGHT) for details.
This project is based on the efforts the original authors:
* [Eidolon](https://github.com/HybridEidolon)
* [FenrirWolf](https://github.com/FenrirWolf)

The old version is archived [here](https://github.com/rust3ds/ctru-rs-old).
4 changes: 2 additions & 2 deletions ctru-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
authors = ["Ronald Kinard <[email protected]>"]
authors = [ "Rust3DS Org", "Ronald Kinard <[email protected]>" ]
description = "A safe wrapper around smealum's ctrulib."
license = "Zlib"
name = "ctru-rs"
Expand All @@ -15,7 +15,7 @@ name = "ctru"
cfg-if = "1.0"
ctru-sys = { path = "../ctru-sys", version = "21.2" }
const-zero = "0.1.0"
linker-fix-3ds = { git = "https://github.com/rust3ds/rust-linker-fix-3ds.git" }
shim-3ds = { git = "https://github.com/rust3ds/shim-3ds.git" }
pthread-3ds = { git = "https://github.com/rust3ds/pthread-3ds.git" }
libc = "0.2.121"
bitflags = "1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions ctru-rs/examples/audio-filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down Expand Up @@ -73,7 +73,7 @@ fn main() {
// This line isn't needed since the default NDSP configuration already sets the output mode to `Stereo`
ndsp.set_output_mode(OutputMode::Stereo);

let channel_zero = ndsp.channel(0).unwrap();
let mut channel_zero = ndsp.channel(0).unwrap();
channel_zero.set_interpolation(InterpolationType::Linear);
channel_zero.set_sample_rate(SAMPLE_RATE as f32);
channel_zero.set_format(AudioFormat::PCM16Stereo);
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/buttons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();
let console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/camera-image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().expect("Failed to initialize Apt service.");
let hid = Hid::init().expect("Failed to initialize Hid service.");
let mut hid = Hid::init().expect("Failed to initialize Hid service.");
let gfx = Gfx::init().expect("Failed to initialize GFX service.");

gfx.top_screen.borrow_mut().set_double_buffering(true);
Expand Down
8 changes: 4 additions & 4 deletions ctru-rs/examples/file-explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();

#[cfg(all(feature = "romfs", romfs_exists))]
let _romfs = ctru::services::romfs::RomFS::init().unwrap();

FileExplorer::init(&apt, &hid, &gfx).run();
FileExplorer::init(&apt, &mut hid, &gfx).run();
}

struct FileExplorer<'a> {
apt: &'a Apt,
hid: &'a Hid,
hid: &'a mut Hid,
gfx: &'a Gfx,
console: Console<'a>,
path: PathBuf,
Expand All @@ -32,7 +32,7 @@ struct FileExplorer<'a> {
}

impl<'a> FileExplorer<'a> {
fn init(apt: &'a Apt, hid: &'a Hid, gfx: &'a Gfx) -> Self {
fn init(apt: &'a Apt, hid: &'a mut Hid, gfx: &'a Gfx) -> Self {
let mut top_screen = gfx.top_screen.borrow_mut();
top_screen.set_wide_mode(true);
let console = Console::init(top_screen);
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/futures-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/futures-tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/gfx-3d-mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.bottom_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/gfx-wide-mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();
let mut console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/graphics-bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/hashmaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
// This generator is only active when activating the `PS` service.
// This service is automatically initialized.
let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/hello-both-screens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();

// Start a console on the top screen
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/hello-world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/linear-memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/mii-selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/network-sockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {

let gfx = Gfx::init().unwrap();
let _console = Console::init(gfx.top_screen.borrow_mut());
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let apt = Apt::init().unwrap();

println!("\nlibctru sockets demo\n");
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/output-3dslink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");

let mut soc = Soc::init().expect("Couldn't obtain SOC controller");
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/romfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/software-keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/system-configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let cfgu = Cfgu::init().expect("Couldn't obtain CFGU controller");
let _console = Console::init(gfx.top_screen.borrow_mut());
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/thread-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
ctru::use_panic_handler();

let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap();
let mut hid = Hid::init().unwrap();
let gfx = Gfx::init().unwrap();
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/thread-info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/thread-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() {

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
gfx.top_screen.borrow_mut().set_wide_mode(true);
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let _console = Console::init(gfx.top_screen.borrow_mut());

Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/time-rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");

let _console = Console::init(gfx.top_screen.borrow_mut());
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/title-info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
ctru::use_panic_handler();

let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let mut hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let am = Am::init().expect("Couldn't obtain AM controller");
let top_screen = Console::init(gfx.top_screen.borrow_mut());
Expand Down
4 changes: 2 additions & 2 deletions ctru-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#![test_runner(test_runner::run)]

// Nothing is imported from these crates but their inclusion here assures correct linking of the missing implementations.
extern crate linker_fix_3ds;
extern crate pthread_3ds;
extern crate shim_3ds;

#[no_mangle]
#[cfg(feature = "big-stack")]
Expand Down Expand Up @@ -55,7 +55,7 @@ fn panic_hook_setup() {
println!("\nPress SELECT to exit the software");

match Hid::init() {
Ok(hid) => loop {
Ok(mut hid) => loop {
hid.scan_input();
let keys = hid.keys_down();
if keys.contains(KeyPad::SELECT) {
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/src/services/apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Apt {
unsafe { ctru_sys::aptMainLoop() }
}

pub fn set_app_cpu_time_limit(&self, percent: u32) -> crate::Result<()> {
pub fn set_app_cpu_time_limit(&mut self, percent: u32) -> crate::Result<()> {
unsafe {
ResultCode(ctru_sys::APT_SetAppCpuTimeLimit(percent))?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/src/services/cam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub trait Camera {
/// The new width will be `trim_width / 2` to the left and right of the center.
/// The new height will be `trim_height / 2` above and below the center.
fn set_trimming_params_center(
&self,
&mut self,
trim_width: i16,
trim_height: i16,
cam_width: i16,
Expand Down
Loading

0 comments on commit a111268

Please sign in to comment.