Skip to content

Commit

Permalink
Update for Breezy Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
wheaney committed Oct 23, 2023
1 parent d8ec487 commit 15a8033
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: wheaney
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: wheaney
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
# XREAL Air Driver
# XREAL Air Gaming
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/U7U8OVC0L) [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://deckbrew.xyz/discord)

Install and configure the [XREAL Air Linux driver](https://github.com/wheaney/xrealAirLinuxDriver) without having to leave Gaming Mode. Once installed, the driver allows for tracking the head movements as mouse or joystick controller movements, which produces VR-like camera movements in some games.
This plugin provides virtual display and head-tracking modes for the XREAL Air glasses by installing [Breezy Vulkan](https://github.com/wheaney/breezy-desktop/tree/vulkan). It also provides a UI for easily changing common configurations. All without leaving Game Mode.

![XREAL Air Driver](./assets/store_image.png)
For the moment, virtual display support only works for Vulkan games. See [Upcoming features](#upcoming-features) for expanding this.

![XREAL Air Gaming plugin](./assets/store_image.png)

## How it works

This plugin installs and keeps you up-to-date with the latest version of the driver. Going into the plugin settings allows you to disable the driver or configure its behavior.
This plugin installs and keeps you up-to-date with the latest version of Breezy. Going into the plugin settings allows you to disable Breezy or configure its behavior.

## Configuration Options

From the plugin settings, you can control the following:
* **Enable/disable the driver**. When disabled, your Air glasses will be display-only, no head movements will be tracked.
* **Mouse vs joystick mode**. In mouse-mode, head movements are translated to mouse movements, while in joystick-mode, they're translated to right-joystick movements on a virtual controller.
* **Change headset modes**. In virtual display mode, a display will be rendered in a fixed space, allowing you to move your head to look at different parts of the screen. In mouse-mode, head movements are translated to mouse movements, while in joystick-mode, they're translated to right-joystick movements on a virtual controller.
* **Mouse sensitivity**. In mouse-mode, this setting controls how much/quickly the mouse will move relative to your head movements.
* **Display size**. In virtual display mode, this setting controls how big the screen appears. A setting of 1 will render at the game's resolution, while a higher setting zooms in (e.g. 2 for 2x zoom) and lower zooms out (e.g. 0.5 for a 50% smaller screen).
* **Movement look-ahead**. In virtual display mode, Breezy automatically attempts to anticipate where the screen will be when the next frame is rendered. If you find that its default look-ahead is producing a screen that drags behind your movements or a screen that is over-eager or jittery, you can tweak this yourself. The max is capped because higher values produce jitter and become unusable.

## Upcoming features
So much more is already in the works for this plugin! If you're enjoying it and any of the upcoming features sound appealing, or if you have a feature request, please consider [becoming a supporter](https://ko-fi.com/wheaney).

Upcoming features:
* Add support for XREAL Air 2/Pro glasses
* 3D SBS support for virtual display depth to make the display appear closer or farther away for eye comfort.
* 3D SBS content virtual display support: render 3D content in a body-anchor display.
* Virtual display for all of Game Mode, not just Vulkan games.
* General Linux virtual display support for productivity.
* Other XR hardware (Rokid, etc...)

## Decky Loader

This plugin requires [Decky Loader](https://github.com/SteamDeckHomebrew/decky-loader). XREAL Air Driver is available on the store.

## Steam Deck Homebrew Discord
[![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://deckbrew.xyz/discord)
[![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://deckbrew.xyz/discord)
Binary file modified assets/store_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 28 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,52 @@ def parse_int(value, default):

class Plugin:
async def retrieve_config(self):
decky_plugin.logger.info(f"retrieve_config called")

config = {}
config['disabled'] = False
config['use_joystick'] = False
config['output_mode'] = 'mouse'
config['mouse_sensitivity'] = 20
config['external_zoom'] = 1
config['look_ahead'] = 0

try:
with open(CONFIG_FILE_PATH, 'r') as f:
for line in f:
key, value = line.strip().split('=')
if key in ['disabled', 'use_joystick']:
if key in ['disabled']:
config[key] = parse_boolean(value, config[key])
elif key == 'mouse_sensitivity':
elif key in ['mouse_sensitivity', 'external_zoom', 'look_ahead']:
config[key] = parse_int(value, config[key])
else:
config[key] = value
except FileNotFoundError:
pass

return config

async def write_config(self, config):
with open(CONFIG_FILE_PATH, 'w') as f:
for key, value in config.items():
decky_plugin.logger.info(f"write_config called with {config}")
output = ""
for key, value in config.items():
if key != "updated":
if isinstance(value, bool):
f.write(f'{key}={str(value).lower()}\n')
output += f'{key}={str(value).lower()}\n'
elif isinstance(value, int):
f.write(f'{key}={value}\n')
output += f'{key}={value}\n'
elif isinstance(value, list):
f.write(f'{key}={",".join(value)}\n')
output += f'{key}={",".join(value)}\n'
else:
f.write(f'{key}={value}\n')
output += f'{key}={value}\n'

temp_file = "temp.txt"

# Write to a temporary file
with open(temp_file, 'w') as f:
f.write(output)

# Atomically replace the old config file with the new one
os.replace(temp_file, CONFIG_FILE_PATH)

async def is_driver_installed(self):
try:
Expand All @@ -76,8 +93,8 @@ async def install_driver(self):
env_copy = os.environ.copy()
env_copy["USER"] = decky_plugin.DECKY_USER

setup_script_path = os.path.dirname(__file__) + "/bin/xreal_driver_setup"
binary_path = os.path.dirname(__file__) + "/bin/xrealAirLinuxDriver.tar.gz"
setup_script_path = os.path.dirname(__file__) + "/bin/breezy_vulkan_setup"
binary_path = os.path.dirname(__file__) + "/bin/breezyVulkan.tar.gz"
try:
subprocess.check_output([setup_script_path, binary_path], stderr=subprocess.STDOUT, env=env_copy)
settings.setSetting(INSTALLED_VERSION_SETTING_KEY, decky_plugin.DECKY_PLUGIN_VERSION)
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "decky-xrealAir",
"version": "0.1.2",
"description": "A plugin to install and configure the XREAL Air head-tracking driver",
"description": "Virtual display and head-tracking modes for the XREAL Air glasses",
"scripts": {
"build": "shx rm -rf dist && rollup -c",
"watch": "rollup -c -w",
Expand Down Expand Up @@ -40,6 +40,7 @@
},
"dependencies": {
"decky-frontend-lib": "^3.21.1",
"qrcode.react": "^3.1.0",
"react-icons": "^4.4.0"
},
"pnpm": {
Expand All @@ -50,16 +51,16 @@
]
}
},
"custom_remote_binary" : [
"custom_remote_binary": [
{
"name" : "xreal_driver_setup",
"url": "https://github.com/wheaney/xrealAirLinuxDriver/releases/download/0.3.2/xreal_driver_setup",
"sha256hash" : "6fc5f6c3967d06b913191a4b6bcca1f99d021e46ed1868a69aa2436744e14c4a"
"name": "breezy_vulkan_setup",
"url": "https://github.com/wheaney/breezy-desktop/releases/download/v0.0.10-alpha/breezy_vulkan_setup",
"sha256hash": "6d4c4d0cf4d88f05e5dab19b1c4a50378c6f712f31f48e50ae542e150892e5e3"
},
{
"name" : "xrealAirLinuxDriver.tar.gz",
"url": "https://github.com/wheaney/xrealAirLinuxDriver/releases/download/0.3.2/xrealAirLinuxDriver.tar.gz",
"sha256hash" : "02193b33ad5024af83706ccda4c7e6e6d5a31f5a3395713a4b867ac8fb9f025a"
"name": "breezyVulkan.tar.gz",
"url": "https://github.com/wheaney/breezy-desktop/releases/download/v0.0.10-alpha/breezyVulkan.tar.gz",
"sha256hash": "ced40c712d8d031d82629bcaa9f54d86a11206d20917d84e1ac2fcd95d2d67f8"
}
]
}
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "XREAL Air Driver",
"name": "XREAL Air Gaming",
"author": "Wayne Heaney",
"flags": ["root"],
"publish": {
"tags": ["xreal", "root"],
"description": "XREAL Air head-tracking for all (including non-VR) games.",
"description": "Virtual display and head-tracking modes for the XREAL Air glasses",
"image": "https://raw.githubusercontent.com/wheaney/decky-xrealAir/main/assets/store_image.png"
}
}
20 changes: 16 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15a8033

Please sign in to comment.