Supporting arkanoid controllers now
This commit is contained in:
parent
29beac9732
commit
afc0c273c5
|
@ -122,8 +122,8 @@ class InputParser
|
|||
parseConsoleInputs(input.reset, input.power, ss, inputString);
|
||||
|
||||
// Parsing controller 1 inputs
|
||||
if (_controller1Type == arkanoidNES) parseArkanoidInput(input, ss, inputString);
|
||||
if (_controller1Type == arkanoidFamicom) parseArkanoidInput(input, ss, inputString);
|
||||
if (_controller1Type == arkanoidNES) parseArkanoidNESInput(input, ss, inputString);
|
||||
if (_controller1Type == arkanoidFamicom) parseArkanoidFamicomInput(input, ss, inputString);
|
||||
if (_controller1Type == joypad || _controller1Type == fourscore1) parseControllerInputs(_controller1Type, input.port1, ss, inputString);
|
||||
|
||||
// Parsing controller 2 inputs
|
||||
|
@ -304,6 +304,28 @@ class InputParser
|
|||
}
|
||||
}
|
||||
|
||||
static inline void parseArkanoidNESInput(input_t& input, std::istringstream& ss, const std::string& inputString)
|
||||
{
|
||||
// Simply parse the arkanoid controller input
|
||||
parseArkanoidInput(input, ss, inputString);
|
||||
}
|
||||
|
||||
static inline void parseArkanoidFamicomInput(input_t& input, std::istringstream& ss, const std::string& inputString)
|
||||
{
|
||||
// Parsing joypad controller
|
||||
parseControllerInputs(controller_t::joypad, input.port1, ss, inputString);
|
||||
|
||||
// Controller separator
|
||||
if (ss.get() != '|') reportBadInputString(inputString);
|
||||
|
||||
// Advancing 7 positions (this input is not supported)
|
||||
for (size_t i = 0; i < 7; i++) if (ss.get() != '.') reportBadInputString(inputString);
|
||||
|
||||
// Then, parse the arkanoid controller input
|
||||
parseArkanoidInput(input, ss, inputString);
|
||||
}
|
||||
|
||||
|
||||
static void parseConsoleInputs(bool &reset, bool &power, std::istringstream &ss, const std::string &inputString)
|
||||
{
|
||||
// Currently read character
|
||||
|
|
|
@ -746,7 +746,7 @@ class Core : private Cpu
|
|||
if (addr == 0x4017)
|
||||
{
|
||||
// latch 0 encodes fire, latch 1 encodes potentiometer
|
||||
const uint8_t result = (input_state.arkanoid_latch & 1) * 16 + current_arkanoid_fire * 8;
|
||||
const uint8_t result = (input_state.arkanoid_latch & 1) * 16 + input_state.arkanoid_fire * 8;
|
||||
|
||||
// Advancing latch 1
|
||||
input_state.arkanoid_latch >>= 1;
|
||||
|
@ -759,17 +759,24 @@ class Core : private Cpu
|
|||
if (addr == 0x4016)
|
||||
{
|
||||
// latch 0 encodes fire
|
||||
const uint8_t result = (input_state.joypad_latches[0] & 1) * 2;
|
||||
uint8_t result = (input_state.arkanoid_fire & 1) * 2;
|
||||
|
||||
// latch 0 also encodes joypad 1
|
||||
result += (input_state.joypad_latches[0] & 1) & 1;
|
||||
|
||||
// Advancing joypad latch
|
||||
input_state.joypad_latches[0] >>= 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (addr == 0x4017)
|
||||
{
|
||||
// latch 1 encodes potentiometer
|
||||
const uint8_t result = (input_state.joypad_latches[1] & 1) * 2;
|
||||
const uint8_t result = (input_state.arkanoid_latch & 1) * 2;
|
||||
|
||||
// Advancing latch 1
|
||||
input_state.joypad_latches[1] >>= 1;
|
||||
input_state.arkanoid_latch >>= 1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue