From da1ee285920f45e900da63b9008cabd54ad8ea4f Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Mon, 22 Feb 2021 08:43:53 -0500 Subject: Fix firelink config --- config/gaming.nix | 2 +- machines/firelink.nix | 3 +- patches/xow/0001-Single-controller-patch.patch | 72 ++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 patches/xow/0001-Single-controller-patch.patch diff --git a/config/gaming.nix b/config/gaming.nix index 7273324..0cf8c39 100644 --- a/config/gaming.nix +++ b/config/gaming.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let - pkgs_unstable = import {}; + pkgs_unstable = pkgs.my-extras.nixpkgs-unstable.legacyPackages.${pkgs.system}; my_steam = self: super: { steam = super.steam.override { # nativeOnly = true; diff --git a/machines/firelink.nix b/machines/firelink.nix index 34a6016..63fe3ac 100644 --- a/machines/firelink.nix +++ b/machines/firelink.nix @@ -3,7 +3,8 @@ let my-overlay = self: super: { xow = super.xow.overrideAttrs (o: rec { - src = /home/orbekk/projects/source/.; + # src = ../xow-src/.; + patches = [../patches/xow/0001-Single-controller-patch.patch]; }); my-linuxPackages = let linuxPkgs = super.my-extras.nixpkgs-unstable.legacyPackages.${pkgs.system}.linuxPackages_latest; diff --git a/patches/xow/0001-Single-controller-patch.patch b/patches/xow/0001-Single-controller-patch.patch new file mode 100644 index 0000000..b56270a --- /dev/null +++ b/patches/xow/0001-Single-controller-patch.patch @@ -0,0 +1,72 @@ +From 8937ae5e05e64c884b9f8d0736628a596bba6728 Mon Sep 17 00:00:00 2001 +From: Kjetil Orbekk +Date: Mon, 22 Feb 2021 08:17:49 -0500 +Subject: [PATCH] Single controller patch + +--- + controller/controller.cpp | 6 ++++++ + controller/controller.h | 1 + + dongle/dongle.cpp | 13 +++++++++---- + 3 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/controller/controller.cpp b/controller/controller.cpp +index d138e0c..83640ea 100644 +--- a/controller/controller.cpp ++++ b/controller/controller.cpp +@@ -171,6 +171,12 @@ void Controller::initInput(const AnnounceData *announce) + return; + } + ++ if (initialized) { ++ Log::info("HACK: Skip initialization because of reute"); ++ return; ++ } ++ initialized = true; ++ + InputDevice::AxisConfig stickConfig = {}; + + // 16 bits (signed) for the sticks +diff --git a/controller/controller.h b/controller/controller.h +index 5486895..cd11853 100644 +--- a/controller/controller.h ++++ b/controller/controller.h +@@ -52,4 +52,5 @@ private: + InputDevice inputDevice; + + uint8_t batteryLevel = 0xff; ++ bool initialized = false; + }; +diff --git a/dongle/dongle.cpp b/dongle/dongle.cpp +index b931ff8..5c5305e 100644 +--- a/dongle/dongle.cpp ++++ b/dongle/dongle.cpp +@@ -72,9 +72,13 @@ void Dongle::handleControllerConnect(Bytes address) + std::placeholders::_1 + ); + +- controllers[wcid - 1].reset(new Controller(sendPacket)); +- +- Log::info("Controller '%d' connected", wcid); ++ if (controllers[wcid - 1] == nullptr) ++ { ++ controllers[wcid - 1].reset(new Controller(sendPacket)); ++ Log::info("Controller '%d' connected", wcid); ++ } else { ++ Log::info("Controller '%d' connected (re-attached)", wcid); ++ } + } + + void Dongle::handleControllerDisconnect(uint8_t wcid) +@@ -93,7 +97,8 @@ void Dongle::handleControllerDisconnect(uint8_t wcid) + return; + } + +- controllers[wcid - 1].reset(); ++ // QQQ: Figure out how to flag protect this. ++ // controllers[wcid - 1].reset(); + + if (!removeClient(wcid)) + { +-- +2.29.2 + -- cgit v1.2.3