Second joystick added

This commit is contained in:
Dan Piponi 2019-05-16 21:57:55 -07:00
parent 3a193a8287
commit 226c32aafd
7 changed files with 117 additions and 26 deletions

View file

@ -11,6 +11,10 @@ Options {
joystick1Right = ["Right"],
joystick1Up = ["Up"],
joystick1Down = ["Down"],
joystick2Left = ["LeftBracket"],
joystick2Right = ["RightBracket"],
joystick2Up = ["Equals"],
joystick2Down = ["Apostrophe"],
joystick1Trigger = ["Space"],
joystick2Trigger = ["Return"],
dumpState = ["1"],
@ -21,10 +25,10 @@ Options {
enterDebugger = ["Escape"],
debugMode = ["Backslash"],
writeRecord = ["W"],
delayLeft = ["LeftBracket"],
delayRight = ["RightBracket"],
delayUp = ["Equals"],
delayDown = ["Minus"],
delayLeft = [],
delayRight = [],
delayUp = [],
delayDown = [],
keyboardController00 = ["7"],
keyboardController01 = ["6"],
keyboardController02 = ["5"],

View file

@ -12,6 +12,7 @@ It'll run Adventure if you have the rom.
News
----
* Added second joystick emulation.
* I'm sure millipede didn't used to work but now it does!
* Added motion blur. Makes Asteroids and Basic look nice.
* Added keypad support and now Basic Programming works.
@ -238,6 +239,7 @@ Lots of games work:
| Adventure | Seems to play fine. |
| Aquaventure | seems to play fine. |
| Air Sea Battle | Seems to play fine. |
| Armor Ambush | Seems to play fine. |
| Asteroids | Seems to play fine. Flicker is correct behaviour. |
| Basic Programming | Works fine. Select Keypads. Flicker is correct behaviour. |
| Battle Zone | Seems to play fine. |
@ -247,6 +249,7 @@ Lots of games work:
| Combat | Seems to play fine. Stellarator has no 2 player support though. |
| Commando Raid | Seems to play fine. Ugly "comb" effect is correct. |
| Cosmic Ark | Seems to play fine but star rendering is replaced by ugly vertical line. |
| Cosmic Swarm | Flays fine. Better with motion blur. |
| Defender: | Seems to play fine. |
| Dig Dug | Use -b f6sc. Seems to play fine apart from some stray pixels. |
| Demon Attack | Seems to play fine. I quite like this one. |
@ -292,8 +295,10 @@ Lots of games work:
| SW: The Arcade Game | Use -b e0. Seems to play fine. Too hard using keyboard! |
| Tank City | Seems to play fine apart from some misrendered score digits |
| Tank Brigade | Seems to play fine. |
| Towering Inferno | I need to implement joystick 2. |
| Tutankh | Use -b e0. At first I thought it wasn't working but it's just bad. |
| Vanguard | Seems to play fine |
| Video Checkers | Seems to play fine. Use pairs of arrow keys to make diagonal moves. |
| Xenohpobe | Seems to play fine |
| Xevious | Seems to play fine. |
| Yar's Revenge | Seems to play fine. |

View file

@ -11,6 +11,10 @@ Options {
joystick1Right = ["Right"],
joystick1Up = ["Up"],
joystick1Down = ["Down"],
joystick2Left = ["LeftBracket"],
joystick2Right = ["RightBracket"],
joystick2Up = ["Equals"],
joystick2Down = ["Apostrophe"],
joystick1Trigger = ["Space"],
joystick2Trigger = ["Return"],
dumpState = ["1"],
@ -21,10 +25,10 @@ Options {
enterDebugger = ["Escape"],
debugMode = ["Backslash"],
writeRecord = ["W"],
delayLeft = ["LeftBracket"],
delayRight = ["RightBracket"],
delayUp = ["Equals"],
delayDown = ["Minus"],
delayLeft = [],
delayRight = [],
delayUp = [],
delayDown = [],
keyboardController00 = ["7"],
keyboardController01 = ["6"],
keyboardController02 = ["5"],

View file

@ -7,12 +7,16 @@ Options {
controllerTypes = "Keypads",
joystick1Left = ["Left"],
joystick1Right = ["Right"],
joystick1Up = ["Up"],
joystick1Down = ["Down"],
joystick1Trigger = ["CapsLock"],
joystick2Trigger = ["Tab"],
joystick1Left = [],
joystick1Right = [],
joystick1Up = [],
joystick1Down = [],
joystick2Left = [],
joystick2Right = [],
joystick2Up = [],
joystick2Down = [],
joystick1Trigger = [],
joystick2Trigger = [],
dumpState = ["Period"],
gameQuit = ["Grave"],
gameSelect = ["LShift"],
@ -21,10 +25,10 @@ Options {
enterDebugger = ["Escape"],
debugMode = ["Backslash"],
writeRecord = ["RShift"],
delayLeft = ["LeftBracket"],
delayRight = ["RightBracket"],
delayUp = ["Semicolon"],
delayDown = ["Apostrophe"],
delayLeft = [],
delayRight = [],
delayUp = [],
delayDown = [],
keyboardController00 = ["C"],
keyboardController01 = ["Minus", "B"],
keyboardController02 = ["A"],

View file

@ -106,6 +106,10 @@ handleKey atariKeys motion sym = do
Joystick1Down -> modify swcha $ bitAt 5 .~ not pressed
Joystick1Left -> modify swcha $ bitAt 6 .~ not pressed
Joystick1Right -> modify swcha $ bitAt 7 .~ not pressed
Joystick2Up -> modify swcha $ bitAt 0 .~ not pressed
Joystick2Down -> modify swcha $ bitAt 1 .~ not pressed
Joystick2Left -> modify swcha $ bitAt 2 .~ not pressed
Joystick2Right -> modify swcha $ bitAt 3 .~ not pressed
Joystick1Trigger -> trigger1Pressed pressed
Joystick2Trigger -> trigger2Pressed pressed
TVType -> modify swchb $ bitAt 3 .~ not pressed

View file

@ -198,6 +198,10 @@ data Options = Options {
joystick1Right :: [String],
joystick1Up :: [String],
joystick1Down :: [String],
joystick2Left :: [String],
joystick2Right :: [String],
joystick2Up :: [String],
joystick2Down :: [String],
joystick1Trigger :: [String],
joystick2Trigger :: [String],
dumpState :: [String],
@ -252,6 +256,10 @@ defaultOptions = Options {
joystick1Right = ["Right"],
joystick1Up = ["Up"],
joystick1Down = ["Down"],
joystick2Left = ["LeftBracket"],
joystick2Right = ["RightBracket"],
joystick2Up = ["Equals"],
joystick2Down = ["Apostrophe"],
joystick1Trigger = ["Space"],
joystick2Trigger = ["Return"],
dumpState = ["1"],
@ -262,10 +270,10 @@ defaultOptions = Options {
enterDebugger = ["Escape"],
debugMode = ["Backslash"],
writeRecord = ["W"],
delayLeft = ["LeftBracket"],
delayRight = ["RightBracket"],
delayUp = ["Equals"],
delayDown = ["Minus"],
delayLeft = [],
delayRight = [],
delayUp = [],
delayDown = [],
keyboardController00 = ["7"],
keyboardController01 = ["6"],
keyboardController02 = ["5"],
@ -293,6 +301,7 @@ defaultOptions = Options {
}
data AtariKey = Joystick1Left | Joystick1Right | Joystick1Up | Joystick1Down
| Joystick2Left | Joystick2Right | Joystick2Up | Joystick2Down
| Joystick1Trigger |Joystick2Trigger
| GameSelect | GameReset | TVType
| GameQuit | DumpState | EnterDebugger | DebugMode
@ -302,16 +311,17 @@ data AtariKey = Joystick1Left | Joystick1Right | Joystick1Up | Joystick1Down
type AtariKeys = M.Map Scancode AtariKey
plop :: Show a => a -> a
plop a = trace (show a) a
keysFromOptions :: Options -> Maybe AtariKeys
keysFromOptions options = do
scancodes <- plop $ sequence $ map (sequence . map scancodeFromString) [
scancodes <- sequence $ map (sequence . map scancodeFromString) [
joystick1Left options,
joystick1Right options,
joystick1Up options,
joystick1Down options,
joystick2Left options,
joystick2Right options,
joystick2Up options,
joystick2Down options,
joystick1Trigger options,
joystick2Trigger options,
dumpState options,
@ -356,6 +366,10 @@ keysFromOptions options = do
Joystick1Right,
Joystick1Up,
Joystick1Down,
Joystick2Left,
Joystick2Right,
Joystick2Up,
Joystick2Down,
Joystick1Trigger,
Joystick2Trigger,
DumpState,

56
swapped-joystick Normal file
View file

@ -0,0 +1,56 @@
Options {
screenScaleX = 5,
screenScaleY = 3,
topOverscan = 10,
bottomOverscan = 10,
motionBlurAlpha = 0.5,
controllerTypes = "Joysticks",
joystick1Left = ["LeftBracket"],
joystick1Right = ["RightBracket"],
joystick1Up = ["Equals"],
joystick1Down = ["Apostrophe"],
joystick2Left = ["Left"],
joystick2Right = ["Right"],
joystick2Up = ["Up"],
joystick2Down = ["Down"],
joystick1Trigger = ["Return"],
joystick2Trigger = ["Space"],
dumpState = ["1"],
gameQuit = ["Q"],
gameSelect = ["C"],
gameReset = ["V"],
tvType = ["X"],
enterDebugger = ["Escape"],
debugMode = ["Backslash"],
writeRecord = ["W"],
delayLeft = [],
delayRight = [],
delayUp = [],
delayDown = [],
keyboardController00 = ["7"],
keyboardController01 = ["6"],
keyboardController02 = ["5"],
keyboardController03 = ["0"],
keyboardController04 = ["9"],
keyboardController05 = ["8"],
keyboardController10 = ["U"],
keyboardController11 = ["Y"],
keyboardController12 = ["T"],
keyboardController13 = ["P"],
keyboardController14 = ["O"],
keyboardController15 = ["I"],
keyboardController20 = ["J"],
keyboardController21 = ["H"],
keyboardController22 = ["G"],
keyboardController23 = ["Semicolon"],
keyboardController24 = ["L"],
keyboardController25 = ["K"],
keyboardController30 = ["M"],
keyboardController31 = ["N"],
keyboardController32 = ["B"],
keyboardController33 = ["Slash"],
keyboardController34 = ["Period"],
keyboardController35 = ["Comma"]
}