feat: remove the option to disable periodic writes
This commit is contained in:
parent
ebebb65e74
commit
5de1171442
2 changed files with 1 additions and 9 deletions
|
@ -4,7 +4,6 @@ use serde_json::Value as JsonValue;
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub fps: u64, // TODO: Fps enum
|
pub fps: u64, // TODO: Fps enum
|
||||||
pub periodic_writes: bool,
|
|
||||||
pub interval: u64
|
pub interval: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +12,6 @@ impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
fps: 120,
|
fps: 120,
|
||||||
periodic_writes: true,
|
|
||||||
interval: 5000
|
interval: 5000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +27,6 @@ impl From<&JsonValue> for Config {
|
||||||
None => default.fps
|
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") {
|
interval: match value.get("interval") {
|
||||||
Some(value) => value.as_u64().unwrap_or(default.interval),
|
Some(value) => value.as_u64().unwrap_or(default.interval),
|
||||||
None => default.interval
|
None => default.interval
|
||||||
|
|
|
@ -117,8 +117,7 @@ pub fn run() -> anyhow::Result<()> {
|
||||||
// If patch applying is disabled, then game_executable is either GenshinImpact.exe or YuanShen.exe
|
// If patch applying is disabled, then game_executable is either GenshinImpact.exe or YuanShen.exe
|
||||||
// so we don't need to check it here
|
// so we don't need to check it here
|
||||||
let unlocker_config = &config.game.enhancements.fps_unlocker.config;
|
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.dir().to_string_lossy(), unlocker_config.fps, unlocker_config.interval))?;
|
||||||
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))?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate `config.ini` if environment emulation feature is presented
|
// Generate `config.ini` if environment emulation feature is presented
|
||||||
|
|
Loading…
Reference in a new issue