mirror of
https://github.com/holub/mame
synced 2025-06-30 07:58:56 +03:00
parent
e43e9b68f6
commit
5a33c5eb6d
@ -197,7 +197,8 @@ protected:
|
|||||||
|
|
||||||
soundmux_status_t soundmux_status(void);
|
soundmux_status_t soundmux_status(void);
|
||||||
void update_sound(void);
|
void update_sound(void);
|
||||||
void poll_joystick(bool *joyin, uint8_t *buttons);
|
bool poll_joystick(void);
|
||||||
|
uint8_t poll_joystick_buttons(void);
|
||||||
void poll_keyboard(void);
|
void poll_keyboard(void);
|
||||||
void poll_hires_joystick(void);
|
void poll_hires_joystick(void);
|
||||||
void update_cassout(int cassout);
|
void update_cassout(int cassout);
|
||||||
|
@ -661,7 +661,7 @@ bool coco_state::is_joystick_hires(int joystick_index)
|
|||||||
// poll_joystick
|
// poll_joystick
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void coco_state::poll_joystick(bool *joyin, uint8_t *buttons)
|
bool coco_state::poll_joystick(void)
|
||||||
{
|
{
|
||||||
static const analog_input_t s_empty = {};
|
static const analog_input_t s_empty = {};
|
||||||
static const int joy_rat_table[] = {15, 24, 42, 33 };
|
static const int joy_rat_table[] = {15, 24, 42, 33 };
|
||||||
@ -712,11 +712,65 @@ void coco_state::poll_joystick(bool *joyin, uint8_t *buttons)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*joyin = joyin_value;
|
return joyin_value;
|
||||||
*buttons = analog->buttons();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// poll_joystick_buttons
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
uint8_t coco_state::poll_joystick_buttons(void)
|
||||||
|
{
|
||||||
|
static const analog_input_t s_empty = {};
|
||||||
|
const analog_input_t *analog;
|
||||||
|
uint8_t joy0, joy1;
|
||||||
|
|
||||||
|
switch(joystick_type(0))
|
||||||
|
{
|
||||||
|
case JOYSTICK_NORMAL:
|
||||||
|
analog = &m_joystick;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOYSTICK_RAT_MOUSE:
|
||||||
|
analog = &m_rat_mouse;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOYSTICK_DIECOM_LIGHT_GUN:
|
||||||
|
analog = &m_diecom_lightgun;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* None */
|
||||||
|
analog = &s_empty;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
joy0 = analog->buttons();
|
||||||
|
|
||||||
|
switch(joystick_type(1))
|
||||||
|
{
|
||||||
|
case JOYSTICK_NORMAL:
|
||||||
|
analog = &m_joystick;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOYSTICK_RAT_MOUSE:
|
||||||
|
analog = &m_rat_mouse;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOYSTICK_DIECOM_LIGHT_GUN:
|
||||||
|
analog = &m_diecom_lightgun;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* None */
|
||||||
|
analog = &s_empty;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
joy1 = analog->buttons();
|
||||||
|
|
||||||
|
return joy0 | joy1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// poll_keyboard
|
// poll_keyboard
|
||||||
@ -743,13 +797,14 @@ void coco_state::poll_keyboard(void)
|
|||||||
|
|
||||||
/* poll the joystick (*/
|
/* poll the joystick (*/
|
||||||
bool joyin;
|
bool joyin;
|
||||||
uint8_t buttons;
|
joyin = poll_joystick();
|
||||||
poll_joystick(&joyin, &buttons);
|
|
||||||
|
|
||||||
/* PA7 comes from JOYIN */
|
/* PA7 comes from JOYIN */
|
||||||
pia0_pa |= joyin ? 0x80 : 0x00;
|
pia0_pa |= joyin ? 0x80 : 0x00;
|
||||||
|
|
||||||
/* mask out the buttons */
|
/* mask out the buttons */
|
||||||
|
uint8_t buttons;
|
||||||
|
buttons = poll_joystick_buttons();
|
||||||
pia0_pa &= ~buttons;
|
pia0_pa &= ~buttons;
|
||||||
|
|
||||||
/* and write the result to PIA0 */
|
/* and write the result to PIA0 */
|
||||||
|
Loading…
Reference in New Issue
Block a user