Cocoa Port:

- Allow the Rotate Display Left and Rotate Display Right commands to be mapped.
This commit is contained in:
rogerman 2013-04-16 22:45:40 +00:00
parent 0abccb098f
commit e7a7a38d91
5 changed files with 68 additions and 2 deletions

View File

@ -26,6 +26,8 @@
<string>Load State Slot</string>
<string>Save State Slot</string>
<string>Copy Screen</string>
<string>Rotate Display Left</string>
<string>Rotate Display Right</string>
<string>Set Speed</string>
<string>Enable/Disable Speed Limiter</string>
<string>Enable/Disable Auto Frame Skip</string>
@ -331,6 +333,40 @@
<array/>
<key>Copy Screen</key>
<array/>
<key>Rotate Display Left</key>
<array>
<dict>
<key>deviceInfoSummary</key>
<string>Keyboard: [</string>
<key>deviceCode</key>
<string>NSEventKeyboard</string>
<key>deviceName</key>
<string>Keyboard</string>
<key>elementCode</key>
<string>33</string>
<key>elementName</key>
<string>[</string>
<key>intValue0</key>
<integer>-90</integer>
</dict>
</array>
<key>Rotate Display Right</key>
<array>
<dict>
<key>deviceInfoSummary</key>
<string>Keyboard: ]</string>
<key>deviceCode</key>
<string>NSEventKeyboard</string>
<key>deviceName</key>
<string>Keyboard</string>
<key>elementCode</key>
<string>30</string>
<key>elementName</key>
<string>]</string>
<key>intValue0</key>
<integer>90</integer>
</dict>
</array>
<key>Set Speed</key>
<array>
<dict>

View File

@ -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;

View File

@ -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;

View File

@ -835,6 +835,8 @@ static std::tr1::unordered_map<unsigned short, std::string> 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<unsigned short, std::string> 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<unsigned short, std::string> 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<unsigned short, std::string> 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<unsigned short, std::string> 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];