3ds transmits volume status.
The Volume slider now controls the "Slider" axis in v-joy
This commit is contained in:
parent
ca1f816e97
commit
7352c3079b
8 changed files with 21 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -51,6 +51,8 @@ struct packet {
|
|||
short x;
|
||||
short y;
|
||||
} cStick;
|
||||
|
||||
unsigned int volume;
|
||||
};
|
||||
struct keysPacket keysPacket;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue