2013-03-03 23:50:38 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-04-26 15:39:46 +00:00
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2013-2014 - Jason Fetters
|
2013-03-03 23:50:38 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-07-07 20:01:58 +00:00
|
|
|
#ifndef __APPLE_RARCH_INPUT_H__
|
|
|
|
#define __APPLE_RARCH_INPUT_H__
|
2013-03-20 01:36:34 +00:00
|
|
|
|
2014-04-26 15:39:46 +00:00
|
|
|
#include "../general.h"
|
2013-10-03 21:43:41 +00:00
|
|
|
|
2013-03-03 23:50:38 +00:00
|
|
|
// Input responder
|
|
|
|
#define MAX_TOUCHES 16
|
|
|
|
#define MAX_KEYS 256
|
|
|
|
|
2013-04-04 17:06:32 +00:00
|
|
|
typedef struct
|
2013-03-03 23:50:38 +00:00
|
|
|
{
|
|
|
|
int16_t screen_x, screen_y;
|
|
|
|
int16_t fixed_x, fixed_y;
|
|
|
|
int16_t full_x, full_y;
|
2013-07-07 20:01:58 +00:00
|
|
|
} apple_touch_data_t;
|
2013-03-03 23:50:38 +00:00
|
|
|
|
2013-04-04 17:06:32 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2013-07-07 20:01:58 +00:00
|
|
|
apple_touch_data_t touches[MAX_TOUCHES];
|
2013-04-04 17:06:32 +00:00
|
|
|
uint32_t touch_count;
|
|
|
|
|
2013-08-11 04:20:15 +00:00
|
|
|
uint32_t mouse_buttons;
|
|
|
|
int16_t mouse_delta[2];
|
|
|
|
|
2013-04-04 17:06:32 +00:00
|
|
|
uint32_t keys[MAX_KEYS];
|
|
|
|
|
2013-10-03 21:43:41 +00:00
|
|
|
uint32_t pad_buttons[MAX_PLAYERS];
|
|
|
|
int16_t pad_axis[MAX_PLAYERS][4];
|
2013-07-07 20:01:58 +00:00
|
|
|
} apple_input_data_t;
|
2013-04-04 17:06:32 +00:00
|
|
|
|
2013-10-03 21:43:41 +00:00
|
|
|
struct apple_pad_connection;
|
|
|
|
struct apple_pad_interface
|
|
|
|
{
|
|
|
|
void* (*connect)(struct apple_pad_connection* connection, uint32_t slot);
|
|
|
|
void (*disconnect)(void* device);
|
|
|
|
void (*packet_handler)(void* device, uint8_t *packet, uint16_t size);
|
2013-10-03 22:04:28 +00:00
|
|
|
void (*set_rumble)(void* device, enum retro_rumble_effect effect, uint16_t strength);
|
2013-10-03 21:43:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Joypad data
|
|
|
|
int32_t apple_joypad_connect(const char* name, struct apple_pad_connection* connection);
|
2014-04-26 15:39:46 +00:00
|
|
|
int32_t apple_joypad_connect_gcapi(void);
|
2013-10-03 21:43:41 +00:00
|
|
|
void apple_joypad_disconnect(uint32_t slot);
|
|
|
|
void apple_joypad_packet(uint32_t slot, uint8_t* data, uint32_t length);
|
|
|
|
|
2013-12-10 21:22:26 +00:00
|
|
|
// Determine if connected joypad is a hidpad backed device; if false apple_joypad_packet cannot be used
|
|
|
|
bool apple_joypad_has_interface(uint32_t slot);
|
|
|
|
|
2013-10-03 21:43:41 +00:00
|
|
|
// This is implemented in the platform specific portions of the input code
|
|
|
|
void apple_joypad_send_hid_control(struct apple_pad_connection* connection, uint8_t* data, size_t size);
|
|
|
|
|
|
|
|
// Input data for the main thread and the game thread
|
2013-10-03 22:04:28 +00:00
|
|
|
extern apple_input_data_t g_current_input_data;
|
2013-04-04 17:06:32 +00:00
|
|
|
|
2013-06-22 17:09:38 +00:00
|
|
|
// Main thread only
|
2013-07-07 20:01:58 +00:00
|
|
|
void apple_input_enable_icade(bool on);
|
2014-01-16 03:14:58 +00:00
|
|
|
void apple_input_enable_small_keyboard(bool on);
|
2013-11-22 14:30:02 +00:00
|
|
|
uint32_t apple_input_get_icade_buttons(void);
|
|
|
|
void apple_input_reset_icade_buttons(void);
|
2014-01-09 23:16:20 +00:00
|
|
|
void apple_input_keyboard_event(bool down, unsigned code, uint32_t character, uint32_t mod);
|
2013-03-20 01:36:34 +00:00
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
extern int32_t apple_input_find_any_key(void);
|
2013-09-09 21:52:02 +00:00
|
|
|
extern int32_t apple_input_find_any_button(uint32_t port);
|
|
|
|
extern int32_t apple_input_find_any_axis(uint32_t port);
|
|
|
|
|
2013-03-30 00:00:42 +00:00
|
|
|
#endif
|