diff --git a/desmume/src/frontend/cocoa/ClientExecutionControl.cpp b/desmume/src/frontend/cocoa/ClientExecutionControl.cpp
index e3866bfd6..d519f0cd0 100644
--- a/desmume/src/frontend/cocoa/ClientExecutionControl.cpp
+++ b/desmume/src/frontend/cocoa/ClientExecutionControl.cpp
@@ -81,7 +81,8 @@ ClientExecutionControl::ClientExecutionControl()
_settingsPending.executionSpeed = SPEED_SCALAR_NORMAL;
_settingsPending.enableFrameSkip = true;
- _settingsPending.frameJumpTarget = 0;
+ _settingsPending.frameJumpRelativeTarget = 60;
+ _settingsPending.frameJumpTarget = 60;
_settingsPending.execBehavior = ExecutionBehavior_Pause;
_settingsPending.jumpBehavior = FrameJumpBehavior_Forward;
@@ -672,6 +673,24 @@ void ClientExecutionControl::ResetFramesToSkip()
pthread_mutex_unlock(&this->_mutexSettingsPendingOnNDSExec);
}
+uint64_t ClientExecutionControl::GetFrameJumpRelativeTarget()
+{
+ pthread_mutex_lock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+ const uint64_t jumpTarget = this->_settingsPending.frameJumpRelativeTarget;
+ pthread_mutex_unlock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+
+ return jumpTarget;
+}
+
+void ClientExecutionControl::SetFrameJumpRelativeTarget(uint64_t newRelativeTarget)
+{
+ pthread_mutex_lock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+ this->_settingsPending.frameJumpRelativeTarget = newRelativeTarget;
+
+ this->_newSettingsPendingOnExecutionLoopStart = true;
+ pthread_mutex_unlock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+}
+
uint64_t ClientExecutionControl::GetFrameJumpTarget()
{
pthread_mutex_lock(&this->_mutexSettingsPendingOnExecutionLoopStart);
@@ -729,12 +748,20 @@ void ClientExecutionControl::SetExecutionBehavior(ExecutionBehavior newBehavior)
FrameJumpBehavior ClientExecutionControl::GetFrameJumpBehavior()
{
- return this->_settingsPending.jumpBehavior;
+ pthread_mutex_lock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+ const FrameJumpBehavior jumpBehavior = this->_settingsPending.jumpBehavior;
+ pthread_mutex_unlock(&this->_mutexSettingsPendingOnExecutionLoopStart);
+
+ return jumpBehavior;
}
void ClientExecutionControl::SetFrameJumpBehavior(FrameJumpBehavior newBehavior)
{
+ pthread_mutex_lock(&this->_mutexSettingsPendingOnExecutionLoopStart);
this->_settingsPending.jumpBehavior = newBehavior;
+
+ this->_newSettingsPendingOnExecutionLoopStart = true;
+ pthread_mutex_unlock(&this->_mutexSettingsPendingOnExecutionLoopStart);
}
void ClientExecutionControl::ApplySettingsOnReset()
@@ -821,7 +848,24 @@ void ClientExecutionControl::ApplySettingsOnExecutionLoopStart()
this->_settingsApplied.enableExecutionSpeedLimiter = this->_settingsPending.enableExecutionSpeedLimiter;
this->_settingsApplied.executionSpeed = speedScalar;
- this->_settingsApplied.frameJumpTarget = this->_settingsPending.frameJumpTarget;
+ this->_settingsApplied.jumpBehavior = this->_settingsPending.jumpBehavior;
+ this->_settingsApplied.frameJumpRelativeTarget = this->_settingsPending.frameJumpRelativeTarget;
+
+ switch (this->_settingsApplied.jumpBehavior)
+ {
+ case FrameJumpBehavior_Forward:
+ this->_settingsApplied.frameJumpTarget = this->_ndsFrameInfo.frameIndex + this->_settingsApplied.frameJumpRelativeTarget;
+ break;
+
+ case FrameJumpBehavior_NextMarker:
+ // TODO: Support frame markers in replays.
+ break;
+
+ case FrameJumpBehavior_ToFrame:
+ default:
+ this->_settingsApplied.frameJumpTarget = this->_settingsPending.frameJumpTarget;
+ break;
+ }
const bool needBehaviorChange = (this->_settingsApplied.execBehavior != this->_settingsPending.execBehavior);
if (needBehaviorChange)
@@ -1380,6 +1424,15 @@ const NDSFrameInfo& ClientExecutionControl::GetNDSFrameInfo()
return this->_ndsFrameInfo;
}
+uint64_t ClientExecutionControl::GetFrameIndex()
+{
+ pthread_mutex_lock(&this->_mutexOutputPostNDSExec);
+ const uint64_t frameIndex = this->_ndsFrameInfo.frameIndex;
+ pthread_mutex_unlock(&this->_mutexOutputPostNDSExec);
+
+ return frameIndex;
+}
+
double ClientExecutionControl::GetFrameTime()
{
return this->_frameTime;
diff --git a/desmume/src/frontend/cocoa/ClientExecutionControl.h b/desmume/src/frontend/cocoa/ClientExecutionControl.h
index 2254d8a3d..40158c142 100644
--- a/desmume/src/frontend/cocoa/ClientExecutionControl.h
+++ b/desmume/src/frontend/cocoa/ClientExecutionControl.h
@@ -345,6 +345,7 @@ struct ClientExecutionControlSettings
double executionSpeed;
bool enableFrameSkip;
+ uint64_t frameJumpRelativeTarget;
uint64_t frameJumpTarget;
ExecutionBehavior execBehavior;
@@ -569,6 +570,9 @@ public:
void SetFramesToSkip(uint8_t numFrames);
void ResetFramesToSkip();
+ uint64_t GetFrameJumpRelativeTarget();
+ void SetFrameJumpRelativeTarget(uint64_t newRelativeTarget);
+
uint64_t GetFrameJumpTarget();
uint64_t GetFrameJumpTargetApplied();
void SetFrameJumpTarget(uint64_t newJumpTarget);
@@ -613,6 +617,7 @@ public:
void FetchOutputPostNDSExec();
const NDSFrameInfo& GetNDSFrameInfo();
+ uint64_t GetFrameIndex();
double GetFrameTime();
uint8_t CalculateFrameSkip(double startAbsoluteTime, double frameAbsoluteTime);
diff --git a/desmume/src/frontend/cocoa/cocoa_core.h b/desmume/src/frontend/cocoa/cocoa_core.h
index d7f20007a..2c9ce2328 100644
--- a/desmume/src/frontend/cocoa/cocoa_core.h
+++ b/desmume/src/frontend/cocoa/cocoa_core.h
@@ -88,6 +88,10 @@ typedef struct
@property (assign) BOOL isCheatingEnabled;
@property (assign) CGFloat speedScalar;
+@property (assign) NSInteger frameJumpBehavior;
+@property (assign) NSUInteger frameJumpNumberFramesForward;
+@property (assign) NSUInteger frameJumpToFrameIndex;
+
@property (assign) BOOL isGdbStubStarted;
@property (assign) BOOL isInDebugTrap;
@property (assign) BOOL enableGdbStubARM9;
@@ -130,8 +134,6 @@ typedef struct
- (void) reset;
- (void) getTimedEmulatorStatistics:(NSTimer *)timer;
- (NSUInteger) frameNumber;
-- (void) frameJumpTo:(NSUInteger)targetFrameNum;
-- (void) frameJump:(NSUInteger)relativeFrameNum;
- (void) addOutput:(CocoaDSOutput *)theOutput;
- (void) removeOutput:(CocoaDSOutput *)theOutput;
diff --git a/desmume/src/frontend/cocoa/cocoa_core.mm b/desmume/src/frontend/cocoa/cocoa_core.mm
index 0e93645e5..a9d5ca5dd 100644
--- a/desmume/src/frontend/cocoa/cocoa_core.mm
+++ b/desmume/src/frontend/cocoa/cocoa_core.mm
@@ -89,6 +89,10 @@ volatile bool execute = true;
@dynamic isCheatingEnabled;
@dynamic speedScalar;
+@dynamic frameJumpBehavior;
+@dynamic frameJumpNumberFramesForward;
+@dynamic frameJumpToFrameIndex;
+
@dynamic isGdbStubStarted;
@dynamic isInDebugTrap;
@synthesize enableGdbStubARM9;
@@ -300,6 +304,40 @@ volatile bool execute = true;
return scalar;
}
+- (void) setFrameJumpBehavior:(NSInteger)theBehavior
+{
+ execControl->SetFrameJumpBehavior((FrameJumpBehavior)theBehavior);
+}
+
+- (NSInteger) frameJumpBehavior
+{
+ const NSInteger theBehavior = (NSInteger)execControl->GetFrameJumpBehavior();
+ return theBehavior;
+}
+
+- (void) setFrameJumpNumberFramesForward:(NSUInteger)numberFrames
+{
+ execControl->SetFrameJumpRelativeTarget((uint64_t)numberFrames);
+ [self setFrameJumpToFrameIndex:[self frameNumber] + numberFrames];
+}
+
+- (NSUInteger) frameJumpNumberFramesForward
+{
+ const NSUInteger numberFrames = execControl->GetFrameJumpRelativeTarget();
+ return numberFrames;
+}
+
+- (void) setFrameJumpToFrameIndex:(NSUInteger)frameIndex
+{
+ execControl->SetFrameJumpTarget((uint64_t)frameIndex);
+}
+
+- (NSUInteger) frameJumpToFrameIndex
+{
+ const NSUInteger frameIndex = execControl->GetFrameJumpTarget();
+ return frameIndex;
+}
+
- (void) setIsSpeedLimitEnabled:(BOOL)enable
{
execControl->SetEnableSpeedLimiter((enable) ? true : false);
@@ -557,6 +595,33 @@ volatile bool execute = true;
- (void) setCoreState:(NSInteger)coreState
{
+ if (coreState == ExecutionBehavior_FrameJump)
+ {
+ uint64_t frameIndex = [self frameNumber];
+
+ switch ([self frameJumpBehavior])
+ {
+ case FrameJumpBehavior_Forward:
+ [self setFrameJumpToFrameIndex:[self frameJumpNumberFramesForward] + frameIndex];
+ break;
+
+ case FrameJumpBehavior_NextMarker:
+ // TODO: Support frame jumping to replay markers.
+ break;
+
+ case FrameJumpBehavior_ToFrame:
+ default:
+ break;
+ }
+
+ uint64_t jumpTarget = [self frameJumpToFrameIndex];
+
+ if (frameIndex >= jumpTarget)
+ {
+ return;
+ }
+ }
+
pthread_mutex_lock(&threadParam.mutexThreadExecute);
execControl->SetExecutionBehavior((ExecutionBehavior)coreState);
@@ -572,7 +637,7 @@ volatile bool execute = true;
[cdsOutput setIdle:YES];
}
- [self setFrameStatus:[NSString stringWithFormat:@"%lu", (unsigned long)[self frameNumber]]];
+ [self setFrameStatus:[NSString stringWithFormat:@"%llu", (unsigned long long)[self frameNumber]]];
[_fpsTimer invalidate];
_fpsTimer = nil;
break;
@@ -585,7 +650,7 @@ volatile bool execute = true;
[cdsOutput setIdle:NO];
}
- [self setFrameStatus:[NSString stringWithFormat:@"%lu", (unsigned long)[self frameNumber]]];
+ [self setFrameStatus:[NSString stringWithFormat:@"%llu", (unsigned long long)[self frameNumber]]];
[_fpsTimer invalidate];
_fpsTimer = nil;
break;
@@ -625,7 +690,7 @@ volatile bool execute = true;
}
}
- [self setFrameStatus:[NSString stringWithFormat:@"Jumping to frame %lu.", (unsigned long)execControl->GetFrameJumpTarget()]];
+ [self setFrameStatus:[NSString stringWithFormat:@"Jumping to frame %llu.", (unsigned long long)execControl->GetFrameJumpTarget()]];
[_fpsTimer invalidate];
_fpsTimer = nil;
break;
@@ -810,26 +875,7 @@ volatile bool execute = true;
- (NSUInteger) frameNumber
{
- pthread_rwlock_rdlock(&threadParam.rwlockCoreExecute);
- const NSUInteger currFrameNum = currFrameCounter;
- pthread_rwlock_unlock(&threadParam.rwlockCoreExecute);
-
- return currFrameNum;
-}
-
-- (void) frameJumpTo:(NSUInteger)targetFrameNum
-{
- execControl->SetFrameJumpTarget(targetFrameNum);
-
- if (targetFrameNum > [self frameNumber])
- {
- [self setCoreState:ExecutionBehavior_FrameJump];
- }
-}
-
-- (void) frameJump:(NSUInteger)relativeFrameNum
-{
- [self frameJumpTo:[self frameNumber] + relativeFrameNum];
+ return (NSUInteger)execControl->GetFrameIndex();
}
- (void) addOutput:(CocoaDSOutput *)theOutput
diff --git a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.strings b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.strings
index cf2c46a80..7525a3a6a 100644
Binary files a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.strings and b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.strings differ
diff --git a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib
index 90174df82..a52ba3789 100644
--- a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib
+++ b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib
@@ -12,6 +12,8 @@
9093
-
-
- selectedTag: selection.frameJumpType
-
-
-
-
-
- selectedTag: selection.frameJumpType
- selectedTag
- selection.frameJumpType
- 2
-
-
- 9096
-
-
-
- value: selection.frameJumpFramesForward
-
-
-
-
-
- value: selection.frameJumpFramesForward
- value
- selection.frameJumpFramesForward
- 2
-
-
- 9097
-
-
-
- value: selection.frameJumpToFrame
-
-
-
-
-
- value: selection.frameJumpToFrame
- value
- selection.frameJumpToFrame
- 2
-
-
- 9098
-
executionControlWindow
@@ -44593,6 +44501,54 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
10510
+
+
+ selectedTag: selection.frameJumpBehavior
+
+
+
+
+
+ selectedTag: selection.frameJumpBehavior
+ selectedTag
+ selection.frameJumpBehavior
+ 2
+
+
+ 10512
+
+
+
+ value: selection.frameJumpNumberFramesForward
+
+
+
+
+
+ value: selection.frameJumpNumberFramesForward
+ value
+ selection.frameJumpNumberFramesForward
+ 2
+
+
+ 10514
+
+
+
+ value: selection.frameJumpToFrameIndex
+
+
+
+
+
+ value: selection.frameJumpToFrameIndex
+ value
+ selection.frameJumpToFrameIndex
+ 2
+
+
+ 10516
+
@@ -55502,18 +55458,12 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
YES
-
-
- 9038
-
-
-
9037
@@ -62868,7 +62818,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
9035.IBPluginDependency
9036.IBPluginDependency
9037.IBPluginDependency
- 9038.IBPluginDependency
9039.IBPluginDependency
904.IBPluginDependency
9040.IBPluginDependency
@@ -64431,7 +64380,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- {{329, 836}, {512, 20}}
+ {{380, 836}, {512, 20}}
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -65556,7 +65505,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- {{599, 423}, {257, 413}}
+ {{568, 423}, {257, 413}}
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -66765,9 +66714,9 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- {{307, 556}, {254, 262}}
+ {{898, 620}, {254, 242}}
com.apple.InterfaceBuilder.CocoaPlugin
- {{307, 556}, {254, 262}}
+ {{898, 620}, {254, 242}}
com.apple.InterfaceBuilder.CocoaPlugin
@@ -66871,7 +66820,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -67353,7 +67301,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
- 10510
+ 10516
diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm
index bd04bdadb..dbe15ce86 100644
--- a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm
+++ b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm
@@ -1596,17 +1596,18 @@ static std::unordered_map _screenMap; //
{
BOOL enable = YES;
const SEL theAction = [theItem action];
+ CocoaDSCore *cdsCore = (CocoaDSCore *)[[emuControl cdsCoreController] content];
if (theAction == @selector(toggleExecutePause:))
{
- if (![emuControl masterExecuteFlag] ||
+ if (![cdsCore masterExecute] ||
[emuControl currentRom] == nil ||
[emuControl isUserInterfaceBlockingExecution])
{
enable = NO;
}
- if ([emuControl executionState] == ExecutionBehavior_Pause)
+ if ([cdsCore coreState] == ExecutionBehavior_Pause)
{
[theItem setLabel:NSSTRING_TITLE_EXECUTE_CONTROL];
[theItem setImage:[emuControl iconExecute]];
@@ -1619,10 +1620,10 @@ static std::unordered_map _screenMap; //
}
else if (theAction == @selector(frameAdvance:))
{
- if (![emuControl masterExecuteFlag] ||
+ if (![cdsCore masterExecute] ||
[emuControl currentRom] == nil ||
[emuControl isUserInterfaceBlockingExecution] ||
- [emuControl executionState] != ExecutionBehavior_Pause)
+ [cdsCore coreState] != ExecutionBehavior_Pause)
{
enable = NO;
}
@@ -1636,7 +1637,7 @@ static std::unordered_map _screenMap; //
}
else if (theAction == @selector(changeCoreSpeed:))
{
- NSInteger speedScalar = (NSInteger)([emuControl speedScalar] * 100.0);
+ NSInteger speedScalar = (NSInteger)([cdsCore speedScalar] * 100.0);
if (speedScalar != (NSInteger)(SPEED_SCALAR_NORMAL * 100.0))
{
diff --git a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.h b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.h
index 742144723..65aef5bc2 100644
--- a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.h
+++ b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 DeSmuME Team
+ Copyright (C) 2013-2017 DeSmuME Team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,15 +77,9 @@ class AudioSampleBlockGenerator;
NSURL *currentSaveStateURL;
NSInteger selectedExportRomSaveID;
NSInteger selectedRomSaveTypeID;
- NSInteger frameJumpType;
- NSInteger frameJumpFramesForward;
- NSInteger frameJumpToFrame;
CGFloat lastSetSpeedScalar;
- BOOL isSoftwareMicActive;
BOOL isHardwareMicAvailable;
- BOOL isHardwareMicIdle;
- BOOL isHardwareMicInClip;
float currentMicGainValue;
BOOL isSoundMuted;
float lastSetVolumeValue;
@@ -143,18 +137,12 @@ class AudioSampleBlockGenerator;
@property (readonly) NSImage *iconSpeedNormal;
@property (readonly) NSImage *iconSpeedDouble;
-@property (readonly) BOOL masterExecuteFlag;
-@property (readonly) NSInteger executionState;
@property (readonly) CGFloat lastSetSpeedScalar;
-@property (readonly) CGFloat speedScalar;
@property (assign) BOOL isWorking;
@property (assign) BOOL isRomLoading;
@property (assign) NSString *statusText;
-@property (assign) BOOL isSoftwareMicActive;
@property (assign) BOOL isHardwareMicAvailable;
-@property (assign) BOOL isHardwareMicIdle;
-@property (assign) BOOL isHardwareMicInClip;
@property (assign) float currentMicGainValue;
@property (assign) float currentVolumeValue;
@property (retain) NSImage *currentMicStatusIcon;
@@ -165,9 +153,6 @@ class AudioSampleBlockGenerator;
@property (retain) NSURL *currentSaveStateURL;
@property (assign) NSInteger selectedExportRomSaveID;
@property (assign) NSInteger selectedRomSaveTypeID;
-@property (assign) NSInteger frameJumpType;
-@property (assign) NSInteger frameJumpFramesForward;
-@property (assign) NSInteger frameJumpToFrame;
@property (retain) DisplayWindowController *mainWindow;
@property (readonly) NSMutableArray *windowList;
diff --git a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm
index b9f4b99cc..a41dacc5b 100644
--- a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm
+++ b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm
@@ -66,18 +66,12 @@
@synthesize iconSpeedNormal;
@synthesize iconSpeedDouble;
-@dynamic masterExecuteFlag;
-@dynamic executionState;
@synthesize lastSetSpeedScalar;
-@dynamic speedScalar;
@synthesize isWorking;
@synthesize isRomLoading;
@synthesize statusText;
-@synthesize isSoftwareMicActive;
@synthesize isHardwareMicAvailable;
-@synthesize isHardwareMicIdle;
-@synthesize isHardwareMicInClip;
@synthesize currentMicGainValue;
@dynamic currentVolumeValue;
@synthesize currentMicStatusIcon;
@@ -90,9 +84,6 @@
@synthesize currentSaveStateURL;
@synthesize selectedExportRomSaveID;
@synthesize selectedRomSaveTypeID;
-@synthesize frameJumpType;
-@synthesize frameJumpFramesForward;
-@synthesize frameJumpToFrame;
@synthesize mainWindow;
@synthesize windowList;
@@ -129,15 +120,9 @@
currentSaveStateURL = nil;
selectedRomSaveTypeID = ROMSAVETYPE_AUTOMATIC;
selectedExportRomSaveID = 0;
- frameJumpType = FrameJumpBehavior_Forward;
- frameJumpFramesForward = 60;
- frameJumpToFrame = 0;
lastSetSpeedScalar = 1.0f;
- isSoftwareMicActive = NO;
isHardwareMicAvailable = NO;
- isHardwareMicIdle = YES;
- isHardwareMicInClip = NO;
currentMicGainValue = 0.0f;
isSoundMuted = NO;
lastSetVolumeValue = MAX_VOLUME;
@@ -282,24 +267,6 @@
return theSpeaker;
}
-- (BOOL) masterExecuteFlag
-{
- CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
- return [cdsCore masterExecute];
-}
-
-- (NSInteger) executionState
-{
- CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
- return [cdsCore coreState];
-}
-
-- (CGFloat) speedScalar
-{
- CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
- return [cdsCore speedScalar];
-}
-
- (void) setCurrentVolumeValue:(float)vol
{
currentVolumeValue = vol;
@@ -1119,7 +1086,7 @@
const float sineWaveFrequency = cmdAttr.floatValue[0];
[cdsController setSineWaveGeneratorFrequency:sineWaveFrequency];
- NSString *audioFilePath = cmdAttr.object[0];
+ NSString *audioFilePath = (NSString *)cmdAttr.object[0];
[cdsController setSelectedAudioFileGenerator:[inputManager audioFileGeneratorFromFilePath:audioFilePath]];
}
@@ -1202,7 +1169,7 @@
return;
}
- const NSInteger slotNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:cmdAttr.input.sender] : cmdAttr.intValue[0];
+ const NSInteger slotNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:(id)cmdAttr.input.object] : cmdAttr.intValue[0];
if (slotNumber < 0 || slotNumber > MAX_SAVESTATE_SLOTS)
{
return;
@@ -1247,7 +1214,7 @@
return;
}
- const NSInteger slotNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:cmdAttr.input.sender] : cmdAttr.intValue[0];
+ const NSInteger slotNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:(id)cmdAttr.input.object] : cmdAttr.intValue[0];
if (slotNumber < 0 || slotNumber > MAX_SAVESTATE_SLOTS)
{
return;
@@ -1283,7 +1250,7 @@
return;
}
- const double relativeDegrees = (cmdAttr.useInputForSender) ? (double)[CocoaDSUtil getIBActionSenderTag:cmdAttr.input.sender] : (double)cmdAttr.intValue[0];
+ const double relativeDegrees = (cmdAttr.useInputForSender) ? (double)[CocoaDSUtil getIBActionSenderTag:(id)cmdAttr.input.object] : (double)cmdAttr.intValue[0];
const double angleDegrees = [mainWindow displayRotation] + relativeDegrees;
[mainWindow setDisplayRotation:angleDegrees];
}
@@ -1429,7 +1396,7 @@
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) || ([self currentRom] == nil) )
{
return;
}
@@ -1451,7 +1418,7 @@
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) || ([self currentRom] == nil) )
{
return;
}
@@ -1464,7 +1431,7 @@
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) || ([self currentRom] == nil) )
{
return;
}
@@ -1479,7 +1446,9 @@
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [cdsCore coreState] != ExecutionBehavior_Pause || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) ||
+ ([cdsCore coreState] != ExecutionBehavior_Pause) ||
+ ([self currentRom] == nil) )
{
return;
}
@@ -1492,34 +1461,15 @@
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) || ([self currentRom] == nil) )
{
return;
}
- CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[executionControlWindow makeFirstResponder:nil];
- NSUInteger jumpFrames = 0;
- switch ([self frameJumpType])
- {
- case FrameJumpBehavior_Forward:
- jumpFrames = [self frameJumpFramesForward];
- [cdsCore frameJump:jumpFrames];
- break;
-
- case FrameJumpBehavior_ToFrame:
- jumpFrames = [self frameJumpToFrame];
- [cdsCore frameJumpTo:jumpFrames];
- break;
-
- case FrameJumpBehavior_NextMarker:
- // TODO: Support when replay markers are implemented.
- break;
-
- default:
- break;
- }
+ CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
+ [cdsCore setCoreState:ExecutionBehavior_FrameJump];
}
- (void) cmdReset:(NSValue *)cmdAttrValue
@@ -1527,13 +1477,11 @@
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
- if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF || [self currentRom] == nil)
+ if ( (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) || ([self currentRom] == nil) )
{
return;
}
- CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
-
[self setStatusText:NSSTRING_STATUS_EMULATOR_RESETTING];
[self setIsWorking:YES];
@@ -1542,6 +1490,7 @@
[[windowController window] displayIfNeeded];
}
+ CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore reset];
for (DisplayWindowController *windowController in windowList)
@@ -1598,7 +1547,7 @@
}
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
- const NSInteger bitNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:cmdAttr.input.sender] : cmdAttr.intValue[0];
+ const NSInteger bitNumber = (cmdAttr.useInputForSender) ? [CocoaDSUtil getIBActionSenderTag:(id)cmdAttr.input.object] : cmdAttr.intValue[0];
const UInt32 flagBit = [cdsCore.cdsGPU gpuStateFlags] ^ (1 << bitNumber);
[cdsCore.cdsGPU setGpuStateFlags:flagBit];
@@ -1998,7 +1947,7 @@
CocoaDSController *cdsController = [cdsCore cdsController];
NSImage *micIcon = iconMicDisabled;
- if ([self isSoftwareMicActive])
+ if ([cdsController softwareMicState])
{
micIcon = iconMicManualOverride;
}
@@ -2006,11 +1955,11 @@
{
if ([cdsController isHardwareMicAvailable])
{
- if ([self isHardwareMicInClip])
+ if ([cdsController isHardwareMicInClip])
{
micIcon = iconMicInClip;
}
- else if ([self isHardwareMicIdle])
+ else if ([cdsController isHardwareMicIdle])
{
micIcon = iconMicIdle;
}
@@ -2304,11 +2253,6 @@
}
else if (theAction == @selector(frameAdvance:))
{
- if ([cdsCore coreState] != ExecutionBehavior_Pause)
- {
- enable = NO;
- }
-
if ([cdsCore coreState] != ExecutionBehavior_Pause ||
![cdsCore masterExecute] ||
[self currentRom] == nil ||
@@ -2534,9 +2478,6 @@
- (void) doMicLevelUpdateFromController:(CocoaDSController *)cdsController
{
- [self setIsSoftwareMicActive:[cdsController softwareMicState]];
- [self setIsHardwareMicIdle:[cdsController isHardwareMicIdle]];
- [self setIsHardwareMicInClip:[cdsController isHardwareMicInClip]];
[self updateMicStatusIcon];
}
diff --git a/desmume/src/frontend/cocoa/userinterface/InputManager.h b/desmume/src/frontend/cocoa/userinterface/InputManager.h
index d57d88e73..4e00d4fe6 100644
--- a/desmume/src/frontend/cocoa/userinterface/InputManager.h
+++ b/desmume/src/frontend/cocoa/userinterface/InputManager.h
@@ -66,7 +66,7 @@ typedef struct
float floatCoordX; // The X-coordinate as a float for commands that require a location
float floatCoordY; // The Y-coordinate as a float for commands that require a location
float scalar; // A scalar value for commands that require a scalar
- id sender; // An object for commands that require an object
+ void *object; // An object for commands that require an object
} InputAttributes;
typedef struct
@@ -75,7 +75,7 @@ typedef struct
SEL selector; // The selector that is called on command dispatch
int32_t intValue[4]; // Context dependent int values
float floatValue[4]; // Context dependent float values
- id object[4]; // Context dependent objects
+ void *object[4]; // Context dependent objects
bool useInputForIntCoord; // The command will prefer the input device's int coordinate
bool useInputForFloatCoord; // The command will prefer the input device's float coordinate
diff --git a/desmume/src/frontend/cocoa/userinterface/InputManager.mm b/desmume/src/frontend/cocoa/userinterface/InputManager.mm
index b2b97ca0f..0ec9be22d 100644
--- a/desmume/src/frontend/cocoa/userinterface/InputManager.mm
+++ b/desmume/src/frontend/cocoa/userinterface/InputManager.mm
@@ -453,7 +453,7 @@ InputAttributes InputAttributesOfHIDValue(IOHIDValueRef hidValueRef)
inputAttr.floatCoordX = 0.0f;
inputAttr.floatCoordY = 0.0f;
inputAttr.scalar = (float)(logicalValue - logicalMin) / (float)(logicalMax - logicalMin);
- inputAttr.sender = nil;
+ inputAttr.object = nil;
if (!inputAttr.isAnalog)
{
@@ -2156,10 +2156,10 @@ NSMutableDictionary* DeviceInfoDictionaryWithCommandAttributes(const CommandAttr
nil];
// Set the object references last since these could be nil.
- [newDeviceInfo setValue:cmdAttr->object[0] forKey:@"object0"];
- [newDeviceInfo setValue:cmdAttr->object[1] forKey:@"object1"];
- [newDeviceInfo setValue:cmdAttr->object[2] forKey:@"object2"];
- [newDeviceInfo setValue:cmdAttr->object[3] forKey:@"object3"];
+ [newDeviceInfo setValue:(id)cmdAttr->object[0] forKey:@"object0"];
+ [newDeviceInfo setValue:(id)cmdAttr->object[1] forKey:@"object1"];
+ [newDeviceInfo setValue:(id)cmdAttr->object[2] forKey:@"object2"];
+ [newDeviceInfo setValue:(id)cmdAttr->object[3] forKey:@"object3"];
return newDeviceInfo;
}
@@ -2217,7 +2217,7 @@ InputAttributes InputManagerEncodeKeyboardInput(const unsigned short keyCode, BO
inputAttr.floatCoordX = 0.0f;
inputAttr.floatCoordY = 0.0f;
inputAttr.scalar = (keyPressed) ? 1.0f : 0.0f;
- inputAttr.sender = nil;
+ inputAttr.object = nil;
return inputAttr;
}
@@ -2255,7 +2255,7 @@ InputAttributes InputManagerEncodeMouseButtonInput(const NSInteger buttonNumber,
inputAttr.floatCoordX = touchLoc.x;
inputAttr.floatCoordY = touchLoc.y;
inputAttr.scalar = (buttonPressed) ? 1.0f : 0.0f;
- inputAttr.sender = nil;
+ inputAttr.object = nil;
return inputAttr;
}
@@ -2275,7 +2275,7 @@ InputAttributes InputManagerEncodeIBAction(const SEL theSelector, id sender)
inputAttr.floatCoordX = 0.0f;
inputAttr.floatCoordY = 0.0f;
inputAttr.scalar = 1.0f;
- inputAttr.sender = sender;
+ inputAttr.object = sender;
return inputAttr;
}