Skip to content

Commit

Permalink
config: deprecate env for global.env, fix card indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Nov 2, 2023
1 parent a43d5a1 commit 8030c9b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
17 changes: 9 additions & 8 deletions config/cardpick.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ func (b *Binary) pickCard() error {
if err != nil {
return err
}
idx = i
}

if idx < 0 {
return errors.New("gpu index cannot be negative")
}

if n < idx+1 {
return errors.New("gpu not found")
idx = i
}

// Check if the system actually has PRIME offload and there's no ambiguity with the GPUs.
Expand All @@ -58,6 +51,14 @@ func (b *Binary) pickCard() error {
}
}

if idx < 0 {
return errors.New("gpu index cannot be negative")
}

if n < idx+1 {
return errors.New("gpu not found")
}

log.Printf("Using Card index: %d", idx)

b.Env.Set("MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE", "1")
Expand Down
40 changes: 20 additions & 20 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Config struct {
Global Binary `toml:"global"`
Player Binary `toml:"player"`
Studio Binary `toml:"studio"`
Env Environment `toml:"env"`
Env Environment `toml:"env"` // kept for compatibilty
Splash Splash `toml:"splash"`
}

Expand All @@ -62,6 +62,11 @@ func Load(path string) (Config, error) {
return cfg, err
}

// Compatibility
if err := mergo.Merge(&cfg.Global.Env, cfg.Env, mergo.WithAppendSlice, mergo.WithOverride); err != nil {
return cfg, err
}

if err := mergo.Merge(&cfg.Player, cfg.Global, mergo.WithAppendSlice); err != nil {
return cfg, err
}
Expand All @@ -77,34 +82,29 @@ func Default() Config {
return Config{
DxvkVersion: "2.3",

Env: Environment{
"WINEARCH": "win64",
"WINEDEBUG": "err-kerberos,err-ntlm",
"WINEESYNC": "1",
"WINEDLLOVERRIDES": "dxdiagn,winemenubuilder.exe,mscoree,mshtml=",

"DXVK_LOG_LEVEL": "warn",
"DXVK_LOG_PATH": "none",

"MESA_GL_VERSION_OVERRIDE": "4.4",
"__GL_THREADED_OPTIMIZATIONS": "1",
},

Global: Binary{
ForcedGpu: "prime-discrete",
Dxvk: true,
AutoKillPrefix: true,
Env: Environment{
"WINEARCH": "win64",
"WINEDEBUG": "err-kerberos,err-ntlm",
"WINEESYNC": "1",
"WINEDLLOVERRIDES": "dxdiagn,winemenubuilder.exe,mscoree,mshtml=",

"DXVK_LOG_LEVEL": "warn",
"DXVK_LOG_PATH": "none",

"MESA_GL_VERSION_OVERRIDE": "4.4",
"__GL_THREADED_OPTIMIZATIONS": "1",
},
},
Player: Binary{
DiscordRPC: true,
Dxvk: true,
AutoKillPrefix: true,
FFlags: roblox.FFlags{
"DFIntTaskSchedulerTargetFps": 640,
},
},
Studio: Binary{
Dxvk: true,
AutoKillPrefix: true,
},

Splash: Splash{
Enabled: true,
Expand Down

0 comments on commit 8030c9b

Please sign in to comment.