mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-04-06 15:04:42 +00:00
Updated rumblers to be able to get their axis name and axis identifier
This commit is contained in:
parent
a4176e75f8
commit
ec62ee8549
5 changed files with 45 additions and 5 deletions
|
|
@ -159,8 +159,8 @@ class DirectInputDevice extends AbstractController {
|
|||
* @param effect the natie effect id
|
||||
* @param axisID The axis ID
|
||||
*/
|
||||
private void addRumbler(long effect, Axis.Identifier axisID) {
|
||||
rumblerList.add(new DirectInputRumbler(this, effect, axisID));
|
||||
private void addRumbler(long effect, Axis.Identifier axisID, String axisName) {
|
||||
rumblerList.add(new DirectInputRumbler(this, effect, axisID, axisName));
|
||||
}
|
||||
|
||||
/** Polls axes for data. Returns false if the controller is no longer valid.
|
||||
|
|
|
|||
|
|
@ -15,12 +15,22 @@ public class DirectInputRumbler implements net.java.games.input.Rumbler {
|
|||
private DirectInputDevice device;
|
||||
private long effect;
|
||||
private Axis.Identifier axisID;
|
||||
private String axisName;
|
||||
|
||||
/** Creates a new instance of DirectInputRumbler */
|
||||
public DirectInputRumbler(DirectInputDevice device, long effect, Axis.Identifier axisID) {
|
||||
public DirectInputRumbler(DirectInputDevice device, long effect, Axis.Identifier axisID, String axisName) {
|
||||
this.device = device;
|
||||
this.effect = effect;
|
||||
this.axisID = axisID;
|
||||
this.axisName = axisName;
|
||||
}
|
||||
|
||||
public Axis.Identifier getAxisIdentifier() {
|
||||
return axisID;
|
||||
}
|
||||
|
||||
public String getAxisName() {
|
||||
return axisName;
|
||||
}
|
||||
|
||||
public void rumble(float intensity) {
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ BOOL InitIDs(JNIEnv* env) {
|
|||
return FALSE;
|
||||
}
|
||||
MID_AddRumbler = env->GetMethodID(CLASS_DirectInputDevice, "addRumbler",
|
||||
"(JLnet/java/games/input/Axis$Identifier;)V");
|
||||
"(JLnet/java/games/input/Axis$Identifier;Ljava/lang/String;)V");
|
||||
if (MID_AddRumbler == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -700,7 +700,7 @@ BOOL CALLBACK EnumObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi,
|
|||
return res;
|
||||
}
|
||||
|
||||
env->CallVoidMethod(obj, MID_AddRumbler, (jlong)(long)g_pEffect, identifier);
|
||||
env->CallVoidMethod(obj, MID_AddRumbler, (jlong)(long)g_pEffect, identifier, name);
|
||||
}
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue