Unified Pov styles, reorganised ini
New pref to choose between Pov or Keys for D Pad, making it work similarly to C Pad, C Stick and Touch. Will automatically check whether vJoy has 4-way Pov or Continuous Pov enabled and choose the correct one to output.
This commit is contained in:
parent
fbee1b4116
commit
4a99a1ba4c
7 changed files with 40 additions and 42 deletions
Binary file not shown.
|
@ -1,20 +1,20 @@
|
|||
Default port is 8889, if you change this, you must change it in the 3DS's 3DSController.ini as well,
|
||||
|
||||
Circle Pad, C Stick and Touch can be MOUSE, JOYSTICK1 or JOYSTICK2
|
||||
JOYSTICK1 uses X and Y. JOYSTICK2 uses Rx and Ry. These are 0, 1, 3 and 4 respectively, leaving 2 and 5 unused.
|
||||
Circle Pad and C Stick may also be set to KEYS, which will enable Pad directions to map to regular keys (no vJoy necessary).
|
||||
|
||||
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,
|
||||
Mouse Speed controls how fast the Circle Pad or Touch Screen moves the mouse. If set to 0 and using the Touch Screen, it will set to the absolute position, rather than moving relatively to last position,
|
||||
vJoy Device chooses which device to connect to. Set this to 2 in a second instance of 3DSController to use a second 3DS at the same time, perhaps for multiplayer.
|
||||
|
||||
|
||||
Circle Pad, C Stick and Touch can be MOUSE, JOYSTICK1, or JOYSTICK2.
|
||||
JOYSTICK1 uses X and Y. JOYSTICK2 uses Rx and Ry. These are axes 0, 1, 3 and 4 respectively, leaving 2 and 5 unused.
|
||||
KEYS will enable Pad directions (eg. Pad Left, C Stick Right) to map to regular keys (no vJoy necessary).
|
||||
D Pad can be KEYS or POV. POV will automatically choose a continuous or 4 directional POV hat depending on what is set in your vJoy Config.
|
||||
|
||||
|
||||
Buttons can be a letter for a keyboard key (like Q, W, E, R, T, or Y), a special keyboard key (like SPACE, CLICK, RIGHT CLICK, ENTER, BACKSPACE, SHIFT, TAB, LEFT, RIGHT, UP, DOWN, PAGE UP, PAGE DOWN, WINDOWS, ESCAPE, CONTROL or ALT), a joypad button (JOY1, JOY2, JOY3, to JOY16) or vJoy Hat Switch direction (NORTH, EAST, SOUTH or WEST) (The hat switch must be enabled in vJoy Config. 4 way only, not continuous!)
|
||||
|
||||
If you want to use JOY9 through JOY16 you need to reconfigure vJoy. Search for vJoy Config in your start menu and set buttons to 16.
|
||||
|
||||
Alternatively, you can disable a key by binding it to NONE,
|
||||
Alternatively, you can disable any 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,
|
||||
|
||||
vJoy Device chooses which device to connect to. Set this to 2 in a second instance of 3DSController to use a second 3DS at the same time, perhaps for multiplayer.
|
||||
|
||||
Make sure to use a single space, not a tab for seperating settings,
|
||||
|
||||
|
@ -23,12 +23,14 @@ Make sure to use a single space, not a tab for seperating settings,
|
|||
|
||||
Port: 8889
|
||||
Throttle: 20
|
||||
Circle Pad: KEYS
|
||||
C Stick: MOUSE
|
||||
Touch: MOUSE
|
||||
Mouse Speed: 3
|
||||
vJoy Device: 1
|
||||
|
||||
Circle Pad: KEYS
|
||||
C Stick: MOUSE
|
||||
D Pad: POV
|
||||
Touch: MOUSE
|
||||
|
||||
A: SPACE
|
||||
B: CONTROL
|
||||
X: E
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
if(currentKeys & DSKey) joyButtons |= PCKey.joypadButton << 8;\
|
||||
else joyButtons &= ~(PCKey.joypadButton << 8);\
|
||||
}\
|
||||
else if(PCKey.useJoypad == 3) {\
|
||||
if(currentKeys & DSKey) hatButtons |= PCKey.joypadButton;\
|
||||
else hatButtons &= ~(PCKey.joypadButton);\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define BIT(n) (1 << (n))
|
||||
|
@ -111,4 +107,3 @@ extern struct touch currentTouch;
|
|||
unsigned int mapVirtualKey(unsigned int key);
|
||||
void simulateKeyNewpress(unsigned int key);
|
||||
void simulateKeyRelease(unsigned int key);
|
||||
void handleHat(unsigned int hat);
|
||||
|
|
|
@ -11,16 +11,22 @@ enum analogue {
|
|||
keys,
|
||||
};
|
||||
|
||||
enum dPad {
|
||||
key,
|
||||
pov,
|
||||
cPov,
|
||||
};
|
||||
|
||||
struct settings {
|
||||
int port;
|
||||
int throttle;
|
||||
enum analogue circlePad;
|
||||
enum analogue cStick;
|
||||
enum analogue touch;
|
||||
enum dPad dPad;
|
||||
int mouseSpeed;
|
||||
UINT vJoyDevice;
|
||||
struct keyMapping A, B, X, Y, L, R, ZL, ZR, Start, Select, Tap, Left, Right, Up, Down, PadLeft, PadRight, PadUp, PadDown, CSLeft, CSRight, CSUp, CSDown;
|
||||
bool isUsingPov;
|
||||
};
|
||||
|
||||
extern struct settings settings;
|
||||
|
|
|
@ -77,12 +77,4 @@ void simulateKeyRelease(unsigned int key) {
|
|||
}
|
||||
|
||||
SendInput(1, &ip, sizeof(INPUT));
|
||||
}
|
||||
|
||||
void handleHat(unsigned int hat) {
|
||||
if(hat & BIT(0)) iReport.bHats = 0;
|
||||
else if(hat & BIT(1)) iReport.bHats = 1;
|
||||
else if(hat & BIT(2)) iReport.bHats = 2;
|
||||
else if(hat & BIT(3)) iReport.bHats = 3;
|
||||
else iReport.bHats = -1;
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
|||
|
||||
bool vJoy = true;
|
||||
UINT iInterface = settings.vJoyDevice;
|
||||
int hatButtons = 0;
|
||||
|
||||
iReport.wAxisX = JOY_MIDDLE;
|
||||
iReport.wAxisY = JOY_MIDDLE;
|
||||
|
@ -55,6 +54,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
|||
ContPovNumber = GetVJDContPovNumber(iInterface);
|
||||
//int DiscPovNumber = GetVJDDiscPovNumber(iInterface);
|
||||
|
||||
if((settings.dPad == pov) && !(ContPovNumber == 0)) settings.dPad = cPov;
|
||||
|
||||
if(vJoy && !updateJoystick(iInterface)) {
|
||||
printf("vJoy failed (3)! Buttons will still work, but joystick won't work.\nIs vJoy device %d configured?\n",iInterface);
|
||||
vJoy = false;
|
||||
|
@ -128,7 +129,7 @@ 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);
|
||||
if(!settings.isUsingPov) { //Handle normally if not using POV in settings.
|
||||
if(settings.dPad == key) { //Handle normally if not using POV in settings.
|
||||
handleKey(KEY_DRIGHT, settings.Right);
|
||||
handleKey(KEY_DLEFT, settings.Left);
|
||||
handleKey(KEY_DUP, settings.Up);
|
||||
|
@ -141,8 +142,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
|||
handleKey(KEY_X, settings.X);
|
||||
handleKey(KEY_Y, settings.Y);
|
||||
|
||||
handleHat(hatButtons);
|
||||
|
||||
if(settings.circlePad == keys) {
|
||||
handleKey(KEY_CPAD_RIGHT, settings.PadRight);
|
||||
handleKey(KEY_CPAD_LEFT, settings.PadLeft);
|
||||
|
@ -246,7 +245,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
|||
}
|
||||
|
||||
|
||||
if(settings.isUsingPov) {
|
||||
if(settings.dPad == cPov) {
|
||||
if((currentKeys & KEY_DUP) && !(currentKeys & KEY_DLEFT)) {
|
||||
if((currentKeys & KEY_DRIGHT)) {
|
||||
povHat = 4500;
|
||||
|
@ -280,6 +279,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
|||
|
||||
}
|
||||
|
||||
else if(settings.dPad == pov) {
|
||||
if((currentKeys & KEY_DUP) && !(currentKeys & KEY_DLEFT)) iReport.bHats = 0;
|
||||
else if(currentKeys & KEY_DRIGHT) iReport.bHats = 1;
|
||||
else if (currentKeys & KEY_DDOWN) iReport.bHats = 2;
|
||||
else if (currentKeys & KEY_DLEFT) iReport.bHats = 3;
|
||||
else iReport.bHats = -1;
|
||||
}
|
||||
|
||||
joyVolume = volume * 512;
|
||||
|
||||
break;
|
||||
|
|
|
@ -32,7 +32,6 @@ 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) {
|
||||
|
@ -93,14 +92,6 @@ 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 if(strcmp(string, "NORTH") == 0) { k.useJoypad = 3; k.joypadButton = 1 << 0; }
|
||||
else if(strcmp(string, "EAST") == 0) { k.useJoypad = 3; k.joypadButton = 1 << 1; }
|
||||
else if(strcmp(string, "SOUTH") == 0) { k.useJoypad = 3; k.joypadButton = 1 << 2; }
|
||||
else if(strcmp(string, "WEST") == 0) { k.useJoypad = 3; k.joypadButton = 1 << 3; }
|
||||
|
||||
else k.virtualKey = (int)string[0];
|
||||
|
||||
|
@ -155,6 +146,11 @@ bool readSettings(void) {
|
|||
else if(strcmp(setting, "KEYS") == 0) settings.cStick = keys;
|
||||
}
|
||||
|
||||
if(getSetting("D Pad: ", buffer, setting)) {
|
||||
if(strcmp(setting, "KEYS") == 0) settings.dPad = key;
|
||||
if(strcmp(setting, "POV") == 0) settings.dPad = pov;
|
||||
}
|
||||
|
||||
if(getSetting("Touch: ", buffer, setting)) {
|
||||
if(strcmp(setting, "MOUSE") == 0) settings.touch = mouse;
|
||||
else if(strcmp(setting, "JOYSTICK1") == 0) settings.touch = joystick1;
|
||||
|
|
Loading…
Reference in a new issue