From bf084eb14aeaceaa181a5e04aab57a195c190456 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 12 Apr 2015 03:02:48 +0200 Subject: [PATCH] (iOS) Create ui_cocoatouch.m --- griffin/griffin_objc.m | 1 + ui/drivers/ui_cocoatouch.m | 87 ++++++++++++++++++++++++++++++++++++++ ui/drivers/ui_null.c | 2 +- ui/ui_companion_driver.h | 1 + 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 ui/drivers/ui_cocoatouch.m diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index a2f633e7b1..1dca7d2a87 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -14,6 +14,7 @@ #include "../apple/iOS/platform.m" #include "../apple/iOS/menu.m" #include "../apple/iOS/browser.m" +//#include "../ui/drivers/ui_cocoatouch.m" #else #include "../apple/OSX/platform.m" #include "../apple/OSX/settings.m" diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m new file mode 100644 index 0000000000..1b20a3cd84 --- /dev/null +++ b/ui/drivers/ui_cocoatouch.m @@ -0,0 +1,87 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2015 - Ali Bouhlel + * + * 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 . + */ + +#include "../../apple/common/RetroArch_Apple.h" +#include +#include +#include +#include +#include + +#include +#include "../ui_companion_driver.h" + +typedef struct ui_companion_cocoatouch +{ + void *empty; +} ui_companion_cocoatouch_t; + +void switch_to_ios(void) +{ + RetroArch_iOS *ap; + runloop_t *runloop = rarch_main_get_ptr(); + + if (!apple_platform) + return; + + ap = (RetroArch_iOS *)apple_platform; + runloop->is_idle = true; + [ap showPauseMenu:ap]; +} + +void notify_content_loaded(void) +{ + if (!apple_platform) + return; + + RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform; + [ap showGameView]; +} + +static int ui_companion_cocoatouch_entry_iterate(void *data, unsigned action) +{ + (void)data; + + switch_to_ios(); + + return 0; +} + +static void ui_companion_cocoatouch_deinit(void *data) +{ + ui_companion_cocoatouch_t *handle = (ui_companion_cocoatouch_t*)data; + + if (handle) + free(handle); +} + +static void *ui_companion_cocoatouch_init(void) +{ + ui_companion_cocoatouch_t *handle = (ui_companion_cocoatouch_t*)calloc(1, sizeof(*handle)); + + if (!handle) + return NULL; + + return handle; +} + +const ui_companion_driver_t ui_companion_cocoatouch = { + ui_companion_cocoatouch_init, + ui_companion_cocoatouch_deinit, + ui_companion_cocoatouch_iterate, + NULL, + NULL, + "null", +}; diff --git a/ui/drivers/ui_null.c b/ui/drivers/ui_null.c index ca18d01287..800d1b576e 100644 --- a/ui/drivers/ui_null.c +++ b/ui/drivers/ui_null.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2015 - Ali Bouhlel + * Copyright (C) 2011-2015 - Daniel De Matteis * * 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- diff --git a/ui/ui_companion_driver.h b/ui/ui_companion_driver.h index 8ed556c7b3..21212004a6 100644 --- a/ui/ui_companion_driver.h +++ b/ui/ui_companion_driver.h @@ -40,6 +40,7 @@ typedef struct ui_companion_driver } ui_companion_driver_t; extern const ui_companion_driver_t ui_companion_null; +extern const ui_companion_driver_t ui_companion_cocoatouch; /** * ui_companion_find_driver: