summaryrefslogtreecommitdiff
path: root/src/components/UsageInstructions.tsx
blob: 727a0ab0451a6d8fbc8f888cc8ef1a694c4e4b28 (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
import { PanelSectionRow } from "@decky/ui";
import { ConfigurationData } from "../config/configSchema";

interface UsageInstructionsProps {
  config: ConfigurationData;
}

export function UsageInstructions({ config }: UsageInstructionsProps) {
  // Build manual environment variables string based on current config
  const buildManualEnvVars = (): string => {
    const envVars: string[] = [];
    
    if (config.enable_lsfg) {
      envVars.push("ENABLE_LSFG=1");
    }
    
    // Always include multiplier and flow_scale if LSFG is enabled, as they have defaults
    if (config.enable_lsfg) {
      envVars.push(`LSFG_MULTIPLIER=${config.multiplier}`);
      envVars.push(`LSFG_FLOW_SCALE=${config.flow_scale}`);
    }
    
    if (config.hdr) {
      envVars.push("LSFG_HDR=1");
    }
    
    if (config.perf_mode) {
      envVars.push("LSFG_PERF_MODE=1");
    }
    
    if (config.immediate_mode) {
      envVars.push("MESA_VK_WSI_PRESENT_MODE=immediate");
    }
    
    if (config.disable_vkbasalt) {
      envVars.push("DISABLE_VKBASALT=1");
    }
    
    if (config.frame_cap > 0) {
      envVars.push(`DXVK_FRAME_RATE=${config.frame_cap}`);
    }
    
    return envVars.length > 0 ? `${envVars.join(" ")} %command%` : "%command%";
  };

  return (
    <>
      <PanelSectionRow>
        <div
          style={{
            fontSize: "13px",
            marginTop: "12px",
            padding: "8px",
            backgroundColor: "rgba(255, 255, 255, 0.05)",
            borderRadius: "4px"
          }}
        >
          <div style={{ fontWeight: "bold", marginBottom: "6px" }}>
            Usage Instructions:
          </div>
          <div style={{ marginBottom: "4px" }}>
            Option 1: Use the lsfg script (recommended):
          </div>
          <div
            style={{
              fontFamily: "monospace",
              backgroundColor: "rgba(0, 0, 0, 0.3)",
              padding: "4px",
              borderRadius: "2px",
              fontSize: "12px",
              marginBottom: "6px"
            }}
          >
            ~/lsfg %command%
          </div>
          <div style={{ marginBottom: "4px" }}>
            Option 2: Manual environment variables:
          </div>
          <div
            style={{
              fontFamily: "monospace",
              backgroundColor: "rgba(0, 0, 0, 0.3)",
              padding: "4px",
              borderRadius: "2px",
              fontSize: "12px",
              marginBottom: "6px"
            }}
          >
            {buildManualEnvVars()}
          </div>
        </div>
      </PanelSectionRow>
    </>
  );
}