Browse Source

Renew manifests and fix warnings

pull/134/head
Andrea Ciliberti 1 year ago
parent
commit
9b97e90484
  1. 1
      Cargo.toml
  2. 4
      ctru-rs/Cargo.toml
  3. 16
      ctru-rs/src/error.rs
  4. 7
      ctru-rs/src/lib.rs
  5. 2
      ctru-rs/src/services/gfx.rs
  6. 2
      ctru-rs/src/services/romfs.rs
  7. 4
      ctru-sys/Cargo.toml

1
Cargo.toml

@ -1,6 +1,7 @@
[workspace] [workspace]
members = ["ctru-rs", "ctru-sys", "ctru-sys/bindgen-ctru-sys"] members = ["ctru-rs", "ctru-sys", "ctru-sys/bindgen-ctru-sys"]
default-members = ["ctru-rs", "ctru-sys"] default-members = ["ctru-rs", "ctru-sys"]
resolver = "2"
[patch.'https://github.com/rust3ds/ctru-rs'] [patch.'https://github.com/rust3ds/ctru-rs']
# Make sure all dependencies use the local ctru-sys package # Make sure all dependencies use the local ctru-sys package

4
ctru-rs/Cargo.toml

@ -1,12 +1,14 @@
[package] [package]
authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"] authors = ["Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>"]
description = "A safe wrapper around libctru" description = "A safe wrapper around libctru"
keywords = ["3ds", "libctru"]
categories = ["os", "api-bindings"]
license = "Zlib" license = "Zlib"
name = "ctru-rs" name = "ctru-rs"
version = "0.7.1" version = "0.7.1"
edition = "2021" edition = "2021"
repository = "https://github.com/rust3ds/ctru-rs" repository = "https://github.com/rust3ds/ctru-rs"
rust-version = "1.64" rust-version = "1.70"
[lib] [lib]
crate-type = ["rlib"] crate-type = ["rlib"]

16
ctru-rs/src/error.rs

