feat: remove the option to disable periodic writes

This commit is contained in:
mkrsym1 2023-12-28 00:53:36 +02:00
parent ebebb65e74
commit 5de1171442
2 changed files with 1 additions and 9 deletions

View file

@ -4,7 +4,6 @@ use serde_json::Value as JsonValue;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct Config {
pub fps: u64, // TODO: Fps enum
pub periodic_writes: bool,
pub interval: u64
}
@ -13,7 +12,6 @@ impl Default for Config {
fn default() -> Self {
Self {
fps: 120,
periodic_writes: true,
interval: 5000
}
}
@ -29,11 +27,6 @@ impl From<&JsonValue> for Config {
None => default.fps
},
periodic_writes: match value.get("periodic_writes") {
Some(value) => value.as_bool().unwrap_or(default.periodic_writes),
None => default.periodic_writes
},
interval: match value.get("interval") {
Some(value) => value.as_u64().unwrap_or(default.interval),
None => default.interval

View file

@ -117,8 +117,7 @@ pub fn run() -> anyhow::Result<()> {
// If patch applying is disabled, then game_executable is either GenshinImpact.exe or YuanShen.exe
// so we don't need to check it here
let unlocker_config = &config.game.enhancements.fps_unlocker.config;
let unlocker_interval = if unlocker_config.periodic_writes { unlocker_config.interval as i64 } else { -1 };
std::fs::write(game_path.join("fps_unlocker.bat"), format!("start {game_executable} %*\n\nZ:\ncd \"{}\"\nstart fpsunlock.exe {} {unlocker_interval}", unlocker.dir().to_string_lossy(), unlocker_config.fps))?;
std::fs::write(game_path.join("fps_unlocker.bat"), format!("start {game_executable} %*\n\nZ:\ncd \"{}\"\nstart fpsunlock.exe {} {}", unlocker.dir().to_string_lossy(), unlocker_config.fps, unlocker_config.interval))?;
}
// Generate `config.ini` if environment emulation feature is presented