[fix] some vconfig not applied -> stable release

This commit is contained in:
Purp1e
2025-03-27 18:02:51 +08:00
parent 7ec20984c4
commit faec03afb1
3 changed files with 17 additions and 16 deletions

View File

@@ -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 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: &regex::Captures| { let updated_content = re.replace_all(&file_content, |caps: &regex::Captures| {

View File

@@ -91,10 +91,10 @@ const VideoSetting = () => {
mapping: (value: string) => { mapping: (value: string) => {
return ( return (
{ {
: 0, : "0",
"2X MSAA": 2, "2X MSAA": "2",
"4X MSAA": 4, "4X MSAA": "4",
"8X MSAA": 8, "8X MSAA": "8",
}[value] || "0" }[value] || "0"
) )
}, },
@@ -168,11 +168,7 @@ const VideoSetting = () => {
{ {
type: "videocfg_hdr_detail", type: "videocfg_hdr_detail",
title: "光影细节", title: "光影细节",
value: value: video.videocfg_hdr_detail === "-1" ? "高" : "低",
{
"3": "低",
"-1": "高",
}[parseInt(video.videocfg_hdr_detail, 10)] || "低",
options: ["低", "高"], options: ["低", "高"],
mapping: (value: string) => { mapping: (value: string) => {
return ( return (
@@ -386,12 +382,17 @@ const VideoSetting = () => {
/> />
<NumberInput <NumberInput
aria-label="height" aria-label="height"
value={parseInt(tool.state.videoSetting.defaultresheight, 10)} value={parseInt(edit ? vconfig.defaultresheight : tool.state.videoSetting.defaultresheight, 10)}
onValueChange={(value) => { onValueChange={(value) => {
tool.setVideoSetting({ const _ = edit
...tool.state.videoSetting, ? setVconfig({
defaultresheight: value.toString(), ...vconfig,
}) defaultresheight: value.toString(),
})
: tool.setVideoSetting({
...tool.state.videoSetting,
defaultresheight: value.toString(),
})
}} }}
radius="full" radius="full"
step={10} step={10}

View File

@@ -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) => { 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 }) await invoke("set_cs2_video_config", { steamDir: steam_dir, steamId32: steam_id32, videoConfig: video_config })
// console.log(video)
} }
const addLaunchOption = (option: LaunchOption) => { const addLaunchOption = (option: LaunchOption) => {