mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-24 10:54:16 +00:00
Move smash to own crate, add bindings for smash C++ API
This commit is contained in:
parent
476fb8788f
commit
dec9735a55
9 changed files with 7911 additions and 3 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -33,6 +33,7 @@ name = "no_std_test"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"skyline",
|
||||
"skyline_smash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -78,6 +79,13 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "skyline_smash"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"skyline_libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.17"
|
||||
|
|
|
@ -11,3 +11,4 @@ crate-type = ["cdylib"]
|
|||
|
||||
[dependencies]
|
||||
skyline = { path = "./skyline" }
|
||||
skyline_smash = { path = "./skyline_smash" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![no_std]
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(alloc_error_handler, lang_items, start, global_asm, const_generics, impl_trait_in_bindings, proc_macro_hygiene, alloc_prelude, const_if_match, const_loop)]
|
||||
#![feature(alloc_error_handler, lang_items, start, global_asm, const_generics, impl_trait_in_bindings, proc_macro_hygiene, alloc_prelude)]
|
||||
|
||||
/// The rust core allocation and collections library
|
||||
pub extern crate alloc;
|
||||
|
@ -11,7 +11,6 @@ pub use skyline_macro;
|
|||
/// Types and functions for working with hooking
|
||||
pub mod hooks;
|
||||
pub mod logging;
|
||||
pub mod smash;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod extern_alloc;
|
||||
|
|
12
skyline_smash/Cargo.lock
generated
Normal file
12
skyline_smash/Cargo.lock
generated
Normal file
|
@ -0,0 +1,12 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "skyline_libc"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "skyline_smash"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"skyline_libc",
|
||||
]
|
13
skyline_smash/Cargo.toml
Normal file
13
skyline_smash/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "skyline_smash"
|
||||
version = "0.1.0"
|
||||
authors = ["jam1garner <jam1.mcleod@hotmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
name = "smash"
|
||||
|
||||
[dependencies]
|
||||
skyline_libc = { path = "../skyline/skyline_libc" }
|
7864
skyline_smash/src/cpp.rs
Normal file
7864
skyline_smash/src/cpp.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -63,3 +63,4 @@ pub const fn crc32(bytes: &[u8]) -> u32 {
|
|||
|
||||
!value
|
||||
}
|
||||
|
|
@ -1,8 +1,18 @@
|
|||
#![no_std]
|
||||
#![feature(const_if_match, const_loop)]
|
||||
|
||||
pub mod crc32;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod cpp;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use cpp::root::*;
|
||||
|
||||
// Find the hash40 of a given string
|
||||
pub const fn hash40(string: &str) -> u64 {
|
||||
let bytes = string.as_bytes();
|
||||
|
||||
((bytes.len() as u64) << 32) + crc32::crc32(bytes) as u64
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
#![feature(proc_macro_hygiene)]
|
||||
|
||||
use skyline::nn::account::{self, Uid, GetLastOpenedUser, GetNickname, Nickname};
|
||||
use skyline::smash::hash40;
|
||||
use smash::hash40;
|
||||
|
||||
#[skyline::main(name = "module_name_test")]
|
||||
pub fn main() {
|
||||
|
|
Loading…
Reference in a new issue