From ef8d1ad4060976abd838d627ff7079ec2f0f14f0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 9 Feb 2019 04:21:01 +0100 Subject: [PATCH] (Cocoa) Create common shared header file --- ui/drivers/cocoa/cocoa_common.h | 40 +------------- ui/drivers/cocoa/cocoa_common_metal.h | 54 +------------------ ui/drivers/cocoa/cocoa_common_shared.h | 74 ++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 91 deletions(-) create mode 100644 ui/drivers/cocoa/cocoa_common_shared.h diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index c3cfd63a3f..74289c5fff 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -31,29 +31,7 @@ #import #endif -/*********************************************/ -/* RAMenuBase */ -/* A menu class that displays RAMenuItemBase */ -/* objects. */ -/*********************************************/ -@interface RAMenuBase : UITableViewController -@property (nonatomic) NSMutableArray* sections; -@property (nonatomic) BOOL hidesHeaders; -@property (nonatomic) RAMenuBase* last_menu; -@property (nonatomic) UILabel *osdmessage; - -- (id)initWithStyle:(UITableViewStyle)style; -- (id)itemForIndexPath:(NSIndexPath*)indexPath; - -@end - -typedef struct -{ - char orientations[32]; - unsigned orientation_flags; - char bluetooth_mode[64]; -} apple_frontend_settings_t; -extern apple_frontend_settings_t apple_frontend_settings; +#include "cocoa_common_shared.h" #if TARGET_OS_IOS @interface CocoaView : UIViewController void get_ios_version(int *major, int *minor); -#elif defined(HAVE_COCOA) -#include - -@interface CocoaView : NSView - -+ (CocoaView*)get; -#if !defined(HAVE_COCOA) -- (void)display; #endif -@end - -#endif - -#define BOXSTRING(x) [NSString stringWithUTF8String:x] -#define BOXINT(x) [NSNumber numberWithInt:x] -#define BOXUINT(x) [NSNumber numberWithUnsignedInt:x] -#define BOXFLOAT(x) [NSNumber numberWithDouble:x] #endif diff --git a/ui/drivers/cocoa/cocoa_common_metal.h b/ui/drivers/cocoa/cocoa_common_metal.h index 50f298c8fe..a8e7bd3f4f 100644 --- a/ui/drivers/cocoa/cocoa_common_metal.h +++ b/ui/drivers/cocoa/cocoa_common_metal.h @@ -24,6 +24,8 @@ #include "../../menu/menu_driver.h" #endif +#include "cocoa_common_shared.h" + typedef enum apple_view_type { APPLE_VIEW_TYPE_NONE, APPLE_VIEW_TYPE_OPENGL_ES, @@ -67,30 +69,6 @@ extern id apple_platform; #if defined(HAVE_COCOATOUCH) #include -/*********************************************/ -/* RAMenuBase */ -/* A menu class that displays RAMenuItemBase */ -/* objects. */ -/*********************************************/ -@interface RAMenuBase : UITableViewController -@property (nonatomic) NSMutableArray* sections; -@property (nonatomic) BOOL hidesHeaders; -@property (nonatomic) RAMenuBase* last_menu; -@property (nonatomic) UILabel *osdmessage; - -- (id)initWithStyle:(UITableViewStyle)style; -- (id)itemForIndexPath:(NSIndexPath*)indexPath; - -@end - -typedef struct -{ - char orientations[32]; - unsigned orientation_flags; - char bluetooth_mode[64]; -} apple_frontend_settings_t; -extern apple_frontend_settings_t apple_frontend_settings; - @interface CocoaView : UIViewController + (CocoaView*)get; @@ -117,34 +95,6 @@ UINavigationControllerDelegate, ApplePlatform> void get_ios_version(int *major, int *minor); -#elif defined(HAVE_COCOA_METAL) -#include - -@interface CocoaView : NSView - -+ (CocoaView*)get; -#if !defined(HAVE_COCOA_METAL) -- (void)display; -#endif - -@end - -#endif - -#define BOXSTRING(x) [NSString stringWithUTF8String:x] -#define BOXINT(x) [NSNumber numberWithInt:x] -#define BOXUINT(x) [NSNumber numberWithUnsignedInt:x] -#define BOXFLOAT(x) [NSNumber numberWithDouble:x] - -#if __has_feature(objc_arc) -#define RELEASE(x) x = nil -#define BRIDGE __bridge -#define UNSAFE_UNRETAINED __unsafe_unretained -#else -#define RELEASE(x) [x release]; \ - x = nil -#define BRIDGE -#define UNSAFE_UNRETAINED #endif #endif diff --git a/ui/drivers/cocoa/cocoa_common_shared.h b/ui/drivers/cocoa/cocoa_common_shared.h new file mode 100644 index 0000000000..99f5d2ee0f --- /dev/null +++ b/ui/drivers/cocoa/cocoa_common_shared.h @@ -0,0 +1,74 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2013-2014 - Jason Fetters + * Copyright (C) 2011-2017 - 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- + * 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 . + */ + +#ifndef __COCOA_COMMON_SHARED_H +#define __COCOA_COMMON_SHARED_H + +/*********************************************/ +/* RAMenuBase */ +/* A menu class that displays RAMenuItemBase */ +/* objects. */ +/*********************************************/ +@interface RAMenuBase : UITableViewController +@property (nonatomic) NSMutableArray* sections; +@property (nonatomic) BOOL hidesHeaders; +@property (nonatomic) RAMenuBase* last_menu; +@property (nonatomic) UILabel *osdmessage; + +- (id)initWithStyle:(UITableViewStyle)style; +- (id)itemForIndexPath:(NSIndexPath*)indexPath; + +@end + +typedef struct +{ + char orientations[32]; + unsigned orientation_flags; + char bluetooth_mode[64]; +} apple_frontend_settings_t; +extern apple_frontend_settings_t apple_frontend_settings; + +#if defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL) +#include + +@interface CocoaView : NSView + ++ (CocoaView*)get; +#if !defined(HAVE_COCOA) && !defined(HAVE_COCOA_METAL) +- (void)display; +#endif + +@end + +#endif + +#define BOXSTRING(x) [NSString stringWithUTF8String:x] +#define BOXINT(x) [NSNumber numberWithInt:x] +#define BOXUINT(x) [NSNumber numberWithUnsignedInt:x] +#define BOXFLOAT(x) [NSNumber numberWithDouble:x] + +#if __has_feature(objc_arc) +#define RELEASE(x) x = nil +#define BRIDGE __bridge +#define UNSAFE_UNRETAINED __unsafe_unretained +#else +#define RELEASE(x) [x release]; \ + x = nil +#define BRIDGE +#define UNSAFE_UNRETAINED +#endif + +#endif