Skip to content

Commit

Permalink
Merge pull request #6 from umjammer/2.0.16v
Browse files Browse the repository at this point in the history
2.0.16v
  • Loading branch information
umjammer authored Feb 1, 2024
2 parents 3aa9f07 + ab1edb2 commit 136159d
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 28 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ Licensed under [BSD License](https://opensource.org/licenses/BSD-3-Clause), copy
* backport cf lib to rococoa
* separate jna parts as jna-platform-extended?
* ~~at windows, i mistake dword as 2byte~~
* component value should be generics? (currently float fixed)
2 changes: 1 addition & 1 deletion coreAPI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>coreapi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>examples</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/OSX/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>osx-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Level;
Expand All @@ -50,6 +51,7 @@
import net.java.games.input.PollingController;
import net.java.games.input.Rumbler;
import net.java.games.input.usb.GenericDesktopUsageId;
import net.java.games.input.usb.HidControllerEnvironment;
import net.java.games.input.usb.UsagePage;
import net.java.games.input.usb.UsagePair;

Expand All @@ -61,7 +63,7 @@
* @author gregorypierce
* @version 1.0
*/
public final class OSXEnvironmentPlugin extends ControllerEnvironment {
public final class OSXEnvironmentPlugin extends ControllerEnvironment implements HidControllerEnvironment {

private static final Logger log = Logger.getLogger(OSXEnvironmentPlugin.class.getName());

Expand Down Expand Up @@ -256,4 +258,13 @@ private void enumerateControllers() {
log.log(Level.FINE, "Failed to enumerate devices: " + e.getMessage(), e);
}
}

@Override
public OSXController getController(int mid, int pid) {
return Arrays.stream(getControllers())
.filter(c -> c instanceof OSXController)
.map(c -> (OSXController) c)
.filter(c -> c.getProductId() == pid && c.getVendorId() == mid)
.findFirst().get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
/**
* DualShock4Plugin.
*
* TODO extract osx independent part
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (nsano)
* @version 0.00 2023-10-24 nsano initial version <br>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void setup() throws Exception {

@Test
void test1() throws Exception {
OSXEnvironmentPlugin plugin = new OSXEnvironmentPlugin();
Debug.println("getControllers: " + plugin.getControllers().length);
Arrays.stream(plugin.getControllers()).forEach(System.err::println);
OSXEnvironmentPlugin environment = new OSXEnvironmentPlugin();
Debug.println("getControllers: " + environment.getControllers().length);
Arrays.stream(environment.getControllers()).forEach(System.err::println);
}

@Test
Expand All @@ -73,25 +73,17 @@ void test2() throws Exception {
@EnabledIf("localPropertiesExists")
@DisplayName("components count")
void test3() throws Exception {
OSXEnvironmentPlugin plugin = new OSXEnvironmentPlugin();
OSXController controller = Arrays.stream(plugin.getControllers())
.filter(c -> c instanceof OSXController)
.map(c -> (OSXController) c)
.filter(c -> c.getProductId() == productId && c.getVendorId() == vendorId)
.findFirst().get();
OSXEnvironmentPlugin environment = new OSXEnvironmentPlugin();
OSXController controller = environment.getController(vendorId, productId);
assertEquals(21, controller.getComponents().length);
}

@Test
@EnabledIf("localPropertiesExists")
@DisplayName("rumbler")
void test4() throws Exception {
OSXEnvironmentPlugin plugin = new OSXEnvironmentPlugin();
OSXController controller = Arrays.stream(plugin.getControllers())
.filter(c -> c instanceof OSXController)
.map(c -> (OSXController) c)
.filter(c -> c.getProductId() == productId && c.getVendorId() == vendorId)
.findFirst().get();
OSXEnvironmentPlugin environment = new OSXEnvironmentPlugin();
OSXController controller = environment.getController(vendorId, productId);

Report5 report = new Report5();
report.smallRumble = 255;
Expand Down
2 changes: 1 addition & 1 deletion plugins/awt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>awt-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/linux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>linux-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>plugins</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/windows/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>windows-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/wintab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>

<packaging>pom</packaging>
<name>JInput</name>
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.15v</version>
<version>2.0.16v</version>
</parent>

<artifactId>tests</artifactId>
Expand Down

0 comments on commit 136159d

Please sign in to comment.