summaryrefslogtreecommitdiff
path: root/unix.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-12-10 11:16:45 +0000
committerbjarni <bjarni@openttd.org>2005-12-10 11:16:45 +0000
commit50a1e16943b03a77c908d938eabcf075390e0dff (patch)
treeb00faf47a1ca2028f095a2c406983e4e94fd533e /unix.c
parentc0218be57ad25083f425db089327a5e5cf7527b8 (diff)
downloadopenttd-50a1e16943b03a77c908d938eabcf075390e0dff.tar.xz
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
you can still use SDL drivers if you like and you have to run "make upgradeconf" to start using the cocoa drivers (or manually write WITH_COCOA:=1) since SDL breaks the cocoa drivers, you can't compile with both SDL and cocoa support Using cocoa drivers makes it easier to make universal binaries and it solves: -FS#18 [OSX] SDL is weird in universal binaries -FS#2 [OSX] lazy pointer crash on exit -FS#10 [OSX] linking error when linking statically to SDL 1.2.8 (needless to explain this, but it means it should be able to compile statically with the default settings now) -[ 1215073 ] Switching to large size out of fullscreen crashes Using SDL drivers will still have those issues though
Diffstat (limited to 'unix.c')
-rw-r--r--unix.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/unix.c b/unix.c
index fd20e3715..7e23aca00 100644
--- a/unix.c
+++ b/unix.c
@@ -444,8 +444,26 @@ void ShowOSErrorBox(const char *buf)
#endif
}
+#ifdef WITH_COCOA
+void cocoaSetWorkingDirectory(void);
+void cocoaSetupAutoreleasePool(void);
+void cocoaReleaseAutoreleasePool(void);
+#endif
+
int CDECL main(int argc, char* argv[])
{
+ int ret;
+
+#ifdef WITH_COCOA
+ cocoaSetupAutoreleasePool();
+ /* This is passed if we are launched by double-clicking */
+ if(argc >= 2 && strncmp (argv[1], "-psn", 4) == 0) {
+ argv[1] = NULL;
+ argc = 1;
+ cocoaSetWorkingDirectory();
+ }
+#endif
+
// change the working directory to enable doubleclicking in UIs
#if defined(__BEOS__) || defined(__linux__)
ChangeWorkingDirectory(argv[0]);
@@ -456,7 +474,13 @@ int CDECL main(int argc, char* argv[])
signal(SIGPIPE, SIG_IGN);
- return ttd_main(argc, argv);
+ ret = ttd_main(argc, argv);
+
+#ifdef WITH_COCOA
+ cocoaReleaseAutoreleasePool();
+#endif
+
+ return ret;
}
void DeterminePaths(void)