[feat] set video and template

This commit is contained in:
2025-03-27 15:48:09 +08:00
parent 114def0b96
commit 63172f12bc
2 changed files with 212 additions and 158 deletions

View File

@@ -3,7 +3,7 @@ import { useSnapshot } from "valtio"
import { DEFAULT_STORE_CONFIG } from "./config"
import { emit } from "@tauri-apps/api/event"
import { invoke } from "@tauri-apps/api/core"
import { steamStore, useSteamStore } from "./steam"
import VideoSetting from "@/components/cstb/VideoSetting"
interface LaunchOption {
option: string
@@ -45,6 +45,87 @@ export interface VideoSetting {
aspectratiomode: string; // 宽高比模式
}
// 视频设置预设模版
// TODO: 校准
export const VideoSettingTemplate = {
veryhigh: {
cpu_level: "3",
gpu_mem_level: "3",
gpu_level: "3",
shaderquality: "0",
r_texturefilteringquality: "3",
msaa_samples: "2",
r_csgo_cmaa_enable: "0",
videocfg_shadow_quality: "0",
videocfg_dynamic_shadows: "1",
videocfg_texture_detail: "1",
videocfg_particle_detail: "0",
videocfg_ao_detail: "0",
videocfg_hdr_detail: "3",
},
high: {
cpu_level: "3",
gpu_mem_level: "3",
gpu_level: "3",
shaderquality: "0",
r_texturefilteringquality: "3",
msaa_samples: "2",
r_csgo_cmaa_enable: "0",
videocfg_shadow_quality: "0",
videocfg_dynamic_shadows: "1",
videocfg_texture_detail: "1",
videocfg_particle_detail: "0",
videocfg_ao_detail: "0",
videocfg_hdr_detail: "3",
},
middle: {
cpu_level: "3",
gpu_mem_level: "3",
gpu_level: "3",
shaderquality: "0",
r_texturefilteringquality: "3",
msaa_samples: "2",
r_csgo_cmaa_enable: "0",
videocfg_shadow_quality: "0",
videocfg_dynamic_shadows: "1",
videocfg_texture_detail: "1",
videocfg_particle_detail: "0",
videocfg_ao_detail: "0",
videocfg_hdr_detail: "3",
},
low: {
cpu_level: "3",
gpu_mem_level: "3",
gpu_level: "3",
shaderquality: "0",
r_texturefilteringquality: "3",
msaa_samples: "2",
r_csgo_cmaa_enable: "0",
videocfg_shadow_quality: "0",
videocfg_dynamic_shadows: "1",
videocfg_texture_detail: "1",
videocfg_particle_detail: "0",
videocfg_ao_detail: "0",
videocfg_hdr_detail: "3",
},
recommend: {
cpu_level: "3",
gpu_mem_level: "3",
gpu_level: "3",
shaderquality: "0",
r_texturefilteringquality: "3",
msaa_samples: "2",
r_csgo_cmaa_enable: "0",
videocfg_shadow_quality: "0",
videocfg_dynamic_shadows: "1",
videocfg_texture_detail: "1",
videocfg_particle_detail: "0",
videocfg_ao_detail: "0",
videocfg_hdr_detail: "3",
},
}
const defaultValue = {
launchOptions: [
{ option: "-novid -high -freq 144 -fullscreen", name: "" },
@@ -115,6 +196,7 @@ export const useToolStore = () => {
setPowerPlan,
setVideoSetting,
getVideoConfig,
setVideoConfig,
addLaunchOption,
resetToolStore,
}
@@ -158,6 +240,11 @@ const getVideoConfig = async (steam_dir: string, steam_id32: number) => {
setVideoSetting(video)
}
const setVideoConfig = async (steam_dir: string, steam_id32: number, video_config: VideoSetting) => {
await invoke("set_cs2_video_config", { steamDir: steam_dir, steamId32: steam_id32, videoConfig: video_config })
// console.log(video)
}
const addLaunchOption = (option: LaunchOption) => {
// 限制最高10个
if (toolStore.state.launchOptions.length >= 10) {