Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 08, 2013
@bradallred bradallred Mac GUI: shutdownLogging should always get called on termination 92268da
@bradallred bradallred Mac GUI: dont let users attempt to relaunch if gemrb is already running b2a7d52
@bradallred bradallred Mac GUI: let the current run loop iteration finish
before attempting to launch gemrb. fixes the launch button being "stuck"
also much more appropriate (backtrace will be cleaner/shorter etc)
81d9b1a
@bradallred bradallred Mac GUI: add pereference for terminating when game window closes
currently disabled since GemRB will crash horribly if it is relaunched due to things like plugins not being unloaded/reinitialized
fed83e6
View
25 apple/CocoaWrapper/mac/CocoaWrapper.mm
@@ -76,8 +76,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *) __un
- (void)applicationWillTerminate:(NSNotification *) __unused aNotification
{
- //override this method using plugin categories.
- NSLog(@"Application terminate");
+ ShutdownLogging();
}
// always called before openFile when launched via CLI/DragDrop
@@ -139,8 +138,18 @@ - (IBAction)openGame:(id) __unused sender
}
}
-- (IBAction)launchGame:(id) __unused sender
+- (IBAction)launchGame:(id) sender
{
+ if (core) {
+ Log(FATAL, "Launch Game", "GemRB game is currently running. Please close it before trying to open another.");
+ return;
+ }
+ if (sender) {
+ // Note: use NSRunLoop over NSObject performSelector!
+ [[NSRunLoop mainRunLoop] performSelector:@selector(launchGame:) target:self argument:nil order:0 modes:@[NSDefaultRunLoopMode]];
+ return;
+ }
+
core = new Interface();
InterfaceConfig* config = new InterfaceConfig(0, NULL);
@@ -179,6 +188,7 @@ - (IBAction)launchGame:(id) __unused sender
if ((status = core->Init(config)) == GEM_ERROR) {
delete config;
delete( core );
+ core = NULL;
Log(MESSAGE, "Cocoa Wrapper", "Unable to initialize core. Terminating.");
} else {
[_configWindow close];
@@ -186,12 +196,11 @@ - (IBAction)launchGame:(id) __unused sender
delete config;
core->Main();
delete( core );
- ShutdownLogging();
- // We must exit since the application runloop never returns.
+ core = NULL;
- // TODO: we want to be able to use NSApplication terminate method
- // need fancier logic in shouldTerminate implementation first (in SDL plugin)
- exit(status);
+ if ([defaults boolForKey:@"TerminateOnClose"]) {
+ [NSApp terminate:self];
+ }
}
}
View
67 apple/CocoaWrapper/mac/nibs/GemRB.xib
@@ -1127,13 +1127,40 @@
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
+ <object class="NSButton" id="416601842">
+ <reference key="NSNextResponder" ref="570115299"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{15, 11}, {92, 18}}</string>
+ <reference key="NSSuperview" ref="570115299"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="233382348"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="289503993">
+ <int key="NSCellFlags">-1543503872</int>
+ <int key="NSCellFlags2">268566528</int>
+ <string key="NSContents">Exit on Close</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSCellIdentifier">_NS:9</string>
+ <reference key="NSControlView" ref="416601842"/>
+ <int key="NSButtonFlags">1211912448</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="19498200"/>
+ <reference key="NSAlternateImage" ref="233505524"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+ </object>
<object class="NSTextField" id="229843470">
<reference key="NSNextResponder" ref="570115299"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{58, 35}, {65, 19}}</string>
<reference key="NSSuperview" ref="570115299"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="233382348"/>
+ <reference key="NSNextKeyView" ref="416601842"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="609783267">
@@ -2183,6 +2210,26 @@
</object>
<int key="connectionID">1139</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.TerminateOnClose</string>
+ <reference key="source" ref="416601842"/>
+ <reference key="destination" ref="385123273"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="416601842"/>
+ <reference key="NSDestination" ref="385123273"/>
+ <string key="NSLabel">value: values.TerminateOnClose</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.TerminateOnClose</string>
+ <object class="NSDictionary" key="NSOptions">
+ <string key="NS.key.0">NSConditionallySetsEnabled</string>
+ <boolean value="NO" key="NS.object.0"/>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1144</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -2896,6 +2943,7 @@
<reference ref="586782438"/>
<reference ref="229843470"/>
<reference ref="772391111"/>
+ <reference ref="416601842"/>
</array>
<reference key="parent" ref="414427165"/>
</object>
@@ -3110,6 +3158,19 @@
<reference key="object" ref="912238578"/>
<reference key="parent" ref="160487778"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1140</int>
+ <reference key="object" ref="416601842"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="289503993"/>
+ </array>
+ <reference key="parent" ref="332651215"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1141</int>
+ <reference key="object" ref="289503993"/>
+ <reference key="parent" ref="416601842"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -3142,6 +3203,8 @@
<string key="1133.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1137.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1138.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="1140.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="1141.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="125.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="126.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3257,7 +3320,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">1139</int>
+ <int key="maxID">1144</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
View
2  apple/defaults.plist
@@ -20,6 +20,8 @@
<integer>480</integer>
<key>GameType</key>
<string>auto</string>
+ <key>TerminateOnClose</key>
+ <true/>
<key>AdditionalPaths</key>
<dict>
<key>CustomFontPath</key>

No commit comments for this range

Something went wrong with that request. Please try again.