Rearrange mac controls to be configured by player, reducing the number of button codes required
This commit is contained in:
parent
41bf8cef73
commit
296650e2c7
@ -66,47 +66,47 @@ static NSString * const kKeyboardPrefs = @"KeyboardConfig";
|
|||||||
|
|
||||||
NSDictionary *defaultKeyBindings = @{
|
NSDictionary *defaultKeyBindings = @{
|
||||||
kKeyboardPrefs : @{
|
kKeyboardPrefs : @{
|
||||||
@(k1PUp).stringValue : @(kVK_UpArrow),
|
@(kUp).stringValue : @(kVK_UpArrow),
|
||||||
@(k1PDown).stringValue : @(kVK_DownArrow),
|
@(kDown).stringValue : @(kVK_DownArrow),
|
||||||
@(k1PLeft).stringValue : @(kVK_LeftArrow),
|
@(kLeft).stringValue : @(kVK_LeftArrow),
|
||||||
@(k1PRight).stringValue : @(kVK_RightArrow),
|
@(kRight).stringValue : @(kVK_RightArrow),
|
||||||
@(k1PY).stringValue : @(kVK_ANSI_X),
|
@(kY).stringValue : @(kVK_ANSI_X),
|
||||||
@(k1PB).stringValue : @(kVK_ANSI_C),
|
@(kB).stringValue : @(kVK_ANSI_C),
|
||||||
@(k1PX).stringValue : @(kVK_ANSI_D),
|
@(kX).stringValue : @(kVK_ANSI_D),
|
||||||
@(k1PA).stringValue : @(kVK_ANSI_V),
|
@(kA).stringValue : @(kVK_ANSI_V),
|
||||||
@(k1PL).stringValue : @(kVK_ANSI_A),
|
@(kL).stringValue : @(kVK_ANSI_A),
|
||||||
@(k1PR).stringValue : @(kVK_ANSI_S),
|
@(kR).stringValue : @(kVK_ANSI_S),
|
||||||
@(k1PStart).stringValue : @(kVK_Space),
|
@(kStart).stringValue : @(kVK_Space),
|
||||||
@(k1PSelect).stringValue : @(kVK_Return),
|
@(kSelect).stringValue : @(kVK_Return),
|
||||||
|
|
||||||
@(k2PUp).stringValue : @(kVK_ANSI_Keypad8),
|
@(kNumButtons + kUp).stringValue : @(kVK_ANSI_Keypad8),
|
||||||
@(k2PDown).stringValue : @(kVK_ANSI_Keypad2),
|
@(kNumButtons + kDown).stringValue : @(kVK_ANSI_Keypad2),
|
||||||
@(k2PLeft).stringValue : @(kVK_ANSI_Keypad4),
|
@(kNumButtons + kLeft).stringValue : @(kVK_ANSI_Keypad4),
|
||||||
@(k2PRight).stringValue : @(kVK_ANSI_Keypad6),
|
@(kNumButtons + kRight).stringValue : @(kVK_ANSI_Keypad6),
|
||||||
@(k2PY).stringValue : @(kVK_PageDown),
|
@(kNumButtons + kY).stringValue : @(kVK_PageDown),
|
||||||
@(k2PB).stringValue : @(kVK_PageUp),
|
@(kNumButtons + kB).stringValue : @(kVK_PageUp),
|
||||||
@(k2PX).stringValue : @(kVK_End),
|
@(kNumButtons + kX).stringValue : @(kVK_End),
|
||||||
@(k2PA).stringValue : @(kVK_Home),
|
@(kNumButtons + kA).stringValue : @(kVK_Home),
|
||||||
@(k2PL).stringValue : @(kVK_ANSI_Keypad0),
|
@(kNumButtons + kL).stringValue : @(kVK_ANSI_Keypad0),
|
||||||
@(k2PR).stringValue : @(kVK_ANSI_KeypadDecimal),
|
@(kNumButtons + kR).stringValue : @(kVK_ANSI_KeypadDecimal),
|
||||||
@(k2PStart).stringValue : @(kVK_ANSI_KeypadEnter),
|
@(kNumButtons + kStart).stringValue : @(kVK_ANSI_KeypadEnter),
|
||||||
@(k2PSelect).stringValue : @(kVK_ANSI_KeypadPlus),
|
@(kNumButtons + kSelect).stringValue : @(kVK_ANSI_KeypadPlus),
|
||||||
|
|
||||||
@(k1PKeyFastForward).stringValue : @(kVK_ANSI_Backslash),
|
@(kKeyFastForward).stringValue : @(kVK_ANSI_Backslash),
|
||||||
@(k1PKeyFreeze).stringValue : @(kVK_ANSI_1),
|
@(kKeyFreeze).stringValue : @(kVK_ANSI_1),
|
||||||
@(k1PKeyDefrost).stringValue : @(kVK_ANSI_0),
|
@(kKeyDefrost).stringValue : @(kVK_ANSI_0),
|
||||||
@(k1PKeyScreenshot).stringValue : @(kVK_ANSI_Grave),
|
@(kKeyScreenshot).stringValue : @(kVK_ANSI_Grave),
|
||||||
@(k1PKeySPC).stringValue : @(kVK_ANSI_R),
|
@(kKeySPC).stringValue : @(kVK_ANSI_R),
|
||||||
@(k1PKeyScopeTurbo).stringValue : @(kVK_ANSI_B),
|
@(kKeyScopeTurbo).stringValue : @(kVK_ANSI_B),
|
||||||
@(k1PKeyScopePause).stringValue : @(kVK_ANSI_N),
|
@(kKeyScopePause).stringValue : @(kVK_ANSI_N),
|
||||||
@(k1PKeyScopeCursor).stringValue : @(kVK_ANSI_Q),
|
@(kKeyScopeCursor).stringValue : @(kVK_ANSI_Q),
|
||||||
@(k1PKeyOffScreen).stringValue : @(kVK_Tab),
|
@(kKeyOffScreen).stringValue : @(kVK_Tab),
|
||||||
@(k1PKeyFunction).stringValue : @(kVK_ANSI_Slash),
|
@(kKeyFunction).stringValue : @(kVK_ANSI_Slash),
|
||||||
@(k1PKeyAlt).stringValue : @(kVK_ANSI_Period),
|
@(kKeyAlt).stringValue : @(kVK_ANSI_Period),
|
||||||
@(k1PKeyFFDown).stringValue : @(kVK_ANSI_Q),
|
@(kKeyFFDown).stringValue : @(kVK_ANSI_Q),
|
||||||
@(k1PKeyFFUp).stringValue : @(kVK_ANSI_W),
|
@(kKeyFFUp).stringValue : @(kVK_ANSI_W),
|
||||||
@(k1PKeyEsc).stringValue : @(kVK_Escape),
|
@(kKeyEsc).stringValue : @(kVK_Escape),
|
||||||
@(k1PKeyTC).stringValue : @(kVK_ANSI_Comma)
|
@(kKeyTC).stringValue : @(kVK_ANSI_Comma)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -116,32 +116,37 @@ static NSString * const kKeyboardPrefs = @"KeyboardConfig";
|
|||||||
|
|
||||||
for (NSString *control in [self.keys copy])
|
for (NSString *control in [self.keys copy])
|
||||||
{
|
{
|
||||||
[self setControl:@(control.integerValue) forKey:self.keys[control]];
|
NSInteger key = control.integerValue;
|
||||||
|
NSInteger player = key / kNumButtons;
|
||||||
|
S9xButtonCode buttonCode = (S9xButtonCode)(key - (kNumButtons * player));
|
||||||
|
[self setButtonCode:buttonCode forKeyCode:self.keys[control].integerValue player:player];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self importKeySettings];
|
[self importKeySettings];
|
||||||
[defaults synchronize];
|
[defaults synchronize];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setControl:(NSNumber *)control forKey:(NSNumber *)key
|
- (void)setButtonCode:(S9xButtonCode)buttonCode forKeyCode:(int16)keyCode player:(int8)player
|
||||||
{
|
{
|
||||||
if (key == nil || control == nil)
|
if (keyCode < 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.keys[control.stringValue] = key;
|
self.keys[@(buttonCode + (kNumButtons * player)).stringValue] = @(keyCode);
|
||||||
|
|
||||||
S9xKey oldControl = kNumButtons;
|
S9xButtonCode oldButton = kNumButtons;
|
||||||
[self.s9xEngine setControl:(S9xKey)control.intValue forKey:key.intValue oldControl:&oldControl oldKey:NULL];
|
int8 oldPlayer = -1;
|
||||||
|
if ([self.s9xEngine setButton:buttonCode forKey:keyCode player:player oldButton:&oldButton oldPlayer:&oldPlayer oldKey:NULL])
|
||||||
if (oldControl >= 0 && oldControl < kNumButtons)
|
|
||||||
{
|
{
|
||||||
[self.keys removeObjectForKey:@(oldControl).stringValue];
|
if (oldButton >= 0 && oldButton < kNumButtons && oldPlayer >= 0 && oldPlayer < MAC_MAX_PLAYERS)
|
||||||
|
{
|
||||||
|
[self.keys removeObjectForKey:@(oldButton + (kNumButtons * oldPlayer)).stringValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
[NSUserDefaults.standardUserDefaults setObject:[self.keys copy] forKey:kKeyboardPrefs];
|
[NSUserDefaults.standardUserDefaults setObject:[self.keys copy] forKey:kKeyboardPrefs];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)importRecentItems
|
- (void)importRecentItems
|
||||||
{
|
{
|
||||||
@ -188,11 +193,11 @@ static NSString * const kKeyboardPrefs = @"KeyboardConfig";
|
|||||||
// The first 24 enum values are the same, but we have to adjust after that.
|
// The first 24 enum values are the same, but we have to adjust after that.
|
||||||
if ( i < 24 )
|
if ( i < 24 )
|
||||||
{
|
{
|
||||||
[self setControl:@(i) forKey:@(bytes[i])];
|
[self setButtonCode:(S9xButtonCode)(i - (i / 12)) forKeyCode:bytes[i] player:i / 12];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self setControl:@(i - 24 + k1PKeyFastForward) forKey:@(bytes[i])];
|
[self setButtonCode:(S9xButtonCode)(i - 24 + kKeyFastForward) forKeyCode:bytes[i] player:0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,4 +231,14 @@ static NSString * const kKeyboardPrefs = @"KeyboardConfig";
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
||||||
|
{
|
||||||
|
return [self.s9xEngine isPaused];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)terminate:(id)sender
|
||||||
|
{
|
||||||
|
[NSApp terminate:sender];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
|
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
|
||||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||||
<menuItem title="Quit Snes9x" keyEquivalent="q" id="4sb-4s-VLi">
|
<menuItem title="Quit Snes9x" keyEquivalent="q" id="4sb-4s-VLi">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
<action selector="terminate:" target="Voe-Tx-rLC" id="KcN-YT-dDk"/>
|
||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
</items>
|
</items>
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
#ifndef _mac_controls_h_
|
#ifndef _mac_controls_h_
|
||||||
#define _mac_controls_h_
|
#define _mac_controls_h_
|
||||||
|
|
||||||
#define KeyIsPressed(km, bm, k) (km[k] || bm[k])
|
#define MAC_MAX_PLAYERS 8
|
||||||
|
|
||||||
|
#define KeyIsPressed(km, bm, p, k) (km[p][k] || bm[p][k])
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -181,256 +183,39 @@ enum
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
k1PUp,
|
kUp,
|
||||||
k1PDown,
|
kDown,
|
||||||
k1PLeft,
|
kLeft,
|
||||||
k1PRight,
|
kRight,
|
||||||
k1PY,
|
kY,
|
||||||
k1PB,
|
kB,
|
||||||
k1PX,
|
kX,
|
||||||
k1PA,
|
kA,
|
||||||
k1PL,
|
kL,
|
||||||
k1PR,
|
kR,
|
||||||
k1PStart,
|
kStart,
|
||||||
k1PSelect,
|
kSelect,
|
||||||
|
|
||||||
k2PUp,
|
kKeyFastForward,
|
||||||
k2PDown,
|
kKeyFreeze,
|
||||||
k2PLeft,
|
kKeyDefrost,
|
||||||
k2PRight,
|
kKeyScreenshot,
|
||||||
k2PY,
|
kKeySPC,
|
||||||
k2PB,
|
kKeyScopeTurbo,
|
||||||
k2PX,
|
kKeyScopePause,
|
||||||
k2PA,
|
kKeyScopeCursor,
|
||||||
k2PL,
|
kKeyOffScreen,
|
||||||
k2PR,
|
kKeyFunction,
|
||||||
k2PStart,
|
kKeyAlt,
|
||||||
k2PSelect,
|
kKeyFFDown,
|
||||||
|
kKeyFFUp,
|
||||||
k3PUp,
|
kKeyEsc,
|
||||||
k3PDown,
|
kKeyTC,
|
||||||
k3PLeft,
|
kKeyMouseLeft,
|
||||||
k3PRight,
|
kKeyMouseRight,
|
||||||
k3PY,
|
|
||||||
k3PB,
|
|
||||||
k3PX,
|
|
||||||
k3PA,
|
|
||||||
k3PL,
|
|
||||||
k3PR,
|
|
||||||
k3PStart,
|
|
||||||
k3PSelect,
|
|
||||||
|
|
||||||
k4PUp,
|
|
||||||
k4PDown,
|
|
||||||
k4PLeft,
|
|
||||||
k4PRight,
|
|
||||||
k4PY,
|
|
||||||
k4PB,
|
|
||||||
k4PX,
|
|
||||||
k4PA,
|
|
||||||
k4PL,
|
|
||||||
k4PR,
|
|
||||||
k4PStart,
|
|
||||||
k4PSelect,
|
|
||||||
|
|
||||||
k5PUp,
|
|
||||||
k5PDown,
|
|
||||||
k5PLeft,
|
|
||||||
k5PRight,
|
|
||||||
k5PY,
|
|
||||||
k5PB,
|
|
||||||
k5PX,
|
|
||||||
k5PA,
|
|
||||||
k5PL,
|
|
||||||
k5PR,
|
|
||||||
k5PStart,
|
|
||||||
k5PSelect,
|
|
||||||
|
|
||||||
k6PUp,
|
|
||||||
k6PDown,
|
|
||||||
k6PLeft,
|
|
||||||
k6PRight,
|
|
||||||
k6PY,
|
|
||||||
k6PB,
|
|
||||||
k6PX,
|
|
||||||
k6PA,
|
|
||||||
k6PL,
|
|
||||||
k6PR,
|
|
||||||
k6PStart,
|
|
||||||
k6PSelect,
|
|
||||||
|
|
||||||
k7PUp,
|
|
||||||
k7PDown,
|
|
||||||
k7PLeft,
|
|
||||||
k7PRight,
|
|
||||||
k7PY,
|
|
||||||
k7PB,
|
|
||||||
k7PX,
|
|
||||||
k7PA,
|
|
||||||
k7PL,
|
|
||||||
k7PR,
|
|
||||||
k7PStart,
|
|
||||||
k7PSelect,
|
|
||||||
|
|
||||||
k8PUp,
|
|
||||||
k8PDown,
|
|
||||||
k8PLeft,
|
|
||||||
k8PRight,
|
|
||||||
k8PY,
|
|
||||||
k8PB,
|
|
||||||
k8PX,
|
|
||||||
k8PA,
|
|
||||||
k8PL,
|
|
||||||
k8PR,
|
|
||||||
k8PStart,
|
|
||||||
k8PSelect,
|
|
||||||
|
|
||||||
k1PKeyFastForward,
|
|
||||||
k1PKeyFreeze,
|
|
||||||
k1PKeyDefrost,
|
|
||||||
k1PKeyScreenshot,
|
|
||||||
k1PKeySPC,
|
|
||||||
k1PKeyScopeTurbo,
|
|
||||||
k1PKeyScopePause,
|
|
||||||
k1PKeyScopeCursor,
|
|
||||||
k1PKeyOffScreen,
|
|
||||||
k1PKeyFunction,
|
|
||||||
k1PKeyAlt,
|
|
||||||
k1PKeyFFDown,
|
|
||||||
k1PKeyFFUp,
|
|
||||||
k1PKeyEsc,
|
|
||||||
k1PKeyTC,
|
|
||||||
k1PKeyMouseLeft,
|
|
||||||
k1PKeyMouseRight,
|
|
||||||
|
|
||||||
k2PKeyFastForward,
|
|
||||||
k2PKeyFreeze,
|
|
||||||
k2PKeyDefrost,
|
|
||||||
k2PKeyScreenshot,
|
|
||||||
k2PKeySPC,
|
|
||||||
k2PKeyScopeTurbo,
|
|
||||||
k2PKeyScopePause,
|
|
||||||
k2PKeyScopeCursor,
|
|
||||||
k2PKeyOffScreen,
|
|
||||||
k2PKeyFunction,
|
|
||||||
k2PKeyAlt,
|
|
||||||
k2PKeyFFDown,
|
|
||||||
k2PKeyFFUp,
|
|
||||||
k2PKeyEsc,
|
|
||||||
k2PKeyTC,
|
|
||||||
k2PKeyMouseLeft,
|
|
||||||
k2PKeyMouseRight,
|
|
||||||
|
|
||||||
k3PKeyFastForward,
|
|
||||||
k3PKeyFreeze,
|
|
||||||
k3PKeyDefrost,
|
|
||||||
k3PKeyScreenshot,
|
|
||||||
k3PKeySPC,
|
|
||||||
k3PKeyScopeTurbo,
|
|
||||||
k3PKeyScopePause,
|
|
||||||
k3PKeyScopeCursor,
|
|
||||||
k3PKeyOffScreen,
|
|
||||||
k3PKeyFunction,
|
|
||||||
k3PKeyAlt,
|
|
||||||
k3PKeyFFDown,
|
|
||||||
k3PKeyFFUp,
|
|
||||||
k3PKeyEsc,
|
|
||||||
k3PKeyTC,
|
|
||||||
k3PKeyMouseLeft,
|
|
||||||
k3PKeyMouseRight,
|
|
||||||
|
|
||||||
k4PKeyFastForward,
|
|
||||||
k4PKeyFreeze,
|
|
||||||
k4PKeyDefrost,
|
|
||||||
k4PKeyScreenshot,
|
|
||||||
k4PKeySPC,
|
|
||||||
k4PKeyScopeTurbo,
|
|
||||||
k4PKeyScopePause,
|
|
||||||
k4PKeyScopeCursor,
|
|
||||||
k4PKeyOffScreen,
|
|
||||||
k4PKeyFunction,
|
|
||||||
k4PKeyAlt,
|
|
||||||
k4PKeyFFDown,
|
|
||||||
k4PKeyFFUp,
|
|
||||||
k4PKeyEsc,
|
|
||||||
k4PKeyTC,
|
|
||||||
k4PKeyMouseLeft,
|
|
||||||
k4PKeyMouseRight,
|
|
||||||
|
|
||||||
k5PKeyFastForward,
|
|
||||||
k5PKeyFreeze,
|
|
||||||
k5PKeyDefrost,
|
|
||||||
k5PKeyScreenshot,
|
|
||||||
k5PKeySPC,
|
|
||||||
k5PKeyScopeTurbo,
|
|
||||||
k5PKeyScopePause,
|
|
||||||
k5PKeyScopeCursor,
|
|
||||||
k5PKeyOffScreen,
|
|
||||||
k5PKeyFunction,
|
|
||||||
k5PKeyAlt,
|
|
||||||
k5PKeyFFDown,
|
|
||||||
k5PKeyFFUp,
|
|
||||||
k5PKeyEsc,
|
|
||||||
k5PKeyTC,
|
|
||||||
k5PKeyMouseLeft,
|
|
||||||
k5PKeyMouseRight,
|
|
||||||
|
|
||||||
k6PKeyFastForward,
|
|
||||||
k6PKeyFreeze,
|
|
||||||
k6PKeyDefrost,
|
|
||||||
k6PKeyScreenshot,
|
|
||||||
k6PKeySPC,
|
|
||||||
k6PKeyScopeTurbo,
|
|
||||||
k6PKeyScopePause,
|
|
||||||
k6PKeyScopeCursor,
|
|
||||||
k6PKeyOffScreen,
|
|
||||||
k6PKeyFunction,
|
|
||||||
k6PKeyAlt,
|
|
||||||
k6PKeyFFDown,
|
|
||||||
k6PKeyFFUp,
|
|
||||||
k6PKeyEsc,
|
|
||||||
k6PKeyTC,
|
|
||||||
k6PKeyMouseLeft,
|
|
||||||
k6PKeyMouseRight,
|
|
||||||
|
|
||||||
k7PKeyFastForward,
|
|
||||||
k7PKeyFreeze,
|
|
||||||
k7PKeyDefrost,
|
|
||||||
k7PKeyScreenshot,
|
|
||||||
k7PKeySPC,
|
|
||||||
k7PKeyScopeTurbo,
|
|
||||||
k7PKeyScopePause,
|
|
||||||
k7PKeyScopeCursor,
|
|
||||||
k7PKeyOffScreen,
|
|
||||||
k7PKeyFunction,
|
|
||||||
k7PKeyAlt,
|
|
||||||
k7PKeyFFDown,
|
|
||||||
k7PKeyFFUp,
|
|
||||||
k7PKeyEsc,
|
|
||||||
k7PKeyTC,
|
|
||||||
k7PKeyMouseLeft,
|
|
||||||
k7PKeyMouseRight,
|
|
||||||
|
|
||||||
k8PKeyFastForward,
|
|
||||||
k8PKeyFreeze,
|
|
||||||
k8PKeyDefrost,
|
|
||||||
k8PKeyScreenshot,
|
|
||||||
k8PKeySPC,
|
|
||||||
k8PKeyScopeTurbo,
|
|
||||||
k8PKeyScopePause,
|
|
||||||
k8PKeyScopeCursor,
|
|
||||||
k8PKeyOffScreen,
|
|
||||||
k8PKeyFunction,
|
|
||||||
k8PKeyAlt,
|
|
||||||
k8PKeyFFDown,
|
|
||||||
k8PKeyFFUp,
|
|
||||||
k8PKeyEsc,
|
|
||||||
k8PKeyTC,
|
|
||||||
k8PKeyMouseLeft,
|
|
||||||
k8PKeyMouseRight,
|
|
||||||
|
|
||||||
kNumButtons
|
kNumButtons
|
||||||
} S9xKey;
|
} S9xButtonCode;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
kISpFastForward,
|
kISpFastForward,
|
||||||
@ -455,6 +240,6 @@ typedef enum {
|
|||||||
void ControlPadFlagsToS9xReportButtons (int, uint32);
|
void ControlPadFlagsToS9xReportButtons (int, uint32);
|
||||||
void ControlPadFlagsToS9xPseudoPointer (uint32);
|
void ControlPadFlagsToS9xPseudoPointer (uint32);
|
||||||
|
|
||||||
long ISpKeyIsPressed (bool8 keys[kNumButtons], bool8 gamepadButtons[kNumButtons], ISpKey key);
|
long ISpKeyIsPressed (bool8 keys[MAC_MAX_PLAYERS][kNumButtons], bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons], ISpKey key);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,8 +175,8 @@ bool S9xPollButton (uint32 id, bool *pressed)
|
|||||||
{
|
{
|
||||||
#define kmControlKey 0x3B
|
#define kmControlKey 0x3B
|
||||||
|
|
||||||
bool8 keys[MAC_NUM_KEYCODES];
|
bool8 keys[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
bool8 gamepadButtons[kNumButtons];
|
bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
|
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
|
|
||||||
@ -218,9 +218,9 @@ bool S9xPollButton (uint32 id, bool *pressed)
|
|||||||
{
|
{
|
||||||
switch (id & 0xFF)
|
switch (id & 0xFF)
|
||||||
{
|
{
|
||||||
case 0: *pressed = KeyIsPressed(keys, gamepadButtons, k2PStart); break;
|
case 0: *pressed = KeyIsPressed(keys, gamepadButtons, 1, kStart); break;
|
||||||
case 1: *pressed = KeyIsPressed(keys, gamepadButtons, k2PB); break;
|
case 1: *pressed = KeyIsPressed(keys, gamepadButtons, 1, kB); break;
|
||||||
case 2: *pressed = KeyIsPressed(keys, gamepadButtons, k2PA);
|
case 2: *pressed = KeyIsPressed(keys, gamepadButtons, 1, kA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,196 +310,196 @@ void ControlPadFlagsToS9xPseudoPointer (uint32 p)
|
|||||||
S9xReportButton(kMacCMapPseudoPtrBase + 3, (p & 0x0100));
|
S9xReportButton(kMacCMapPseudoPtrBase + 3, (p & 0x0100));
|
||||||
}
|
}
|
||||||
|
|
||||||
long ISpKeyIsPressed (bool8 keys[kNumButtons], bool8 gamepadButtons[kNumButtons], ISpKey key)
|
long ISpKeyIsPressed (bool8 keys[MAC_MAX_PLAYERS][kNumButtons], bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons], ISpKey key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case kISpFastForward:
|
case kISpFastForward:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyFastForward) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyFastForward) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyFastForward);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyFastForward);
|
||||||
|
|
||||||
case kISpFreeze:
|
case kISpFreeze:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyFreeze) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyFreeze) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyFreeze);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyFreeze);
|
||||||
|
|
||||||
case kISpDefrost:
|
case kISpDefrost:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyDefrost) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyDefrost) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyDefrost);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyDefrost);
|
||||||
|
|
||||||
case kISpScreenshot:
|
case kISpScreenshot:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyScreenshot) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyScreenshot) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyScreenshot);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyScreenshot);
|
||||||
|
|
||||||
case kISpSPC:
|
case kISpSPC:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeySPC) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeySPC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeySPC);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeySPC);
|
||||||
|
|
||||||
case kISpScopeTurbo:
|
case kISpScopeTurbo:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyScopeTurbo) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyScopeTurbo) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyScopeTurbo);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyScopeTurbo);
|
||||||
|
|
||||||
case kISpScopePause:
|
case kISpScopePause:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyScopePause) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyScopePause) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyScopePause);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyScopePause);
|
||||||
|
|
||||||
case kISpScopeCursor:
|
case kISpScopeCursor:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyScopeCursor) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyScopeCursor) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyScopeCursor);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyScopeCursor);
|
||||||
|
|
||||||
case kISpOffScreen:
|
case kISpOffScreen:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyOffScreen) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyOffScreen) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyOffScreen);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyOffScreen);
|
||||||
|
|
||||||
case kISpFunction:
|
case kISpFunction:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyFunction) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyFunction) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyFunction);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyFunction);
|
||||||
|
|
||||||
case kISpAlt:
|
case kISpAlt:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyAlt) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyAlt) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyAlt);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyAlt);
|
||||||
|
|
||||||
case kISpFFDown:
|
case kISpFFDown:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyFFDown) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyFFDown) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyFFDown);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyFFDown);
|
||||||
|
|
||||||
case kISpFFUp:
|
case kISpFFUp:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyFFUp) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyFFUp) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyFFUp);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyFFUp);
|
||||||
|
|
||||||
case kISpEsc:
|
case kISpEsc:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyEsc) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyEsc);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyEsc);
|
||||||
|
|
||||||
case kISpTC:
|
case kISpTC:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyTC) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyTC) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k8PKeyTC);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyTC);
|
||||||
|
|
||||||
case kISpMouseLeft:
|
case kISpMouseLeft:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyMouseLeft) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyMouseLeft) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyMouseLeft);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyMouseLeft);
|
||||||
|
|
||||||
case kISpMouseRight:
|
case kISpMouseRight:
|
||||||
return
|
return
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k3PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k4PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 3, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k5PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 4, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k6PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 5, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyMouseRight) ||
|
KeyIsPressed(keys, gamepadButtons, 6, kKeyMouseRight) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k7PKeyMouseRight);
|
KeyIsPressed(keys, gamepadButtons, 7, kKeyMouseRight);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -26,11 +26,16 @@
|
|||||||
|
|
||||||
#define MAC_NUM_KEYCODES 255
|
#define MAC_NUM_KEYCODES 255
|
||||||
|
|
||||||
extern int16 keyCodes[MAC_NUM_KEYCODES];
|
struct S9xButton {
|
||||||
|
int16 buttonCode;
|
||||||
|
int8 player;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct S9xButton keyCodes[MAC_NUM_KEYCODES];
|
||||||
|
|
||||||
void InitKeyboard (void);
|
void InitKeyboard (void);
|
||||||
void DeinitKeyboard (void);
|
void DeinitKeyboard (void);
|
||||||
|
|
||||||
void SetKeyCode(int16 keyCode, S9xKey control, int16 *oldKeyCode, S9xKey *oldControl);
|
bool SetKeyCode(int16 keyCode, S9xButtonCode button, int8 player, int16 *oldKeyCode, S9xButtonCode *oldButton, int8 *oldPlayer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,13 +28,13 @@
|
|||||||
#include "mac-os.h"
|
#include "mac-os.h"
|
||||||
#include "mac-keyboard.h"
|
#include "mac-keyboard.h"
|
||||||
|
|
||||||
int16 keyCodes[MAC_NUM_KEYCODES];
|
struct S9xButton keyCodes[MAC_NUM_KEYCODES];
|
||||||
|
|
||||||
void InitKeyboard (void)
|
void InitKeyboard (void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
for (int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
||||||
{
|
{
|
||||||
keyCodes[i] = -1;
|
keyCodes[i] = { -1, -1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,17 +42,23 @@ void DeinitKeyboard (void)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
for (int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
||||||
{
|
{
|
||||||
keyCodes[i] = -1;
|
keyCodes[i] = { -1, -1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetKeyCode(int16 keyCode, S9xKey control, int16 *oldKeyCode, S9xKey *oldControl)
|
bool SetKeyCode(int16 keyCode, S9xButtonCode buttonCode, int8 player, int16 *oldKeyCode, S9xButtonCode *oldButtonCode, int8 *oldPlayer)
|
||||||
{
|
{
|
||||||
|
if (player < 0 || player >= MAC_MAX_PLAYERS || buttonCode < 0 || buttonCode >= kNumButtons)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
for ( int i = 0; i < MAC_NUM_KEYCODES; ++i)
|
||||||
{
|
{
|
||||||
if (keyCodes[i] == control && i != keyCode)
|
struct S9xButton button = keyCodes[i];
|
||||||
|
if (button.player == player && button.buttonCode == buttonCode && i != keyCode)
|
||||||
{
|
{
|
||||||
keyCodes[i] = -1;
|
keyCodes[i] = { -1, -1 };
|
||||||
|
|
||||||
if (oldKeyCode !=NULL)
|
if (oldKeyCode !=NULL)
|
||||||
{
|
{
|
||||||
@ -61,10 +67,17 @@ void SetKeyCode(int16 keyCode, S9xKey control, int16 *oldKeyCode, S9xKey *oldCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldControl != NULL)
|
if (oldButtonCode != NULL)
|
||||||
{
|
{
|
||||||
*oldControl = (S9xKey)keyCodes[keyCode];
|
*oldButtonCode = (S9xButtonCode)keyCodes[keyCode].buttonCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyCodes[keyCode] = control;
|
if (*oldPlayer != NULL )
|
||||||
|
{
|
||||||
|
*oldPlayer = (S9xButtonCode)keyCodes[keyCode].player;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyCodes[keyCode] = { static_cast<int16>(buttonCode), player };
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
@interface MusicBoxController : NSObject
|
@interface MusicBoxController : NSObject
|
||||||
{
|
{
|
||||||
IBOutlet id window;
|
IBOutlet NSWindow *window;
|
||||||
IBOutlet id gametitle;
|
IBOutlet id gametitle;
|
||||||
IBOutlet id disclosure;
|
IBOutlet id disclosure;
|
||||||
IBOutlet id rewind;
|
IBOutlet id rewind;
|
||||||
|
@ -112,7 +112,6 @@ typedef struct
|
|||||||
} ExtraOption;
|
} ExtraOption;
|
||||||
|
|
||||||
#define kMacWindowHeight (SNES_HEIGHT_EXTENDED)
|
#define kMacWindowHeight (SNES_HEIGHT_EXTENDED)
|
||||||
#define MAC_MAX_PLAYERS 8
|
|
||||||
#define MAC_MAX_CHEATS 150
|
#define MAC_MAX_CHEATS 150
|
||||||
|
|
||||||
extern volatile bool8 running, s9xthreadrunning;
|
extern volatile bool8 running, s9xthreadrunning;
|
||||||
@ -164,8 +163,8 @@ extern CFStringRef multiCartPath[2];
|
|||||||
extern IconRef macIconRef[118];
|
extern IconRef macIconRef[118];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool8 pressedKeys[kNumButtons];
|
extern bool8 pressedKeys[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
extern bool8 pressedGamepadButtons[kNumButtons];
|
extern bool8 pressedGamepadButtons[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
extern os_unfair_lock keyLock;
|
extern os_unfair_lock keyLock;
|
||||||
|
|
||||||
extern NSOpenGLView *s9xView;
|
extern NSOpenGLView *s9xView;
|
||||||
@ -180,7 +179,7 @@ void PostQueueToSubEventLoop (void);
|
|||||||
int PromptFreezeDefrost (Boolean);
|
int PromptFreezeDefrost (Boolean);
|
||||||
uint64 GetMicroseconds(void);
|
uint64 GetMicroseconds(void);
|
||||||
|
|
||||||
void CopyPressedKeys(uint8 keys[kNumButtons], uint8 gamepadButtons[kNumButtons]);
|
void CopyPressedKeys(uint8 keys[MAC_MAX_PLAYERS][kNumButtons], uint8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons]);
|
||||||
|
|
||||||
@interface S9xEngine : NSObject
|
@interface S9xEngine : NSObject
|
||||||
|
|
||||||
@ -191,7 +190,7 @@ void CopyPressedKeys(uint8 keys[kNumButtons], uint8 gamepadButtons[kNumButtons])
|
|||||||
- (void)pause;
|
- (void)pause;
|
||||||
- (void)resume;
|
- (void)resume;
|
||||||
|
|
||||||
- (void)setControl:(S9xKey)control forKey:(int16)key oldControl:(S9xKey *)oldControl oldKey:(int16 *)oldControl;
|
- (BOOL)setButton:(S9xButtonCode)button forKey:(int16)key player:(int8)player oldButton:(S9xButtonCode *)oldButton oldPlayer:(int8 *)oldPlayer oldKey:(int16 *)oldKey;
|
||||||
|
|
||||||
- (BOOL)loadROM:(NSURL *)fileURL;
|
- (BOOL)loadROM:(NSURL *)fileURL;
|
||||||
|
|
||||||
|
362
macosx/mac-os.mm
362
macosx/mac-os.mm
@ -174,8 +174,8 @@ CFStringRef multiCartPath[2];
|
|||||||
IconRef macIconRef[118];
|
IconRef macIconRef[118];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool8 pressedKeys[kNumButtons] = { 0 };
|
bool8 pressedKeys[MAC_MAX_PLAYERS][kNumButtons] = { 0 };
|
||||||
bool8 pressedGamepadButtons[kNumButtons] = { 0 };
|
bool8 pressedGamepadButtons[MAC_MAX_PLAYERS][kNumButtons] = { 0 };
|
||||||
os_unfair_lock keyLock;
|
os_unfair_lock keyLock;
|
||||||
os_unfair_lock renderLock;
|
os_unfair_lock renderLock;
|
||||||
|
|
||||||
@ -357,51 +357,51 @@ static void * MacSnes9xThread (void *)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyPressedKeys(bool8 keys[MAC_NUM_KEYCODES], bool8 gamepadButtons[kNumButtons])
|
void CopyPressedKeys(bool8 keys[MAC_MAX_PLAYERS][kNumButtons], bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons])
|
||||||
{
|
{
|
||||||
os_unfair_lock_lock(&keyLock);
|
os_unfair_lock_lock(&keyLock);
|
||||||
NSEventModifierFlags flags = [NSEvent modifierFlags];
|
NSEventModifierFlags flags = [NSEvent modifierFlags];
|
||||||
|
|
||||||
int16 key = keyCodes[kVK_Shift];
|
struct S9xButton button = keyCodes[kVK_Shift];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagShift) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagShift) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_Command];
|
button = keyCodes[kVK_Command];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagCommand) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagCommand) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_Control];
|
button = keyCodes[kVK_Control];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagControl) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagControl) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_CapsLock];
|
button = keyCodes[kVK_CapsLock];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagCapsLock) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagCapsLock) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_Option];
|
button = keyCodes[kVK_Option];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagOption) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagOption) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_Help];
|
button = keyCodes[kVK_Help];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagHelp) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagHelp) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = keyCodes[kVK_Function];
|
button = keyCodes[kVK_Function];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if (button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player >= 0 && button.player < MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = (flags & NSEventModifierFlagFunction) != 0;
|
pressedKeys[button.player][button.buttonCode] = (flags & NSEventModifierFlagFunction) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(keys, pressedKeys, sizeof(pressedKeys));
|
memcpy(keys, pressedKeys, sizeof(pressedKeys));
|
||||||
@ -1760,8 +1760,8 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||||||
CGRect rct;
|
CGRect rct;
|
||||||
CFURLRef url;
|
CFURLRef url;
|
||||||
FSCatalogInfo info;
|
FSCatalogInfo info;
|
||||||
bool8 keys[kNumButtons];
|
bool8 keys[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
bool8 gamepadButtons[kNumButtons];
|
bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
CFAbsoluteTime newestDate, currentDate;
|
CFAbsoluteTime newestDate, currentDate;
|
||||||
int64 startTime;
|
int64 startTime;
|
||||||
float x, y;
|
float x, y;
|
||||||
@ -1963,69 +1963,69 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||||||
|
|
||||||
for (int count = 0; count <= 12; count++)
|
for (int count = 0; count <= 12; count++)
|
||||||
{
|
{
|
||||||
while (KeyIsPressed(keys, gamepadButtons, count))
|
while (KeyIsPressed(keys, gamepadButtons, 0, count))
|
||||||
{
|
{
|
||||||
result = count - 1;
|
result = count - 1;
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PRight))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kRight))
|
||||||
{
|
{
|
||||||
startTime = mach_absolute_time();
|
startTime = mach_absolute_time();
|
||||||
current_selection += 1;
|
current_selection += 1;
|
||||||
if (current_selection > 11)
|
if (current_selection > 11)
|
||||||
current_selection -= 12;
|
current_selection -= 12;
|
||||||
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PRight) && (mach_absolute_time() < (startTime + repeatDelay)))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kRight) && (mach_absolute_time() < (startTime + repeatDelay)))
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PLeft))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kLeft))
|
||||||
{
|
{
|
||||||
startTime = mach_absolute_time();
|
startTime = mach_absolute_time();
|
||||||
current_selection -= 1;
|
current_selection -= 1;
|
||||||
if (current_selection < 0)
|
if (current_selection < 0)
|
||||||
current_selection += 12;
|
current_selection += 12;
|
||||||
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PLeft) && (mach_absolute_time() < (startTime + repeatDelay)))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kLeft) && (mach_absolute_time() < (startTime + repeatDelay)))
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PDown))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kDown))
|
||||||
{
|
{
|
||||||
startTime = mach_absolute_time();
|
startTime = mach_absolute_time();
|
||||||
current_selection += 4;
|
current_selection += 4;
|
||||||
if (current_selection > 11)
|
if (current_selection > 11)
|
||||||
current_selection -= 12;
|
current_selection -= 12;
|
||||||
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PDown) && (mach_absolute_time() < (startTime + repeatDelay)))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kDown) && (mach_absolute_time() < (startTime + repeatDelay)))
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PUp))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kUp))
|
||||||
{
|
{
|
||||||
startTime = mach_absolute_time();
|
startTime = mach_absolute_time();
|
||||||
current_selection -= 4;
|
current_selection -= 4;
|
||||||
if (current_selection < 0)
|
if (current_selection < 0)
|
||||||
current_selection += 12;
|
current_selection += 12;
|
||||||
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PUp) && (mach_absolute_time() < (startTime + repeatDelay)))
|
while (KeyIsPressed(keys, gamepadButtons, 0, kUp) && (mach_absolute_time() < (startTime + repeatDelay)))
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PA ) ||
|
while (KeyIsPressed(keys, gamepadButtons, 1, kA ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PA ) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kA ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PB ) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kB ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PB ) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kB ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PX ) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kX ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PX ) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kX ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PY ) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kY ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PY ) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kY ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PStart ) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kStart ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PStart ) ||
|
KeyIsPressed(keys, gamepadButtons, 2, kStart ) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PSelect) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kSelect) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PSelect))
|
KeyIsPressed(keys, gamepadButtons, 2, kSelect))
|
||||||
{
|
{
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
result = current_selection;
|
result = current_selection;
|
||||||
@ -2034,8 +2034,8 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||||||
uint32 pad1, pad2;
|
uint32 pad1, pad2;
|
||||||
|
|
||||||
while (ISpKeyIsPressed(keys, gamepadButtons, kISpEsc) ||
|
while (ISpKeyIsPressed(keys, gamepadButtons, kISpEsc) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PStart) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kStart) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PStart))
|
KeyIsPressed(keys, gamepadButtons, 1, kStart))
|
||||||
{
|
{
|
||||||
CopyPressedKeys(keys, gamepadButtons);
|
CopyPressedKeys(keys, gamepadButtons);
|
||||||
result = -1;
|
result = -1;
|
||||||
@ -2113,14 +2113,14 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||||||
} while (((pad1 & 0x0400) || (pad2 & 0x0400)) && (mach_absolute_time() < (startTime + repeatDelay)));
|
} while (((pad1 & 0x0400) || (pad2 & 0x0400)) && (mach_absolute_time() < (startTime + repeatDelay)));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (KeyIsPressed(keys, gamepadButtons, k1PA) ||
|
while (KeyIsPressed(keys, gamepadButtons, 0, kA) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PA) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kA) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PB) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kB) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PB) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kB) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PX) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kX) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PX) ||
|
KeyIsPressed(keys, gamepadButtons, 1, kX) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k1PY) ||
|
KeyIsPressed(keys, gamepadButtons, 0, kY) ||
|
||||||
KeyIsPressed(keys, gamepadButtons, k2PY))
|
KeyIsPressed(keys, gamepadButtons, 1, kY))
|
||||||
result = current_selection;
|
result = current_selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2177,8 +2177,8 @@ static void UpdateFreezeDefrostScreen (int newIndex, CGImageRef image, uint8 *dr
|
|||||||
|
|
||||||
static void ProcessInput (void)
|
static void ProcessInput (void)
|
||||||
{
|
{
|
||||||
bool8 keys[MAC_NUM_KEYCODES];
|
bool8 keys[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
bool8 gamepadButtons[kNumButtons];
|
bool8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons];
|
||||||
bool8 isok, fnbtn, altbtn, tcbtn;
|
bool8 isok, fnbtn, altbtn, tcbtn;
|
||||||
static bool8 toggleff = false, lastTimeTT = false, lastTimeFn = false, ffUp = false, ffDown = false, ffUpSp = false, ffDownSp = false;
|
static bool8 toggleff = false, lastTimeTT = false, lastTimeFn = false, ffUp = false, ffDown = false, ffUpSp = false, ffDownSp = false;
|
||||||
|
|
||||||
@ -2254,106 +2254,6 @@ static void ProcessInput (void)
|
|||||||
else
|
else
|
||||||
ffDownSp = false;
|
ffDownSp = false;
|
||||||
|
|
||||||
controlPad[0] = controlPad[1] = 0;
|
|
||||||
|
|
||||||
JoypadScanDirection(0, &(controlPad[0]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PR )) controlPad[0] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PL )) controlPad[0] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PX )) controlPad[0] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PA )) controlPad[0] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PStart )) controlPad[0] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PSelect)) controlPad[0] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PY )) controlPad[0] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PB )) controlPad[0] |= 0x8000;
|
|
||||||
|
|
||||||
JoypadScanDirection(1, &(controlPad[1]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PR )) controlPad[1] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PL )) controlPad[1] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PX )) controlPad[1] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PA )) controlPad[1] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PStart )) controlPad[1] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PSelect)) controlPad[1] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PY )) controlPad[1] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PB )) controlPad[1] |= 0x8000;
|
|
||||||
|
|
||||||
if (((macControllerOption == SNES_MULTIPLAYER5) || (macControllerOption == SNES_MULTIPLAYER5_2)) && Settings.MultiPlayer5Master)
|
|
||||||
{
|
|
||||||
controlPad[2] = controlPad[3] = controlPad[4] = 0;
|
|
||||||
|
|
||||||
JoypadScanDirection(2, &(controlPad[2]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PR )) controlPad[2] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PL )) controlPad[2] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PX )) controlPad[2] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PA )) controlPad[2] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PStart )) controlPad[2] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PSelect)) controlPad[2] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PY )) controlPad[2] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PB )) controlPad[2] |= 0x8000;
|
|
||||||
|
|
||||||
JoypadScanDirection(3, &(controlPad[3]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PR )) controlPad[3] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PL )) controlPad[3] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PX )) controlPad[3] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PA )) controlPad[3] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PStart )) controlPad[3] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PSelect)) controlPad[3] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PY )) controlPad[3] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PB )) controlPad[3] |= 0x8000;
|
|
||||||
|
|
||||||
JoypadScanDirection(4, &(controlPad[4]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PR )) controlPad[4] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PL )) controlPad[4] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PX )) controlPad[4] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PA )) controlPad[4] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PStart )) controlPad[4] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PSelect)) controlPad[4] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PY )) controlPad[4] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PB )) controlPad[4] |= 0x8000;
|
|
||||||
|
|
||||||
ControlPadFlagsToS9xReportButtons(2, controlPad[2]);
|
|
||||||
ControlPadFlagsToS9xReportButtons(3, controlPad[3]);
|
|
||||||
ControlPadFlagsToS9xReportButtons(4, controlPad[4]);
|
|
||||||
|
|
||||||
if (macControllerOption == SNES_MULTIPLAYER5_2)
|
|
||||||
{
|
|
||||||
controlPad[5] = controlPad[6] = controlPad[7] = 0;
|
|
||||||
|
|
||||||
JoypadScanDirection(5, &(controlPad[5]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PR )) controlPad[5] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PL )) controlPad[5] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PX )) controlPad[5] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PA )) controlPad[5] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PStart )) controlPad[5] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PSelect)) controlPad[5] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PY )) controlPad[5] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PB )) controlPad[5] |= 0x8000;
|
|
||||||
|
|
||||||
JoypadScanDirection(6, &(controlPad[6]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PR )) controlPad[6] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PL )) controlPad[6] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PX )) controlPad[6] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PA )) controlPad[6] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PStart )) controlPad[6] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PSelect)) controlPad[6] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PY )) controlPad[6] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PB )) controlPad[6] |= 0x8000;
|
|
||||||
|
|
||||||
JoypadScanDirection(7, &(controlPad[7]));
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PR )) controlPad[7] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PL )) controlPad[7] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PX )) controlPad[7] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PA )) controlPad[7] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PStart )) controlPad[7] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PSelect)) controlPad[7] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PY )) controlPad[7] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PB )) controlPad[7] |= 0x8000;
|
|
||||||
|
|
||||||
ControlPadFlagsToS9xReportButtons(5, controlPad[5]);
|
|
||||||
ControlPadFlagsToS9xReportButtons(6, controlPad[6]);
|
|
||||||
ControlPadFlagsToS9xReportButtons(7, controlPad[7]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fnbtn = ISpKeyIsPressed(keys, gamepadButtons, kISpFunction);
|
fnbtn = ISpKeyIsPressed(keys, gamepadButtons, kISpFunction);
|
||||||
altbtn = ISpKeyIsPressed(keys, gamepadButtons, kISpAlt);
|
altbtn = ISpKeyIsPressed(keys, gamepadButtons, kISpAlt);
|
||||||
|
|
||||||
@ -2499,109 +2399,22 @@ static void ProcessInput (void)
|
|||||||
else
|
else
|
||||||
ffDown = false;
|
ffDown = false;
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PR )) controlPad[0] |= 0x0010;
|
for (int i = 0; i < MAC_MAX_PLAYERS; ++i)
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PL )) controlPad[0] |= 0x0020;
|
{
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PX )) controlPad[0] |= 0x0040;
|
controlPad[i] = 0;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PA )) controlPad[0] |= 0x0080;
|
if (KeyIsPressed(keys, gamepadButtons, i, kR )) controlPad[i] |= 0x0010;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PRight )) controlPad[0] |= 0x0100;
|
if (KeyIsPressed(keys, gamepadButtons, i, kL )) controlPad[i] |= 0x0020;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PLeft )) controlPad[0] |= 0x0200;
|
if (KeyIsPressed(keys, gamepadButtons, i, kX )) controlPad[i] |= 0x0040;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PDown )) controlPad[0] |= 0x0400;
|
if (KeyIsPressed(keys, gamepadButtons, i, kA )) controlPad[i] |= 0x0080;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PUp )) controlPad[0] |= 0x0800;
|
if (KeyIsPressed(keys, gamepadButtons, i, kRight )) controlPad[i] |= 0x0100;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PStart )) controlPad[0] |= 0x1000;
|
if (KeyIsPressed(keys, gamepadButtons, i, kLeft )) controlPad[i] |= 0x0200;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PSelect)) controlPad[0] |= 0x2000;
|
if (KeyIsPressed(keys, gamepadButtons, i, kDown )) controlPad[i] |= 0x0400;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PY )) controlPad[0] |= 0x4000;
|
if (KeyIsPressed(keys, gamepadButtons, i, kUp )) controlPad[i] |= 0x0800;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k1PB )) controlPad[0] |= 0x8000;
|
if (KeyIsPressed(keys, gamepadButtons, i, kStart )) controlPad[i] |= 0x1000;
|
||||||
|
if (KeyIsPressed(keys, gamepadButtons, i, kSelect)) controlPad[i] |= 0x2000;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PR )) controlPad[1] |= 0x0010;
|
if (KeyIsPressed(keys, gamepadButtons, i, kY )) controlPad[i] |= 0x4000;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PL )) controlPad[1] |= 0x0020;
|
if (KeyIsPressed(keys, gamepadButtons, i, kB )) controlPad[i] |= 0x8000;
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PX )) controlPad[1] |= 0x0040;
|
}
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PA )) controlPad[1] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PRight )) controlPad[1] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PLeft )) controlPad[1] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PDown )) controlPad[1] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PUp )) controlPad[1] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PStart )) controlPad[1] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PSelect)) controlPad[1] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PY )) controlPad[1] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k2PB )) controlPad[1] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PR )) controlPad[2] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PL )) controlPad[2] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PX )) controlPad[2] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PA )) controlPad[2] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PRight )) controlPad[2] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PLeft )) controlPad[2] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PDown )) controlPad[2] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PUp )) controlPad[2] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PStart )) controlPad[2] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PSelect)) controlPad[2] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PY )) controlPad[2] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k3PB )) controlPad[2] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PR )) controlPad[3] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PL )) controlPad[3] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PX )) controlPad[3] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PA )) controlPad[3] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PRight )) controlPad[3] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PLeft )) controlPad[3] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PDown )) controlPad[3] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PUp )) controlPad[3] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PStart )) controlPad[3] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PSelect)) controlPad[3] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PY )) controlPad[3] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k4PB )) controlPad[3] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PR )) controlPad[4] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PL )) controlPad[4] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PX )) controlPad[4] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PA )) controlPad[4] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PRight )) controlPad[4] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PLeft )) controlPad[4] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PDown )) controlPad[4] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PUp )) controlPad[4] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PStart )) controlPad[4] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PSelect)) controlPad[4] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PY )) controlPad[4] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k5PB )) controlPad[4] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PR )) controlPad[5] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PL )) controlPad[5] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PX )) controlPad[5] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PA )) controlPad[5] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PRight )) controlPad[5] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PLeft )) controlPad[5] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PDown )) controlPad[5] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PUp )) controlPad[5] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PStart )) controlPad[5] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PSelect)) controlPad[5] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PY )) controlPad[5] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k6PB )) controlPad[5] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PR )) controlPad[6] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PL )) controlPad[6] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PX )) controlPad[6] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PA )) controlPad[6] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PRight )) controlPad[6] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PLeft )) controlPad[6] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PDown )) controlPad[6] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PUp )) controlPad[6] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PStart )) controlPad[6] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PSelect)) controlPad[6] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PY )) controlPad[6] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k7PB )) controlPad[6] |= 0x8000;
|
|
||||||
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PR )) controlPad[7] |= 0x0010;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PL )) controlPad[7] |= 0x0020;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PX )) controlPad[7] |= 0x0040;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PA )) controlPad[7] |= 0x0080;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PRight )) controlPad[7] |= 0x0100;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PLeft )) controlPad[7] |= 0x0200;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PDown )) controlPad[7] |= 0x0400;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PUp )) controlPad[7] |= 0x0800;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PStart )) controlPad[7] |= 0x1000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PSelect)) controlPad[7] |= 0x2000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PY )) controlPad[7] |= 0x4000;
|
|
||||||
if (KeyIsPressed(keys, gamepadButtons, k8PB )) controlPad[7] |= 0x8000;
|
|
||||||
|
|
||||||
if (altbtn)
|
if (altbtn)
|
||||||
{
|
{
|
||||||
@ -3127,10 +2940,10 @@ void QuitWithFatalError ( NSString *message)
|
|||||||
- (void)keyDown:(NSEvent *)event
|
- (void)keyDown:(NSEvent *)event
|
||||||
{
|
{
|
||||||
os_unfair_lock_lock(&keyLock);
|
os_unfair_lock_lock(&keyLock);
|
||||||
int16 key = keyCodes[event.keyCode];
|
S9xButton button = keyCodes[event.keyCode];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES )
|
if ( button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player <= 0 && button.player <= MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = true;
|
pressedKeys[button.player][button.buttonCode] = true;
|
||||||
}
|
}
|
||||||
os_unfair_lock_unlock(&keyLock);
|
os_unfair_lock_unlock(&keyLock);
|
||||||
}
|
}
|
||||||
@ -3138,10 +2951,10 @@ void QuitWithFatalError ( NSString *message)
|
|||||||
- (void)keyUp:(NSEvent *)event
|
- (void)keyUp:(NSEvent *)event
|
||||||
{
|
{
|
||||||
os_unfair_lock_lock(&keyLock);
|
os_unfair_lock_lock(&keyLock);
|
||||||
int16 key = keyCodes[event.keyCode];
|
S9xButton button = keyCodes[event.keyCode];
|
||||||
if ( key >= 0 && key < MAC_NUM_KEYCODES)
|
if ( button.buttonCode >= 0 && button.buttonCode < kNumButtons && button.player <= 0 && button.player <= MAC_MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
pressedKeys[key] = false;
|
pressedKeys[button.player][button.buttonCode] = false;
|
||||||
}
|
}
|
||||||
os_unfair_lock_unlock(&keyLock);
|
os_unfair_lock_unlock(&keyLock);
|
||||||
}
|
}
|
||||||
@ -3174,6 +2987,11 @@ void QuitWithFatalError ( NSString *message)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
||||||
|
{
|
||||||
|
return !( running && !pauseEmulation);
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation S9xEngine
|
@implementation S9xEngine
|
||||||
@ -3265,7 +3083,7 @@ void QuitWithFatalError ( NSString *message)
|
|||||||
|
|
||||||
- (BOOL)isPaused
|
- (BOOL)isPaused
|
||||||
{
|
{
|
||||||
return pauseEmulation;
|
return running && pauseEmulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)pause
|
- (void)pause
|
||||||
@ -3278,11 +3096,13 @@ void QuitWithFatalError ( NSString *message)
|
|||||||
pauseEmulation = false;
|
pauseEmulation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setControl:(S9xKey)control forKey:(int16)key oldControl:(S9xKey *)oldControl oldKey:(int16 *)oldKey
|
- (BOOL)setButton:(S9xButtonCode)button forKey:(int16)key player:(int8)player oldButton:(S9xButtonCode *)oldButton oldPlayer:(int8 *)oldPlayer oldKey:(int16 *)oldKey
|
||||||
{
|
{
|
||||||
|
BOOL result = NO;
|
||||||
os_unfair_lock_lock(&keyLock);
|
os_unfair_lock_lock(&keyLock);
|
||||||
SetKeyCode(key, control, oldKey, oldControl);
|
result = SetKeyCode(key, button, player, oldKey, oldButton, oldPlayer);
|
||||||
os_unfair_lock_unlock(&keyLock);
|
os_unfair_lock_unlock(&keyLock);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)loadROM:(NSURL *)fileURL
|
- (BOOL)loadROM:(NSURL *)fileURL
|
||||||
|
Loading…
Reference in New Issue
Block a user