mirror of
https://github.com/DevL0rd/SkyNX
synced 2024-11-13 23:17:06 +00:00
fixed joy packet struct
This commit is contained in:
parent
8f09a090fd
commit
ea653c9ed3
8 changed files with 85636 additions and 85603 deletions
|
@ -107,50 +107,50 @@ hidStreamClient.on('connect', function () {
|
|||
var switchHidBuffer = new Buffer.alloc(0);
|
||||
function parseInputStruct(buff) {
|
||||
var input = Struct()
|
||||
.word64Ule('HeldKeys1')
|
||||
.word16Ule('LJoyX1')
|
||||
.word16Ule('LJoyY1')
|
||||
.word16Ule('RJoyX1')
|
||||
.word16Ule('RJoyY1')
|
||||
.word64Ule('HeldKeys2')
|
||||
.word16Ule('LJoyX2')
|
||||
.word16Ule('LJoyY2')
|
||||
.word16Ule('RJoyX2')
|
||||
.word16Ule('RJoyY2')
|
||||
.word64Ule('HeldKeys3')
|
||||
.word16Ule('LJoyX3')
|
||||
.word16Ule('LJoyY3')
|
||||
.word16Ule('RJoyX3')
|
||||
.word16Ule('RJoyY3')
|
||||
.word64Ule('HeldKeys4')
|
||||
.word16Ule('LJoyX4')
|
||||
.word16Ule('LJoyY4')
|
||||
.word16Ule('RJoyX4')
|
||||
.word16Ule('RJoyY4')
|
||||
.word64Ule('HeldKeys5')
|
||||
.word16Ule('LJoyX5')
|
||||
.word16Ule('LJoyY5')
|
||||
.word16Ule('RJoyX5')
|
||||
.word16Ule('RJoyY5')
|
||||
.word64Ule('HeldKeys6')
|
||||
.word16Ule('LJoyX6')
|
||||
.word16Ule('LJoyY6')
|
||||
.word16Ule('RJoyX6')
|
||||
.word16Ule('RJoyY6')
|
||||
.word64Ule('HeldKeys7')
|
||||
.word16Ule('LJoyX7')
|
||||
.word16Ule('LJoyY7')
|
||||
.word16Ule('RJoyX7')
|
||||
.word16Ule('RJoyY7')
|
||||
.word64Ule('HeldKeys8')
|
||||
.word16Ule('LJoyX8')
|
||||
.word16Ule('LJoyY8')
|
||||
.word16Ule('RJoyX8')
|
||||
.word16Ule('RJoyY8')
|
||||
.word16Ule('touchX1')
|
||||
.word16Ule('touchY1')
|
||||
.word16Ule('touchX2')
|
||||
.word16Ule('touchY2')
|
||||
.word32Ule('HeldKeys1')
|
||||
.word32Sle('LJoyX1')
|
||||
.word32Sle('LJoyY1')
|
||||
.word32Sle('RJoyX1')
|
||||
.word32Sle('RJoyY1')
|
||||
.word32Ule('HeldKeys2')
|
||||
.word32Sle('LJoyX2')
|
||||
.word32Sle('LJoyY2')
|
||||
.word32Sle('RJoyX2')
|
||||
.word32Sle('RJoyY2')
|
||||
.word32Ule('HeldKeys3')
|
||||
.word32Sle('LJoyX3')
|
||||
.word32Sle('LJoyY3')
|
||||
.word32Sle('RJoyX3')
|
||||
.word32Sle('RJoyY3')
|
||||
.word32Ule('HeldKeys4')
|
||||
.word32Sle('LJoyX4')
|
||||
.word32Sle('LJoyY4')
|
||||
.word32Sle('RJoyX4')
|
||||
.word32Sle('RJoyY4')
|
||||
.word32Ule('HeldKeys5')
|
||||
.word32Sle('LJoyX5')
|
||||
.word32Sle('LJoyY5')
|
||||
.word32Sle('RJoyX5')
|
||||
.word32Sle('RJoyY5')
|
||||
.word32Ule('HeldKeys6')
|
||||
.word32Sle('LJoyX6')
|
||||
.word32Sle('LJoyY6')
|
||||
.word32Sle('RJoyX6')
|
||||
.word32Sle('RJoyY6')
|
||||
.word32Ule('HeldKeys7')
|
||||
.word32Sle('LJoyX7')
|
||||
.word32Sle('LJoyY7')
|
||||
.word32Sle('RJoyX7')
|
||||
.word32Sle('RJoyY7')
|
||||
.word32Ule('HeldKeys8')
|
||||
.word32Sle('LJoyX8')
|
||||
.word32Sle('LJoyY8')
|
||||
.word32Sle('RJoyX8')
|
||||
.word32Sle('RJoyY8')
|
||||
.word32Ule('touchX1')
|
||||
.word32Ule('touchY1')
|
||||
.word32Ule('touchX2')
|
||||
.word32Ule('touchY2')
|
||||
.floatle('accelX')
|
||||
.floatle('accelY')
|
||||
.floatle('accelZ')
|
||||
|
@ -280,6 +280,8 @@ var rightClicking = false;
|
|||
var scrolling = false;
|
||||
var toggledMouseInput = false;
|
||||
var mouseInput = false;
|
||||
var touchLeftClicking = false;
|
||||
var touchRightClicking = false;
|
||||
function handleMouseInputToggling(hid, playerNumber) {
|
||||
var heldKeys = hid.get("HeldKeys" + playerNumber);
|
||||
var inputStates = heldKeysBitmask(heldKeys);
|
||||
|
@ -396,14 +398,14 @@ function handleTouchInput(hid) {
|
|||
touchX1old = touchX1;
|
||||
touchY1old = touchY1;
|
||||
scrolling = true;
|
||||
rightClicking = false;
|
||||
touchRightClicking = false;
|
||||
} else { //Handle left click
|
||||
rightClicking = true;
|
||||
touchRightClicking = true;
|
||||
}
|
||||
} else {
|
||||
if (rightClicking) {
|
||||
if (touchRightClicking) {
|
||||
robot.mouseClick("right");
|
||||
rightClicking = false
|
||||
touchRightClicking = false
|
||||
}
|
||||
scrolling = false;
|
||||
rightTouchTime = 0;
|
||||
|
@ -411,18 +413,18 @@ function handleTouchInput(hid) {
|
|||
if (!scrolling) {
|
||||
leftTouchTime++;
|
||||
robot.moveMouse(touchX1 / screenScale, touchY1 / screenScale);
|
||||
if (!leftClicking) {
|
||||
if (!touchLeftClicking) {
|
||||
robot.mouseToggle("down");
|
||||
leftClicking = true;
|
||||
touchLeftClicking = true;
|
||||
}
|
||||
} else {
|
||||
robot.mouseToggle("up");
|
||||
leftClicking = false;
|
||||
touchLeftClicking = false;
|
||||
}
|
||||
} else {
|
||||
if (leftClicking) { //release left click
|
||||
if (touchLeftClicking) { //release left click
|
||||
robot.mouseToggle("up");
|
||||
leftClicking = false;
|
||||
touchLeftClicking = false;
|
||||
if (leftTouchTime < 3) {
|
||||
robot.mouseClick("left", true); //double click
|
||||
}
|
||||
|
|
53806
SkyNX/build/SkyNX.lst
53806
SkyNX/build/SkyNX.lst
File diff suppressed because it is too large
Load diff
117198
SkyNX/build/SkyNX.map
117198
SkyNX/build/SkyNX.map
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -31,7 +31,7 @@ void gamePadSend(JoyConSocket *connection)
|
|||
}
|
||||
pkg.frameRate = frameRate;
|
||||
pkg.controllerCount = controllersConnected;
|
||||
pkg.heldKeys1 = hidKeysHeld(player1Id);
|
||||
pkg.heldKeys1 = (u32)hidKeysHeld(player1Id);
|
||||
hidJoystickRead(&lJoy, player1Id, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, player1Id, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX1 = lJoy.dx;
|
||||
|
@ -39,7 +39,7 @@ void gamePadSend(JoyConSocket *connection)
|
|||
pkg.rJoyX1 = rJoy.dx;
|
||||
pkg.rJoyY1 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys2 = hidKeysHeld(CONTROLLER_PLAYER_2);
|
||||
pkg.heldKeys2 = (u32)hidKeysHeld(CONTROLLER_PLAYER_2);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_2, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_2, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX2 = lJoy.dx;
|
||||
|
@ -47,7 +47,7 @@ void gamePadSend(JoyConSocket *connection)
|
|||
pkg.rJoyX2 = rJoy.dx;
|
||||
pkg.rJoyY2 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys3 = hidKeysHeld(CONTROLLER_PLAYER_3);
|
||||
pkg.heldKeys3 = (u32)hidKeysHeld(CONTROLLER_PLAYER_3);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_3, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_3, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX3 = lJoy.dx;
|
||||
|
@ -55,7 +55,7 @@ void gamePadSend(JoyConSocket *connection)
|
|||
pkg.rJoyX3 = rJoy.dx;
|
||||
pkg.rJoyY3 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys4 = hidKeysHeld(CONTROLLER_PLAYER_4);
|
||||
pkg.heldKeys4 = (u32)hidKeysHeld(CONTROLLER_PLAYER_4);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_4, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_4, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX4 = lJoy.dx;
|
||||
|
@ -63,6 +63,37 @@ void gamePadSend(JoyConSocket *connection)
|
|||
pkg.rJoyX4 = rJoy.dx;
|
||||
pkg.rJoyY4 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys5 = (u32)hidKeysHeld(CONTROLLER_PLAYER_5);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_5, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_5, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX5 = lJoy.dx;
|
||||
pkg.lJoyY5 = lJoy.dy;
|
||||
pkg.rJoyX5 = rJoy.dx;
|
||||
pkg.rJoyY5 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys6 = (u32)hidKeysHeld(CONTROLLER_PLAYER_6);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_6, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_6, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX6 = lJoy.dx;
|
||||
pkg.lJoyY6 = lJoy.dy;
|
||||
pkg.rJoyX6 = rJoy.dx;
|
||||
pkg.rJoyY6 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys7 = (u32)hidKeysHeld(CONTROLLER_PLAYER_7);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_7, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_7, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX7 = lJoy.dx;
|
||||
pkg.lJoyY7 = lJoy.dy;
|
||||
pkg.rJoyX7 = rJoy.dx;
|
||||
pkg.rJoyY7 = rJoy.dy;
|
||||
|
||||
pkg.heldKeys8 = (u32)hidKeysHeld(CONTROLLER_PLAYER_8);
|
||||
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_8, JOYSTICK_LEFT);
|
||||
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_8, JOYSTICK_RIGHT);
|
||||
pkg.lJoyX8 = lJoy.dx;
|
||||
pkg.lJoyY8 = lJoy.dy;
|
||||
pkg.rJoyX8 = rJoy.dx;
|
||||
pkg.rJoyY8 = rJoy.dy;
|
||||
touchPosition touch;
|
||||
hidTouchRead(&touch, 0);
|
||||
pkg.touchX1 = touch.px;
|
||||
|
|
|
@ -10,50 +10,50 @@
|
|||
/* Data to send to server */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long heldKeys1;
|
||||
short lJoyX1;
|
||||
short lJoyY1;
|
||||
short rJoyX1;
|
||||
short rJoyY1;
|
||||
unsigned long heldKeys2;
|
||||
short lJoyX2;
|
||||
short lJoyY2;
|
||||
short rJoyX2;
|
||||
short rJoyY2;
|
||||
unsigned long heldKeys3;
|
||||
short lJoyX3;
|
||||
short lJoyY3;
|
||||
short rJoyX3;
|
||||
short rJoyY3;
|
||||
unsigned long heldKeys4;
|
||||
short lJoyX4;
|
||||
short lJoyY4;
|
||||
short rJoyX4;
|
||||
short rJoyY4;
|
||||
unsigned long heldKeys5;
|
||||
short lJoyX5;
|
||||
short lJoyY5;
|
||||
short rJoyX5;
|
||||
short rJoyY5;
|
||||
unsigned long heldKeys6;
|
||||
short lJoyX6;
|
||||
short lJoyY6;
|
||||
short rJoyX6;
|
||||
short rJoyY6;
|
||||
unsigned long heldKeys7;
|
||||
short lJoyX7;
|
||||
short lJoyY7;
|
||||
short rJoyX7;
|
||||
short rJoyY7;
|
||||
unsigned long heldKeys8;
|
||||
short lJoyX8;
|
||||
short lJoyY8;
|
||||
short rJoyX8;
|
||||
short rJoyY8;
|
||||
short touchX1;
|
||||
short touchY1;
|
||||
short touchX2;
|
||||
short touchY2;
|
||||
u32 heldKeys1;
|
||||
s32 lJoyX1;
|
||||
s32 lJoyY1;
|
||||
s32 rJoyX1;
|
||||
s32 rJoyY1;
|
||||
u32 heldKeys2;
|
||||
s32 lJoyX2;
|
||||
s32 lJoyY2;
|
||||
s32 rJoyX2;
|
||||
s32 rJoyY2;
|
||||
u32 heldKeys3;
|
||||
s32 lJoyX3;
|
||||
s32 lJoyY3;
|
||||
s32 rJoyX3;
|
||||
s32 rJoyY3;
|
||||
u32 heldKeys4;
|
||||
s32 lJoyX4;
|
||||
s32 lJoyY4;
|
||||
s32 rJoyX4;
|
||||
s32 rJoyY4;
|
||||
u32 heldKeys5;
|
||||
s32 lJoyX5;
|
||||
s32 lJoyY5;
|
||||
s32 rJoyX5;
|
||||
s32 rJoyY5;
|
||||
u32 heldKeys6;
|
||||
s32 lJoyX6;
|
||||
s32 lJoyY6;
|
||||
s32 rJoyX6;
|
||||
s32 rJoyY6;
|
||||
u32 heldKeys7;
|
||||
s32 lJoyX7;
|
||||
s32 lJoyY7;
|
||||
s32 rJoyX7;
|
||||
s32 rJoyY7;
|
||||
u32 heldKeys8;
|
||||
s32 lJoyX8;
|
||||
s32 lJoyY8;
|
||||
s32 rJoyX8;
|
||||
s32 rJoyY8;
|
||||
u32 touchX1;
|
||||
u32 touchY1;
|
||||
u32 touchX2;
|
||||
u32 touchY2;
|
||||
float accelX;
|
||||
float accelY;
|
||||
float accelZ;
|
||||
|
|
Loading…
Reference in a new issue