mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2024-12-21 23:08:53 -05:00
Need one current_pad_type var. per channel
This commit is contained in:
parent
434aec0d4b
commit
c2fd3a10ba
@ -96,6 +96,8 @@ static void hiddata_processCommandBuffer(struct hiddata_ops *ops)
|
|||||||
// TODO : Range checking
|
// TODO : Range checking
|
||||||
// cmdbuf[] : RQ, CHN, LEN, data[]
|
// cmdbuf[] : RQ, CHN, LEN, data[]
|
||||||
channel = cmdbuf[1];
|
channel = cmdbuf[1];
|
||||||
|
if (channel >= NUM_CHANNELS)
|
||||||
|
break;
|
||||||
cmdbuf_len = gcn64_transaction(channel, cmdbuf+3, cmdbuf[2], cmdbuf + 3, CMDBUF_SIZE-3);
|
cmdbuf_len = gcn64_transaction(channel, cmdbuf+3, cmdbuf[2], cmdbuf + 3, CMDBUF_SIZE-3);
|
||||||
cmdbuf[2] = cmdbuf_len;
|
cmdbuf[2] = cmdbuf_len;
|
||||||
cmdbuf_len += 3; // Answer: RQ, CHN, LEN, data[]
|
cmdbuf_len += 3; // Answer: RQ, CHN, LEN, data[]
|
||||||
@ -131,7 +133,10 @@ static void hiddata_processCommandBuffer(struct hiddata_ops *ops)
|
|||||||
case RQ_GCN64_GET_CONTROLLER_TYPE:
|
case RQ_GCN64_GET_CONTROLLER_TYPE:
|
||||||
// CMD : RQ, CHN
|
// CMD : RQ, CHN
|
||||||
// Answer: RQ, CHN, TYPE
|
// Answer: RQ, CHN, TYPE
|
||||||
cmdbuf[2] = current_pad_type;
|
channel = cmdbuf[1];
|
||||||
|
if (channel >= NUM_CHANNELS)
|
||||||
|
break;
|
||||||
|
cmdbuf[2] = current_pad_type[channel];
|
||||||
cmdbuf_len = 3;
|
cmdbuf_len = 3;
|
||||||
break;
|
break;
|
||||||
case RQ_GCN64_SET_VIBRATION:
|
case RQ_GCN64_SET_VIBRATION:
|
||||||
|
6
main.c
6
main.c
@ -364,13 +364,13 @@ void hwinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned char current_pad_type = CONTROLLER_IS_ABSENT;
|
unsigned char current_pad_type[NUM_CHANNELS] = { };
|
||||||
|
|
||||||
Gamepad *detectPad(unsigned char chn)
|
Gamepad *detectPad(unsigned char chn)
|
||||||
{
|
{
|
||||||
current_pad_type = gcn64_detectController(chn);
|
current_pad_type[chn] = gcn64_detectController(chn);
|
||||||
|
|
||||||
switch (current_pad_type)
|
switch (current_pad_type[chn])
|
||||||
{
|
{
|
||||||
case CONTROLLER_IS_ABSENT:
|
case CONTROLLER_IS_ABSENT:
|
||||||
case CONTROLLER_IS_UNKNOWN:
|
case CONTROLLER_IS_UNKNOWN:
|
||||||
|
Loading…
Reference in New Issue
Block a user