mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Support the ApplePlatform delegate for all iOS builds (the OpenGL one) so that the view initialization happens in the same way; remove the companion UI for iOS; four finger swipe down now shows RA menu on iOS
This commit is contained in:
parent
271ac7f925
commit
2187cf67c9
@ -34,9 +34,9 @@
|
||||
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#include "../ui/drivers/cocoa/cocoatouch_menu.m"
|
||||
#endif
|
||||
//#if TARGET_OS_IOS
|
||||
//#include "../ui/drivers/cocoa/cocoatouch_menu.m"
|
||||
//#endif
|
||||
#include "../ui/drivers/ui_cocoatouch.m"
|
||||
|
||||
#else
|
||||
|
@ -87,7 +87,7 @@
|
||||
696012F119F3389A006A1088 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
|
||||
69D31DE31A547EC800EF4C92 /* iOS/Resources/Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = iOS/Resources/Media.xcassets; sourceTree = SOURCE_ROOT; };
|
||||
83EB675F19EEAF050096F441 /* iOS/modules */ = {isa = PBXFileReference; lastKnownFileType = folder; path = iOS/modules; sourceTree = SOURCE_ROOT; };
|
||||
9204BE2B1D319EF300BD49DB /* RADEBUGL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RADEBUGL.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9204BE2B1D319EF300BD49DB /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9222F1FE2314BA7C0097C0FD /* assets.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = assets.zip; sourceTree = "<group>"; };
|
||||
9222F2082315DAD50097C0FD /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
|
||||
9222F20A2315DD3D0097C0FD /* retroarch_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = retroarch_logo.png; sourceTree = "<group>"; };
|
||||
@ -343,7 +343,7 @@
|
||||
96AFAE2616C1D4EA009DE44C /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9204BE2B1D319EF300BD49DB /* RADEBUGL.app */,
|
||||
9204BE2B1D319EF300BD49DB /* RetroArch.app */,
|
||||
926C77D721FD1E6500103EDE /* RetroArchTV.app */,
|
||||
);
|
||||
name = Products;
|
||||
@ -419,7 +419,7 @@
|
||||
);
|
||||
name = RetroArchiOS11;
|
||||
productName = RetroArch;
|
||||
productReference = 9204BE2B1D319EF300BD49DB /* RADEBUGL.app */;
|
||||
productReference = 9204BE2B1D319EF300BD49DB /* RetroArch.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
926C77D621FD1E6500103EDE /* RetroArchTV */ = {
|
||||
@ -696,8 +696,8 @@
|
||||
"-DHAVE_MFI",
|
||||
"-DHAVE_KEYMAPPER",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RADEBUG2;
|
||||
PRODUCT_NAME = RADEBUGL;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.ios.RetroArch;
|
||||
PRODUCT_NAME = RetroArch;
|
||||
PROVISIONING_PROFILE = "";
|
||||
VALID_ARCHS = "armv7 arm64";
|
||||
WARNING_CFLAGS = "-Wno-invalid-source-encoding";
|
||||
@ -799,8 +799,8 @@
|
||||
"-DHAVE_MFI",
|
||||
"-DHAVE_KEYMAPPER",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RADEBUG2;
|
||||
PRODUCT_NAME = RADEBUGL;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.ios.RetroArch;
|
||||
PRODUCT_NAME = RetroArch;
|
||||
PROVISIONING_PROFILE = "";
|
||||
VALID_ARCHS = "armv7 arm64";
|
||||
WARNING_CFLAGS = "-Wno-invalid-source-encoding";
|
||||
|
@ -1007,9 +1007,6 @@ static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
#endif
|
||||
#if TARGET_OS_OSX
|
||||
&ui_companion_cocoa,
|
||||
#endif
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
&ui_companion_cocoatouch,
|
||||
#endif
|
||||
&ui_companion_null,
|
||||
NULL
|
||||
|
@ -1,9 +1,12 @@
|
||||
#ifndef COCOA_APPLE_PLATFORM_H
|
||||
#define COCOA_APPLE_PLATFORM_H
|
||||
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
|
||||
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
#import <Metal/Metal.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH)
|
||||
@interface WindowListener : NSResponder<NSWindowDelegate>
|
||||
@ -52,16 +55,11 @@ extern id<ApplePlatform> apple_platform;
|
||||
id<ApplePlatform> apple_platform;
|
||||
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
@interface RetroArch_iOS : UINavigationController<ApplePlatform, UIApplicationDelegate,
|
||||
UINavigationControllerDelegate> {
|
||||
UIView *_renderView;
|
||||
apple_view_type_t _vt;
|
||||
}
|
||||
#else
|
||||
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate,
|
||||
UINavigationControllerDelegate>
|
||||
#endif
|
||||
|
||||
@property (nonatomic) UIWindow* window;
|
||||
@property (nonatomic) NSString* documentsDirectory;
|
||||
@ -101,7 +99,7 @@ id apple_platform;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
@property(nonatomic, retain) NSWindow IBOutlet *window;
|
||||
|
||||
@end
|
||||
|
@ -82,26 +82,6 @@ typedef enum apple_view_type {
|
||||
+ (CocoaView*)get;
|
||||
@end
|
||||
|
||||
#if !defined(HAVE_COCOA_METAL)
|
||||
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate,
|
||||
UINavigationControllerDelegate>
|
||||
@property (nonatomic) UIWindow* window;
|
||||
@property (nonatomic) NSString* documentsDirectory;
|
||||
@property (nonatomic) RAMenuBase* mainmenu;
|
||||
@property (nonatomic) int menu_count;
|
||||
|
||||
+ (RetroArch_iOS*)get;
|
||||
|
||||
- (void)showGameView;
|
||||
- (void)toggleUI;
|
||||
- (void)supportOtherAudioSessions;
|
||||
|
||||
- (void)refreshSystemConfig;
|
||||
- (void)mainMenuPushPop: (bool)pushp;
|
||||
- (void)mainMenuRefresh;
|
||||
@end
|
||||
#endif
|
||||
|
||||
void get_ios_version(int *major, int *minor);
|
||||
|
||||
#endif
|
||||
|
@ -29,10 +29,8 @@
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
#import "GCDWebUploader.h"
|
||||
#import "WebServer.h"
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
#include "apple_platform.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -176,9 +174,7 @@ void *glkitview_init(void);
|
||||
#elif TARGET_OS_IOS
|
||||
-(void) showNativeMenu {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// disabling this for now - the UIKit menu is becoming less useful
|
||||
// TODO: maybe show the RA menu instead
|
||||
// [[RetroArch_iOS get] toggleUI];
|
||||
command_event(CMD_EVENT_MENU_TOGGLE, NULL);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
|
||||
id<ApplePlatform> apple_platform;
|
||||
#else
|
||||
static id apple_platform;
|
||||
@ -138,7 +138,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
}
|
||||
|
||||
#ifndef HAVE_APPLE_STORE
|
||||
// iO7 Keyboard support
|
||||
// iOS7 Keyboard support
|
||||
@interface UIEvent(iOS7Keyboard)
|
||||
@property(readonly, nonatomic) long long _keyCode;
|
||||
@property(readonly, nonatomic) _Bool _isKeyDown;
|
||||
@ -318,7 +318,6 @@ enum
|
||||
@implementation RetroArch_iOS
|
||||
|
||||
#pragma mark - ApplePlatform
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
-(id)renderView {
|
||||
return _renderView;
|
||||
}
|
||||
@ -339,6 +338,7 @@ enum
|
||||
}
|
||||
|
||||
switch (vt) {
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
case APPLE_VIEW_TYPE_VULKAN:
|
||||
case APPLE_VIEW_TYPE_METAL:
|
||||
{
|
||||
@ -351,7 +351,7 @@ enum
|
||||
_renderView = v;
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
case APPLE_VIEW_TYPE_OPENGL_ES:
|
||||
{
|
||||
_renderView = (BRIDGE GLKView*)glkitview_init();
|
||||
@ -377,6 +377,7 @@ enum
|
||||
}
|
||||
|
||||
- (void)setVideoMode:(gfx_ctx_mode_t)mode {
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
MetalView *metalView = (MetalView*) _renderView;
|
||||
CGFloat scale = [[UIScreen mainScreen] scale];
|
||||
[metalView setDrawableSize:CGSizeMake(
|
||||
@ -384,6 +385,7 @@ enum
|
||||
_renderView.bounds.size.height * scale
|
||||
)
|
||||
];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)setCursorVisible:(bool)v {
|
||||
@ -394,7 +396,6 @@ enum
|
||||
// no-op for iOS
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (RetroArch_iOS*)get
|
||||
{
|
||||
@ -428,12 +429,6 @@ enum
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
self.mainmenu = [RAMainMenu new];
|
||||
self.mainmenu.last_menu = self.mainmenu;
|
||||
[self pushViewController:self.mainmenu animated:NO];
|
||||
#endif
|
||||
|
||||
NSError *error;
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error];
|
||||
if (error) {
|
||||
@ -556,50 +551,10 @@ enum
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)mainMenuRefresh
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
[self.mainmenu reloadData];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)mainMenuPushPop: (bool)pushp
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
if (pushp)
|
||||
{
|
||||
self.menu_count++;
|
||||
RAMenuBase* next_menu = [RAMainMenu new];
|
||||
next_menu.last_menu = self.mainmenu;
|
||||
self.mainmenu = next_menu;
|
||||
[self pushViewController:self.mainmenu animated:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self.menu_count == 0)
|
||||
[self.mainmenu reloadData];
|
||||
else
|
||||
{
|
||||
self.menu_count--;
|
||||
|
||||
[self popViewControllerAnimated:YES];
|
||||
self.mainmenu = self.mainmenu.last_menu;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)supportOtherAudioSessions
|
||||
{
|
||||
}
|
||||
|
||||
- (void)mainMenuRenderMessageBox:(NSString *)msg
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
[self.mainmenu renderMessageBox:msg];
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -617,132 +572,3 @@ static void apple_rarch_exited(void)
|
||||
return;
|
||||
[ap showPauseMenu:ap];
|
||||
}
|
||||
|
||||
typedef struct ui_companion_cocoatouch
|
||||
{
|
||||
void *empty;
|
||||
} ui_companion_cocoatouch_t;
|
||||
|
||||
static void ui_companion_cocoatouch_notify_content_loaded(void *data)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (ap)
|
||||
[ap showGameView];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_toggle(void *data, bool force)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (ap)
|
||||
[ap toggleUI];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_deinit(void *data)
|
||||
{
|
||||
ui_companion_cocoatouch_t *handle = (ui_companion_cocoatouch_t*)data;
|
||||
|
||||
apple_rarch_exited();
|
||||
|
||||
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;
|
||||
|
||||
rarch_enable_ui();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_notify_list_pushed(void *data,
|
||||
file_list_t *list, file_list_t *menu_list)
|
||||
{
|
||||
static size_t old_size = 0;
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
bool pushp = false;
|
||||
size_t new_size = file_list_get_size(menu_list);
|
||||
|
||||
/* FIXME workaround for the double call */
|
||||
if (old_size == 0)
|
||||
{
|
||||
old_size = new_size;
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_size == new_size)
|
||||
pushp = false;
|
||||
else if (old_size < new_size)
|
||||
pushp = true;
|
||||
else if (old_size > new_size)
|
||||
printf("notify_list_pushed: old size should not be larger\n" );
|
||||
|
||||
old_size = new_size;
|
||||
|
||||
if (ap)
|
||||
[ap mainMenuPushPop: pushp];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_notify_refresh(void *data)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
if (ap)
|
||||
[ap mainMenuRefresh];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_render_messagebox(const char *msg)
|
||||
{
|
||||
static char msg_old[PATH_MAX_LENGTH];
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
if (ap && !string_is_equal(msg, msg_old))
|
||||
{
|
||||
[ap mainMenuRenderMessageBox: [NSString stringWithUTF8String:msg]];
|
||||
strlcpy(msg_old, msg, sizeof(msg_old));
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_msg_queue_push(void *data, const char *msg,
|
||||
unsigned priority, unsigned duration, bool flush)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
if (ap && msg)
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
[ap.mainmenu msgQueuePush: [NSString stringWithUTF8String:msg]];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
ui_companion_driver_t ui_companion_cocoatouch = {
|
||||
ui_companion_cocoatouch_init,
|
||||
ui_companion_cocoatouch_deinit,
|
||||
ui_companion_cocoatouch_toggle,
|
||||
ui_companion_cocoatouch_event_command,
|
||||
ui_companion_cocoatouch_notify_content_loaded,
|
||||
ui_companion_cocoatouch_notify_list_pushed,
|
||||
ui_companion_cocoatouch_notify_refresh,
|
||||
ui_companion_cocoatouch_msg_queue_push,
|
||||
ui_companion_cocoatouch_render_messagebox,
|
||||
NULL, /* get_main_window */
|
||||
NULL, /* log_msg */
|
||||
NULL, /* is_active */
|
||||
NULL, /* ui_browser_window_null */
|
||||
NULL, /* ui_msg_window_null */
|
||||
NULL, /* ui_window_null */
|
||||
NULL, /* ui_application_null */
|
||||
"cocoatouch",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user