Port moved to settings struct and default to 8889

This commit is contained in:
CTurt 2014-12-13 19:46:52 +00:00
parent 3a4c493835
commit 870210e6a2
6 changed files with 12 additions and 12 deletions

View file

@ -1,12 +1,12 @@
Default port is 8888, if you change this, you must change it in the 3DS's 3DSController.ini as well,
Default port is 8889, if you change this, you must change it in the 3DS's 3DSController.ini as well,
Circle Pad and Touch can be either JOYSTICK or MOUSE,
Buttons can either be a letter for example B, or a special key, like SPACE, CLICK, RIGHT CLICK, ENTER, BACKSPACE, SHIFT, TAB, LEFT, RIGHT, UP, DOWN, PAGE UP, PAGE DOWN, or WINDOWS,
Alternatively, you can disable a key by binding it to NONE,
Make sure to use a space, not a tab for seperating settings
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: 20
Port: 8889
Throttle: 20
Circle Pad: JOYSTICK
Touch: MOUSE
Mouse Speed: 4

View file

@ -8,6 +8,7 @@ enum analogue {
};
struct settings {
int port;
int throttle;
enum analogue circlePad;
enum analogue touch;

View file

@ -30,8 +30,6 @@ struct packet {
} touch;
};
extern int port;
extern SOCKET listener;
extern SOCKET client;

View file

@ -43,7 +43,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
initNetwork();
printf("Port: %d\n", port);
printf("Port: %d\n", settings.port);
printf("Running on: %s\n", hostName);

View file

@ -9,6 +9,7 @@
struct settings settings;
struct settings defaultSettings = {
port: 8889,
throttle: 20,
circlePad: joystick,
touch: mouse,
@ -93,12 +94,12 @@ bool readSettings(void) {
char setting[64] = { '\0' };
if(getSetting("Throttle: ", buffer, setting)) {
sscanf(setting, "%d", &settings.throttle);
if(getSetting("Port: ", buffer, setting)) {
sscanf(setting, "%d", &settings.port);
}
if(getSetting("Port: ", buffer, setting)) {
sscanf(setting, "%d", &port);
if(getSetting("Throttle: ", buffer, setting)) {
sscanf(setting, "%d", &settings.throttle);
}
if(getSetting("Circle Pad: ", buffer, setting)) {

View file

@ -1,8 +1,8 @@
#include "general.h"
#include "wireless.h"
#include "settings.h"
int port = 8888;
#include "wireless.h"
SOCKET listener;
SOCKET client;
@ -55,7 +55,7 @@ void startListening(void) {
serverInfo.sin_family = AF_INET;
serverInfo.sin_addr.s_addr = IP;
serverInfo.sin_port = htons(port);
serverInfo.sin_port = htons(settings.port);
u_long one = 1;
ioctlsocket(listener, FIONBIO, &one);