Skip to content

Commit

Permalink
Closes #3 - added Linux client-support
Browse files Browse the repository at this point in the history
  • Loading branch information
bwRavencl committed May 24, 2022
1 parent d7b430c commit e031877
Show file tree
Hide file tree
Showing 107 changed files with 5,656 additions and 3,385 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master

jobs:
build:
windows:
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -30,8 +30,8 @@ jobs:
id: extract_release_variables
shell: bash
run: |
echo ::set-output name=tag_name::$(ls build/distributions/ControllerBuddy-*.zip | xargs -i basename {} .zip)
echo ::set-output name=zip_path::$(ls build/distributions/ControllerBuddy-*.zip)
echo ::set-output name=tag_name::$(ls build/distributions/ControllerBuddy-*.zip | xargs -i basename -s .zip {} | sed s/-windows//)
echo ::set-output name=archive_path::$(ls build/distributions/ControllerBuddy-*.zip)
- name: Tag Commit
uses: tvdias/[email protected]
with:
Expand All @@ -44,4 +44,39 @@ jobs:
tag_name: ${{ steps.extract_release_variables.outputs.tag_name }}
draft: false
prerelease: false
files: ${{ steps.extract_release_variables.outputs.zip_path }}
files: ${{ steps.extract_release_variables.outputs.archive_path }}
linux:
needs: windows
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
submodules: true
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 18.0.1+10
- name: Build
uses: eskatos/gradle-command-action@v2
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
with:
arguments: distTar --info
- name: Extract Release Variables
id: extract_release_variables
shell: bash
run: |
echo ::set-output name=tag_name::$(ls build/distributions/ControllerBuddy-*.tgz | xargs -i basename -s .tgz {} | sed s/-linux//)
echo ::set-output name=archive_path::$(ls build/distributions/ControllerBuddy-*.tgz)
- name: Release
id: release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.extract_release_variables.outputs.tag_name }}
draft: false
prerelease: false
files: ${{ steps.extract_release_variables.outputs.archive_path }}
899 changes: 617 additions & 282 deletions LICENSE

Large diffs are not rendered by default.

