feature: Add basic EDID reading, writing, and patching capabilities
This commit is contained in:
parent
d0a4d26082
commit
183d2606dc
12 changed files with 431 additions and 5 deletions
80
app/config/config.go
Normal file
80
app/config/config.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
package config
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed default_config.yml
|
||||
var InitialConfig []byte
|
||||
|
||||
type DisplayConfig struct {
|
||||
Angle *int `yaml:"angle"`
|
||||
FOV *int `yaml:"fov"`
|
||||
Spacing *int `yaml:"spacing"`
|
||||
Count *int `yaml:"count"`
|
||||
}
|
||||
|
||||
type AppOverrides struct {
|
||||
AllowUnsupportedDevices *bool `yaml:"allow_unsupported_devices"`
|
||||
OverrideWidth *int `yaml:"width"`
|
||||
OverrideHeight *int `yaml:"height"`
|
||||
OverrideRefreshRate *int `yaml:"refresh_rate"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
DisplayConfig DisplayConfig `yaml:"display"`
|
||||
Overrides AppOverrides `yaml:"overrides"`
|
||||
}
|
||||
|
||||
func getPtrToInt(int int) *int {
|
||||
return &int
|
||||
}
|
||||
|
||||
func getPtrToBool(bool bool) *bool {
|
||||
return &bool
|
||||
}
|
||||
|
||||
var DefaultConfig = &Config{
|
||||
DisplayConfig: DisplayConfig{
|
||||
Angle: getPtrToInt(45),
|
||||
FOV: getPtrToInt(45),
|
||||
Spacing: getPtrToInt(1),
|
||||
Count: getPtrToInt(3),
|
||||
},
|
||||
Overrides: AppOverrides{
|
||||
AllowUnsupportedDevices: getPtrToBool(false),
|
||||
},
|
||||
}
|
||||
|
||||
func InitializePotentiallyMissingConfigValues(config *Config) {
|
||||
// TODO: is there a better way to do this?
|
||||
if config.DisplayConfig.Angle == nil {
|
||||
config.DisplayConfig.Angle = DefaultConfig.DisplayConfig.Angle
|
||||
}
|
||||
|
||||
if config.DisplayConfig.FOV == nil {
|
||||
config.DisplayConfig.FOV = DefaultConfig.DisplayConfig.FOV
|
||||
}
|
||||
|
||||
if config.DisplayConfig.Spacing == nil {
|
||||
config.DisplayConfig.Spacing = DefaultConfig.DisplayConfig.Spacing
|
||||
}
|
||||
|
||||
if config.DisplayConfig.Count == nil {
|
||||
config.DisplayConfig.Count = DefaultConfig.DisplayConfig.Count
|
||||
}
|
||||
|
||||
if config.Overrides.AllowUnsupportedDevices == nil {
|
||||
config.Overrides.AllowUnsupportedDevices = DefaultConfig.Overrides.AllowUnsupportedDevices
|
||||
}
|
||||
|
||||
if config.Overrides.OverrideWidth == nil {
|
||||
config.Overrides.OverrideWidth = DefaultConfig.Overrides.OverrideWidth
|
||||
}
|
||||
|
||||
if config.Overrides.OverrideHeight == nil {
|
||||
config.Overrides.OverrideHeight = DefaultConfig.Overrides.OverrideHeight
|
||||
}
|
||||
|
||||
if config.Overrides.OverrideRefreshRate == nil {
|
||||
config.Overrides.OverrideRefreshRate = DefaultConfig.Overrides.OverrideRefreshRate
|
||||
}
|
||||
}
|
18
app/config/default_config.yml
Normal file
18
app/config/default_config.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
# __ __ ___ __ ____
|
||||
# / / / /___ ________ ____ _/ / |/ // __ \
|
||||
# / / / / __ \/ ___/ _ \/ __ `/ /| // /_/ /
|
||||
# / /_/ / / / / / / __/ /_/ / // |/ _, _/
|
||||
# \____/_/ /_/_/ \___/\__,_/_//_/|_/_/ |_|
|
||||
#
|
||||
# Welcome to UnrealXR! This is the configuration file to configure various UnrealXR settings.
|
||||
|
||||
display:
|
||||
angle: 45 # Angle of the virtual displays
|
||||
fov: 45 # FOV of the 3D camera
|
||||
spacing: 1 # Spacing between virtual displays
|
||||
count: 3 # Count of virtual displays
|
||||
overrides:
|
||||
allow_unsupported_devices: false # If true, allows unsupported devices to be used as long as they're a compatible vendor (Xreal)
|
||||
# width: 1920 # If set, overrides the width of the screen and virtual displays
|
||||
# height: 1080 # If set, overrides the height of the screen and virtual displays
|
||||
# refresh_rate: 120 # If set, overrides the refresh rate of the screen and the maximum refresh rate of the virtual displays
|
Loading…
Add table
Add a link
Reference in a new issue