Made vJoy Device configurabe
You can now choose which vJoy device to output to in the .ini, allowing you to use multiple 3DS, each controlling their own virtual Joystick.
This commit is contained in:
parent
7e64fea254
commit
0684a4811e
6 changed files with 21 additions and 14 deletions
|
@ -13,6 +13,8 @@ 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,
|
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,
|
Make sure to use a single space, not a tab for seperating settings,
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +26,7 @@ Circle Pad: JOYSTICK1
|
||||||
C Stick: JOYSTICK2
|
C Stick: JOYSTICK2
|
||||||
Touch: MOUSE
|
Touch: MOUSE
|
||||||
Mouse Speed: 0
|
Mouse Speed: 0
|
||||||
|
vJoy Device: 1
|
||||||
|
|
||||||
A: A
|
A: A
|
||||||
B: B
|
B: B
|
||||||
|
|
|
@ -18,9 +18,8 @@
|
||||||
#define JOY_MIDDLE (128 * 128)
|
#define JOY_MIDDLE (128 * 128)
|
||||||
|
|
||||||
extern int ContPovNumber;
|
extern int ContPovNumber;
|
||||||
extern UINT iInterface;
|
|
||||||
//extern BOOL ContinuousPOV;
|
//extern BOOL ContinuousPOV;
|
||||||
|
|
||||||
extern JOYSTICK_POSITION iReport;
|
extern JOYSTICK_POSITION iReport;
|
||||||
|
|
||||||
BOOL updateJoystick(void);
|
BOOL updateJoystick(int);
|
||||||
|
|
|
@ -17,6 +17,7 @@ struct settings {
|
||||||
enum analogue cStick;
|
enum analogue cStick;
|
||||||
enum analogue touch;
|
enum analogue touch;
|
||||||
int mouseSpeed;
|
int mouseSpeed;
|
||||||
|
UINT vJoyDevice;
|
||||||
struct keyMapping A, B, X, Y, L, R, ZL, ZR, Left, Right, Up, Down, Start, Select, Tap;
|
struct keyMapping A, B, X, Y, L, R, ZL, ZR, Left, Right, Up, Down, Start, Select, Tap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,11 @@
|
||||||
#include "joystick.h"
|
#include "joystick.h"
|
||||||
|
|
||||||
int ContPovNumber;
|
int ContPovNumber;
|
||||||
UINT iInterface = 1;
|
|
||||||
//BOOL ContinuousPOV = FALSE;
|
//BOOL ContinuousPOV = FALSE;
|
||||||
|
|
||||||
JOYSTICK_POSITION iReport;
|
JOYSTICK_POSITION iReport;
|
||||||
|
|
||||||
BOOL updateJoystick(void) {
|
BOOL updateJoystick(iInterface) {
|
||||||
BYTE id = (BYTE)iInterface;
|
BYTE id = (BYTE)iInterface;
|
||||||
|
|
||||||
iReport.bDevice = id;
|
iReport.bDevice = id;
|
||||||
|
|
|
@ -22,8 +22,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
||||||
double widthMultiplier = screenWidth / 320.0;
|
double widthMultiplier = screenWidth / 320.0;
|
||||||
double heightMultiplier = screenHeight / 240.0;
|
double heightMultiplier = screenHeight / 240.0;
|
||||||
|
|
||||||
|
if(!readSettings()) {
|
||||||
|
printf("Couldn't read settings file, using default key bindings.\n");
|
||||||
|
}
|
||||||
|
|
||||||
bool vJoy = true;
|
bool vJoy = true;
|
||||||
UINT iInterface = 1;
|
UINT iInterface = settings.vJoyDevice;
|
||||||
|
|
||||||
iReport.wAxisX = JOY_MIDDLE;
|
iReport.wAxisX = JOY_MIDDLE;
|
||||||
iReport.wAxisY = JOY_MIDDLE;
|
iReport.wAxisY = JOY_MIDDLE;
|
||||||
|
@ -50,19 +54,15 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
||||||
ContPovNumber = GetVJDContPovNumber(iInterface);
|
ContPovNumber = GetVJDContPovNumber(iInterface);
|
||||||
//int DiscPovNumber = GetVJDDiscPovNumber(iInterface);
|
//int DiscPovNumber = GetVJDDiscPovNumber(iInterface);
|
||||||
|
|
||||||
if(vJoy && !updateJoystick()) {
|
if(vJoy && !updateJoystick(iInterface)) {
|
||||||
printf("vJoy failed (3)! Buttons will still work, but joystick won't work.\n");
|
printf("vJoy failed (3)! Buttons will still work, but joystick won't work.\nIs vJoy device %d configured?\n",iInterface);
|
||||||
vJoy = false;
|
vJoy = false;
|
||||||
}
|
} else printf("Connected to vJoy device %d\n",iInterface);
|
||||||
|
|
||||||
if(!readSettings()) {
|
|
||||||
printf("Couldn't read settings file, using default key bindings.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
initNetwork();
|
initNetwork();
|
||||||
|
|
||||||
char nButtons = GetVJDButtonNumber(iInterface);
|
char nButtons = GetVJDButtonNumber(iInterface);
|
||||||
if(nButtons <16) printf("Your vJoy has %d buttons, 3DSController supports 16!\n", nButtons);
|
if(vJoy && nButtons <16) printf("Your vJoy has %d buttons, 3DSController supports 16!\n", nButtons);
|
||||||
|
|
||||||
printf("Port: %d\n", settings.port);
|
printf("Port: %d\n", settings.port);
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vJoy) updateJoystick();
|
if(vJoy) updateJoystick(iInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
error("accept()");
|
error("accept()");
|
||||||
|
|
|
@ -16,6 +16,7 @@ struct settings defaultSettings = {
|
||||||
cStick: joystick2,
|
cStick: joystick2,
|
||||||
touch: mouse,
|
touch: mouse,
|
||||||
mouseSpeed: 4,
|
mouseSpeed: 4,
|
||||||
|
vJoyDevice: 1,
|
||||||
A: { 1, {'A'} },
|
A: { 1, {'A'} },
|
||||||
B: { 1, {'B'} },
|
B: { 1, {'B'} },
|
||||||
X: { 1, {'X'} },
|
X: { 1, {'X'} },
|
||||||
|
@ -150,6 +151,10 @@ bool readSettings(void) {
|
||||||
sscanf(setting, "%d", &settings.mouseSpeed);
|
sscanf(setting, "%d", &settings.mouseSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(getSetting("vJoy Device: ", buffer, setting)) {
|
||||||
|
sscanf(setting, "%d", &settings.vJoyDevice);
|
||||||
|
}
|
||||||
|
|
||||||
if(getSetting("A: ", buffer, setting)) settings.A = getButton(setting);
|
if(getSetting("A: ", buffer, setting)) settings.A = getButton(setting);
|
||||||
if(getSetting("B: ", buffer, setting)) settings.B = getButton(setting);
|
if(getSetting("B: ", buffer, setting)) settings.B = getButton(setting);
|
||||||
if(getSetting("X: ", buffer, setting)) settings.X = getButton(setting);
|
if(getSetting("X: ", buffer, setting)) settings.X = getButton(setting);
|
||||||
|
|
Loading…
Add table
Reference in a new issue