diff --git a/3DS/include/wireless.h b/3DS/include/wireless.h index 27efcae..6ad6983 100644 --- a/3DS/include/wireless.h +++ b/3DS/include/wireless.h @@ -59,6 +59,8 @@ struct packet { short x; short y; } cStick; + + unsigned int volume; //way longer than needed, but it works. }; struct keysPacket keysPacket; }; @@ -84,4 +86,4 @@ bool openSocket(int port); void sendBuf(int length); int receiveBuffer(int length); void sendConnectionRequest(void); -void sendKeys(unsigned int keys, circlePosition circlePad, touchPosition touch, circlePosition cStick); +void sendKeys(unsigned int keys, circlePosition circlePad, touchPosition touch, circlePosition cStick, unsigned int volume); diff --git a/3DS/source/main.c b/3DS/source/main.c index 686a00a..e119ca7 100644 --- a/3DS/source/main.c +++ b/3DS/source/main.c @@ -91,8 +91,12 @@ int main(void) { u32 kHeld = hidKeysHeld(); circlePosition circlePad; circlePosition cStick; + u8 vol8; + u8* volp = &vol8; //As a test for pointing at things. hidCstickRead(&cStick); hidCircleRead(&circlePad); + HIDUSER_GetSoundVolume(volp); + u32 volume = (u32)vol8; //Upscale to 32 for transmission touchPosition touch; touchRead(&touch); @@ -139,8 +143,8 @@ int main(void) { } } - sendKeys(kHeld, circlePad, touch, cStick); - + sendKeys(kHeld, circlePad, touch, cStick, volume); + drawString(10, 10, "Volume: %x", volume); //receiveBuffer(sizeof(struct packet)); if((kHeld & KEY_START) && (kHeld & KEY_SELECT)) longjmp(exitJmp, 1); diff --git a/3DS/source/wireless.c b/3DS/source/wireless.c index 0c9bc38..8abe2c8 100644 --- a/3DS/source/wireless.c +++ b/3DS/source/wireless.c @@ -38,12 +38,13 @@ void sendConnectionRequest(void) { sendBuf(offsetof(struct packet, connectPacket) + sizeof(struct connectPacket)); } -void sendKeys(unsigned int keys, circlePosition circlePad, touchPosition touch, circlePosition cStick) { +void sendKeys(unsigned int keys, circlePosition circlePad, touchPosition touch, circlePosition cStick, unsigned int volume) { outBuf.command = KEYS; outBuf.keyboardActive = keyboardActive; memcpy(&outBuf.keys, &keys, 4); memcpy(&outBuf.circlePad, &circlePad, 4); memcpy(&outBuf.touch, &touch, 4); memcpy(&outBuf.cStick, &cStick, 4); + memcpy(&outBuf.volume, &volume, 4); sendBuf(offsetof(struct packet, keysPacket) + sizeof(struct keysPacket)); } diff --git a/PC/include/joystick.h b/PC/include/joystick.h index bcbb46b..a01ee64 100644 --- a/PC/include/joystick.h +++ b/PC/include/joystick.h @@ -13,6 +13,7 @@ #define joyY iReport.wAxisY #define joyRX iReport.wAxisXRot #define joyRY iReport.wAxisYRot +#define joyVolume iReport.wSlider #define joyButtons iReport.lButtons #define JOY_MIDDLE (128 * 128) diff --git a/PC/include/keys.h b/PC/include/keys.h index 8b64fd2..c8e23ba 100644 --- a/PC/include/keys.h +++ b/PC/include/keys.h @@ -97,6 +97,8 @@ struct touch { extern unsigned int lastKeys; extern unsigned int currentKeys; +extern unsigned int volume; + extern struct circlePad circlePad; extern struct cStick cStick; extern struct touch lastTouch; diff --git a/PC/include/wireless.h b/PC/include/wireless.h index 772a194..4bff563 100644 --- a/PC/include/wireless.h +++ b/PC/include/wireless.h @@ -51,6 +51,8 @@ struct packet { short x; short y; } cStick; + + unsigned int volume; }; struct keysPacket keysPacket; diff --git a/PC/source/keys.c b/PC/source/keys.c index 8d7a89b..e8ef73b 100644 --- a/PC/source/keys.c +++ b/PC/source/keys.c @@ -6,6 +6,7 @@ DEFINE_GUID(GUID_DEVINTERFACE_VJOY, 0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00 unsigned int lastKeys; unsigned int currentKeys; +unsigned int volume; //slider struct circlePad circlePad; struct cStick cStick; diff --git a/PC/source/main.c b/PC/source/main.c index 38f8388..7eaf098 100644 --- a/PC/source/main.c +++ b/PC/source/main.c @@ -120,6 +120,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) memcpy(&circlePad, &buffer.circlePad, 4); memcpy(¤tTouch, &buffer.touch, 4); memcpy(&cStick, &buffer.cStick, 4); + memcpy(&volume, &buffer.volume, 4); + //printf("\rVolume is currently: %x ", volume); //test handleKey(KEY_A, settings.A); handleKey(KEY_B, settings.B); @@ -214,6 +216,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) joyRY = (128 - cStick.y) * 128; } + joyVolume = volume * 512; + break; }