From 0738a12aab85e169941a5f734f8c3007849111c8 Mon Sep 17 00:00:00 2001 From: shadow3aaa Date: Thu, 10 Oct 2024 18:23:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20remove=20'tigger'=20=F0=9F=90=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 拼写错误... --- src/cpu_common/mod.rs | 12 +++++----- src/framework/extension/mod.rs | 2 +- .../scheduler/looper/buffer/calculate.rs | 2 +- src/framework/scheduler/looper/utils.rs | 24 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cpu_common/mod.rs b/src/cpu_common/mod.rs index 939b6069..96a974c0 100644 --- a/src/cpu_common/mod.rs +++ b/src/cpu_common/mod.rs @@ -96,9 +96,9 @@ impl Controller { pub fn init_game(&mut self, extension: &Extension) { self.policy_freq = self.max_freq; - extension.tigger_extentions(ApiV0::InitCpuFreq); - extension.tigger_extentions(ApiV1::InitCpuFreq); - extension.tigger_extentions(ApiV2::InitCpuFreq); + extension.trigger_extentions(ApiV0::InitCpuFreq); + extension.trigger_extentions(ApiV1::InitCpuFreq); + extension.trigger_extentions(ApiV2::InitCpuFreq); for cpu in &self.cpu_infos { cpu.write_freq(self.max_freq, &mut self.file_handler) @@ -108,9 +108,9 @@ impl Controller { pub fn init_default(&mut self, extension: &Extension) { self.policy_freq = self.max_freq; - extension.tigger_extentions(ApiV0::ResetCpuFreq); - extension.tigger_extentions(ApiV1::ResetCpuFreq); - extension.tigger_extentions(ApiV2::ResetCpuFreq); + extension.trigger_extentions(ApiV0::ResetCpuFreq); + extension.trigger_extentions(ApiV1::ResetCpuFreq); + extension.trigger_extentions(ApiV2::ResetCpuFreq); for cpu in &mut self.cpu_infos { cpu.reset_freq(&mut self.file_handler) diff --git a/src/framework/extension/mod.rs b/src/framework/extension/mod.rs index 642ddf34..886e7244 100644 --- a/src/framework/extension/mod.rs +++ b/src/framework/extension/mod.rs @@ -42,7 +42,7 @@ impl Extension { Ok(Self { sx }) } - pub fn tigger_extentions(&self, trigger: impl Api + 'static) { + pub fn trigger_extentions(&self, trigger: impl Api + 'static) { let _ = self.sx.try_send(trigger.into_box()); } } diff --git a/src/framework/scheduler/looper/buffer/calculate.rs b/src/framework/scheduler/looper/buffer/calculate.rs index 473e17e1..070afc96 100644 --- a/src/framework/scheduler/looper/buffer/calculate.rs +++ b/src/framework/scheduler/looper/buffer/calculate.rs @@ -53,7 +53,7 @@ impl Buffer { let new_target_fps = self.target_fps(); if self.target_fps != new_target_fps { if let Some(target_fps) = new_target_fps { - extension.tigger_extentions(ApiV2::TargetFpsChange(target_fps, self.pkg.clone())); + extension.trigger_extentions(ApiV2::TargetFpsChange(target_fps, self.pkg.clone())); } self.target_fps = new_target_fps; diff --git a/src/framework/scheduler/looper/utils.rs b/src/framework/scheduler/looper/utils.rs index 7dabfd0b..58d492d1 100644 --- a/src/framework/scheduler/looper/utils.rs +++ b/src/framework/scheduler/looper/utils.rs @@ -44,11 +44,11 @@ impl Looper { self.database = open_database().unwrap(); } self.extension - .tigger_extentions(ApiV0::UnloadFas(buffer.pid, pkg.clone())); + .trigger_extentions(ApiV0::UnloadFas(buffer.pid, pkg.clone())); self.extension - .tigger_extentions(ApiV1::UnloadFas(buffer.pid, pkg.clone())); + .trigger_extentions(ApiV1::UnloadFas(buffer.pid, pkg.clone())); self.extension - .tigger_extentions(ApiV2::UnloadFas(buffer.pid, pkg)); + .trigger_extentions(ApiV2::UnloadFas(buffer.pid, pkg)); self.buffer = None; } } @@ -66,9 +66,9 @@ impl Looper { self.state = State::NotWorking; self.cleaner.undo_cleanup(); self.controller.init_default(&self.extension); - self.extension.tigger_extentions(ApiV0::StopFas); - self.extension.tigger_extentions(ApiV1::StopFas); - self.extension.tigger_extentions(ApiV2::StopFas); + self.extension.trigger_extentions(ApiV0::StopFas); + self.extension.trigger_extentions(ApiV1::StopFas); + self.extension.trigger_extentions(ApiV2::StopFas); } State::Waiting => self.state = State::NotWorking, State::NotWorking => (), @@ -80,9 +80,9 @@ impl Looper { State::NotWorking => { self.state = State::Waiting; self.delay_timer = Instant::now(); - self.extension.tigger_extentions(ApiV0::StartFas); - self.extension.tigger_extentions(ApiV1::StartFas); - self.extension.tigger_extentions(ApiV2::StartFas); + self.extension.trigger_extentions(ApiV0::StartFas); + self.extension.trigger_extentions(ApiV1::StartFas); + self.extension.trigger_extentions(ApiV2::StartFas); } State::Waiting => { if self.delay_timer.elapsed() > DELAY_TIME { @@ -122,11 +122,11 @@ impl Looper { self.fitness = f64::MIN; self.extension - .tigger_extentions(ApiV0::LoadFas(pid, pkg.clone())); + .trigger_extentions(ApiV0::LoadFas(pid, pkg.clone())); self.extension - .tigger_extentions(ApiV1::LoadFas(pid, pkg.clone())); + .trigger_extentions(ApiV1::LoadFas(pid, pkg.clone())); self.extension - .tigger_extentions(ApiV2::LoadFas(pid, pkg.clone())); + .trigger_extentions(ApiV2::LoadFas(pid, pkg.clone())); let mut buffer = Buffer::new(target_fps, pid, pkg); buffer.push_frametime(frametime, &self.extension);