81 changes: 50 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,35 @@
This is the source code repository of ControllerBuddy, regular users should refer to [ControllerBuddy's homepage](https://controllerbuddy.org) for getting started.

#### License Information:
GNU General Public License v2.0
GNU General Public License v3.0

#### Download and Installation:

###### Windows:
1. First ensure you have correctly installed [vJoy](https://github.com/jshafer817/vJoy/releases/latest) on your system.
2. [Click here](https://github.com/bwRavencl/ControllerBuddy/releases/latest) and download the latest build of ControllerBuddy for Windows as a ZIP archive.
3. Extract the `ControllerBuddy` directory from the archive to any desired location on your hard-drive.
4. Run `ControllerBuddy.exe` inside the extracted `ControllerBuddy` directory.

###### Linux:
1. First ensure you have installed libsdl2 on your system:
- Debian / Ubuntu: `sudo apt-get install libsdl2-2.0`
- Red-Hat-based: `sudo yum install SDL2`
2. Configure uinput:
1. Create an uinput group: `sudo groupadd -f uinput`
2. Add yourself to the group: `sudo gpasswd -a USER uinput` (replace USER with your username)
3. As root, create a file `/etc/udev/rules.d/99-input.rules` with the following content:
`SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput"`
4. As root, create a file `/etc/modules-load.d/uinput.conf` with the following content:
`uinput`
3. Reboot
5. [Click here](https://github.com/bwRavencl/ControllerBuddy/releases/latest) and download the latest build of ControllerBuddy for Linux as a TGZ archive.
6. Extract the `ControllerBuddy` directory from the archive to any desired location on your hard-drive.
7. Run `ControllerBuddy` inside the extracted `ControllerBuddy/bin` directory.

#### Description:
ControllerBuddy is a highly advanced gamepad mapping software, which supports the creation of input profiles for complex target applications such as flight simulators.
In addition to the simplistic mapping of buttons and axes of a physical game-controller to keyboard and mouse input, ControllerBuddy also supports the feeding of input commands to a virtual joystick, provided by the awesome vJoy device driver created by Shaul Eizikovich.
In addition to the simplistic mapping of buttons and axes of a physical game-controller to keyboard and mouse input, ControllerBuddy also supports the feeding of input commands to a virtual joystick device (vJoy / uinput).
ControllerBuddy's goal is to enable the user to control target applications solely via a gamepad and not having to reach for a keyboard or mouse at any point in time.

#### Features:
Expand Down Expand Up @@ -47,9 +65,8 @@ ControllerBuddy's goal is to enable the user to control target applications sole
- Dual Sense (with special support for the touchpad, haptic feedback and lightbar)
- etc. (to check if your controller is supported please refer to the [SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project)
- Supported operating systems:
- Windows x64 (local / client / server)
- Windows / Linux (local / client / server)
- macOS (only server - no binaries provided!)
- Linux (only server - no binaries provided!)
- Language support for:
- English
- German
Expand Down Expand Up @@ -96,21 +113,21 @@ A set of well thought out profiles for the most popular flight simulators are av
#### Architecture:
Local mode:
```
Local:
Physical Controller
|
|
v
ControllerBuddy
| |
| |
v v
vJoy Device Driver Win32 API
| |
| |
v v
Target Application
Local:
Physical Controller
|
|
v
ControllerBuddy
| |
| |
v v
vJoy / uinput Win32 / X11
| |
| |
v v
Target Application
```

Server-Client mode:
Expand All @@ -125,7 +142,7 @@ Server-Client mode:
| |
| |
v v
vJoy Device Driver Win32 API
vJoy / uinput Win32 / X11
| |
| |
v v
Expand Down Expand Up @@ -177,6 +194,7 @@ ControllerBuddy uses the following awesome software technologies and libraries:
- [FlatLaf](https://www.formdev.com/flatlaf/)
- [Gson](https://github.com/google/gson)
- [Java Native Access (JNA)](https://github.com/java-native-access/jna)
- [linuxio4j](https://github.com/bithatch/linuxio4j)
- [LWJGL - Lightweight Java Game Library 3](https://www.lwjgl.org)
- [Pure Java HID-API](https://github.com/nyholku/purejavahidapi)
- [SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB)
Expand All @@ -186,15 +204,16 @@ ControllerBuddy uses the following awesome software technologies and libraries:
If you want to build ControllerBuddy from its source code this section might be helpful to get you started.
ControllerBuddy uses the Gradle build system, the following Gradle tasks are supported:

| Task | Command |
| -------------------------------- | ------------------------ |
| Generate version source file | gradlew generateVersion |
| Run SpotBugs and Spotless | gradlew check |
| Apply Spotless formatting | gradlew spotlessApply |
| Run ControllerBuddy | gradlew run |
| Install a jpackage image | gradlew installDist |
| Create a zipped jpackage image | gradlew distZip |
| Generate Eclipse files | gradlew eclipse |
| Delete Eclipse files | gradlew cleanEclipse |
| Delete build and gen directories | gradlew clean |
| Task | Command |
| -------------------------------------- | ------------------------ |
| Generate version source file | gradlew generateVersion |
| Run SpotBugs and Spotless | gradlew check |
| Apply Spotless formatting | gradlew spotlessApply |
| Run ControllerBuddy | gradlew run |
| Install a jpackage image | gradlew installDist |
| Create a ZIP-compressed jpackage image | gradlew distZip |
| Create a TGZ-compressed jpackage image | gradlew distTar |
| Generate Eclipse files | gradlew eclipse |
| Delete Eclipse files | gradlew cleanEclipse |
| Delete build and gen directories | gradlew clean |
| Check for dependency updates | gradlew dependencyUpdate |
88 changes: 73 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.gradle.nativeplatform.platform.internal.Architectures
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.gradle.plugins.ide.eclipse.model.Container
import org.gradle.plugins.ide.eclipse.model.SourceFolder

import com.github.spotbugs.snom.SpotBugsReport
Expand Down Expand Up @@ -28,6 +29,8 @@ java {
}

ext {
os = DefaultNativePlatform.currentOperatingSystem

versionWithoutHash = version.substring(0, version.indexOf('-'))

resourcesDir = 'src/main/resources'
Expand All @@ -38,6 +41,10 @@ ext {
appImageDir = "$tmpDir/$project.name"
runtimeDir = "$tmpDir/runtime"

linuxJvmArgs = [
'--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED'
]

gamecontrollerdbFile = "$resourcesDir/gamecontrollerdb.txt"
jdtUiPrefsFile = '.settings/org.eclipse.jdt.ui.prefs'

Expand All @@ -49,6 +56,8 @@ ext {

spotlessFormatFile = 'spotless.eclipseformat.xml'
spotlessImportOrderFile = 'spotless.importorder'

distAppendix = os.toFamilyName()
}

repositories {
Expand All @@ -60,17 +69,17 @@ dependencies {
def jnaVersion = '5.11.0'
def lwjglVersion = '3.3.1'

def os = DefaultNativePlatform.currentOperatingSystem
def clientPlatform = false
def openVrSupport = false
def lwjglOs
if (os.windows) {
lwjglOs = "windows"
clientPlatform = true
openVrSupport = true
} else if (os.macOsX)
lwjglOs = 'macos'
else if (os.linux)
else if (os.linux) {
lwjglOs = 'linux'
else
openVrSupport = true
} else
throw new GradleException("Unsupported operating system $os.displayName")

def arch = DefaultNativePlatform.currentArchitecture
Expand All @@ -84,11 +93,13 @@ dependencies {
break
case { Architectures.ARM_V7.isAlias(it) && os.linux }:
lwjglArch = 'arm32'
openVrSupport = false
break
case 'aarch64':
case 'arm-v8':
case 'arm64':
lwjglArch = 'arm64'
openVrSupport = false
break
default:
throw new GradleException("Unsupported system architecture $arch.displayName")
Expand All @@ -108,15 +119,16 @@ dependencies {
"org.lwjgl:lwjgl-opengl:$lwjglVersion",
"org.lwjgl:lwjgl-openvr:$lwjglVersion",
"org.lwjgl:lwjgl:$lwjglVersion:natives-$lwjglPlatform",
'com.github.prat-man:unique4j:6701cef900'
'com.github.prat-man:unique4j:6701cef900',
'uk.co.bithatch:linuxio4j:2.1'

runtimeOnly "org.lwjgl:lwjgl-glfw:$lwjglVersion:natives-$lwjglPlatform"

implementation ('org.apache.xmlgraphics:batik-swing:1.14') {
exclude group: 'xml-apis', module: 'xml-apis'
}

if (clientPlatform)
if (openVrSupport)
runtimeOnly "org.lwjgl:lwjgl-opengl:$lwjglVersion:natives-${lwjglPlatform}", "org.lwjgl:lwjgl-openvr:$lwjglVersion:natives-${lwjglPlatform}"
}

Expand Down Expand Up @@ -155,19 +167,18 @@ spotless {
licenseHeader '''\
/* Copyright (C) $YEAR Matteo Hausner
*
* This program is free software; you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
'''.stripIndent()
Expand Down Expand Up @@ -249,6 +260,12 @@ eclipse {
file {
whenMerged { cp ->
cp.entries.add(3, new SourceFolder(versionDir, null))
if (os.linux)
cp.entries.findAll {it instanceof Container && it.path ==~ /org\.eclipse\.jdt\.launching\.JRE_CONTAINER\/.*$/}.each {
def entryAttributes = it.entryAttributes
entryAttributes['module'] = 'true'
entryAttributes['add-opens'] = 'java.desktop/sun.awt.X11=ALL-UNNAMED'
}
}
}
}
Expand Down Expand Up @@ -452,7 +469,12 @@ tasks.eclipse.doLast {
compileJava {
dependsOn generateVersion, copyGameControllerDB
source generateVersion.outputs.files, sourceSets.main.java
options.compilerArgs += ["-Xlint:deprecation"]
options.compilerArgs += ['-Xlint:deprecation']
}

run {
if (os.linux)
jvmArgs = linuxJvmArgs
}

task jlink(type: Exec) {
Expand Down Expand Up @@ -486,16 +508,52 @@ task jpackage(type: Exec) {
description = 'Executes the jpackage command to create a standalone application image packaged with a custom minimal Java runtime.'
dependsOn copyLibs, customizeLoggingProperties
doFirst { delete appImageDir }
commandLine 'jpackage', '--input', libsDir, '--dest', tmpDir, '--type', 'app-image', '--name', project.name, '--runtime-image', runtimeDir, '--main-class', project.application.mainClassName, '--main-jar', "$project.name-${version}.jar", '--app-version', versionWithoutHash, '--icon', "$projectDir/icon.ico", '--copyright', "Copyright ${new Date().format('yyyy')} Matteo Hausner", '--vendor', 'Matteo Hausner', '--verbose'
def commandLineParts = [
'jpackage',
'--input',
libsDir,
'--dest',
tmpDir,
'--type',
'app-image',
'--name',
project.name,
'--runtime-image',
runtimeDir,
'--main-class',
project.application.mainClassName,
'--main-jar',
"$project.name-${version}.jar",
'--app-version',
versionWithoutHash,
'--icon',
"$projectDir/icon.${os.windows ? 'ico' : 'png'}",
'--copyright',
"Copyright ${new Date().format('yyyy')} Matteo Hausner",
'--vendor',
'Matteo Hausner',
'--verbose'
]
if (os.linux)
linuxJvmArgs.each { commandLineParts.addAll(['--java-options', it]) }
commandLine commandLineParts
}

startScripts.enabled = false
distTar.enabled = false

task distTar(type: Tar, overwrite: true) {
dependsOn jpackage
from tmpDir
include "$project.name/**"
appendix distAppendix
compression Compression.GZIP
}

task distZip(type: Zip, overwrite: true) {
dependsOn jpackage
from tmpDir
include "$project.name/**"
appendix distAppendix
}

task installDist(type: Sync, overwrite: true) {
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e031877

Please sign in to comment.