From ef7b8c2c9e41601ddc952c6f5a296d6747aae421 Mon Sep 17 00:00:00 2001 From: RedInquisitive Date: Sat, 3 Oct 2015 21:25:41 -0500 Subject: [PATCH] Fixed some bindings and added tweaks. The volume slider is now the Z axis and the touchpad (if configured like a joystick) is more accurate. If the touchpad is lifted off of, then the RX and RY axis will center (like taking your thumb off a real joystick) --- PC/3DSController.ini | 4 ++-- PC/include/joystick.h | 3 ++- PC/source/main.c | 20 +++++++++++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/PC/3DSController.ini b/PC/3DSController.ini index c45e834..6a4c88f 100644 --- a/PC/3DSController.ini +++ b/PC/3DSController.ini @@ -23,8 +23,8 @@ Make sure to use a single space, not a tab for seperating settings, Port: 8889 Throttle: 20 Circle Pad: JOYSTICK1 -C Stick: JOYSTICK2 -Touch: MOUSE +C Stick: MOUSE +Touch: JOYSTICK2 Mouse Speed: 4 A: JOY1 diff --git a/PC/include/joystick.h b/PC/include/joystick.h index a495198..f5b2ea8 100644 --- a/PC/include/joystick.h +++ b/PC/include/joystick.h @@ -13,7 +13,8 @@ #define joyY iReport.wAxisY #define joyRX iReport.wAxisXRot #define joyRY iReport.wAxisYRot -#define joyVolume iReport.wSlider +//#define joyVolume iReport.wSlider +#define joyVolume iReport.wAxisZ #define povHat iReport.bHats #define joyButtons iReport.lButtons diff --git a/PC/source/main.c b/PC/source/main.c index 320256b..67e778b 100644 --- a/PC/source/main.c +++ b/PC/source/main.c @@ -167,18 +167,28 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) SetCursorPos((int)((double)currentTouch.x * widthMultiplier), (int)((double)currentTouch.y * heightMultiplier)); } } - else if(settings.touch == joystick1) { - joyX = (currentTouch.x) * 128; - joyY = (currentTouch.y) * 128; + else if(settings.touch == joystick1) { //made a little bit more accurate to the screen size. + joyX = (int)((float)(currentTouch.x) * 102.3f); + joyY = (int)((float)(currentTouch.y) * 136.5f); } else if(settings.touch == joystick2) { - joyRX = (currentTouch.x) * 128; - joyRY = (currentTouch.y) * 128; + joyRX = (int)((float)(currentTouch.x) * 102.3f); + joyRY = (int)((float)(currentTouch.y) * 136.5f); } else { handleKey(KEY_TOUCH, settings.Tap); } + } else { //If we are not touching, move to center (Like if you release the joystick on a normal controller). + if(settings.touch == joystick1) { + joyX = 16383; //Halfway between the x + joyY = 16383; //Halfway between the y + } + + else if(settings.touch == joystick2) { + joyRX = 16383; //Halfway between the rx + joyRY = 16383; //Halfway between the ry + } } if(settings.circlePad == mouse) {