From faec03afb13570a70c16fb262538112a1c3f8082 Mon Sep 17 00:00:00 2001 From: Purp1e <47248616+Purple-CSGO@users.noreply.github.com> Date: Thu, 27 Mar 2025 18:02:51 +0800 Subject: [PATCH] [fix] some vconfig not applied -> stable release --- src-tauri/src/vdf/preset.rs | 2 +- src/components/cstb/VideoSetting.tsx | 29 ++++++++++++++-------------- src/store/tool.ts | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src-tauri/src/vdf/preset.rs b/src-tauri/src/vdf/preset.rs index 297b390..902418b 100644 --- a/src-tauri/src/vdf/preset.rs +++ b/src-tauri/src/vdf/preset.rs @@ -480,7 +480,7 @@ pub fn set_cs2_video(file_path: &str, data: VideoConfig) -> Result<()> { let file_content = fs::read_to_string(file_path)?; // 定义正则表达式匹配模式 - let re = Regex::new(r#""(setting\.\w+)"\s+"\d+""#).unwrap(); + let re = Regex::new(r#""(setting\.\w+)"\s+"-?\d+""#).unwrap(); // 替换字段值 let updated_content = re.replace_all(&file_content, |caps: ®ex::Captures| { diff --git a/src/components/cstb/VideoSetting.tsx b/src/components/cstb/VideoSetting.tsx index 0739a90..f70f7b4 100644 --- a/src/components/cstb/VideoSetting.tsx +++ b/src/components/cstb/VideoSetting.tsx @@ -91,10 +91,10 @@ const VideoSetting = () => { mapping: (value: string) => { return ( { - 无: 0, - "2X MSAA": 2, - "4X MSAA": 4, - "8X MSAA": 8, + 无: "0", + "2X MSAA": "2", + "4X MSAA": "4", + "8X MSAA": "8", }[value] || "0" ) }, @@ -168,11 +168,7 @@ const VideoSetting = () => { { type: "videocfg_hdr_detail", title: "光影细节", - value: - { - "3": "低", - "-1": "高", - }[parseInt(video.videocfg_hdr_detail, 10)] || "低", + value: video.videocfg_hdr_detail === "-1" ? "高" : "低", options: ["低", "高"], mapping: (value: string) => { return ( @@ -386,12 +382,17 @@ const VideoSetting = () => { /> { - tool.setVideoSetting({ - ...tool.state.videoSetting, - defaultresheight: value.toString(), - }) + const _ = edit + ? setVconfig({ + ...vconfig, + defaultresheight: value.toString(), + }) + : tool.setVideoSetting({ + ...tool.state.videoSetting, + defaultresheight: value.toString(), + }) }} radius="full" step={10} diff --git a/src/store/tool.ts b/src/store/tool.ts index 0b4a7d8..631d2e4 100644 --- a/src/store/tool.ts +++ b/src/store/tool.ts @@ -229,8 +229,8 @@ const getVideoConfig = async (steam_dir: string, steam_id32: number) => { } const setVideoConfig = async (steam_dir: string, steam_id32: number, video_config: VideoSetting) => { + console.log(video_config.videocfg_hdr_detail) await invoke("set_cs2_video_config", { steamDir: steam_dir, steamId32: steam_id32, videoConfig: video_config }) - // console.log(video) } const addLaunchOption = (option: LaunchOption) => {