Added ability to use POV hat.

Set any of the DPad settings to the word "POV" and the DPad will be used as "CONTINUOUS POV number 1".
This commit is contained in:
RedInquisitive 2015-10-03 20:25:46 -05:00
parent 7352c3079b
commit 82917a0437
6 changed files with 68 additions and 22 deletions

View File

@ -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

View File

@ -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
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

View File

@ -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)

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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];