(OSX) Start RGUI loaded without a file; allow opening new files without manually closing the old one

This commit is contained in:
meancoot 2013-07-07 20:52:27 -04:00
parent 1b0e86f5af
commit 42b5f47400

View File

@ -124,14 +124,15 @@ void apple_rarch_exited(void* result)
if (result) if (result)
apple_display_alert(@"Failed to load game.", 0); apple_display_alert(@"Failed to load game.", 0);
RAModuleInfo* used_core = apple_core;
apple_core = nil;
if (apple_is_running) if (apple_is_running)
{ {
[apple_platform unloadingCore:apple_core];
apple_is_running = false; apple_is_running = false;
[apple_platform unloadingCore:used_core];
} }
apple_core = nil;
if (use_tv_mode) if (use_tv_mode)
apple_run_core(nil, 0); apple_run_core(nil, 0);
} }
@ -486,7 +487,10 @@ int main(int argc, char *argv[])
@implementation RetroArch_OSX @implementation RetroArch_OSX
{ {
NSWindow IBOutlet* _coreSelectSheet; NSWindow IBOutlet* _coreSelectSheet;
bool _wantReload;
NSString* _file; NSString* _file;
RAModuleInfo* _core;
} }
+ (RetroArch_OSX*)get + (RetroArch_OSX*)get
@ -498,9 +502,6 @@ int main(int argc, char *argv[])
{ {
apple_platform = self; apple_platform = self;
if (!apple_is_running)
[self openDocument:nil];
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
window.backgroundColor = [NSColor blackColor]; window.backgroundColor = [NSColor blackColor];
@ -511,12 +512,15 @@ int main(int argc, char *argv[])
[window makeFirstResponder:RAGameView.get]; [window makeFirstResponder:RAGameView.get];
// Create core select list
NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1]; NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1];
for (RAModuleInfo* i in RAModuleInfo.getModules) for (RAModuleInfo* i in RAModuleInfo.getModules)
{
[cb addItemWithObjectValue:i]; [cb addItemWithObjectValue:i];
}
// Run RGUI if needed
if (!apple_is_running)
apple_run_core(nil, 0);
} }
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
@ -574,8 +578,15 @@ int main(int argc, char *argv[])
[_coreSelectSheet orderOut:self]; [_coreSelectSheet orderOut:self];
NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1]; NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1];
RAModuleInfo* module = (RAModuleInfo*)cb.objectValueOfSelectedItem; _core = (RAModuleInfo*)cb.objectValueOfSelectedItem;
apple_run_core(module, _file.UTF8String);
if (!apple_is_running)
apple_run_core(_core, _file.UTF8String);
else
{
_wantReload = true;
apple_frontend_post_event(event_basic_command, (void*)QUIT);
}
} }
#pragma mark RetroArch_Platform #pragma mark RetroArch_Platform
@ -587,6 +598,10 @@ int main(int argc, char *argv[])
- (void)unloadingCore:(RAModuleInfo*)core - (void)unloadingCore:(RAModuleInfo*)core
{ {
if (_wantReload)
apple_run_core(_core, _file.UTF8String);
_wantReload = false;
} }
- (NSString*)retroarchConfigPath - (NSString*)retroarchConfigPath