2020-04-08 04:21:52 +00:00
|
|
|
#![no_std]
|
2020-04-08 10:28:33 +00:00
|
|
|
#![feature(proc_macro_hygiene)]
|
2020-04-08 04:21:52 +00:00
|
|
|
|
2020-04-09 09:10:23 +00:00
|
|
|
use skyline::nn::account::{self, Uid, GetLastOpenedUser, GetNickname, Nickname};
|
2020-04-08 10:28:33 +00:00
|
|
|
|
|
|
|
#[skyline::main]
|
2020-04-08 04:21:52 +00:00
|
|
|
pub fn main() {
|
2020-04-08 05:13:06 +00:00
|
|
|
println!("Hello from Skyline Rust Plugin!\n");
|
2020-04-08 04:21:52 +00:00
|
|
|
|
2020-04-08 05:13:06 +00:00
|
|
|
for i in 0..3 {
|
|
|
|
println!("{}", i);
|
2020-04-08 04:21:52 +00:00
|
|
|
}
|
2020-04-08 10:28:33 +00:00
|
|
|
|
2020-04-09 09:10:23 +00:00
|
|
|
init_accounts();
|
|
|
|
|
|
|
|
let nickname = unsafe { get_last_user_nickname() };
|
|
|
|
|
|
|
|
println!("Last nickname: {}", nickname);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn init_accounts() {
|
|
|
|
unsafe { account::Initialize() };
|
2020-04-09 06:15:39 +00:00
|
|
|
}
|
|
|
|
|
2020-04-09 09:10:23 +00:00
|
|
|
unsafe fn get_last_user_nickname() -> Nickname {
|
|
|
|
let uid = &mut Uid::new();
|
|
|
|
let mut nick = Nickname::new();
|
|
|
|
|
|
|
|
GetLastOpenedUser(uid);
|
|
|
|
GetNickname(&mut nick, uid);
|
|
|
|
|
|
|
|
nick
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
use skyline::{
|
|
|
|
libc::{fopen, FileOpenMode, fwrite_slice, fclose},
|
|
|
|
c_str
|
|
|
|
};
|
|
|
|
|
2020-04-09 06:15:39 +00:00
|
|
|
fn write_to_file(file: &str, contents: &str) {
|
|
|
|
unsafe {
|
|
|
|
let file = fopen(c_str(file), FileOpenMode::Write);
|
|
|
|
fwrite_slice(contents.as_bytes(), file);
|
|
|
|
fclose(file);
|
2020-04-09 02:39:10 +00:00
|
|
|
}
|
2020-04-09 09:10:23 +00:00
|
|
|
}*/
|