1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-14 02:16:10 +00:00

Fix some broken mangled symbols

This commit is contained in:
jam1garner 2020-04-09 05:10:23 -04:00
parent 36d7d33443
commit 11cc29058e
3 changed files with 85 additions and 37 deletions

View file

@ -1,7 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "nn"
name = "nnsdk"
version = "0.1.0"
dependencies = [
"skyline_libc",

View file

@ -1,6 +1,8 @@
#![no_std]
/* automatically generated by rust-bindgen */
extern crate alloc;
#[doc(inline)]
pub use root::nn::*;
@ -1594,7 +1596,7 @@ pub mod root {
);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2os21TimedPeekMessageQueueEPmPKNS0_16MessageQueueTypeE"]
#[link_name = "\u{1}_ZN2nn2os21TimedPeekMessageQueueEPmPKNS0_16MessageQueueTypeENS_8TimeSpanE"]
pub fn TimedPeekMessageQueue(
arg1: *mut u64,
arg2: *const root::nn::os::MessageQueueType,
@ -1636,7 +1638,7 @@ pub mod root {
pub fn BroadcastConditionVariable(arg1: *mut root::nn::os::ConditionVariableType);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2os21WaitConditionVariableEPNS0_21ConditionVariableTypeE"]
#[link_name = "\u{1}_ZN2nn2os21WaitConditionVariableEPNS0_21ConditionVariableTypeEPNS0_9MutexTypeE"]
pub fn WaitConditionVariable(arg1: *mut root::nn::os::ConditionVariableType);
}
extern "C" {
@ -2392,7 +2394,7 @@ pub mod root {
pub fn Initialize();
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2oe27SetPerformanceConfigurationEii"]
#[link_name = "\u{1}_ZN2nn2oe27SetPerformanceConfigurationENS0_15PerformanceModeEi"]
pub fn SetPerformanceConfiguration(
arg1: root::nn::oe::PerformanceMode,
arg2: root::s32,
@ -2419,7 +2421,7 @@ pub mod root {
pub fn SetPerformanceModeChangedNotificationEnabled(arg1: bool);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2oe20SetFocusHandlingModeEi"]
#[link_name = "\u{1}_ZN2nn2oe20SetFocusHandlingModeENS0_17FocusHandlingModeE"]
pub fn SetFocusHandlingMode(arg1: root::nn::oe::FocusHandlingMode);
}
extern "C" {
@ -2458,11 +2460,39 @@ pub mod root {
pub mod account {
#[allow(unused_imports)]
use self::super::super::super::root;
pub type Nickname = [skyline_libc::c_char; 33usize];
//pub type Nickname = [skyline_libc::c_char; 33usize];
#[repr(transparent)]
pub struct Nickname(pub [skyline_libc::c_char; 33usize]);
impl Nickname {
pub fn new() -> Self {
Self([0; 33])
}
}
impl core::fmt::Display for Nickname {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
let mut i = 0;
while self.0[i] != 0 {
i += 1;
}
write!(f, "{}", unsafe { alloc::str::from_utf8_unchecked(&self.0[..i]) })
}
}
#[repr(C)]
pub struct Uid {
pub _x0: [u64; 2usize],
pub id: [u64; 2usize],
}
impl Uid {
pub fn new() -> Self {
Self { id: [0, 0] }
}
}
#[test]
fn bindgen_test_layout_Uid() {
assert_eq!(
@ -2544,7 +2574,7 @@ pub mod root {
pub fn GetLastOpenedUser(arg1: *mut root::nn::account::Uid) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn7account11GetNicknameEPA33_cRKNS0_3UidE"]
#[link_name = "\u{1}_ZN2nn7account11GetNicknameEPNS0_8NicknameERKNS0_3UidE"]
pub fn GetNickname(
nickname: *mut root::nn::account::Nickname,
userID: *const root::nn::account::Uid,
@ -2595,7 +2625,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn7account12AsyncContextC1Ev"]
#[link_name = "\u{1}_ZN2nn7account12AsyncContextC2Ev"]
pub fn AsyncContext_AsyncContext(this: *mut root::nn::account::AsyncContext);
}
impl AsyncContext {
@ -2819,7 +2849,7 @@ pub mod root {
pub fn QueryMountRomCacheSize(size: *mut u64) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2fs22QueryMountRomCacheSizeEPmm"]
#[link_name = "\u{1}_ZN2nn2fs22QueryMountRomCacheSizeEPmi"]
pub fn QueryMountRomCacheSize1(
size: *mut u64,
arg1: root::nn::ApplicationId,
@ -2838,7 +2868,7 @@ pub mod root {
pub fn CanMountRomForDebug() -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2fs11CanMountRomEm"]
#[link_name = "\u{1}_ZN2nn2fs11CanMountRomENS_13ApplicationIdE"]
pub fn CanMountRom(arg1: root::nn::ApplicationId) -> root::Result;
}
extern "C" {
@ -2862,7 +2892,7 @@ pub mod root {
pub fn EnsureSaveData(arg1: *const root::nn::account::Uid) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2fs13MountSaveDataEPKcm"]
#[link_name = "\u{1}_ZN2nn2fs13MountSaveDataEPKcNS_13ApplicationIdERKNS_7account3UidE"]
pub fn MountSaveData(
arg1: *const skyline_libc::c_char,
arg2: root::nn::fs::UserId,
@ -2910,7 +2940,7 @@ pub mod root {
pub fn DeleteFile(filepath: *const skyline_libc::c_char) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2fs8ReadFileEPmNS0_10FileHandleElPvmRKi"]
#[link_name = "\u{1}_ZN2nn2fs8ReadFileEPmNS0_10FileHandleElPvm"]
pub fn ReadFile(
outSize: *mut u64,
handle: root::nn::fs::FileHandle,
@ -3748,7 +3778,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2ro20UnregisterModuleInfoEPNS0_16RegistrationInfoEPKv"]
#[link_name = "\u{1}_ZN2nn2ro20UnregisterModuleInfoEPNS0_16RegistrationInfoE"]
pub fn UnregisterModuleInfo(
arg1: *mut root::nn::ro::RegistrationInfo,
arg2: *const skyline_libc::c_void,
@ -4531,7 +4561,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn5prepo10PlayReport9SetBufferEv"]
#[link_name = "\u{1}_ZN2nn5prepo10PlayReport9SetBufferEPvm"]
pub fn PlayReport_SetBuffer(this: *mut root::nn::prepo::PlayReport)
-> root::Result;
}
@ -4571,7 +4601,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn5prepo10PlayReportC1Ev"]
#[link_name = "\u{1}_ZN2nn5prepo10PlayReportC1EPKc"]
pub fn PlayReport_PlayReport(this: *mut root::nn::prepo::PlayReport);
}
impl PlayReport {
@ -4659,7 +4689,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn2vi11CreateLayerEPNS0_5LayerEPNS0_7DisplayE"]
#[link_name = "\u{1}_ZN2nn2vi11CreateLayerEPPNS0_5LayerEPNS0_7DisplayENS_4util10BitFlagSetILi32ENS0_15CompositorFlagsEEE"]
pub fn CreateLayer(
out_Layer: *mut root::nn::vi::Layer,
disp: *mut root::nn::vi::Display,
@ -4869,7 +4899,7 @@ pub mod root {
) -> root::s64;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn5image11JpegDecoder6DecodeEPvliS2_l"]
#[link_name = "\u{1}_ZN2nn5image11JpegDecoder6DecodeEPvmiS2_m"]
pub fn JpegDecoder_Decode(
this: *mut root::nn::image::JpegDecoder,
out: *mut skyline_libc::c_void,
@ -4880,7 +4910,7 @@ pub mod root {
) -> root::nn::image::JpegStatus;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn5image11JpegDecoderC1Ev"]
#[link_name = "\u{1}_ZN2nn5image11JpegDecoderC2Ev"]
pub fn JpegDecoder_JpegDecoder(this: *mut root::nn::image::JpegDecoder);
}
impl JpegDecoder {
@ -4923,7 +4953,7 @@ pub mod root {
}
}
extern "C" {
#[link_name = "\u{1}_ZN2nn5image11JpegDecoderD1Ev"]
#[link_name = "\u{1}_ZN2nn5image11JpegDecoderD0Ev"]
pub fn JpegDecoder_JpegDecoder_destructor(this: *mut root::nn::image::JpegDecoder);
}
}
@ -4936,7 +4966,7 @@ pub mod root {
pub fn Initialize();
}
extern "C" {
#[link_name = "\u{1}_ZN2nn7friends14GetProfileListEPNS0_12AsyncContextEPNS0_7ProfileERKNS_7account3UidEPKmi"]
#[link_name = "\u{1}_ZN2nn7friends14GetProfileListEPNS0_12AsyncContextEPNS0_7ProfileEPKNS_7account23NetworkServiceAccountIdEi"]
pub fn GetProfileList(
context: *mut root::nn::friends::AsyncContext,
profiles: *mut root::nn::friends::Profile,
@ -4980,7 +5010,7 @@ pub mod root {
pub fn Profile_IsValid(this: *const root::nn::friends::Profile) -> bool;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn7friends7Profile18GetProfileImageUrlEPA160_ci"]
#[link_name = "\u{1}_ZNK2nn7friends7Profile18GetProfileImageUrlEPNS0_3UrlENS0_9ImageSizeE"]
pub fn Profile_GetProfileImageUrl(
this: *mut root::nn::friends::Profile,
arg1: *mut root::nn::friends::Url,
@ -5051,7 +5081,7 @@ pub mod root {
) -> root::Result;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn7friends12AsyncContextC1Ev"]
#[link_name = "\u{1}_ZN2nn7friends12AsyncContextC2Ev"]
pub fn AsyncContext_AsyncContext(this: *mut root::nn::friends::AsyncContext);
}
extern "C" {
@ -5164,7 +5194,7 @@ pub mod root {
);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn4diag6detail9AbortImplEPKcS3_S3_ij"]
#[link_name = "\u{1}_ZN2nn4diag6detail9AbortImplEPKcS3_S3_i"]
pub fn AbortImpl1(
arg1: *const skyline_libc::c_char,
arg2: *const skyline_libc::c_char,
@ -5382,11 +5412,11 @@ pub mod root {
);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn3mem17StandardAllocator4DumpEv"]
#[link_name = "\u{1}_ZNK2nn3mem17StandardAllocator4DumpEv"]
pub fn StandardAllocator_Dump(this: *mut root::nn::mem::StandardAllocator);
}
extern "C" {
#[link_name = "\u{1}_ZN2nn3mem17StandardAllocatorC1Ev"]
#[link_name = "\u{1}_ZN2nn3mem17StandardAllocatorC2EPvmb"]
pub fn StandardAllocator_StandardAllocator(
this: *mut root::nn::mem::StandardAllocator,
);
@ -6492,7 +6522,7 @@ pub mod root {
pub fn IsNetworkRequestOnHold() -> bool;
}
extern "C" {
#[link_name = "\u{1}_ZN2nn4nifm26GetCurrentPrimaryIpAddressEPm"]
#[link_name = "\u{1}_ZN2nn4nifm26GetCurrentPrimaryIpAddressEP7in_addr"]
pub fn GetCurrentPrimaryIpAddress(inAddr: *mut u64) -> root::Result;
}
}

View file

@ -1,10 +1,7 @@
#![no_std]
#![feature(proc_macro_hygiene)]
use skyline::{
libc::{fopen, FileOpenMode, fwrite_slice, fclose},
c_str
};
use skyline::nn::account::{self, Uid, GetLastOpenedUser, GetNickname, Nickname};
#[skyline::main]
pub fn main() {
@ -14,17 +11,38 @@ pub fn main() {
println!("{}", i);
}
println!("Writing to file!");
write_to_file("sd:/test.txt\0", "test test test test");
println!("Done writing to file!");
init_accounts();
let nickname = unsafe { get_last_user_nickname() };
println!("Last nickname: {}", nickname);
}
fn init_accounts() {
unsafe { account::Initialize() };
}
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
};
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);
}
}
}*/