Browse Source

Need one current_pad_type var. per channel

pull/5/head
Raphael Assenat 5 years ago
parent
commit
c2fd3a10ba
3 changed files with 12 additions and 5 deletions
  1. +6
    -1
      hiddata.c
  2. +3
    -3
      main.c
  3. +3
    -1
      main.h

+ 6
- 1
hiddata.c View File

@ -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:


+ 3
- 3
main.c View File

@ -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:


+ 3
- 1
main.h View File

@ -1,6 +1,8 @@
#ifndef _main_h__
#define _main_h__
extern unsigned char current_pad_type;
#include "config.h"
extern unsigned char current_pad_type[NUM_CHANNELS];
#endif // _main_h__

Loading…
Cancel
Save