RetroArch
Classes | Macros | Typedefs | Functions | Variables
device_wiiu_gca.c File Reference
#include <stdio.h>
#include "hid_device_driver.h"
Include dependency graph for device_wiiu_gca.c:

Classes

struct  wiiu_gca_instance
 
struct  gca_pad_data
 

Macros

#define GCA_PORT_INITIALIZING   0x00
 
#define GCA_PORT_POWERED   0x04
 
#define GCA_PORT_CONNECTED   0x10
 
#define GCA_WAVEBIRD_CONNECTED   0x22
 

Typedefs

typedef struct wiiu_gca_instance wiiu_gca_instance_t
 
typedef struct gca_pad_data gca_pad_t
 

Functions

static void update_pad_state (wiiu_gca_instance_t *instance)
 
static void unregister_pad (wiiu_gca_instance_t *instance, int port)
 
static voidwiiu_gca_init (void *handle)
 
static void wiiu_gca_free (void *data)
 
static void wiiu_gca_handle_packet (void *data, uint8_t *buffer, size_t size)
 
static bool wiiu_gca_detect (uint16_t vendor_id, uint16_t product_id)
 
static voidwiiu_gca_pad_init (void *data, uint32_t slot, hid_driver_t *driver)
 
static void wiiu_gca_pad_deinit (void *data)
 
static void wiiu_gca_get_buttons (void *data, input_bits_t *state)
 
static void update_buttons (gca_pad_t *pad)
 
static void update_analog_state (gca_pad_t *pad)
 
static void wiiu_gca_packet_handler (void *data, uint8_t *packet, uint16_t size)
 
static void wiiu_gca_set_rumble (void *data, enum retro_rumble_effect effect, uint16_t strength)
 
static int16_t wiiu_gca_get_axis (void *data, unsigned axis)
 
static const char * wiiu_gca_get_name (void *data)
 
static bool wiiu_gca_button (void *data, uint16_t joykey)
 

Variables

static uint8_t activation_packet [] = { 0x13 }
 
pad_connection_interface_t wiiu_gca_pad_connection
 
hid_device_t wiiu_gca_hid_device
 

Macro Definition Documentation

◆ GCA_PORT_CONNECTED

#define GCA_PORT_CONNECTED   0x10

◆ GCA_PORT_INITIALIZING

#define GCA_PORT_INITIALIZING   0x00

◆ GCA_PORT_POWERED

#define GCA_PORT_POWERED   0x04

◆ GCA_WAVEBIRD_CONNECTED

#define GCA_WAVEBIRD_CONNECTED   0x22

Typedef Documentation

◆ gca_pad_t

typedef struct gca_pad_data gca_pad_t

◆ wiiu_gca_instance_t

Function Documentation

◆ unregister_pad()

static void unregister_pad ( wiiu_gca_instance_t instance,
int  port 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_analog_state()

static void update_analog_state ( gca_pad_t pad)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_buttons()

static void update_buttons ( gca_pad_t pad)
static
Here is the caller graph for this function:

◆ update_pad_state()

static void update_pad_state ( wiiu_gca_instance_t instance)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wiiu_gca_button()

static bool wiiu_gca_button ( void data,
uint16_t  joykey 
)
static

Button bitmask values: 0x0001 - A 0x0010 - left 0x0100 - Start/Pause 0x0002 - B 0x0020 - right 0x0200 - Z 0x0004 - X 0x0040 - down 0x0400 - R 0x0008 - Y 0x0080 - up 0x0800 - L

◆ wiiu_gca_detect()

static bool wiiu_gca_detect ( uint16_t  vendor_id,
uint16_t  product_id 
)
static

◆ wiiu_gca_free()

static void wiiu_gca_free ( void data)
static
Here is the call graph for this function:

◆ wiiu_gca_get_axis()

static int16_t wiiu_gca_get_axis ( void data,
unsigned  axis 
)
static
Here is the call graph for this function:

◆ wiiu_gca_get_buttons()

static void wiiu_gca_get_buttons ( void data,
input_bits_t state 
)
static

◆ wiiu_gca_get_name()

static const char* wiiu_gca_get_name ( void data)
static

◆ wiiu_gca_handle_packet()

static void wiiu_gca_handle_packet ( void data,
uint8_t buffer,
size_t  size 
)
static
Here is the call graph for this function:

◆ wiiu_gca_init()

static void* wiiu_gca_init ( void handle)
static
Here is the call graph for this function:

◆ wiiu_gca_packet_handler()

static void wiiu_gca_packet_handler ( void data,
uint8_t packet,
uint16_t  size 
)
static

The USB packet provides a 9-byte data packet for each pad.

byte 0: connection status (0x14 = connected, 0x04 = disconnected) bytes 1-2: digital buttons bytes 3-4: left analog stick x/y bytes 5-6: right analog stick x/y bytes 7-8: L/R analog state (note that these have digital buttons too)

Here is the call graph for this function:

◆ wiiu_gca_pad_deinit()

static void wiiu_gca_pad_deinit ( void data)
static
Here is the call graph for this function:

◆ wiiu_gca_pad_init()

static void* wiiu_gca_pad_init ( void data,
uint32_t  slot,
hid_driver_t driver 
)
static

Pad connection interface implementation. This handles each individual GC controller (as opposed to the above that handles the GCA itself).

Here is the call graph for this function:

◆ wiiu_gca_set_rumble()

static void wiiu_gca_set_rumble ( void data,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

Variable Documentation

◆ activation_packet

uint8_t activation_packet[] = { 0x13 }
static

◆ wiiu_gca_hid_device

hid_device_t wiiu_gca_hid_device
Initial value:
= {
"Wii U Gamecube Adapter"
}
static bool wiiu_gca_detect(uint16_t vendor_id, uint16_t product_id)
Definition: device_wiiu_gca.c:161
static void * wiiu_gca_init(void *handle)
Definition: device_wiiu_gca.c:53
static void wiiu_gca_handle_packet(void *data, uint8_t *buffer, size_t size)
Definition: device_wiiu_gca.c:89
static void wiiu_gca_free(void *data)
Definition: device_wiiu_gca.c:75

◆ wiiu_gca_pad_connection

pad_connection_interface_t wiiu_gca_pad_connection
Initial value:
= {
}
static void wiiu_gca_get_buttons(void *data, input_bits_t *state)
Definition: device_wiiu_gca.c:205
static void wiiu_gca_pad_deinit(void *data)
Definition: device_wiiu_gca.c:194
static void wiiu_gca_packet_handler(void *data, uint8_t *packet, uint16_t size)
Definition: device_wiiu_gca.c:292
static void * wiiu_gca_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
Definition: device_wiiu_gca.c:178
static const char * wiiu_gca_get_name(void *data)
Definition: device_wiiu_gca.c:328
static bool wiiu_gca_button(void *data, uint16_t joykey)
Definition: device_wiiu_gca.c:343
static void wiiu_gca_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
Definition: device_wiiu_gca.c:307
static int16_t wiiu_gca_get_axis(void *data, unsigned axis)
Definition: device_wiiu_gca.c:314