(GX) Make input driver more generic

This commit is contained in:
twinaphex 2014-06-04 06:22:29 +02:00
parent 3abff4c01f
commit 7a7fffc7d8
2 changed files with 15 additions and 7 deletions

View File

@ -16,10 +16,12 @@
*/ */
#include <stdint.h> #include <stdint.h>
#ifdef HW_RVL
#include <gccore.h> #include <gccore.h>
#include <ogc/pad.h> #include <ogc/pad.h>
#ifdef HW_RVL
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#else
#include <cafe/pads/wpad/wpad.h>
#endif #endif
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -32,6 +34,12 @@
#include "../libretro.h" #include "../libretro.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef GEKKO
#define WPADInit WPAD_Init
#define WPADDisconnect WPAD_Disconnect
#define WPADProbe WPAD_Probe
#endif
enum enum
{ {
GX_GC_A = 0, GX_GC_A = 0,
@ -379,7 +387,7 @@ static void gx_input_free_input(void *data)
#ifdef HW_RVL #ifdef HW_RVL
WPAD_Flush(i); WPAD_Flush(i);
WPAD_Disconnect(i); WPADDisconnect(i);
#endif #endif
} }
@ -716,7 +724,7 @@ static void *gx_input_init(void)
USB_Initialize(); USB_Initialize();
#endif #endif
#ifdef HW_RVL #ifdef HW_RVL
WPAD_Init(); WPADInit();
#endif #endif
SYS_SetResetCallback(reset_cb); SYS_SetResetCallback(reset_cb);
#ifdef HW_RVL #ifdef HW_RVL
@ -794,7 +802,7 @@ static void gx_input_poll(void *data)
#ifdef HW_RVL #ifdef HW_RVL
uint32_t ptype = 0; uint32_t ptype = 0;
uint32_t connected = WPAD_Probe(port, &ptype); uint32_t connected = WPADProbe(port, &ptype);
#ifdef HAVE_LIBSICKSAXIS #ifdef HAVE_LIBSICKSAXIS
USB_DeviceChangeNotifyAsync(USB_CLASS_HID, change_cb, (void*)&lol); USB_DeviceChangeNotifyAsync(USB_CLASS_HID, change_cb, (void*)&lol);

View File

@ -68,7 +68,7 @@ static u32 __lwp_heap_block_size(heap_cntrl *theheap, void *ptr)
static heap_cntrl gx_mem2_heap; static heap_cntrl gx_mem2_heap;
bool gx_init_mem2() bool gx_init_mem2(void)
{ {
u32 level; u32 level;
_CPU_ISR_Disable(level); _CPU_ISR_Disable(level);
@ -185,14 +185,14 @@ char *_mem2_strndup(const char *s, size_t n)
return ptr; return ptr;
} }
u32 gx_mem2_used() u32 gx_mem2_used(void)
{ {
heap_iblock info; heap_iblock info;
__lwp_heap_getinfo(&gx_mem2_heap, &info); __lwp_heap_getinfo(&gx_mem2_heap, &info);
return info.used_size; return info.used_size;
} }
u32 gx_mem2_total() u32 gx_mem2_total(void)
{ {
heap_iblock info; heap_iblock info;
__lwp_heap_getinfo(&gx_mem2_heap, &info); __lwp_heap_getinfo(&gx_mem2_heap, &info);