Skip to content

Commit f3421a7

Browse files
committed
Confirm the issue is emulator specific
1 parent 1382d2c commit f3421a7

File tree

1 file changed

+23
-46
lines changed

1 file changed

+23
-46
lines changed

src/lib.rs

+23-46
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ use std::{
1414
collections::HashMap, fmt, io::{BufWriter, Write}, path::{Path, PathBuf}, str::FromStr, sync::{LazyLock, RwLock}
1515
};
1616

17+
use api::file;
1718
use arcropolis_api::Event;
1819
use log::LevelFilter;
1920
use thiserror::Error;
2021

2122
#[macro_use]
2223
extern crate log;
2324

24-
// use parking_lot::const_rwlock;
2525
use skyline::{hooks::InlineCtx, libc::c_char, nn};
2626

2727
mod api;
@@ -38,7 +38,6 @@ mod resource;
3838
mod update;
3939
mod utils;
4040
mod lua;
41-
mod loader;
4241

4342
use fs::GlobalFilesystem;
4443
use smash_arc::{Hash40, Region};
@@ -237,8 +236,8 @@ fn check_for_update() {
237236

238237
#[skyline::hook(offset = offsets::initial_loading(), inline)]
239238
fn initial_loading(_ctx: &InlineCtx) {
240-
// #[cfg(feature = "online")]
241-
// check_for_changelog();
239+
#[cfg(feature = "online")]
240+
check_for_changelog();
242241

243242
// Begin checking if there is an update to do. We do this in a separate thread so that we can install the hooks while we are waiting on GitHub response
244243
#[cfg(feature = "online")]
@@ -261,34 +260,13 @@ fn initial_loading(_ctx: &InlineCtx) {
261260
fuse::arc::install_arc_fs();
262261
api::event::send_event(Event::ArcFilesystemMounted);
263262
replacement::lookup::initialize(Some(arc));
264-
println!("Before filesystem");
263+
265264
let mut filesystem = unsafe { GLOBAL_FILESYSTEM.write().unwrap() };
266-
267-
// let discovery = std::thread::Builder::new()
268-
// .stack_size(0x10000)
269-
// .spawn(|| {
270-
// unsafe {
271-
// let curr_thread = nn::os::GetCurrentThread();
272-
// nn::os::ChangeThreadPriority(curr_thread, 0);
273-
// }
274-
// std::thread::sleep(std::time::Duration::from_millis(5000));
275-
// fs::perform_discovery()
276-
// })
277-
// .unwrap();
278-
279-
println!("Before promise");
280-
281-
println!("Before take");
282-
*filesystem = GlobalFilesystem::Initialized(Box::new(fs::CachedFilesystem::make_from_promise(fs::perform_discovery())));
283-
// *filesystem = GlobalFilesystem::Promised(discovery).take().finish(arc).unwrap();
284-
println!("Before process mods");
265+
266+
*filesystem = filesystem.take().finish(arc).unwrap();
285267

286268
filesystem.process_mods();
287-
println!("Before share hashes");
288-
289269
filesystem.share_hashes();
290-
println!("Before patch files");
291-
292270
filesystem.patch_files();
293271

294272
if config::debug_enabled() {
@@ -305,7 +283,9 @@ fn initial_loading(_ctx: &InlineCtx) {
305283
}
306284
});
307285
}
286+
308287
drop(filesystem);
288+
309289
fuse::mods::install_mod_fs();
310290
api::event::send_event(Event::ModFilesystemMounted);
311291

@@ -499,24 +479,21 @@ pub fn main() {
499479
}
500480

501481
// Acquire the filesystem and promise it to the initial_loading hook
502-
println!("Before acquire");
503-
// let mut filesystem = unsafe { GLOBAL_FILESYSTEM.write().unwrap() };
504-
505-
// let discovery = std::thread::Builder::new()
506-
// .stack_size(0x10000)
507-
// .spawn(|| {
508-
// unsafe {
509-
// let curr_thread = nn::os::GetCurrentThread();
510-
// nn::os::ChangeThreadPriority(curr_thread, 0);
511-
// }
512-
// std::thread::sleep(std::time::Duration::from_millis(5000));
513-
// fs::perform_discovery()
514-
// })
515-
// .unwrap();
516-
517-
// println!("Before promise");
518-
519-
// *filesystem = GlobalFilesystem::Promised(discovery);
482+
let mut filesystem = unsafe { GLOBAL_FILESYSTEM.write().unwrap() };
483+
484+
let discovery = std::thread::Builder::new()
485+
.stack_size(0x10000)
486+
.spawn(|| {
487+
unsafe {
488+
let curr_thread = nn::os::GetCurrentThread();
489+
nn::os::ChangeThreadPriority(curr_thread, 0);
490+
}
491+
std::thread::sleep(std::time::Duration::from_millis(5000));
492+
fs::perform_discovery()
493+
})
494+
.unwrap();
495+
496+
*filesystem = GlobalFilesystem::Promised(discovery);
520497

521498
let resources = std::thread::Builder::new()
522499
.stack_size(0x10000)

0 commit comments

Comments
 (0)