feature: Add dummy mode
This commit is contained in:
parent
f79657afc2
commit
8b482cecd5
40 changed files with 323 additions and 141 deletions
BIN
app/edidtools/bin/xreal-air-edid.bin
Normal file
BIN
app/edidtools/bin/xreal-air-edid.bin
Normal file
Binary file not shown.
42
app/edidtools/patching_tools_fake_patching.go
Normal file
42
app/edidtools/patching_tools_fake_patching.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
//go:build fake_edid_patching
|
||||
// +build fake_edid_patching
|
||||
|
||||
package edidtools
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
)
|
||||
|
||||
//go:embed bin/xreal-air-edid.bin
|
||||
var edidFirmware []byte
|
||||
|
||||
// Attempts to fetch the EDID firmware for any supported XR glasses device
|
||||
func FetchXRGlassEDID(allowUnsupportedDevices bool) (*DisplayMetadata, error) {
|
||||
log.Warn("Not actually fetching EDID firmware in fake patching build -- using embedded firmware")
|
||||
parsedEDID, err := ParseEDID(edidFirmware, allowUnsupportedDevices)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse embedded EDID firmware: %w", err)
|
||||
}
|
||||
|
||||
parsedEDID.DeviceQuirks.ZVectorDisabled = false
|
||||
parsedEDID.DeviceQuirks.SensorInitDelay = 0
|
||||
parsedEDID.DeviceQuirks.UsesMouseMovement = true
|
||||
|
||||
return parsedEDID, nil
|
||||
}
|
||||
|
||||
// Loads custom firmware for a supported XR glass device
|
||||
func LoadCustomEDIDFirmware(displayMetadata *DisplayMetadata, edidFirmware []byte) error {
|
||||
log.Warn("Not actually patching EDID firmware in fake patching build -- ignoring")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unloads custom firmware for a supported XR glass device
|
||||
func UnloadCustomEDIDFirmware(displayMetadata *DisplayMetadata) error {
|
||||
log.Warn("Not actually unloading EDID firmware in fake patching build -- ignoring")
|
||||
return nil
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
//go:build linux
|
||||
// +build linux
|
||||
//go:build linux && !fake_edid_patching
|
||||
// +build linux,!fake_edid_patching
|
||||
|
||||
package edidtools
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//go:build darwin
|
||||
// +build darwin
|
||||
//go:build darwin && !fake_edid_patching
|
||||
// +build darwin,!fake_edid_patching
|
||||
|
||||
package edidtools
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
//go:build windows && !fake_edid_patching
|
||||
// +build windows,!fake_edid_patching
|
||||
|
||||
package edidtools
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package edidtools
|
||||
|
||||
type DisplayQuirks struct {
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
MaxRefreshRate int
|
||||
SensorInitDelay int
|
||||
ZVectorDisabled bool
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
MaxRefreshRate int
|
||||
SensorInitDelay int
|
||||
ZVectorDisabled bool
|
||||
UsesMouseMovement bool
|
||||
}
|
||||
|
||||
type DisplayMetadata struct {
|
||||
|
|
|
@ -184,20 +184,24 @@ func EnterRenderLoop(config *libconfig.Config, displayMetadata *edidtools.Displa
|
|||
eventTimeoutDuration := 0 * time.Millisecond
|
||||
|
||||
for !rl.WindowShouldClose() {
|
||||
if hasSensorInitDelayQuirk {
|
||||
if time.Now().Sub(sensorInitStartTime) > time.Duration(displayMetadata.DeviceQuirks.SensorInitDelay)*time.Second {
|
||||
log.Info("Movement is now enabled.")
|
||||
hasSensorInitDelayQuirk = false
|
||||
if !displayMetadata.DeviceQuirks.UsesMouseMovement {
|
||||
if hasSensorInitDelayQuirk {
|
||||
if time.Now().Sub(sensorInitStartTime) > time.Duration(displayMetadata.DeviceQuirks.SensorInitDelay)*time.Second {
|
||||
log.Info("Movement is now enabled.")
|
||||
hasSensorInitDelayQuirk = false
|
||||
}
|
||||
} else {
|
||||
lookVector.X = (currentYaw - previousYaw) * 6.5
|
||||
lookVector.Y = -(currentPitch - previousPitch) * 6.5
|
||||
|
||||
if !hasZVectorDisabledQuirk {
|
||||
lookVector.Z = (currentRoll - previousRoll) * 6.5
|
||||
}
|
||||
|
||||
rl.UpdateCameraPro(&camera, movementVector, lookVector, 0)
|
||||
}
|
||||
} else {
|
||||
lookVector.X = (currentYaw - previousYaw) * 6.5
|
||||
lookVector.Y = -(currentPitch - previousPitch) * 6.5
|
||||
|
||||
if !hasZVectorDisabledQuirk {
|
||||
lookVector.Z = (currentRoll - previousRoll) * 6.5
|
||||
}
|
||||
|
||||
rl.UpdateCameraPro(&camera, movementVector, lookVector, 0)
|
||||
rl.UpdateCamera(&camera, rl.CameraFirstPerson)
|
||||
}
|
||||
|
||||
rl.BeginDrawing()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue