(Apple) Generalize the ios_joypad driver

This commit is contained in:
meancoot 2013-07-08 15:14:36 -04:00
parent 261df7061e
commit b3c36b54d7
4 changed files with 33 additions and 33 deletions

View File

@ -22,12 +22,8 @@
#include "general.h"
#include "driver.h"
#ifdef IOS
extern const rarch_joypad_driver_t ios_joypad;
static const rarch_joypad_driver_t* const g_joydriver = &ios_joypad;
#else
static const rarch_joypad_driver_t* const g_joydriver = 0;
#endif
extern const rarch_joypad_driver_t apple_joypad;
static const rarch_joypad_driver_t* const g_joydriver = &apple_joypad;
apple_input_data_t g_current_input_data;
apple_input_data_t g_polled_input_data;

View File

@ -14,25 +14,33 @@
*/
#include "input/input_common.h"
#include "../../RetroArch/apple_input.h"
#include "BTStack/btpad.h"
#include "general.h"
static bool ios_joypad_init(void)
#ifdef IOS
#include "../iOS/input/BTStack/btdynamic.c"
#include "../iOS/input/BTStack/wiimote.c"
#include "../iOS/input/BTStack/btpad.c"
#include "../iOS/input/BTStack/btpad_ps3.c"
#include "../iOS/input/BTStack/btpad_wii.c"
#include "../iOS/input/BTStack/btpad_queue.c"
#endif
static bool apple_joypad_init(void)
{
return true;
}
static bool ios_joypad_query_pad(unsigned pad)
static bool apple_joypad_query_pad(unsigned pad)
{
return pad < MAX_PLAYERS;
}
static void ios_joypad_destroy(void)
static void apple_joypad_destroy(void)
{
}
static bool ios_joypad_button(unsigned port, uint16_t joykey)
static bool apple_joypad_button(unsigned port, uint16_t joykey)
{
if (joykey == NO_BTN)
return false;
@ -44,7 +52,7 @@ static bool ios_joypad_button(unsigned port, uint16_t joykey)
return (port < MAX_PADS && joykey < 32) ? (g_polled_input_data.pad_buttons[port] & (1 << joykey)) != 0 : false;
}
static int16_t ios_joypad_axis(unsigned port, uint32_t joyaxis)
static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis)
{
if (joyaxis == AXIS_NONE || port != 0)
return 0;
@ -64,24 +72,24 @@ static int16_t ios_joypad_axis(unsigned port, uint32_t joyaxis)
return val;
}
static void ios_joypad_poll(void)
static void apple_joypad_poll(void)
{
}
static const char *ios_joypad_name(unsigned joypad)
static const char *apple_joypad_name(unsigned joypad)
{
(void)joypad;
return NULL;
}
const rarch_joypad_driver_t ios_joypad = {
ios_joypad_init,
ios_joypad_query_pad,
ios_joypad_destroy,
ios_joypad_button,
ios_joypad_axis,
ios_joypad_poll,
ios_joypad_name,
"ios",
const rarch_joypad_driver_t apple_joypad = {
apple_joypad_init,
apple_joypad_query_pad,
apple_joypad_destroy,
apple_joypad_button,
apple_joypad_axis,
apple_joypad_poll,
apple_joypad_name,
"apple"
};

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
962EE0E2178B3DF6004224FF /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 962EE0E1178B3DF6004224FF /* IOKit.framework */; };
96355CE31788E72A0010DBFA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96355CE21788E72A0010DBFA /* Cocoa.framework */; };
967894931788ECDB00D6CA69 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9678948F1788ECDB00D6CA69 /* InfoPlist.strings */; };
967894941788ECDB00D6CA69 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 967894911788ECDB00D6CA69 /* MainMenu.xib */; };
@ -23,6 +24,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
962EE0E1178B3DF6004224FF /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = ../../../../../../../System/Library/Frameworks/IOKit.framework; sourceTree = "<group>"; };
96355CDF1788E72A0010DBFA /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; };
96355CE21788E72A0010DBFA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
96355CE51788E72A0010DBFA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@ -51,6 +53,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
962EE0E2178B3DF6004224FF /* IOKit.framework in Frameworks */,
967894A91788F0E500D6CA69 /* AudioUnit.framework in Frameworks */,
967894A71788F0D900D6CA69 /* OpenGL.framework in Frameworks */,
967894A41788F0C200D6CA69 /* CoreAudio.framework in Frameworks */,
@ -65,6 +68,7 @@
96355CD41788E6E00010DBFA = {
isa = PBXGroup;
children = (
962EE0E1178B3DF6004224FF /* IOKit.framework */,
96355CE81788E72A0010DBFA /* RetroArch */,
967894E7178A2E9B00D6CA69 /* Assets */,
96355CE11788E72A0010DBFA /* Frameworks */,

View File

@ -285,15 +285,7 @@ INPUT
#include "../android/native/jni/input_android.c"
#elif defined(IOS) || defined(OSX)
#include "../apple/RetroArch/apple_input.c"
#ifdef IOS
#include "../apple/iOS/input/ios_joypad.c"
#include "../apple/iOS/input/BTStack/btdynamic.c"
#include "../apple/iOS/input/BTStack/wiimote.c"
#include "../apple/iOS/input/BTStack/btpad.c"
#include "../apple/iOS/input/BTStack/btpad_ps3.c"
#include "../apple/iOS/input/BTStack/btpad_wii.c"
#include "../apple/iOS/input/BTStack/btpad_queue.c"
#endif
#include "../apple/RetroArch/apple_joypad.c"
#elif defined(__BLACKBERRY_QNX__)
#include "../blackberry-qnx/qnx_input.c"
#endif