diff --git a/desmume/src/cocoa/DefaultKeyMappings.plist b/desmume/src/cocoa/DefaultKeyMappings.plist
index f5092b775..762281308 100644
--- a/desmume/src/cocoa/DefaultKeyMappings.plist
+++ b/desmume/src/cocoa/DefaultKeyMappings.plist
@@ -26,6 +26,8 @@
Load State Slot
Save State Slot
Copy Screen
+ Rotate Display Left
+ Rotate Display Right
Set Speed
Enable/Disable Speed Limiter
Enable/Disable Auto Frame Skip
@@ -331,6 +333,40 @@
Copy Screen
+ Rotate Display Left
+
+
+ deviceInfoSummary
+ Keyboard: [
+ deviceCode
+ NSEventKeyboard
+ deviceName
+ Keyboard
+ elementCode
+ 33
+ elementName
+ [
+ intValue0
+ -90
+
+
+ Rotate Display Right
+
+
+ deviceInfoSummary
+ Keyboard: ]
+ deviceCode
+ NSEventKeyboard
+ deviceName
+ Keyboard
+ elementCode
+ 30
+ elementName
+ ]
+ intValue0
+ 90
+
+
Set Speed
diff --git a/desmume/src/cocoa/DefaultUserPrefs.plist b/desmume/src/cocoa/DefaultUserPrefs.plist
index 5b432207e..990f84687 100644
Binary files a/desmume/src/cocoa/DefaultUserPrefs.plist and b/desmume/src/cocoa/DefaultUserPrefs.plist differ
diff --git a/desmume/src/cocoa/userinterface/EmuControllerDelegate.h b/desmume/src/cocoa/userinterface/EmuControllerDelegate.h
index 4b4edc9bc..003a2e8de 100644
--- a/desmume/src/cocoa/userinterface/EmuControllerDelegate.h
+++ b/desmume/src/cocoa/userinterface/EmuControllerDelegate.h
@@ -212,6 +212,7 @@ class AudioSampleBlockGenerator;
- (void) cmdSaveEmuSaveStateSlot:(NSValue *)cmdAttrValue;
- (void) cmdCopyScreen:(NSValue *)cmdAttrValue;
+- (void) cmdRotateDisplayRelative:(NSValue *)cmdAttrValue;
- (void) cmdHoldToggleSpeedScalar:(NSValue *)cmdAttrValue;
- (void) cmdToggleSpeedLimiter:(NSValue *)cmdAttrValue;
diff --git a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm
index a094db54f..e42a37a08 100644
--- a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm
+++ b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm
@@ -878,8 +878,7 @@
- (IBAction) changeRotationRelative:(id)sender
{
- const double angleDegrees = [mainWindow displayRotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender];
- [mainWindow setDisplayRotation:angleDegrees];
+ [inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
}
- (IBAction) changeDisplayMode:(id)sender
@@ -1167,6 +1166,21 @@
[mainWindow copy:nil];
}
+- (void) cmdRotateDisplayRelative:(NSValue *)cmdAttrValue
+{
+ CommandAttributes cmdAttr;
+ [cmdAttrValue getValue:&cmdAttr];
+
+ if (cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF)
+ {
+ return;
+ }
+
+ const double relativeDegrees = (cmdAttr.useInputForSender) ? (double)[CocoaDSUtil getIBActionSenderTag:cmdAttr.input.sender] : (double)cmdAttr.intValue[0];
+ const double angleDegrees = [mainWindow displayRotation] + relativeDegrees;
+ [mainWindow setDisplayRotation:angleDegrees];
+}
+
- (void) cmdHoldToggleSpeedScalar:(NSValue *)cmdAttrValue
{
CommandAttributes cmdAttr;
diff --git a/desmume/src/cocoa/userinterface/InputManager.mm b/desmume/src/cocoa/userinterface/InputManager.mm
index a39c070cc..02586be11 100644
--- a/desmume/src/cocoa/userinterface/InputManager.mm
+++ b/desmume/src/cocoa/userinterface/InputManager.mm
@@ -835,6 +835,8 @@ static std::tr1::unordered_map keyboardNameTable; /
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_DSButtonStart_420x420" ofType:@"png"]] autorelease], @"Start",
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_DSButtonSelect_420x420" ofType:@"png"]] autorelease], @"Select",
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_Microphone_420x420" ofType:@"png"]] autorelease], @"Microphone",
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_RotateCCW_420x420" ofType:@"png"]] autorelease], @"Rotate Display Left",
+ [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_RotateCW_420x420" ofType:@"png"]] autorelease], @"Rotate Display Right",
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_ShowHUD_420x420" ofType:@"png"]] autorelease], @"HUD",
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_Execute_420x420" ofType:@"png"]] autorelease], @"Execute",
[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Icon_Pause_420x420" ofType:@"png"]] autorelease], @"Pause",
@@ -865,6 +867,7 @@ static std::tr1::unordered_map keyboardNameTable; /
commandSelector["Load State Slot"] = @selector(cmdLoadEmuSaveStateSlot:);
commandSelector["Save State Slot"] = @selector(cmdSaveEmuSaveStateSlot:);
commandSelector["Copy Screen"] = @selector(cmdCopyScreen:);
+ commandSelector["Rotate Display Relative"] = @selector(cmdRotateDisplayRelative:);
commandSelector["Set Speed"] = @selector(cmdHoldToggleSpeedScalar:);
commandSelector["Enable/Disable Speed Limiter"] = @selector(cmdToggleSpeedLimiter:);
commandSelector["Enable/Disable Auto Frame Skip"] = @selector(cmdToggleAutoFrameSkip:);
@@ -901,6 +904,15 @@ static std::tr1::unordered_map keyboardNameTable; /
CommandAttributes cmdSaveEmuSaveStateSlot = NewCommandAttributesForSelector("Save State Slot", commandSelector["Save State Slot"]);
CommandAttributes cmdCopyScreen = NewCommandAttributesForSelector("Copy Screen", commandSelector["Copy Screen"]);
+ CommandAttributes cmdRotateDisplayRelative = NewCommandAttributesForSelector("Rotate Display Relative", commandSelector["Rotate Display Relative"]);
+ cmdRotateDisplayRelative.intValue[0] = 90;
+
+ CommandAttributes cmdRotateDisplayLeft = NewCommandAttributesForSelector("Rotate Display Left", commandSelector["Rotate Display Relative"]);
+ cmdRotateDisplayLeft.intValue[0] = -90;
+
+ CommandAttributes cmdRotateDisplayRight = NewCommandAttributesForSelector("Rotate Display Right", commandSelector["Rotate Display Relative"]);
+ cmdRotateDisplayRight.intValue[0] = 90;
+
CommandAttributes cmdToggleSpeed = NewCommandAttributesForSelector("Set Speed", commandSelector["Set Speed"]);
cmdToggleSpeed.floatValue[0] = 1.0f;
@@ -932,6 +944,8 @@ static std::tr1::unordered_map keyboardNameTable; /
defaultCommandAttributes["Load State Slot"] = cmdLoadEmuSaveStateSlot;
defaultCommandAttributes["Save State Slot"] = cmdSaveEmuSaveStateSlot;
defaultCommandAttributes["Copy Screen"] = cmdCopyScreen;
+ defaultCommandAttributes["Rotate Display Left"] = cmdRotateDisplayLeft;
+ defaultCommandAttributes["Rotate Display Right"] = cmdRotateDisplayRight;
defaultCommandAttributes["Set Speed"] = cmdToggleSpeed;
defaultCommandAttributes["Enable/Disable Speed Limiter"] = cmdToggleSpeedLimiter;
defaultCommandAttributes["Enable/Disable Auto Frame Skip"] = cmdToggleAutoFrameSkip;
@@ -945,6 +959,7 @@ static std::tr1::unordered_map keyboardNameTable; /
[self addMappingForIBAction:@selector(loadEmuSaveStateSlot:) commandAttributes:&cmdLoadEmuSaveStateSlot];
[self addMappingForIBAction:@selector(saveEmuSaveStateSlot:) commandAttributes:&cmdSaveEmuSaveStateSlot];
[self addMappingForIBAction:@selector(copy:) commandAttributes:&cmdCopyScreen];
+ [self addMappingForIBAction:@selector(changeRotationRelative:) commandAttributes:&cmdRotateDisplayRelative];
[self addMappingForIBAction:@selector(toggleSpeedLimiter:) commandAttributes:&cmdToggleSpeedLimiter];
[self addMappingForIBAction:@selector(toggleAutoFrameSkip:) commandAttributes:&cmdToggleAutoFrameSkip];
[self addMappingForIBAction:@selector(toggleCheats:) commandAttributes:&cmdToggleCheats];