diff --git a/src/main.rs b/src/main.rs index d94899d..92cf60a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{env, fs, io, io::Read, path::Path}; +use std::{env, fs, io::{self, stdin, Read, Write}, path::Path}; fn main() { let mut rblxpath = String::new(); if let Some(lad) = env::var("LOCALAPPDATA").ok() { @@ -18,6 +18,24 @@ fn main() { println!("Roblox not found (Die)"); return; } + println!("What FPS would you like to cap the fps to? (0 for no cap at all)"); + let _ = io::stdout().flush(); + let mut input = String::new(); + stdin().read_line(&mut input).expect("invalid input, try again"); + if let Some('\n')=input.chars().next_back() { + input.pop(); + } + if let Some('\r')=input.chars().next_back() { + input.pop(); + } + let fps = input.parse::().unwrap(); + let desired_fps = match fps { + 0 => 5588562, + _ => fps + }; + println!("fps cap will be set to {desired_fps}"); + let just_make_this_work = format!("{{\"FFlagHandleAltEnterFullscreenManually\":\"False\",\"DFIntTaskSchedulerTargetFps\":{desired_fps},\"FFlagEnableInGameMenuChromeABTest3\":\"False\",\"FFlagGameBasicSettingsFramerateCap5\":\"False\",\"FFlagTaskSchedulerLimitTargetFpsTo2402\":\"False\"}}"); + let fflag_contents = just_make_this_work.as_str(); let versions = format!("{}\\Versions\\", rblxpath); for folder in fs::read_dir(versions).unwrap() { let cur_folder = folder.unwrap().path().display().to_string(); @@ -32,12 +50,8 @@ fn main() { println!("ClientSettings folder already exists in {}", cur_folder); } let cas_json = format!("{}\\ClientAppSettings.json", cs_folder); - if !Path::new(&cas_json).is_file() { - fs::write(cas_json, "{\"FFlagHandleAltEnterFullscreenManually\":\"False\",\"DFIntTaskSchedulerTargetFps\":5588562,\"FFlagEnableInGameMenuChromeABTest3\":\"False\",\"FFlagGameBasicSettingsFramerateCap5\":\"False\",\"FFlagTaskSchedulerLimitTargetFpsTo2402\":\"False\"}").ok(); - println!("Wrote ClientAppSettings.json to {}", cur_folder) - } else { - println!("ClientAppSettings.json already exists in {}", cur_folder) - } + fs::write(cas_json, fflag_contents).ok(); + println!("Wrote ClientAppSettings.json to {}", cur_folder) } } }