Revert "Refactor small keyboard/icade code a bit"
This reverts commit 340c15c517
.
This commit is contained in:
parent
d4a9221deb
commit
fde9676ac3
|
@ -126,6 +126,26 @@ const struct apple_key_name_map_entry apple_key_name_map[] =
|
|||
};
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
void cocoa_input_enable_small_keyboard(bool on)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
if (apple)
|
||||
apple->small_keyboard_enabled = on;
|
||||
}
|
||||
|
||||
void cocoa_input_enable_icade(bool on)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
|
||||
if (!apple)
|
||||
return;
|
||||
|
||||
apple->icade_enabled = on;
|
||||
apple->icade_buttons = 0;
|
||||
}
|
||||
|
||||
void cocoa_input_reset_icade_buttons(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
@ -158,10 +178,9 @@ int32_t cocoa_input_find_any_key(void)
|
|||
static int cocoa_input_find_any_button_ret(cocoa_input_data_t *apple,
|
||||
unsigned buttons, unsigned port)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned i;
|
||||
#if TARGET_OS_IPHONE
|
||||
if (port == 0 && settings->input.icade_enable)
|
||||
if (port == 0 && apple->icade_enabled)
|
||||
BIT32_SET(buttons, apple->icade_buttons);
|
||||
#endif
|
||||
|
||||
|
@ -248,7 +267,6 @@ static void *cocoa_input_init(void)
|
|||
static void cocoa_input_poll(void *data)
|
||||
{
|
||||
uint32_t i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
|
||||
for (i = 0; i < apple->touch_count; i++)
|
||||
|
@ -264,7 +282,7 @@ static void cocoa_input_poll(void *data)
|
|||
apple->joypad->poll();
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (settings->input.icade_enable)
|
||||
if (apple->icade_enabled)
|
||||
BIT32_SET(apple->buttons[0], apple->icade_buttons);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -60,6 +60,9 @@ typedef struct
|
|||
|
||||
#if TARGET_OS_IPHONE
|
||||
uint32_t mfi_buttons[MAX_USERS];
|
||||
|
||||
bool icade_enabled;
|
||||
bool small_keyboard_enabled;
|
||||
bool small_keyboard_active;
|
||||
uint32_t icade_buttons;
|
||||
#endif
|
||||
|
@ -68,6 +71,10 @@ typedef struct
|
|||
} cocoa_input_data_t;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
void cocoa_input_enable_icade(bool on);
|
||||
|
||||
void cocoa_input_enable_small_keyboard(bool on);
|
||||
|
||||
void cocoa_input_reset_icade_buttons(void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ void cocoa_input_keyboard_event(bool down,
|
|||
unsigned code, uint32_t character, uint32_t mod, unsigned device)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
|
||||
if (!apple)
|
||||
|
@ -151,16 +150,14 @@ void cocoa_input_keyboard_event(bool down,
|
|||
code = HIDKEY(code);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (settings->input.icade_enable)
|
||||
if (apple->icade_enabled)
|
||||
{
|
||||
handle_icade_event(code);
|
||||
return;
|
||||
}
|
||||
else if (settings->input.small_keyboard_enable)
|
||||
{
|
||||
if (handle_small_keyboard(&code, down))
|
||||
character = 0;
|
||||
}
|
||||
else if (apple->small_keyboard_enabled &&
|
||||
handle_small_keyboard(&code, down))
|
||||
character = 0;
|
||||
#endif
|
||||
|
||||
if (code == 0 || code >= MAX_KEYS)
|
||||
|
|
|
@ -390,6 +390,7 @@ enum
|
|||
|
||||
- (void)refreshSystemConfig
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool is_btstack;
|
||||
|
||||
/* Get enabled orientations */
|
||||
|
@ -403,6 +404,8 @@ enum
|
|||
/* Set bluetooth mode */
|
||||
is_btstack = !(strcmp(apple_frontend_settings.bluetooth_mode, "btstack"));
|
||||
|
||||
cocoa_input_enable_small_keyboard(settings->input.small_keyboard_enable);
|
||||
cocoa_input_enable_icade(settings->input.icade_enable);
|
||||
btstack_set_poweron(is_btstack);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue