mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2024-11-15 21:55:06 -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
|
||||
// cmdbuf[] : RQ, CHN, LEN, data[]
|
||||
channel = cmdbuf[1];
|
||||
if (channel >= NUM_CHANNELS)
|
||||
break;
|
||||
cmdbuf_len = gcn64_transaction(channel, cmdbuf+3, cmdbuf[2], cmdbuf + 3, CMDBUF_SIZE-3);
|
||||
cmdbuf[2] = cmdbuf_len;
|
||||
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:
|
||||
// CMD : RQ, CHN
|
||||
// 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;
|
||||
break;
|
||||
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)
|
||||
{
|
||||
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_UNKNOWN:
|
||||
|
Loading…
Reference in New Issue
Block a user