Mac can toggle emulation pause state

This commit is contained in:
Aaron Culliney 2014-10-25 13:51:32 -07:00
parent 0eeb93820c
commit ec0af686b2

View File

@ -25,6 +25,7 @@
@property (assign) IBOutlet EmulatorGLView *view;
@property (assign) IBOutlet NSWindow *disksWindow;
@property (assign) IBOutlet NSWindow *prefsWindow;
@property (assign) IBOutlet NSMenuItem *pauseMenuItem;
@property (nonatomic, retain) EmulatorFullscreenWindow *fullscreenWindow;
@property (nonatomic, retain) NSWindow *standardWindow;
@ -80,6 +81,30 @@
timing_toggle_cpu_speed();
}
- (IBAction)togglePause:(id)sender
{
NSAssert(pthread_main_np(), @"Pause emulation called from non-main thread");
static BOOL paused = NO;
if (paused)
{
[[self pauseMenuItem] setTitle:@"Pause Emulation"];
#ifdef AUDIO_ENABLED
SoundSystemUnpause();
#endif
pthread_mutex_unlock(&interface_mutex);
paused = NO;
}
else
{
paused = YES;
[[self pauseMenuItem] setTitle:@"Resume Emulation"];
pthread_mutex_lock(&interface_mutex);
#ifdef AUDIO_ENABLED
SoundSystemPause();
#endif
}
}
- (void)goFullscreen
{
// If app is already fullscreen...