mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(OSX) Fix PowerPC build
This commit is contained in:
parent
f6833cf595
commit
1e9f6f175e
@ -72,22 +72,22 @@
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_inflightSemaphore = dispatch_semaphore_create(MAX_INFLIGHT);
|
||||
_device = d;
|
||||
_layer = layer;
|
||||
#if TARGET_OS_OSX
|
||||
_layer.framebufferOnly = NO;
|
||||
_layer.displaySyncEnabled = YES;
|
||||
_inflightSemaphore = dispatch_semaphore_create(MAX_INFLIGHT);
|
||||
_device = d;
|
||||
_layer = layer;
|
||||
#ifdef OSX
|
||||
_layer.framebufferOnly = NO;
|
||||
_layer.displaySyncEnabled = YES;
|
||||
#endif
|
||||
_library = l;
|
||||
_commandQueue = [_device newCommandQueue];
|
||||
_clearColor = MTLClearColorMake(0, 0, 0, 1);
|
||||
_library = l;
|
||||
_commandQueue = [_device newCommandQueue];
|
||||
_clearColor = MTLClearColorMake(0, 0, 0, 1);
|
||||
_uniforms.projectionMatrix = matrix_proj_ortho(0, 1, 0, 1);
|
||||
|
||||
_rotation = 0;
|
||||
_rotation = 0;
|
||||
[self setRotation:0];
|
||||
_mvp_no_rot = matrix_proj_ortho(0, 1, 0, 1);
|
||||
_mvp = matrix_proj_ortho(0, 1, 0, 1);
|
||||
_mvp_no_rot = matrix_proj_ortho(0, 1, 0, 1);
|
||||
_mvp = matrix_proj_ortho(0, 1, 0, 1);
|
||||
|
||||
{
|
||||
MTLSamplerDescriptor *sd = [MTLSamplerDescriptor new];
|
||||
@ -166,17 +166,17 @@
|
||||
|
||||
- (void)setDisplaySyncEnabled:(bool)displaySyncEnabled
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
_layer.displaySyncEnabled = displaySyncEnabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (bool)displaySyncEnabled
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
return _layer.displaySyncEnabled;
|
||||
#else
|
||||
return NO;
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -646,7 +646,7 @@
|
||||
|
||||
if (_blitCommandBuffer)
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
if (_captureEnabled)
|
||||
{
|
||||
id<MTLBlitCommandEncoder> bce = [_blitCommandBuffer blitCommandEncoder];
|
||||
@ -741,21 +741,20 @@ static const NSUInteger kConstantAlignment = 4;
|
||||
|
||||
- (void)commitRanges
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
for (BufferNode *n = _head; n != nil; n = n.next)
|
||||
#ifdef OSX
|
||||
BufferNode *n;
|
||||
for (n = _head; n != nil; n = n.next)
|
||||
{
|
||||
if (n.allocated > 0)
|
||||
{
|
||||
[n.src didModifyRange:NSMakeRange(0, n.allocated)];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)discard
|
||||
{
|
||||
_current = _head;
|
||||
_offset = 0;
|
||||
_current = _head;
|
||||
_offset = 0;
|
||||
_allocated = 0;
|
||||
}
|
||||
|
||||
@ -785,9 +784,7 @@ static const NSUInteger kConstantAlignment = 4;
|
||||
|
||||
NSUInteger blockLen = _blockLen;
|
||||
if (length > blockLen)
|
||||
{
|
||||
blockLen = length;
|
||||
}
|
||||
|
||||
_current.next = [[BufferNode alloc] initWithBuffer:[_device newBufferWithLength:blockLen options:opts]];
|
||||
if (!_current.next)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#else
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <AppKit/NSScreen.h>
|
||||
@ -114,7 +114,7 @@ void *nsview_get_ptr(void)
|
||||
|
||||
void nsview_set_ptr(CocoaView *p) { g_instance = p; }
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
static NSOpenGLPixelFormat* g_format;
|
||||
void *glcontext_get_ptr(void) { return (BRIDGE void *)g_context; }
|
||||
#endif
|
||||
@ -232,7 +232,7 @@ float get_backing_scale_factor(void)
|
||||
return backing_scale_def;
|
||||
|
||||
backing_scale_def = 1.0f;
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
{
|
||||
id nsscreen = objc_getClass("NSScreen");
|
||||
SEL selector = sel_registerName("backingScaleFactor");
|
||||
@ -259,7 +259,7 @@ void cocoagl_gfx_ctx_update(void)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_OPENGL_CORE)
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
CGLUpdateContext(g_hw_ctx.CGLContextObj);
|
||||
CGLUpdateContext(g_context.CGLContextObj);
|
||||
@ -289,14 +289,12 @@ static void cocoagl_gfx_ctx_destroy(void *data)
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_OPENGL_CORE)
|
||||
[GLContextClass clearCurrentContext];
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
[g_context clearDrawable];
|
||||
RELEASE(g_context);
|
||||
RELEASE(g_format);
|
||||
if (g_hw_ctx)
|
||||
{
|
||||
[g_hw_ctx clearDrawable];
|
||||
}
|
||||
RELEASE(g_hw_ctx);
|
||||
#endif
|
||||
[GLContextClass clearCurrentContext];
|
||||
@ -325,7 +323,7 @@ static enum gfx_ctx_api cocoagl_gfx_ctx_get_api(void *data) { return cocoagl_api
|
||||
|
||||
static void cocoagl_gfx_ctx_show_mouse(void *data, bool state)
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
if (state)
|
||||
[NSCursor unhide];
|
||||
else
|
||||
@ -361,7 +359,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
static void cocoagl_gfx_ctx_update_title(void *data)
|
||||
{
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
@ -385,7 +383,7 @@ static bool cocoagl_gfx_ctx_get_metrics(
|
||||
float *value)
|
||||
{
|
||||
RAScreen *screen = (BRIDGE RAScreen*)get_chosen_screen();
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize display_physical_size = CGDisplayScreenSize(
|
||||
@ -397,7 +395,7 @@ static bool cocoagl_gfx_ctx_get_metrics(
|
||||
float physical_height = display_physical_size.height;
|
||||
float scale = get_backing_scale_factor();
|
||||
float dpi = (display_width/ physical_width) * 25.4f * scale;
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
#else
|
||||
float scale = cocoagl_gfx_ctx_get_native_scale();
|
||||
CGRect screen_rect = [screen bounds];
|
||||
float display_height = screen_rect.size.height;
|
||||
@ -474,7 +472,7 @@ static void cocoagl_gfx_ctx_get_video_size(void *data,
|
||||
unsigned* width, unsigned* height)
|
||||
{
|
||||
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
CGRect size, cgrect;
|
||||
GLsizei backingPixelWidth, backingPixelHeight;
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
@ -620,10 +618,10 @@ static void cocoagl_gfx_ctx_swap_buffers(void *data)
|
||||
if (!(--cocoa_ctx->fast_forward_skips < 0))
|
||||
return;
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
[g_context flushBuffer];
|
||||
[g_hw_ctx flushBuffer];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
#else
|
||||
if (g_view)
|
||||
[g_view display];
|
||||
#endif
|
||||
@ -694,7 +692,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
#endif
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
static bool
|
||||
has_went_fullscreen = false;
|
||||
cocoa_ctx->width = width;
|
||||
@ -706,7 +704,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
{
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
if ([g_view respondsToSelector: @selector(setWantsBestResolutionOpenGLSurface:)])
|
||||
[g_view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
@ -782,7 +780,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
break;
|
||||
}
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
/* TODO: Screen mode support. */
|
||||
if (fullscreen)
|
||||
{
|
||||
@ -917,7 +915,7 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = {
|
||||
NULL, /* get_video_output_next */
|
||||
cocoagl_gfx_ctx_get_metrics,
|
||||
NULL, /* translate_aspect */
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
cocoagl_gfx_ctx_update_title,
|
||||
#else
|
||||
NULL, /* update_title */
|
||||
|
@ -776,15 +776,12 @@ INPUT
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBSHAKE)
|
||||
#if TARGET_OS_OSX
|
||||
#include "../deps/libShake/src/common/error.c"
|
||||
#include "../deps/libShake/src/common/helpers.c"
|
||||
#include "../deps/libShake/src/common/presets.c"
|
||||
#if defined(OSX)
|
||||
#include "../deps/libShake/src/osx/shake.c"
|
||||
#elif defined(__linux__) || (defined(BSD) && !defined(__MACH__))
|
||||
#include "../deps/libShake/src/common/error.c"
|
||||
#include "../deps/libShake/src/common/helpers.c"
|
||||
#include "../deps/libShake/src/common/presets.c"
|
||||
#include "../deps/libShake/src/linux/shake.c"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -32,18 +32,14 @@
|
||||
#include "../ui/drivers/cocoa/cocoa_common.m"
|
||||
#include "../gfx/drivers_context/cocoa_gl_ctx.m"
|
||||
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
#include "../ui/drivers/ui_cocoatouch.m"
|
||||
#else
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_window.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_browser_window.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_application.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_msg_window.m"
|
||||
#include "../ui/drivers/ui_cocoa.m"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "../ui/drivers/ui_cocoatouch.m"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1152,7 +1152,7 @@ static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
&ui_companion_win32,
|
||||
#endif
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
&ui_companion_cocoa,
|
||||
#endif
|
||||
&ui_companion_null,
|
||||
|
@ -86,7 +86,7 @@ id apple_platform;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#ifdef OSX
|
||||
@property(nonatomic, retain) NSWindow IBOutlet *window;
|
||||
|
||||
@end
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define RAScreen NSScreen
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
#include <AppKit/AppKit.h>
|
||||
#endif
|
||||
|
||||
@ -75,7 +75,7 @@ typedef struct
|
||||
} apple_frontend_settings_t;
|
||||
extern apple_frontend_settings_t apple_frontend_settings;
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
@interface CocoaView : NSView
|
||||
|
||||
+ (CocoaView*)get;
|
||||
|
@ -42,7 +42,7 @@ void *glkitview_init(void);
|
||||
|
||||
@implementation CocoaView
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
- (BOOL)layer:(CALayer *)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow *)window { return YES; }
|
||||
#endif
|
||||
@ -64,7 +64,7 @@ void *glkitview_init(void);
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
NSArray *array = [NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil];
|
||||
[self registerForDraggedTypes:array];
|
||||
@ -81,7 +81,7 @@ void *glkitview_init(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
video_driver_display_type_set(RARCH_DISPLAY_OSX);
|
||||
video_driver_display_set(0);
|
||||
video_driver_display_userdata_set((uintptr_t)self);
|
||||
@ -95,7 +95,7 @@ void *glkitview_init(void);
|
||||
return self;
|
||||
}
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#if defined(OSX)
|
||||
- (void)setFrame:(NSRect)frameRect
|
||||
{
|
||||
[super setFrame:frameRect];
|
||||
|
@ -23,6 +23,10 @@
|
||||
#define MAC_OS_X_VERSION_10_12 101200
|
||||
#endif
|
||||
|
||||
#ifndef NSEventModifierFlags
|
||||
#define NSEventModifierFlags NSUInteger
|
||||
#endif
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
|
||||
#define NSEventModifierFlagCommand NSCommandKeyMask
|
||||
#define NSEventModifierFlagControl NSControlKeyMask
|
||||
|
@ -126,7 +126,7 @@ static char **waiting_argv;
|
||||
{
|
||||
CGFloat delta_x = event.deltaX;
|
||||
CGFloat delta_y = event.deltaY;
|
||||
CGPoint pos = CONVERT_POINT();
|
||||
NSPoint pos = CONVERT_POINT();
|
||||
cocoa_input_data_t
|
||||
*apple = (cocoa_input_data_t*)
|
||||
input_driver_get_data();
|
||||
@ -155,7 +155,7 @@ static char **waiting_argv;
|
||||
case NSEventTypeOtherMouseDown:
|
||||
{
|
||||
NSInteger number = event.buttonNumber;
|
||||
CGPoint pos = CONVERT_POINT();
|
||||
NSPoint pos = CONVERT_POINT();
|
||||
cocoa_input_data_t
|
||||
*apple = (cocoa_input_data_t*)
|
||||
input_driver_get_data();
|
||||
@ -170,7 +170,7 @@ static char **waiting_argv;
|
||||
case NSEventTypeOtherMouseUp:
|
||||
{
|
||||
NSInteger number = event.buttonNumber;
|
||||
CGPoint pos = CONVERT_POINT();
|
||||
NSPoint pos = CONVERT_POINT();
|
||||
cocoa_input_data_t
|
||||
*apple = (cocoa_input_data_t*)
|
||||
input_driver_get_data();
|
||||
|
Loading…
x
Reference in New Issue
Block a user