Skip to content

Commit 37a03d0

Browse files
committed
chore: 移除废弃功能并简化 autoplay 成绩拦截为始终开启
1 parent ebaa9fb commit 37a03d0

4 files changed

Lines changed: 11 additions & 28 deletions

File tree

manifest.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,9 @@ label = { zh = "所有计时器 999", en = "All timers 999" }
100100

101101
[[config.sections]]
102102
id = "Autoplay"
103-
default_enabled = false
103+
default_enabled = true
104104
label = { zh = "自动游玩", en = "Autoplay" }
105105
description = { zh = "只屏蔽成绩数据,角色/设置/地图进度正常保存", en = "Only blocks score data, settings/progress saved normally" }
106-
[[config.sections.entries]]
107-
key = "block_playlog"
108-
type = "bool"
109-
default = true
110-
label = { zh = "屏蔽游玩记录", en = "Block playlog" }
111-
[[config.sections.entries]]
112-
key = "block_music_detail"
113-
type = "bool"
114-
default = true
115-
label = { zh = "屏蔽成绩详情", en = "Block music detail" }
116106

117107
[[config.sections]]
118108
id = "Unlock120fps"

src/config.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ Version = "1"
5656
5757
## 自动游玩
5858
## 只屏蔽成绩数据,角色/设置/地图进度正常保存
59-
#[Autoplay]
60-
#block_playlog = true
61-
#block_music_detail = true
59+
[Autoplay]
6260
6361
## 解锁 120fps
6462
[Unlock120fps]
@@ -117,7 +115,12 @@ impl Config {
117115
self.sections
118116
.get(section)
119117
.and_then(toml::Value::as_table)
120-
.is_some_and(|table| !table.get("Disabled").and_then(toml::Value::as_bool).unwrap_or(false))
118+
.is_some_and(|table| {
119+
!table
120+
.get("Disabled")
121+
.and_then(toml::Value::as_bool)
122+
.unwrap_or(false)
123+
})
121124
}
122125

123126
pub fn get_int(&self, section: &str, key: &str, default: i64) -> i64 {

src/hooks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::util::api::Api;
77
pub fn init_all(api: &Api, config: &Config) {
88
if config.is_enabled("Autoplay") {
99
autoplay::init(api, config);
10-
smart_upload::init(api, config);
10+
smart_upload::init(api);
1111
}
1212
}
1313

src/hooks/smart_upload.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
use std::ffi::c_void;
22

3-
use crate::config::Config;
43
use crate::hooks::autoplay;
54
use crate::util::api::Api;
65

76
static mut API_HANDLE: Option<Api> = None;
87
static mut UPSERT_ADDR: usize = 0;
98
static mut ORIG_UPSERT: usize = 0;
10-
static mut BLOCK_WHEN_AUTOPLAY: bool = false;
11-
12-
pub fn init(api: &Api, config: &Config) {
13-
let block_playlog = config.get_bool("Autoplay", "block_playlog", true);
14-
let block_music_detail = config.get_bool("Autoplay", "block_music_detail", true);
15-
if !block_playlog && !block_music_detail {
16-
api.log_info("智能成绩屏蔽未启用: block_playlog/block_music_detail 均为 false");
17-
return;
18-
}
199

10+
pub fn init(api: &Api) {
2011
unsafe {
2112
API_HANDLE = Some(*api);
22-
BLOCK_WHEN_AUTOPLAY = true;
2313
}
2414

2515
let upsert = find_upsert_function(api, api.text_base(), api.text_size(), api.game_base(), api.game_size());
@@ -60,7 +50,7 @@ pub fn shutdown() {
6050
}
6151

6252
unsafe extern "C" fn hooked_upsert(a: *mut c_void, b: *mut c_void, c: *mut c_void) {
63-
if BLOCK_WHEN_AUTOPLAY && (autoplay::is_enabled() || autoplay::was_used()) {
53+
if autoplay::is_enabled() || autoplay::was_used() {
6454
if let Some(api) = API_HANDLE {
6555
api.log_info("成绩屏蔽: 本次游玩使用过 autoplay,已阻止上传");
6656
}

0 commit comments

Comments
 (0)