Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Allow connecting Wiimotes via L2CAP #1353

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b869280
Add `L2CapWiimote`
capitalistspz Sep 26, 2024
919d26f
Remove unnecessary != overload
capitalistspz Sep 26, 2024
34f08a4
Create `L2CapWiimote` instances as `shared_ptr`
capitalistspz Sep 26, 2024
ee60171
Allow `WiimoteControllerProvider` to receive `L2CapWiimote`s
capitalistspz Sep 26, 2024
c0f4dd7
Link `bluez`
capitalistspz Sep 26, 2024
7395452
Correct return value on `L2CapWiimote::write_data`
capitalistspz Sep 26, 2024
96f4851
PairingDialog: Implement 'pairing' for bluez, reformat file
capitalistspz Sep 26, 2024
e66984b
Fix periodic hitching when controller paired and connected
capitalistspz Sep 26, 2024
b21c8de
`WiimoteDevice`: Make equality actually constant
capitalistspz Sep 26, 2024
75b5d28
Fix Windows build error
capitalistspz Sep 26, 2024
873b628
Use bdaddr to compare `L2CapWiimote`s
capitalistspz Sep 26, 2024
ae2f5d2
`WiimoteControllerProvider`: Move device getting to another thread
capitalistspz Sep 26, 2024
d524059
Stop using `std::jthread`, because Mac doesn't support it
capitalistspz Sep 26, 2024
e17b9d6
Make Bluez optional
capitalistspz Sep 26, 2024
6f18012
Add bluez libs to dependency list
capitalistspz Sep 26, 2024
8c3976c
Install `libbluetooth-dev` for AppImage too
capitalistspz Sep 26, 2024
4c93d4b
Fix a crash from writing to a disconnected device
capitalistspz Sep 26, 2024
ff7da39
Stop replacing non-duplicate controllers
capitalistspz Sep 26, 2024
5079bc2
Prevent storing duplicate addresses
capitalistspz Oct 1, 2024
c7abd7a
Free BT resources acquired during pairing
capitalistspz Oct 3, 2024
6a3096e
Show bluetooth address in correct order.
capitalistspz Oct 4, 2024
d53e4fe
Search for up to 4 devices at a time
capitalistspz Oct 10, 2024
a6bab48
Make cancellable between name reads, disable cancel button during inq…
capitalistspz Oct 21, 2024
a3dc371
screaming case constexpr
capitalistspz Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: "Install system dependencies"
run: |
sudo apt update -qq
sudo apt install -y clang-15 cmake freeglut3-dev libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libudev-dev nasm ninja-build
sudo apt install -y clang-15 cmake freeglut3-dev libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libudev-dev nasm ninja-build libbluetooth-dev

- name: "Setup cmake"
uses: jwlawson/actions-setup-cmake@v2
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- name: "Install system dependencies"
run: |
sudo apt update -qq
sudo apt install -y clang-15 cmake freeglut3-dev libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build appstream
sudo apt install -y clang-15 cmake freeglut3-dev libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build appstream libbluetooth-dev

- name: "Build AppImage"
run: |
Expand Down
6 changes: 3 additions & 3 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
### Dependencies

#### For Arch and derivatives:
`sudo pacman -S --needed base-devel clang cmake freeglut git glm gtk3 libgcrypt libpulse libsecret linux-headers llvm nasm ninja systemd unzip zip`
`sudo pacman -S --needed base-devel bluez-libs clang cmake freeglut git glm gtk3 libgcrypt libpulse libsecret linux-headers llvm nasm ninja systemd unzip zip`

#### For Debian, Ubuntu and derivatives:
`sudo apt install -y cmake curl clang-15 freeglut3-dev git libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libtool nasm ninja-build`
`sudo apt install -y cmake curl clang-15 freeglut3-dev git libbluetooth-dev libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libtool nasm ninja-build`

You may also need to install `libusb-1.0-0-dev` as a workaround for an issue with the vcpkg hidapi package.

At Step 3 in [Build Cemu using cmake and clang](#build-cemu-using-cmake-and-clang), use the following command instead:
`cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-15 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja`

#### For Fedora and derivatives:
`sudo dnf install clang cmake cubeb-devel freeglut-devel git glm-devel gtk3-devel kernel-headers libgcrypt-devel libsecret-devel libtool libusb1-devel llvm nasm ninja-build perl-core systemd-devel zlib-devel zlib-static`
`sudo dnf install bluez-libs clang cmake cubeb-devel freeglut-devel git glm-devel gtk3-devel kernel-headers libgcrypt-devel libsecret-devel libtool libusb1-devel llvm nasm ninja-build perl-core systemd-devel zlib-devel zlib-static`

### Build Cemu

Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ endif()
if (UNIX AND NOT APPLE)
option(ENABLE_WAYLAND "Build with Wayland support" ON)
option(ENABLE_FERAL_GAMEMODE "Enables Feral Interactive GameMode Support" ON)
option(ENABLE_BLUEZ "Build with Bluez support" ON)
endif()

option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
Expand Down Expand Up @@ -179,6 +180,12 @@ if (UNIX AND NOT APPLE)
endif()
find_package(GTK3 REQUIRED)

if(ENABLE_BLUEZ)
find_package(bluez REQUIRED)
set(ENABLE_WIIMOTE ON)
add_compile_definitions(HAS_BLUEZ)
endif()

endif()

if (ENABLE_VULKAN)
Expand Down
20 changes: 20 additions & 0 deletions cmake/Findbluez.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2022 Andrea Pappacoda <[email protected]>
# SPDX-License-Identifier: ISC

find_package(bluez CONFIG)
if (NOT bluez_FOUND)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_search_module(bluez IMPORTED_TARGET GLOBAL bluez-1.0 bluez)
if (bluez_FOUND)
add_library(bluez::bluez ALIAS PkgConfig::bluez)
endif ()
endif ()
endif ()

find_package_handle_standard_args(bluez
REQUIRED_VARS
bluez_LINK_LIBRARIES
bluez_FOUND
VERSION_VAR bluez_VERSION
)
Loading
Loading