summaryrefslogtreecommitdiff
path: root/py_modules/lsfg_vk/config_schema_generated.py
blob: 9cfda513fe2b43dc672f6547100c62b150c9ebec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""
Auto-generated configuration schema components from shared_config.py
DO NOT EDIT THIS FILE MANUALLY - it will be overwritten on build
"""

from typing import TypedDict, Dict, Any, Union
from enum import Enum
import sys
from pathlib import Path

# Import shared configuration constants
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType

# Field name constants for type-safe access
DLL = "dll"
ALLOW_FP16 = "allow_fp16"
MULTIPLIER = "multiplier"
FLOW_SCALE = "flow_scale"
PERFORMANCE_MODE = "performance_mode"
PACING = "pacing"
ACTIVE_IN = "active_in"
USE_NATIVE_MATCHING = "use_native_matching"
GPU = "gpu"
DISABLE_LSFGVK = "disable_lsfgvk"
DXVK_FRAME_RATE = "dxvk_frame_rate"
ENABLE_WOW64 = "enable_wow64"
DISABLE_STEAMDECK_MODE = "disable_steamdeck_mode"
MANGOHUD_WORKAROUND = "mangohud_workaround"
DISABLE_VKBASALT = "disable_vkbasalt"
FORCE_ENABLE_VKBASALT = "force_enable_vkbasalt"
ENABLE_WSI = "enable_wsi"
ENABLE_ZINK = "enable_zink"


class ConfigurationData(TypedDict):
    """Type-safe configuration data structure - AUTO-GENERATED"""
    dll: str
    allow_fp16: bool
    multiplier: int
    flow_scale: float
    performance_mode: bool
    pacing: str
    active_in: str
    use_native_matching: bool
    gpu: str
    disable_lsfgvk: bool
    dxvk_frame_rate: int
    enable_wow64: bool
    disable_steamdeck_mode: bool
    mangohud_workaround: bool
    disable_vkbasalt: bool
    force_enable_vkbasalt: bool
    enable_wsi: bool
    enable_zink: bool


def get_script_parsing_logic():
    """Return the script parsing logic as a callable"""
    def parse_script_values(lines):
        script_values = {}
        for line in lines:
            line = line.strip()
            if not line or line.startswith("#") or not line.startswith("export "):
                continue
            if "=" in line:
                export_line = line[len("export "):]
                key, value = export_line.split("=", 1)
                key = key.strip()
                value = value.strip()

                # Auto-generated parsing logic:
                if key == "DECKY_LSFGVK_AUTO_PROFILE":
                        script_values["use_native_matching"] = value == "1"
                if key == "DISABLE_LSFGVK":
                        script_values["disable_lsfgvk"] = value == "1"
                if key == "DXVK_FRAME_RATE":
                        try:
                            script_values["dxvk_frame_rate"] = int(value)
                        except ValueError:
                            pass
                if key == "PROTON_USE_WOW64":
                        script_values["enable_wow64"] = value == "1"
                if key == "SteamDeck":
                        script_values["disable_steamdeck_mode"] = value == "0"
                if key == "MANGOHUD":
                        script_values["mangohud_workaround"] = value == "1"
                if key == "DISABLE_VKBASALT":
                        script_values["disable_vkbasalt"] = value == "1"
                if key == "ENABLE_VKBASALT":
                        script_values["force_enable_vkbasalt"] = value == "1"
                if key == "ENABLE_GAMESCOPE_WSI":
                        script_values["enable_wsi"] = value != "0"
                if key == "__GLX_VENDOR_LIBRARY_NAME" and value == "mesa":
                        script_values["enable_zink"] = True
                if key == "MESA_LOADER_DRIVER_OVERRIDE" and value == "zink":
                        script_values["enable_zink"] = True
                if key == "GALLIUM_DRIVER" and value == "zink":
                        script_values["enable_zink"] = True

        return script_values
    return parse_script_values


def get_script_generation_logic():
    """Return the script generation logic as a callable"""
    def generate_script_lines(config):
        lines = []
        if config.get("use_native_matching", False):
            lines.append("export DECKY_LSFGVK_AUTO_PROFILE=1")
        if config.get("disable_lsfgvk", False):
            lines.append("export DISABLE_LSFGVK=1")
        dxvk_frame_rate = config.get("dxvk_frame_rate", 0)
        if dxvk_frame_rate > 0:
            lines.append(f"export DXVK_FRAME_RATE={dxvk_frame_rate}")
        if config.get("enable_wow64", False):
            lines.append("export PROTON_USE_WOW64=1")
        if config.get("disable_steamdeck_mode", False):
            lines.append("export SteamDeck=0")
        if config.get("mangohud_workaround", False):
            lines.append("export MANGOHUD=1")
        if config.get("disable_vkbasalt", False):
            lines.append("export DISABLE_VKBASALT=1")
        if config.get("force_enable_vkbasalt", False):
            lines.append("export ENABLE_VKBASALT=1")
        if not config.get("enable_wsi", False):
            lines.append("export ENABLE_GAMESCOPE_WSI=0")
        if config.get("enable_zink", False):
            lines.append("export __GLX_VENDOR_LIBRARY_NAME=mesa")
            lines.append("export MESA_LOADER_DRIVER_OVERRIDE=zink")
            lines.append("export GALLIUM_DRIVER=zink")
        return lines
    return generate_script_lines


ALL_FIELDS = ['dll', 'allow_fp16', 'multiplier', 'flow_scale', 'performance_mode', 'pacing', 'active_in', 'use_native_matching', 'gpu', 'disable_lsfgvk', 'dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt', 'force_enable_vkbasalt', 'enable_wsi', 'enable_zink']