118 lines
2.9 KiB
C
Raw Normal View History

2014-11-04 22:01:01 -05:00
/* RetroArch - A frontend for libretro.
2015-01-07 17:46:50 +01:00
* Copyright (C) 2014-2015 - Jay McCarthy
2014-11-04 22:01:01 -05: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/>.
*/
2015-01-26 10:54:13 +01:00
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
2014-11-04 22:01:01 -05:00
#include <stdlib.h>
#include <stdio.h>
#include "../menu_driver.h"
2015-01-10 04:53:37 +01:00
#include "../menu.h"
2014-11-04 22:01:01 -05:00
#include "../../general.h"
#include "ios.h"
2015-01-26 10:54:13 +01:00
#include "../menu_input.h"
2015-01-26 11:17:38 +01:00
#if 1
2015-01-26 10:54:13 +01:00
static int ios_entry_iterate(unsigned action)
{
ios_handle_t *ios = NULL;
if (!driver.menu)
return 0;
ios = (ios_handle_t*)driver.menu->userdata;
if (ios->switch_to_ios)
ios->switch_to_ios();
return 0;
}
#else
static int ios_entry_iterate(unsigned action)
{
const char *label = NULL;
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
driver.menu->selection_ptr);
menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
driver.menu_ctx->set_texture(driver.menu);
if (cbs && cbs->action_iterate)
return cbs->action_iterate(label, action);
return -1;
}
#endif
2014-11-04 22:01:01 -05:00
2014-11-09 14:43:10 +01:00
static void *ios_init(void)
{
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
2015-02-02 19:03:56 +01:00
goto error;
2014-11-04 22:01:01 -05:00
2014-11-09 14:43:10 +01:00
menu->userdata = (ios_handle_t*)calloc(1, sizeof(ios_handle_t));
if (!menu->userdata)
2015-02-02 19:03:56 +01:00
goto error;
2014-11-04 22:01:01 -05:00
2014-11-09 14:43:10 +01:00
return menu;
2015-02-02 19:03:56 +01:00
error:
if (menu->userdata)
free(menu->userdata);
if (menu)
free(menu);
return NULL;
2014-11-04 22:01:01 -05:00
}
2014-11-09 14:43:10 +01:00
static void ios_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
return;
2014-11-04 22:01:01 -05:00
2014-11-09 14:43:10 +01:00
if (menu->userdata)
free(menu->userdata);
2014-11-04 22:01:01 -05:00
2014-11-09 14:43:10 +01:00
free(menu);
2014-11-04 22:01:01 -05:00
}
menu_ctx_driver_t menu_ctx_ios = {
NULL, // set_texture
NULL, // render_messagebox
NULL, // render
2014-11-04 22:01:01 -05:00
NULL, // frame
ios_init, // init
ios_free, // free
NULL, // context_reset
NULL, // context_destroy
NULL, // populate_entries
NULL, // toggle
2014-11-04 22:01:01 -05:00
NULL, // navigation_clear
NULL, // navigation_decrement
NULL, // navigation_increment
NULL, // navigation_set
NULL, // navigation_set_last
NULL, // navigation_descend_alphabet
NULL, // navigation_ascend_alphabet
NULL, // list_insert
NULL, // list_delete
NULL, // list_clear
2014-12-01 10:09:29 -05:00
NULL, // list_cache
2014-11-04 22:01:01 -05:00
NULL, // list_set_selection
2015-01-26 10:54:13 +01:00
ios_entry_iterate,
2014-11-04 22:01:01 -05:00
"ios",
};