@ -1,5 +1,5 @@
//! Error handling interface. //! Error handling interface.
//! //!
//! This module holds the generic error and result types to interface with [`ctru_sys`] and the safe wrapper. //! This module holds the generic error and result types to interface with [`ctru_sys`] and the safe wrapper.
use std::borrow::Cow; use std::borrow::Cow;
use std::error; use std::error;
@ -10,16 +10,16 @@ use std::ops::{ControlFlow, FromResidual, Try};
use ctru_sys::result::{R_DESCRIPTION, R_LEVEL, R_MODULE, R_SUMMARY}; use ctru_sys::result::{R_DESCRIPTION, R_LEVEL, R_MODULE, R_SUMMARY};
/// Custom type alias for generic `ctru` operations. /// Custom type alias for generic `ctru` operations.
/// ///
/// This type is compatible with `ctru-sys` result codes. /// This type is compatible with `ctru-sys` result codes.
pub type Result<T> = ::std::result::Result<T, Error>; pub type Result<T> = ::std::result::Result<T, Error>;
/// Validity checker of raw [`ctru_sys::Result`] codes. /// Validity checker of raw [`ctru_sys::Result`] codes.
/// ///
/// This struct supports the "try" syntax (`?`) to convert to an [`Error::Os`]. /// This struct supports the "try" syntax (`?`) to convert to an [`Error::Os`].
/// ///
/// # Example /// # Example
/// ///
/// ```no_run /// ```no_run
/// pub fn hid_init() -> crate::Result<()> { /// pub fn hid_init() -> crate::Result<()> {
/// // We run an unsafe function which returns a `ctru_sys::Result`. /// // We run an unsafe function which returns a `ctru_sys::Result`.
@ -71,13 +71,13 @@ impl<T> FromResidual<Error> for Result<T> {
} }
/// The generic error enum returned by `ctru` functions. /// The generic error enum returned by `ctru` functions.
/// ///
/// This error enum supports parsing and displaying [`ctru_sys::Result`] codes. /// This error enum supports parsing and displaying [`ctru_sys::Result`] codes.
#[non_exhaustive] #[non_exhaustive]
pub enum Error { pub enum Error {
/// Raw [`ctru_sys::Result`] codes. /// Raw [`ctru_sys::Result`] codes.
Os(ctru_sys::Result), Os(ctru_sys::Result),
/// Generic `libc` error codes. /// Generic `libc` error codes.
Libc(String), Libc(String),
/// Requested service is already active and cannot be activated again. /// Requested service is already active and cannot be activated again.
ServiceAlreadyActive, ServiceAlreadyActive,
@ -94,7 +94,7 @@ pub enum Error {
impl Error { impl Error {
/// Create an [`Error`] out of the last set value in `errno`. /// Create an [`Error`] out of the last set value in `errno`.
/// ///
/// This can be used to get a human-readable error string from calls to `libc` functions. /// This can be used to get a human-readable error string from calls to `libc` functions.
pub(crate) fn from_errno() -> Self { pub(crate) fn from_errno() -> Self {
let error_str = unsafe { let error_str = unsafe {

7
ctru-rs/src/lib.rs

@ -25,7 +25,6 @@
#![feature(custom_test_frameworks)] #![feature(custom_test_frameworks)]
#![feature(try_trait_v2)] #![feature(try_trait_v2)]
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(nonnull_slice_from_raw_parts)]
#![test_runner(test_runner::run)] #![test_runner(test_runner::run)]
#![doc( #![doc(
html_favicon_url = "https://user-images.githubusercontent.com/11131775/225929072-2fa1741c-93ae-4b47-9bdf-af70f3d59910.png" html_favicon_url = "https://user-images.githubusercontent.com/11131775/225929072-2fa1741c-93ae-4b47-9bdf-af70f3d59910.png"
@ -39,7 +38,7 @@ extern crate pthread_3ds;
extern crate shim_3ds; extern crate shim_3ds;
/// Expanded stack size used to spawn the main thread by `libctru`. /// Expanded stack size used to spawn the main thread by `libctru`.
/// ///
/// This value was chosen to support crate dependencies which expected more stack than provided, without compromising performance. /// This value was chosen to support crate dependencies which expected more stack than provided, without compromising performance.
#[no_mangle] #[no_mangle]
#[cfg(feature = "big-stack")] #[cfg(feature = "big-stack")]
@ -69,9 +68,9 @@ pub fn use_panic_handler() {
} }
/// Internal protocol to activate the custom panic handler hook. /// Internal protocol to activate the custom panic handler hook.
/// ///
/// # Notes /// # Notes
/// ///
/// When `test` is enabled, this function will be ignored. /// When `test` is enabled, this function will be ignored.
#[cfg(not(test))] #[cfg(not(test))]
fn panic_hook_setup() { fn panic_hook_setup() {

2
ctru-rs/src/services/gfx.rs

@ -134,7 +134,7 @@ impl<S: Screen> Flush for S {
let framebuffer = self.raw_framebuffer(); let framebuffer = self.raw_framebuffer();
// Flush the data array. `self.raw_framebuffer` should get the correct parameters for all kinds of screens // Flush the data array. `self.raw_framebuffer` should get the correct parameters for all kinds of screens
unsafe { let _ = unsafe {
ctru_sys::GSPGPU_FlushDataCache( ctru_sys::GSPGPU_FlushDataCache(
framebuffer.ptr.cast(), framebuffer.ptr.cast(),
(framebuffer.height * framebuffer.width) as u32, (framebuffer.height * framebuffer.width) as u32,

2
ctru-rs/src/services/romfs.rs

@ -36,7 +36,7 @@ impl RomFS {
}, },
|| { || {
let mount_name = CStr::from_bytes_with_nul(b"romfs\0").unwrap(); let mount_name = CStr::from_bytes_with_nul(b"romfs\0").unwrap();
unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) }; let _ = unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) };
}, },
)?; )?;

4
ctru-sys/Cargo.toml

@ -2,9 +2,13 @@
name = "ctru-sys" name = "ctru-sys"
version = "22.2.0+2.2.2-1" version = "22.2.0+2.2.2-1"
authors = [ "Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>" ] authors = [ "Rust3DS Org", "Ronald Kinard <furyhunter600@gmail.com>" ]
description = "Raw bindings to libctru"
keywords = ["3ds", "libctru"]
categories = ["os", "external-ffi-bindings", "no-std"]
license = "Zlib" license = "Zlib"
links = "ctru" links = "ctru"
edition = "2021" edition = "2021"
repository = "https://github.com/rust3ds/ctru-rs"
[dependencies] [dependencies]
libc = { version = "0.2.121", default-features = false } libc = { version = "0.2.121", default-features = false }

Loading…
Cancel
Save