@@ -14,14 +14,14 @@ use std::{
14
14
collections:: HashMap , fmt, io:: { BufWriter , Write } , path:: { Path , PathBuf } , str:: FromStr , sync:: { LazyLock , RwLock }
15
15
} ;
16
16
17
+ use api:: file;
17
18
use arcropolis_api:: Event ;
18
19
use log:: LevelFilter ;
19
20
use thiserror:: Error ;
20
21
21
22
#[ macro_use]
22
23
extern crate log;
23
24
24
- // use parking_lot::const_rwlock;
25
25
use skyline:: { hooks:: InlineCtx , libc:: c_char, nn} ;
26
26
27
27
mod api;
@@ -38,7 +38,6 @@ mod resource;
38
38
mod update;
39
39
mod utils;
40
40
mod lua;
41
- mod loader;
42
41
43
42
use fs:: GlobalFilesystem ;
44
43
use smash_arc:: { Hash40 , Region } ;
@@ -237,8 +236,8 @@ fn check_for_update() {
237
236
238
237
#[ skyline:: hook( offset = offsets:: initial_loading( ) , inline) ]
239
238
fn initial_loading ( _ctx : & InlineCtx ) {
240
- // #[cfg(feature = "online")]
241
- // check_for_changelog();
239
+ #[ cfg( feature = "online" ) ]
240
+ check_for_changelog ( ) ;
242
241
243
242
// 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
244
243
#[ cfg( feature = "online" ) ]
@@ -261,34 +260,13 @@ fn initial_loading(_ctx: &InlineCtx) {
261
260
fuse:: arc:: install_arc_fs ( ) ;
262
261
api:: event:: send_event ( Event :: ArcFilesystemMounted ) ;
263
262
replacement:: lookup:: initialize ( Some ( arc) ) ;
264
- println ! ( "Before filesystem" ) ;
263
+
265
264
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 ( ) ;
285
267
286
268
filesystem. process_mods ( ) ;
287
- println ! ( "Before share hashes" ) ;
288
-
289
269
filesystem. share_hashes ( ) ;
290
- println ! ( "Before patch files" ) ;
291
-
292
270
filesystem. patch_files ( ) ;
293
271
294
272
if config:: debug_enabled ( ) {
@@ -305,7 +283,9 @@ fn initial_loading(_ctx: &InlineCtx) {
305
283
}
306
284
} ) ;
307
285
}
286
+
308
287
drop ( filesystem) ;
288
+
309
289
fuse:: mods:: install_mod_fs ( ) ;
310
290
api:: event:: send_event ( Event :: ModFilesystemMounted ) ;
311
291
@@ -499,24 +479,21 @@ pub fn main() {
499
479
}
500
480
501
481
// 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) ;
520
497
521
498
let resources = std:: thread:: Builder :: new ( )
522
499
. stack_size ( 0x10000 )
0 commit comments