2019-11-19 05:54:01 +01:00
|
|
|
#ifndef COCOA_APPLE_PLATFORM_H
|
|
|
|
#define COCOA_APPLE_PLATFORM_H
|
|
|
|
|
2023-05-11 22:30:06 -04:00
|
|
|
#if TARGET_OS_TV
|
|
|
|
#include "config_file.h"
|
|
|
|
extern config_file_t *open_userdefaults_config_file(void);
|
|
|
|
extern void write_userdefaults_config_file(void);
|
2024-02-28 02:20:32 -05:00
|
|
|
extern void update_topshelf(void);
|
2023-05-11 22:30:06 -04:00
|
|
|
#endif
|
|
|
|
|
2024-04-29 21:30:15 -04:00
|
|
|
#if TARGET_OS_IOS
|
|
|
|
extern void ios_show_file_sheet(void);
|
|
|
|
#endif
|
|
|
|
|
2023-05-11 22:30:06 -04:00
|
|
|
#ifdef __OBJC__
|
|
|
|
|
2021-01-22 22:20:38 +01:00
|
|
|
#ifdef HAVE_METAL
|
2019-11-19 12:00:24 +07:00
|
|
|
#import <Metal/Metal.h>
|
|
|
|
#import <MetalKit/MetalKit.h>
|
2020-07-20 15:38:24 -10:00
|
|
|
#endif
|
2019-11-19 12:00:24 +07:00
|
|
|
|
2023-01-05 19:35:15 +01:00
|
|
|
typedef enum apple_view_type
|
|
|
|
{
|
|
|
|
APPLE_VIEW_TYPE_NONE = 0,
|
|
|
|
APPLE_VIEW_TYPE_OPENGL_ES,
|
|
|
|
APPLE_VIEW_TYPE_OPENGL,
|
|
|
|
APPLE_VIEW_TYPE_VULKAN,
|
|
|
|
APPLE_VIEW_TYPE_METAL
|
|
|
|
} apple_view_type_t;
|
|
|
|
|
2021-01-22 22:20:38 +01:00
|
|
|
#if defined(HAVE_COCOA_METAL) && !defined(HAVE_COCOATOUCH)
|
2019-11-30 12:49:52 +07:00
|
|
|
@interface WindowListener : NSResponder<NSWindowDelegate>
|
2023-02-03 01:32:30 -05:00
|
|
|
@property (nonatomic) NSWindow* window;
|
2019-11-19 12:00:24 +07:00
|
|
|
@end
|
2020-07-07 05:03:42 -10:00
|
|
|
#endif
|
2019-11-19 12:00:24 +07:00
|
|
|
|
2021-01-22 22:20:38 +01:00
|
|
|
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
|
2019-11-30 12:49:52 +07:00
|
|
|
@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;
|
2023-02-03 01:32:30 -05:00
|
|
|
#if defined(HAVE_COCOA_METAL) && !defined(HAVE_COCOATOUCH)
|
|
|
|
- (void)updateWindowedMode;
|
|
|
|
#endif
|
2019-11-30 12:49:52 +07:00
|
|
|
@end
|
|
|
|
|
2021-01-24 03:56:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
|
2019-11-30 12:49:52 +07:00
|
|
|
extern id<ApplePlatform> apple_platform;
|
2021-01-22 22:20:38 +01:00
|
|
|
#else
|
2022-07-23 09:24:46 +01:00
|
|
|
extern id apple_platform;
|
2021-01-22 22:20:38 +01:00
|
|
|
#endif
|
2020-07-07 05:03:42 -10:00
|
|
|
|
|
|
|
#if defined(HAVE_COCOATOUCH)
|
2023-02-19 12:15:45 +01:00
|
|
|
void rarch_start_draw_observer(void);
|
|
|
|
void rarch_stop_draw_observer(void);
|
2023-02-15 05:59:06 -05:00
|
|
|
|
2020-07-07 05:03:42 -10:00
|
|
|
@interface RetroArch_iOS : UINavigationController<ApplePlatform, UIApplicationDelegate,
|
|
|
|
UINavigationControllerDelegate> {
|
|
|
|
UIView *_renderView;
|
|
|
|
apple_view_type_t _vt;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property (nonatomic) UIWindow* window;
|
|
|
|
@property (nonatomic) NSString* documentsDirectory;
|
|
|
|
@property (nonatomic) int menu_count;
|
2023-12-28 14:10:13 -05:00
|
|
|
@property (nonatomic) NSDate *bgDate;
|
2020-07-07 05:03:42 -10:00
|
|
|
|
|
|
|
+ (RetroArch_iOS*)get;
|
|
|
|
|
|
|
|
- (void)showGameView;
|
|
|
|
- (void)supportOtherAudioSessions;
|
|
|
|
|
|
|
|
- (void)refreshSystemConfig;
|
|
|
|
@end
|
|
|
|
#else
|
2021-01-22 22:20:38 +01:00
|
|
|
#if defined(HAVE_COCOA_METAL)
|
2019-11-30 12:49:52 +07:00
|
|
|
@interface RetroArch_OSX : NSObject<ApplePlatform, NSApplicationDelegate> {
|
2022-01-24 16:22:07 +01:00
|
|
|
#elif (defined(__MACH__) && defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED < 101200))
|
2021-01-22 22:20:38 +01:00
|
|
|
@interface RetroArch_OSX : NSObject {
|
|
|
|
#else
|
|
|
|
@interface RetroArch_OSX : NSObject<NSApplicationDelegate> {
|
|
|
|
#endif
|
2019-11-30 12:49:52 +07:00
|
|
|
NSWindow *_window;
|
|
|
|
apple_view_type_t _vt;
|
|
|
|
NSView *_renderView;
|
|
|
|
id _sleepActivity;
|
2021-01-22 22:20:38 +01:00
|
|
|
#if defined(HAVE_COCOA_METAL)
|
2019-11-30 12:49:52 +07:00
|
|
|
WindowListener *_listener;
|
2019-11-19 05:54:01 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-11-19 12:00:24 +07:00
|
|
|
@property(nonatomic, retain) NSWindow IBOutlet *window;
|
2019-11-19 05:54:01 +01:00
|
|
|
|
|
|
|
@end
|
2019-11-20 02:58:17 +01:00
|
|
|
#endif
|
2019-11-19 05:54:01 +01:00
|
|
|
|
|
|
|
#endif
|
2023-05-11 22:30:06 -04:00
|
|
|
|
|
|
|
#endif
|