OS X Objective-C files: NSApp -> nsapp as before for a PPC linkage fix

Note: I'm not really sure whether I'm initializing it in the right places.

git-svn-id: https://svn.eduke32.com/eduke32@2429 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-08 19:16:06 +00:00
parent 91c13a4ee6
commit 8c4151f8af
2 changed files with 18 additions and 6 deletions

View file

@ -13,6 +13,8 @@
#import "GrpFile.game.h" #import "GrpFile.game.h"
#import "GameListSource.game.h" #import "GameListSource.game.h"
static id nsapp;
static struct { static struct {
int fullscreen; int fullscreen;
int xdim3d, ydim3d, bpp3d; int xdim3d, ydim3d, bpp3d;
@ -186,7 +188,7 @@ static struct soundQuality_t {
- (IBAction)cancel:(id)sender - (IBAction)cancel:(id)sender
{ {
[NSApp abortModal]; [nsapp abortModal];
} }
- (IBAction)start:(id)sender - (IBAction)start:(id)sender
@ -217,7 +219,7 @@ static struct soundQuality_t {
settings.forcesetup = [alwaysShowButton state] == NSOnState; settings.forcesetup = [alwaysShowButton state] == NSOnState;
[NSApp stopModal]; [nsapp stopModal];
} }
- (void)setupRunMode - (void)setupRunMode
@ -305,6 +307,12 @@ static StartupWinController *startwin = nil;
int startwin_open(void) int startwin_open(void)
{ {
// PK: is this the entry point?
// fix for "ld: absolute address to symbol _NSApp in a different linkage unit not supported"
// (OS X 10.6) when building for PPC
nsapp = [NSApplication sharedApplication];
if (startwin != nil) return 1; if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"];
@ -412,7 +420,7 @@ int startwin_run(void)
[startwin setupRunMode]; [startwin setupRunMode];
switch ([NSApp runModalForWindow:[startwin window]]) { switch ([nsapp runModalForWindow:[startwin window]]) {
case NSRunStoppedResponse: retval = 1; break; case NSRunStoppedResponse: retval = 1; break;
case NSRunAbortedResponse: retval = 0; break; case NSRunAbortedResponse: retval = 0; break;
default: retval = -1; default: retval = -1;

View file

@ -2,6 +2,8 @@
#include "baselayer.h" #include "baselayer.h"
static id nsapp;
@interface StartupWinController : NSWindowController @interface StartupWinController : NSWindowController
{ {
IBOutlet NSButton *alwaysShowButton; IBOutlet NSButton *alwaysShowButton;
@ -39,13 +41,13 @@
- (IBAction)cancel:(id)sender - (IBAction)cancel:(id)sender
{ {
[NSApp abortModal]; [nsapp abortModal];
} }
- (IBAction)start:(id)sender - (IBAction)start:(id)sender
{ {
// XXX: write the states of the form controls to their respective homes // XXX: write the states of the form controls to their respective homes
[NSApp stopModal]; [nsapp stopModal];
} }
- (void)setupRunMode - (void)setupRunMode
@ -114,6 +116,8 @@ static StartupWinController *startwin = nil;
int startwin_open(void) int startwin_open(void)
{ {
nsapp = [NSApplication sharedApplication];
if (startwin != nil) return 1; if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"];
@ -177,7 +181,7 @@ int startwin_run(void)
[startwin setupRunMode]; [startwin setupRunMode];
switch ([NSApp runModalForWindow:[startwin window]]) { switch ([nsapp runModalForWindow:[startwin window]]) {
case NSRunStoppedResponse: retval = 1; break; case NSRunStoppedResponse: retval = 1; break;
case NSRunAbortedResponse: retval = 0; break; case NSRunAbortedResponse: retval = 0; break;
default: retval = -1; default: retval = -1;