2020-04-08 10:28:33 +00:00
|
|
|
#![feature(proc_macro_hygiene)]
|
2020-04-08 04:21:52 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
use skyline::{hook, install_hook};
|
2020-04-08 10:28:33 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
extern "C" fn test() -> u32 {
|
|
|
|
2
|
|
|
|
}
|
2020-04-08 10:28:33 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
#[hook(replace = test)]
|
|
|
|
fn test_replacement() -> u32 {
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
let original_test = original!();
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
let val = original_test();
|
2020-04-12 23:34:43 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
println!("[override] original value: {}", val); // 2
|
2020-04-10 01:54:01 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
val + 1
|
2020-04-09 06:15:39 +00:00
|
|
|
}
|
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
#[skyline::main(name = "skyline_rs_template")]
|
|
|
|
pub fn main() {
|
|
|
|
println!("Hello from Skyline Rust Plugin!");
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
install_hook!(test_replacement);
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
let x = test();
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-04-16 04:55:22 +00:00
|
|
|
println!("[main] test returned: {}", x); // 3
|
|
|
|
}
|