diff --git a/OpenRA.Launcher.Mac/Controller.h b/OpenRA.Launcher.Mac/Controller.h index 4d0fc23193..b7ecca9b7d 100644 --- a/OpenRA.Launcher.Mac/Controller.h +++ b/OpenRA.Launcher.Mac/Controller.h @@ -9,10 +9,13 @@ #import @class ModEntry; +@class GameInstall; @interface Controller : NSObject { ModEntry *sidebarItems; + GameInstall *game; IBOutlet NSOutlineView *outlineView; } - (ModEntry *)modTree; +- (IBAction)launchGame:(id)sender; @end diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m index 42a81dcea8..10a17ece8f 100644 --- a/OpenRA.Launcher.Mac/Controller.m +++ b/OpenRA.Launcher.Mac/Controller.m @@ -8,6 +8,7 @@ #import "Controller.h" #import "ModEntry.h" +#import "GameInstall.h" #import "ImageAndTextCell.h" @implementation Controller @@ -24,6 +25,8 @@ [outlineView reloadData]; [outlineView expandItem:[outlineView itemAtRow:1] expandChildren:YES]; [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO]; + + game = [[GameInstall alloc] initWithPath:@"/Users/paul/src/OpenRA"]; } - (void) dealloc @@ -110,4 +113,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn } } } + +- (IBAction)launchGame:(id)sender +{ + [game launchGame]; +} @end diff --git a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib index 5e7bf36e3b..77f762be9e 100644 --- a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib +++ b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib @@ -12,7 +12,7 @@ YES - + @@ -337,7 +337,7 @@ 337772096 2048 Text Cell - + LucidaGrande 13 1044 @@ -443,6 +443,29 @@ 256 + + YES + + + 268 + {{383, 15}, {111, 27}} + + YES + + -2080244224 + 134217728 + GO! + + + -2033434369 + 160 + + + 400 + 75 + + + {{146, 0}, {513, 469}} 2 @@ -585,6 +608,14 @@ 585 + + + launchGame: + + + + 588 + @@ -820,6 +851,7 @@ YES + @@ -881,6 +913,20 @@ + + 586 + + + YES + + + + + + 587 + + + @@ -959,6 +1005,9 @@ 579.IBPluginDependency 58.IBPluginDependency 58.ImportedFromIB2 + 586.IBPluginDependency + 586.IBViewBoundsToFrameTransform + 587.IBPluginDependency 92.IBPluginDependency 92.ImportedFromIB2 @@ -1039,6 +1088,11 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDnQAAw6CAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -1058,7 +1112,7 @@ - 585 + 588 @@ -1066,6 +1120,17 @@ Controller NSObject + + launchGame: + id + + + launchGame: + + launchGame: + id + + outlineView NSOutlineView @@ -1155,6 +1220,22 @@ AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + NSCell NSObject diff --git a/OpenRA.Launcher.Mac/GameInstall.h b/OpenRA.Launcher.Mac/GameInstall.h new file mode 100644 index 0000000000..aec58557b5 --- /dev/null +++ b/OpenRA.Launcher.Mac/GameInstall.h @@ -0,0 +1,18 @@ +// +// GameInstall.h +// OpenRA +// +// Created by Paul Chote on 15/11/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface GameInstall : NSObject { + NSString *gamePath; +} + +-(id)initWithPath:(NSString *)path; +-(void)launchGame; +@end diff --git a/OpenRA.Launcher.Mac/GameInstall.m b/OpenRA.Launcher.Mac/GameInstall.m new file mode 100644 index 0000000000..a41607e31c --- /dev/null +++ b/OpenRA.Launcher.Mac/GameInstall.m @@ -0,0 +1,52 @@ +// +// GameInstall.m +// OpenRA +// +// Created by Paul Chote on 15/11/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "GameInstall.h" + + +@implementation GameInstall + +-(id)initWithPath:(NSString *)path +{ + self = [super init]; + if (self != nil) + { + NSLog(@"creating game at path %@",path); + + gamePath = path; + } + return self; +} + +-(void)launchGame +{ + // Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6 + NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"OpenRA.app/Contents/MacOS/OpenRA"]; + NSArray *args = [NSArray arrayWithObjects:gamePath, @"mono", @"--debug", @"OpenRA.Game.exe", @"Game.Mods=ra",nil]; + + FSRef appRef; + CFURLGetFSRef((CFURLRef)[NSURL URLWithString:path], &appRef); + + // Set the launch parameters + LSApplicationParameters params; + params.version = 0; + params.flags = kLSLaunchDefaults; + params.application = &appRef; + params.asyncLaunchRefCon = NULL; + params.environment = NULL; // CFDictionaryRef of environment variables; could be useful + params.argv = (CFArrayRef)args; + params.initialEvent = NULL; + + ProcessSerialNumber psn; + OSStatus err = LSOpenApplication(¶ms, &psn); + + // Bring the game window to the front + if (err == noErr) + SetFrontProcess(&psn); +} +@end diff --git a/OpenRA.Launcher.Mac/OpenRA-Info.plist b/OpenRA.Launcher.Mac/OpenRA-Info.plist index 8524368158..1fa4f51735 100644 --- a/OpenRA.Launcher.Mac/OpenRA-Info.plist +++ b/OpenRA.Launcher.Mac/OpenRA-Info.plist @@ -5,15 +5,17 @@ CFBundleDevelopmentRegion English CFBundleExecutable - ${EXECUTABLE_NAME} + OpenRA CFBundleIconFile OpenRA.icns + CFBundleName + OpenRA Launcher + CFBundleDisplayName + OpenRA Launcher CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + org.open-ra.launcher.mac CFBundleInfoDictionaryVersion 6.0 - CFBundleName - ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString diff --git a/OpenRA.Launcher.Mac/OpenRA.app/Contents/Info.plist b/OpenRA.Launcher.Mac/OpenRA.app/Contents/Info.plist new file mode 100755 index 0000000000..5b8182b3f7 --- /dev/null +++ b/OpenRA.Launcher.Mac/OpenRA.app/Contents/Info.plist @@ -0,0 +1,12 @@ + + + + + CFBundleIdentifier + OpenRA + CFBundleExecutable + OpenRA + CFBundleIconFile + OpenRA.icns + + diff --git a/OpenRA.Launcher.Mac/OpenRA.app/Contents/MacOS/OpenRA b/OpenRA.Launcher.Mac/OpenRA.app/Contents/MacOS/OpenRA new file mode 100755 index 0000000000..a9eb1fd6d0 --- /dev/null +++ b/OpenRA.Launcher.Mac/OpenRA.app/Contents/MacOS/OpenRA @@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright 2007-2010 The OpenRA Developers (see AUTHORS) +# This file is part of OpenRA, which is free software. It is made +# available to you under the terms of the GNU General Public License +# as published by the Free Software Foundation. For more information, +# see LICENSE. + +echo "Launching OpenRA from $1" +cd $1 +${@:2} \ No newline at end of file diff --git a/OpenRA.Launcher.Mac/OpenRA.app/Contents/Resources/OpenRA.icns b/OpenRA.Launcher.Mac/OpenRA.app/Contents/Resources/OpenRA.icns new file mode 120000 index 0000000000..5b28bc3de3 --- /dev/null +++ b/OpenRA.Launcher.Mac/OpenRA.app/Contents/Resources/OpenRA.icns @@ -0,0 +1 @@ +../../../OpenRA.icns \ No newline at end of file diff --git a/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj b/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj index 249a805b13..b84f0cecd1 100644 --- a/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj +++ b/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ DA81FAAA1290FA0000C48F2F /* ModEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FAA91290FA0000C48F2F /* ModEntry.m */; }; DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */; }; DA81FBDC12910E4900C48F2F /* OpenRA.icns in Resources */ = {isa = PBXBuildFile; fileRef = DA81FBDB12910E4900C48F2F /* OpenRA.icns */; }; + DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FC3E12911E2B00C48F2F /* GameInstall.m */; }; + DA9292C81291DF2D00EDB02E /* OpenRA.app in Resources */ = {isa = PBXBuildFile; fileRef = DA9292C71291DF2D00EDB02E /* OpenRA.app */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -38,6 +40,9 @@ DA81FB9112910A8B00C48F2F /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = ""; }; DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = ""; }; DA81FBDB12910E4900C48F2F /* OpenRA.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRA.icns; sourceTree = ""; }; + DA81FC3D12911E2B00C48F2F /* GameInstall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameInstall.h; sourceTree = ""; }; + DA81FC3E12911E2B00C48F2F /* GameInstall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameInstall.m; sourceTree = ""; }; + DA9292C71291DF2D00EDB02E /* OpenRA.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = OpenRA.app; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,6 +68,8 @@ DA81FA811290F5C800C48F2F /* Controller.m */, DA81FAA81290FA0000C48F2F /* ModEntry.h */, DA81FAA91290FA0000C48F2F /* ModEntry.m */, + DA81FC3D12911E2B00C48F2F /* GameInstall.h */, + DA81FC3E12911E2B00C48F2F /* GameInstall.m */, ); name = Classes; sourceTree = ""; @@ -117,6 +124,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + DA9292C71291DF2D00EDB02E /* OpenRA.app */, DA81FBDB12910E4900C48F2F /* OpenRA.icns */, 8D1107310486CEB800E47090 /* OpenRA-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, @@ -187,6 +195,7 @@ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, DA81FBDC12910E4900C48F2F /* OpenRA.icns in Resources */, + DA9292C81291DF2D00EDB02E /* OpenRA.app in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -202,6 +211,7 @@ DA81FA821290F5C800C48F2F /* Controller.m in Sources */, DA81FAAA1290FA0000C48F2F /* ModEntry.m in Sources */, DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */, + DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj b/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj index 34b8ca0e74..fb99b99376 100644 --- a/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj +++ b/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj @@ -159,7 +159,14 @@ isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "OpenRA" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* OpenRA */; projectDirPath = ""; projectRoot = "";