diff --git a/3DS/3DSController.ini b/3DS/3DSController.ini index 8d43317..2773d24 100644 --- a/3DS/3DSController.ini +++ b/3DS/3DSController.ini @@ -1,4 +1,4 @@ Change the IP to be your PC's local IP, (run 3DSController.exe to find it), -IP: 192.168.0.4 +IP: 192.168.0.40 Port: 8889 \ No newline at end of file diff --git a/PC/3DSController.ini b/PC/3DSController.ini index 2bb191b..c45e834 100644 --- a/PC/3DSController.ini +++ b/PC/3DSController.ini @@ -9,6 +9,8 @@ Buttons can be a letter for a keyboard key (like Q, W, E, R, T, or Y), a special If you want to use JOY9 through JOY16 you need to reconfigure vJoy. Search for vJoyConf in your start menu and set buttons to 16. +If you want to use the DPad as a Point of View Hat, set any or all of the DPad Left Right Up or Down to POV. + Alternatively, you can disable a key by binding it to NONE, Throttle controls the delay between checking for new packets (in milliseconds), a high number will have slightly more lag between pressing a button on the 3DS and receiving it on the PC, however will make the application use less CPU. In my experience, 20 is a reasonable throttling amount, @@ -23,20 +25,20 @@ Throttle: 20 Circle Pad: JOYSTICK1 C Stick: JOYSTICK2 Touch: MOUSE -Mouse Speed: 0 +Mouse Speed: 4 -A: A -B: B -X: X -Y: Y -L: L -R: R -ZL: Q -ZR: W -Left: LEFT -Right: RIGHT -Up: UP -Down: DOWN -Start: ENTER -Select: BACKSPACE -Tap: SPACE \ No newline at end of file +A: JOY1 +B: JOY2 +X: JOY3 +Y: JOY4 +L: JOY5 +R: JOY6 +ZL: JOY9 +ZR: JOY10 +Left: POV +Right: POV +Up: POV +Down: POV +Start: JOY8 +Select: JOY7 +Tap: NONE \ No newline at end of file diff --git a/PC/include/joystick.h b/PC/include/joystick.h index a01ee64..a495198 100644 --- a/PC/include/joystick.h +++ b/PC/include/joystick.h @@ -14,6 +14,8 @@ #define joyRX iReport.wAxisXRot #define joyRY iReport.wAxisYRot #define joyVolume iReport.wSlider +#define povHat iReport.bHats + #define joyButtons iReport.lButtons #define JOY_MIDDLE (128 * 128) diff --git a/PC/include/settings.h b/PC/include/settings.h index e5006de..e771b9c 100644 --- a/PC/include/settings.h +++ b/PC/include/settings.h @@ -18,6 +18,7 @@ struct settings { enum analogue touch; int mouseSpeed; struct keyMapping A, B, X, Y, L, R, ZL, ZR, Left, Right, Up, Down, Start, Select, Tap; + bool isUsingPov; }; extern struct settings settings; diff --git a/PC/source/main.c b/PC/source/main.c index 7eaf098..320256b 100644 --- a/PC/source/main.c +++ b/PC/source/main.c @@ -127,10 +127,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) handleKey(KEY_B, settings.B); handleKey(KEY_SELECT, settings.Select); handleKey(KEY_START, settings.Start); - handleKey(KEY_DRIGHT, settings.Right); - handleKey(KEY_DLEFT, settings.Left); - handleKey(KEY_DUP, settings.Up); - handleKey(KEY_DDOWN, settings.Down); + if(!settings.isUsingPov) { //Handle normally if not using POV in settings. + handleKey(KEY_DRIGHT, settings.Right); + handleKey(KEY_DLEFT, settings.Left); + handleKey(KEY_DUP, settings.Up); + handleKey(KEY_DDOWN, settings.Down); + } handleKey(KEY_R, settings.R); handleKey(KEY_L, settings.L); handleKey(KEY_ZR, settings.ZR); @@ -216,6 +218,41 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) joyRY = (128 - cStick.y) * 128; } + + if(settings.isUsingPov) { + if((currentKeys & KEY_DUP) && !(currentKeys & KEY_DLEFT)) { + if((currentKeys & KEY_DRIGHT)) { + povHat = 4500; + } else { + povHat = 0; + } + } else if((currentKeys & KEY_DRIGHT)) { + if((currentKeys & KEY_DDOWN)) { + povHat = 13500; + } else { + povHat = 9000; + } + } else if((currentKeys & KEY_DDOWN)) { + if((currentKeys & KEY_DLEFT)) { + povHat = 22500; + } else { + povHat = 18000; + } + } else if((currentKeys & KEY_DLEFT)) { + if ((currentKeys & KEY_DUP)) { + povHat = 31500; + } else { + povHat = 27000; + } + } + + if(!((currentKeys & KEY_DUP) || (currentKeys & KEY_DRIGHT) || (currentKeys & KEY_DDOWN) || (currentKeys & KEY_DLEFT))) { + //If none are pressed, reset the POV hat + povHat = -1; + } + + } + joyVolume = volume * 512; break; @@ -226,4 +263,4 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) error("accept()"); return 0; -} +} \ No newline at end of file diff --git a/PC/source/settings.c b/PC/source/settings.c index 1af66c3..66b751d 100644 --- a/PC/source/settings.c +++ b/PC/source/settings.c @@ -31,6 +31,7 @@ struct settings defaultSettings = { Start: { 1, {VK_RETURN} }, Select: { 1, {VK_BACK} }, Tap: { 1, {'T'} }, + isUsingPov: false, }; static bool getSetting(char *name, char *src, char *dest) { @@ -88,6 +89,9 @@ static struct keyMapping getButton(char *string) { else if(strcmp(string, "JOY14") == 0) { k.useJoypad = 2; k.joypadButton = 1 << 5; } else if(strcmp(string, "JOY15") == 0) { k.useJoypad = 2; k.joypadButton = 1 << 6; } else if(strcmp(string, "JOY16") == 0) { k.useJoypad = 2; k.joypadButton = 1 << 7; } + else if(strcmp(string, "POV") == 0) {settings.isUsingPov = true;} + //No matter what the others are, if any are set to true then we are using the POV hat for the DPad + //This would mean if any setting at all is POV then the dpad is suddenly a POV. else k.virtualKey = (int)string[0];