1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00
RetroArch/no-xib.diff
Francisco José García García 51922ea5be Squashed 'deps/vitaGL/' changes from c816fec50f..2934af8af0
2934af8af0 Added Patreon sponsor link.
c8f18b6f0f Getting current program only when required for vglDrawObjects.
4c5d136b0d Added directive to enable vitaShaRK usage from cmd.
4a10df3be5 Minor adjustments and bugfixes.
14a0124acf Added GL_TEXTURE_LOD_BIAS support.
40c8c6205e Added GL_NONE def and fixed glUniform4f impl.
868079c51e Added glUniform4f implementation.
0a682cbad2 Typo fix.
be3ce61ae7 Added GL_DEPTH_BITS and GL_STENCIL_BITS support.
21e6d1d330 Added runtime shader compiler support.
696e40bc62 Beautify error handler code.
537b37b110 Added glUniform3fv implementation.
7dd1403015 Fixed GLenum size and added missing types defines.
0c75f27ff1 Moved to NEON optimized memcpy usage.
98951895de Added gluPerspective implementation.
23e0b0b309 Fix for vglInitExtended not working on sys app mode.
4989c33ef5 Run clang-format.
429f1c1d8a Added system mode support.
9231680d02 Initializing sceGxm before free mem checking on vglInitExtended.
091e5e7882 Added vglInitWithCustomSizes.
f4c646ea78 Added vglSetParamBufferSize.
1b9a063c41 Beautify some code.
089e81efc5 Fix for duplicated symbols
789dcbf812 Typo fix in readRGBA4444.
1514a4b2cb Disabling lto due to it being broken on vitasdk with gcc 9.1.
fca18d9ab7 Added support for RGBA4444 texture format.
d449f12808 Added support for RGB565 texture format.

git-subtree-dir: deps/vitaGL
git-subtree-split: 2934af8af083a9acf598ab75233c518a251c6f0d
2020-07-05 11:43:47 +02:00

172 lines
6.8 KiB
Diff

diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m
index e67725f..868d874 100644
--- a/gfx/drivers_context/cocoa_gl_ctx.m
+++ b/gfx/drivers_context/cocoa_gl_ctx.m
@@ -83,6 +83,7 @@ static NSOpenGLPixelFormat* g_format;
static unsigned g_minor = 0;
static unsigned g_major = 0;
+static bool g_is_inited = false;
/* forward declaration */
void *nsview_get_ptr(void);
@@ -152,6 +153,9 @@ static bool cocoagl_gfx_ctx_init(void *data)
{
(void)data;
+ if (g_is_inited)
+ return true;
+
#if defined(HAVE_COCOA)
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
#if MAC_OS_X_VERSION_10_7
@@ -196,6 +200,11 @@ static bool cocoagl_gfx_ctx_init(void *data)
[g_context makeCurrentContext];
// Make sure the view was created
[CocoaView get];
+#if defined(HAVE_COCOA)
+ [NSApp setDelegate:g_view];
+#endif
+
+ g_is_inited = true;
return true;
}
@@ -221,6 +230,8 @@ static void cocoagl_gfx_ctx_destroy(void *data)
#endif
[GLContextClass clearCurrentContext];
g_context = nil;
+
+ g_is_inited = false;
}
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
diff --git a/pkg/apple/OSX/Info.plist b/pkg/apple/OSX/Info.plist
index 8d59658..af95482 100644
--- a/pkg/apple/OSX/Info.plist
+++ b/pkg/apple/OSX/Info.plist
@@ -41,8 +41,6 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 RetroArch. All rights reserved.</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>RApplication</string>
</dict>
diff --git a/pkg/apple/RetroArch.xcodeproj/project.pbxproj b/pkg/apple/RetroArch.xcodeproj/project.pbxproj
index a7c1b57..e48f0bf 100644
--- a/pkg/apple/RetroArch.xcodeproj/project.pbxproj
+++ b/pkg/apple/RetroArch.xcodeproj/project.pbxproj
@@ -7,9 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
- 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
500845251B89300700CE6073 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
- 500845261B89300700CE6073 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
500845271B89300700CE6073 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; };
500845291B89300700CE6073 /* griffin_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */; };
5008452A1B89300700CE6073 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = 840222FB1A889EE2009AB261 /* griffin.c */; };
@@ -75,7 +73,6 @@
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = OSX/en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 1DDD58150DA1D0A300B32029 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = OSX/en.lproj/MainMenu.xib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
5008453A1B89300700CE6073 /* RetroArch copy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RetroArch copy.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5008453B1B89300700CE6073 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info.plist"; path = "/../../pkg/apple/OSX/Info.plist"; sourceTree = SOURCE_ROOT; };
@@ -196,7 +193,6 @@
84DD5EB71A89F1C7007336C1 /* retroarch.icns */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
- 1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -301,7 +297,6 @@
buildActionMask = 2147483647;
files = (
500845251B89300700CE6073 /* InfoPlist.strings in Resources */,
- 500845261B89300700CE6073 /* MainMenu.xib in Resources */,
500845271B89300700CE6073 /* retroarch.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -311,7 +306,6 @@
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
- 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -348,14 +342,6 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
- 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
- isa = PBXVariantGroup;
- children = (
- 1DDD58150DA1D0A300B32029 /* MainMenu.xib */,
- );
- name = MainMenu.xib;
- sourceTree = "<group>";
- };
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m
index 5dde6f9..37cd066 100644
--- a/ui/drivers/ui_cocoa.m
+++ b/ui/drivers/ui_cocoa.m
@@ -421,10 +421,50 @@ extern void action_ok_push_quick_menu(void);
@end
+static void setup_appkit(void)
+{
+ [NSAutoreleasePool new];
+ [NSApplication sharedApplication];
+
+ /* Might be Snow Leopard (10.6) only and up */
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+
+ id menubar = [[NSMenu new] autorelease];
+ id appMenuItem = [[NSMenuItem new] autorelease];
+
+ [menubar addItem:appMenuItem];
+ [NSApp setMainMenu:menubar];
+
+ /* Add 'Quit' to menu */
+ id appMenu = [[NSMenu new] autorelease];
+ id appName = [[NSProcessInfo processInfo] processName];
+ id quitTitle = BOXSTRING("Quit");
+ id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:quitTitle
+ action:@selector(terminate:) keyEquivalent:BOXSTRING("q")] autorelease];
+ [appMenu addItem:quitMenuItem];
+ [appMenuItem setSubmenu:appMenu];
+
+ /* Create a window and activate the application */
+ id window = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO] autorelease];
+ [window cascadeTopLeftFromPoint:NSMakePoint(20,20)];
+ [window setTitle:appName];
+ [window makeKeyAndOrderFront:nil];
+
+ cocoagl_gfx_ctx_init(NULL);
+ [window setContentView:(CocoaView*)nsview_get_ptr()];
+
+ /* Start the application */
+ [NSApp activateIgnoringOtherApps:YES]; /* Brings application to front on startup */
+ [NSApp run];
+}
+
int main(int argc, char *argv[])
{
waiting_argc = argc;
waiting_argv = argv;
+
+ setup_appkit();
+
return NSApplicationMain(argc, (const char **) argv);
}