1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(incomplete_features, stable_features)]
#![feature(alloc_error_handler, lang_items, start, global_asm, const_generics, impl_trait_in_bindings, proc_macro_hygiene, alloc_prelude, panic_info_message, track_caller)]
use libc::strlen;
#[cfg(not(feature = "std"))]
use alloc::{borrow::ToOwned, string::String};
pub extern crate alloc;
#[doc(hidden)]
pub use skyline_macro;
pub mod hooks;
pub mod logging;
pub mod patching;
pub mod text_iter;
pub mod error;
pub mod nro;
pub mod info;
#[doc(hidden)]
pub mod extern_alloc;
#[doc(hidden)]
pub mod build;
pub mod nn;
#[doc(inline)]
pub use {
error::{Error, ErrorKind},
hooks::iter_hooks,
libc,
skyline_macro::{from_offset, hook, install_hook, main, null_check},
};
pub fn c_str(string: &str) -> *const u8 {
string.as_bytes().as_ptr()
}
pub unsafe fn from_c_str(c_str: *const u8) -> String {
let name_slice = core::slice::from_raw_parts(c_str as *mut _, strlen(c_str));
match core::str::from_utf8(&name_slice) {
Ok(v) => v.to_owned(),
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
}
}
pub mod prelude {
pub use crate::alloc::prelude::v1::*;
pub use crate::println;
pub use alloc::format;
pub use alloc::vec;
}