Skip to content

Commit

Permalink
Get the discovery thread to start faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Raytwo committed May 27, 2022
1 parent eca096a commit e7d9207
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
@@ -1,3 +1,3 @@
{
"rust-analyzer.server.extraEnv": {"RUSTFLAGS" : "--cfg skyline_std_v3"}
}
}
20 changes: 13 additions & 7 deletions src/lib.rs
Expand Up @@ -293,14 +293,20 @@ pub fn main() {
// Acquire the filesystem and promise it to the initial_loading hook
let mut filesystem = GLOBAL_FILESYSTEM.write();

let discovery = std::thread::Builder::new()
.stack_size(0x40000)
.spawn(|| {
unsafe {
let curr_thread = nn::os::GetCurrentThread();
nn::os::ChangeThreadPriority(curr_thread, 0);
}
std::thread::sleep(std::time::Duration::from_millis(5000));
fs::perform_discovery()
})
.unwrap();

*filesystem = GlobalFilesystem::Promised(
std::thread::Builder::new()
.stack_size(0x40000)
.spawn(|| {
std::thread::sleep(std::time::Duration::from_millis(5000));
fs::perform_discovery()
})
.unwrap(),
discovery
);

let resources = std::thread::Builder::new()
Expand Down
2 changes: 1 addition & 1 deletion src/replacement/addition.rs
Expand Up @@ -66,7 +66,7 @@ pub fn add_file(ctx: &mut AdditionContext, path: &Path) {

ctx.added_files.insert(file_path.path.hash40(), filepath_idx);

info!("Added file '{}' ({:#x})", path.display(), file_path.path.hash40().0);
// info!("Added file '{}' ({:#x})", path.display(), file_path.path.hash40().0);
}

pub fn add_shared_file(ctx: &mut AdditionContext, path: &Path, shared_to: Hash40) {
Expand Down

0 comments on commit e7d9207

Please sign in to comment.