Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OpenEmuSystem/OEKeyBindingDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef NS_ENUM(NSUInteger, OEGlobalButtonIdentifier) {
OEGlobalButtonIdentifierRapidFireToggle,
OEGlobalButtonIdentifierRapidFireClear,
OEGlobalButtonIdentifierRapidFireReset,
OEGlobalButtonIdentifierFastForwardToggle,

OEGlobalButtonIdentifierCount,

Expand Down
4 changes: 4 additions & 0 deletions OpenEmuSystem/OEKeyBindingDescription.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
return @"OEGlobalButtonIdentifierLastDisplayMode";
case OEGlobalButtonIdentifierScreenshot :
return @"OEGlobalButtonIdentifierScreenshot";
case OEGlobalButtonIdentifierFastForwardToggle :
return @"OEGlobalButtonIdentifierFastForwardToggle";
case OEGlobalButtonIdentifierCount :
return @"OEGlobalButtonIdentifierCount";
case OEGlobalButtonIdentifierFlag :
Expand Down Expand Up @@ -139,6 +141,8 @@
return OEGlobalButtonLastDisplayMode;
case OEGlobalButtonIdentifierScreenshot :
return OEGlobalButtonScreenshot;
case OEGlobalButtonIdentifierFastForwardToggle :
return OEGlobalButtonFastForwardToggle;
default :
break;
}
Expand Down
1 change: 1 addition & 0 deletions OpenEmuSystem/OESystemBindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern NSString *const OEGlobalButtonScreenshot;
extern NSString *const OEGlobalButtonRapidFireToggle;
extern NSString *const OEGlobalButtonRapidFireClear;
extern NSString *const OEGlobalButtonRapidFireReset;
extern NSString *const OEGlobalButtonFastForwardToggle;

/// Manages the bindings for a specific system, useful for system responders
/// Instances of this class are allocated by OEGameBindingsController
Expand Down
1 change: 1 addition & 0 deletions OpenEmuSystem/OESystemBindings.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
NSString *const OEGlobalButtonRapidFireToggle = @"OEGlobalButtonRapidFireToggle";
NSString *const OEGlobalButtonRapidFireClear = @"OEGlobalButtonRapidFireClear";
NSString *const OEGlobalButtonRapidFireReset = @"OEGlobalButtonRapidFireReset";
NSString *const OEGlobalButtonFastForwardToggle = @"OEGlobalButtonFastForwardToggle";

@interface OEHIDEvent ()
- (OEHIDEvent *)OE_eventWithDeviceHandler:(OEDeviceHandler *)aDeviceHandler;
Expand Down
2 changes: 2 additions & 0 deletions OpenEmuSystem/OESystemController.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ - (NSString *)serialLookupForFile:(__kindof OEFile *)file
Button(@"Pause/Resume", OEGlobalButtonPause),
Button(@"Rewind", OEGlobalButtonRewind),
Button(@"Fast Forward", OEGlobalButtonFastForward),
Button(@"Toggle Fast Forward", OEGlobalButtonFastForwardToggle),
//Button(@"Slow Motion", OEGlobalButtonSlowMotion),
Button(@"Step Backward", OEGlobalButtonStepFrameBackward),
Button(@"Step Forward", OEGlobalButtonStepFrameForward),
Expand All @@ -249,6 +250,7 @@ - (NSString *)serialLookupForFile:(__kindof OEFile *)file
Button(@"Pause/Resume", OEGlobalButtonPause),
Button(@"Rewind", OEGlobalButtonRewind),
Button(@"Fast Forward", OEGlobalButtonFastForward),
Button(@"Toggle Fast Forward", OEGlobalButtonFastForwardToggle),
Button(@"Step Backward", OEGlobalButtonStepFrameBackward),
Button(@"Step Forward", OEGlobalButtonStepFrameForward),
Button(@"Next Display Mode", OEGlobalButtonNextDisplayMode),
Expand Down
45 changes: 41 additions & 4 deletions OpenEmuSystem/OESystemResponder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ @implementation OESystemResponder

std::set<NSInteger> _rapidFireKeyBlacklist;
std::vector<OEPlayerRapidFireState> _rapidFireState;
BOOL _fastForwardHeld;
BOOL _fastForwardToggled;
BOOL _fastForwardActive;

BOOL _handlesEscapeKey;
double _analogToDigitalThreshold;
Expand Down Expand Up @@ -495,6 +498,36 @@ - (void)changeAnalogEmulatorKey:(OESystemKey *)aKey value:(CGFloat)value
else dispatch_async(dispatch_get_main_queue(), blk); \
} while(NO)

- (void)OE_setFastForwardActive:(BOOL)enable
{
if (_fastForwardActive == enable)
return;

_fastForwardActive = enable;
SEND_ACTION2(fastForwardGameplay:, enable);
[[self client] fastForward:enable];
}

- (void)OE_updateFastForwardState
{
[self OE_setFastForwardActive:_fastForwardHeld || _fastForwardToggled];
}

- (void)OE_setFastForwardHeld:(BOOL)held
{
if (_fastForwardHeld == held)
return;

_fastForwardHeld = held;
[self OE_updateFastForwardState];
}

- (void)OE_toggleFastForward
{
_fastForwardToggled = !_fastForwardToggled;
[self OE_updateFastForwardState];
}

- (void)pressGlobalButtonWithIdentifier:(OEGlobalButtonIdentifier)identifier player:(NSInteger)player
{
// FIXME: We currently only trigger these actions on release, but maybe some of these (like StepFrameBackward and StepFrameForward) should allow key repeat
Expand All @@ -509,8 +542,10 @@ - (void)pressGlobalButtonWithIdentifier:(OEGlobalButtonIdentifier)identifier pla
[[self client] stepFrameForward];
return;
case OEGlobalButtonIdentifierFastForward :
SEND_ACTION2(fastForwardGameplay:, YES);
[[self client] fastForward:YES];
[self OE_setFastForwardHeld:YES];
return;
case OEGlobalButtonIdentifierFastForwardToggle :
[self OE_toggleFastForward];
return;
case OEGlobalButtonIdentifierRewind :
SEND_ACTION2(rewindGameplay:, YES);
Expand Down Expand Up @@ -578,8 +613,9 @@ - (void)releaseGlobalButtonWithIdentifier:(OEGlobalButtonIdentifier)identifier p
case OEGlobalButtonIdentifierStepFrameForward :
return;
case OEGlobalButtonIdentifierFastForward :
SEND_ACTION2(fastForwardGameplay:, NO);
[[self client] fastForward:NO];
[self OE_setFastForwardHeld:NO];
return;
case OEGlobalButtonIdentifierFastForwardToggle :
return;
case OEGlobalButtonIdentifierRewind :
SEND_ACTION2(rewindGameplay:, NO);
Expand Down Expand Up @@ -647,6 +683,7 @@ - (void)changeAnalogGlobalButtonIdentifier:(OEGlobalButtonIdentifier)identifier
case OEGlobalButtonIdentifierNextDisplayMode :
case OEGlobalButtonIdentifierLastDisplayMode :
case OEGlobalButtonIdentifierScreenshot :
case OEGlobalButtonIdentifierFastForwardToggle :
case OEGlobalButtonIdentifierRapidFireToggle :
case OEGlobalButtonIdentifierRapidFireClear :
case OEGlobalButtonIdentifierRapidFireReset :
Expand Down