(PS3) refactored input

This commit is contained in:
Twinaphex 2012-07-01 22:14:09 +02:00
parent 277e1f61cd
commit 4848403161
3 changed files with 14 additions and 25 deletions

View File

@ -50,7 +50,7 @@ typedef struct CtrlFreeArg
uint32_t freeCallCounts;
} CtrlFreeArg;
void *img_malloc(uint32_t size, void * a)
void *img_malloc(uint32_t size, void *a)
{
#ifndef __PSL1GHT__
CtrlMallocArg *arg;
@ -61,7 +61,7 @@ void *img_malloc(uint32_t size, void * a)
return malloc(size);
}
static int img_free(void *ptr, void * a)
static int img_free(void *ptr, void *a)
{
#ifndef __PSL1GHT__
CtrlFreeArg *arg;
@ -77,7 +77,7 @@ static int img_free(void *ptr, void * a)
Image decompression - libJPEG
********************************************************************************/
static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_img)
static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_img)
{
#ifndef __PSL1GHT__
CtrlMallocArg MallocArg;
@ -185,7 +185,7 @@ error:
Image decompression - libPNG
********************************************************************************/
static bool ps3graphics_load_png(const char * path, struct texture_image *out_img)
static bool ps3graphics_load_png(const char *path, struct texture_image *out_img)
{
#ifndef __PSL1GHT__
CtrlMallocArg MallocArg;

View File

@ -103,13 +103,6 @@ static unsigned pads_connected;
static unsigned mice_connected;
#endif
uint32_t cell_pad_input_pads_connected(void)
{
pPadInfo pad_info;
pPadGetInfo(&pad_info);
return pad_info.now_connect;
}
uint64_t cell_pad_input_poll_device(uint32_t id)
{
pPadData pad_data;
@ -118,9 +111,7 @@ uint64_t cell_pad_input_poll_device(uint32_t id)
// Get new pad data
pPadGetData(id, &pad_data);
if (pad_data.len == 0)
return ret[id];
else
if (pad_data.len != 0)
{
ret[id] = 0;
@ -141,18 +132,20 @@ uint64_t cell_pad_input_poll_device(uint32_t id)
ret[id] |= (uint64_t)(PRESSED_RIGHT_RSTICK(ret[id])) << RSTICK_RIGHT_SHIFT;
ret[id] |= (uint64_t)(PRESSED_UP_RSTICK(ret[id])) << RSTICK_UP_SHIFT;
ret[id] |= (uint64_t)(PRESSED_DOWN_RSTICK(ret[id])) << RSTICK_DOWN_SHIFT;
return ret[id];
}
return ret[id];
}
static void ps3_input_poll(void *data)
{
pPadInfo pad_info;
(void)data;
for (unsigned i = 0; i < MAX_PADS; i++)
{
state[i] = cell_pad_input_poll_device(i);
}
pads_connected = cell_pad_input_pads_connected();
for (unsigned i = 0; i < MAX_PADS; i++)
state[i] = cell_pad_input_poll_device(i);
pPadGetInfo(&pad_info);
pads_connected = pad_info.now_connect;
#ifdef HAVE_MOUSE
mice_connected = ps3_mouse_input_mice_connected();
#endif

View File

@ -133,11 +133,7 @@
#define OSK_IS_RUNNING(object) object.is_running
#define OUTPUT_TEXT_STRING(object) object.osk_text_buffer_char
typedef uint64_t cell_input_state_t;
uint32_t cell_pad_input_pads_connected(void);
cell_input_state_t cell_pad_input_poll_device(uint32_t id);
uint64_t cell_pad_input_poll_device(uint32_t id);
void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);