(Cocoa) Unify both headers

This commit is contained in:
twinaphex 2019-02-09 04:40:38 +01:00
parent f64f598987
commit 1a8ad73c3f
14 changed files with 175 additions and 270 deletions

View File

@ -6,14 +6,17 @@
//
#import <Foundation/Foundation.h>
#import "metal_common.h"
#import "../../ui/drivers/cocoa/cocoa_common_metal.h"
#import <memory.h>
#import <gfx/video_frame.h>
#import <Metal/Metal.h>
#import <QuartzCore/QuartzCore.h>
#import <memory.h>
#import <stddef.h>
#include <simd/simd.h>
#import <gfx/video_frame.h>
#import "metal_common.h"
#import "../../ui/drivers/cocoa/cocoa_common.h"
#import "Context.h"
#ifdef HAVE_MENU

View File

@ -34,7 +34,7 @@
#include <retro_assert.h>
#include <compat/apple_compat.h>
#import "../../ui/drivers/cocoa/cocoa_common_metal.h"
#import "../../ui/drivers/cocoa/cocoa_common.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"

View File

@ -555,7 +555,6 @@
A9020AF14B9A73364C6CDDA5 /* cocoa_common_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cocoa_common_metal.m; sourceTree = "<group>"; };
A9020BD6594399DDAB0E2563 /* ui_cocoatouch_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ui_cocoatouch_metal.m; sourceTree = "<group>"; };
A9020C55D864F0E0C6E7DFF9 /* ui_cocoa_window_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_window_metal.m; sourceTree = "<group>"; };
A9020E880B5DBFD909921A8F /* cocoa_common_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_common_metal.h; sourceTree = "<group>"; };
A9020EE4BE2C6A15024A32E0 /* ui_cocoa_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_metal.m; sourceTree = "<group>"; };
A9020F2EEF870903107B0EA7 /* ui_cocoa_application_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_application_metal.m; sourceTree = "<group>"; };
A9020F48BA562B13D4789292 /* ui_cocoa_browser_window_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_browser_window_metal.m; sourceTree = "<group>"; };
@ -959,7 +958,6 @@
05A8C5BB20DB72F000FF7857 /* cocoa */ = {
isa = PBXGroup;
children = (
A9020E880B5DBFD909921A8F /* cocoa_common_metal.h */,
A9020AF14B9A73364C6CDDA5 /* cocoa_common_metal.m */,
05A8C5C220DB72F000FF7857 /* cocoa_common.h */,
05A8C5BD20DB72F000FF7857 /* cocoa_common.m */,

View File

@ -1,55 +1,162 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __COCOA_COMMON_H
#define __COCOA_COMMON_H
#include "cocoa_common_shared.h"
#if defined(HAVE_COCOATOUCH)
#if TARGET_OS_IOS
@interface CocoaView : UIViewController<CLLocationManagerDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate>
#elif TARGET_OS_TV
@interface CocoaView : GCEventViewController
#endif
+ (CocoaView*)get;
@end
@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
void get_ios_version(int *major, int *minor);
#endif
#endif
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __COCOA_COMMON_SHARED_H
#define __COCOA_COMMON_SHARED_H
#include <Foundation/Foundation.h>
#ifdef HAVE_MENU
#include "../../menu/menu_setting.h"
#include "../../menu/menu_driver.h"
#endif
typedef enum apple_view_type {
APPLE_VIEW_TYPE_NONE,
APPLE_VIEW_TYPE_OPENGL_ES,
APPLE_VIEW_TYPE_OPENGL,
APPLE_VIEW_TYPE_VULKAN,
APPLE_VIEW_TYPE_METAL,
} apple_view_type_t;
#ifdef HAVE_METAL
#import <MetalKit/MetalKit.h>
@interface MetalView : MTKView
@end
#ifdef HAVE_COCOA_METAL
@protocol ApplePlatform
/*! @brief renderView returns the current render view based on the viewType */
@property (readonly) id renderView;
/*! @brief isActive returns true if the application has focus */
@property (readonly) bool hasFocus;
@property (readwrite) apple_view_type_t viewType;
/*! @brief setVideoMode adjusts the video display to the specified mode */
- (void)setVideoMode:(gfx_ctx_mode_t)mode;
/*! @brief setCursorVisible specifies whether the cursor is visible */
- (void)setCursorVisible:(bool)v;
/*! @brief controls whether the screen saver should be disabled and
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
@end
extern id<ApplePlatform> apple_platform;
#endif
#endif
#if defined(HAVE_COCOATOUCH)
#include <UIKit/UIKit.h>
#if TARGET_OS_TV
#import <GameController/GameController.h>
#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
#if TARGET_OS_IOS
@interface CocoaView : UIViewController<
AVCaptureAudioDataOutputSampleBufferDelegate>
#elif TARGET_OS_TV
@interface CocoaView : GCEventViewController
#endif
+ (CocoaView*)get;
@end
@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
void get_ios_version(int *major, int *minor);
#endif
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 <AppKit/AppKit.h>
@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

View File

@ -1,91 +0,0 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __COCOA_COMMON_METAL_H
#define __COCOA_COMMON_METAL_H
#include "cocoa_common_shared.h"
typedef enum apple_view_type {
APPLE_VIEW_TYPE_NONE,
APPLE_VIEW_TYPE_OPENGL_ES,
APPLE_VIEW_TYPE_OPENGL,
APPLE_VIEW_TYPE_VULKAN,
APPLE_VIEW_TYPE_METAL,
} apple_view_type_t;
#ifdef HAVE_METAL
#import <MetalKit/MetalKit.h>
@interface MetalView : MTKView
@end
#endif
@protocol ApplePlatform
/*! @brief renderView returns the current render view based on the viewType */
@property (readonly) id renderView;
/*! @brief isActive returns true if the application has focus */
@property (readonly) bool hasFocus;
@property (readwrite) apple_view_type_t viewType;
/*! @brief setVideoMode adjusts the video display to the specified mode */
- (void)setVideoMode:(gfx_ctx_mode_t)mode;
/*! @brief setCursorVisible specifies whether the cursor is visible */
- (void)setCursorVisible:(bool)v;
/*! @brief controls whether the screen saver should be disabled and
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
@end
extern id<ApplePlatform> apple_platform;
#if defined(HAVE_COCOATOUCH)
@interface CocoaView : UIViewController<CLLocationManagerDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate>
+ (CocoaView*)get;
@end
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate,
UINavigationControllerDelegate, ApplePlatform>
@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
void get_ios_version(int *major, int *minor);
#endif
#endif

View File

@ -16,7 +16,7 @@
#import <AvailabilityMacros.h>
#include <sys/stat.h>
#include "cocoa_common_metal.h"
#include "cocoa_common.h"
#include "../ui_cocoa.h"
#include <retro_assert.h>

View File

@ -1,90 +0,0 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __COCOA_COMMON_SHARED_H
#define __COCOA_COMMON_SHARED_H
#include <Foundation/Foundation.h>
#ifdef HAVE_MENU
#include "../../menu/menu_setting.h"
#include "../../menu/menu_driver.h"
#endif
#if defined(HAVE_COCOATOUCH)
#include <UIKit/UIKit.h>
#if TARGET_OS_TV
#import <GameController/GameController.h>
#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
#endif
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 <AppKit/AppKit.h>
@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

View File

@ -20,11 +20,7 @@
#include <string.h>
#include <objc/objc-runtime.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#include "cocoa_common.h"
#endif
#include "../../ui_companion_driver.h"
static void* ui_application_cocoa_initialize(void)

View File

@ -21,11 +21,7 @@
#include <string/stdstring.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#endif
#include "cocoa_common.h"
#include "../../ui_companion_driver.h"
static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)

View File

@ -21,10 +21,9 @@
#include <string/stdstring.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#include "cocoa_common.h"
#if defined(HAVE_COCOA)
extern id apple_platform;
#endif

View File

@ -21,11 +21,7 @@
#include <string/stdstring.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#include "cocoa_common.h"
#endif
#include "../ui_cocoa.h"
#include "../../ui_companion_driver.h"

View File

@ -23,11 +23,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa/cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#include "cocoa/cocoa_common.h"
#endif
#include "../ui_companion_driver.h"

View File

@ -26,12 +26,7 @@
#include <queues/task_queue.h>
#include <retro_timers.h>
#if defined(HAVE_COCOA_METAL)
#include "cocoa/cocoa_common_metal.h"
#elif defined(HAVE_COCOA)
#include "cocoa/cocoa_common.h"
#endif
#include "../ui_companion_driver.h"
#include "../../input/drivers/cocoa_input.h"
#include "../../input/drivers_keyboard/keyboard_event_apple.h"

View File

@ -25,7 +25,7 @@
#include <string/stdstring.h>
#include <retro_timers.h>
#include "cocoa/cocoa_common_metal.h"
#include "cocoa/cocoa_common.h"
#include "../ui_companion_driver.h"
#include "../../configuration.h"
#include "../../frontend/frontend.h"