You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goals:
Create a flexible routine that can be used for gear shifters and more.
Currently racing games are hardcoded to however the author liked the controls. Such as gear controls in Pole Position and OutRun using a toggle button. The choice of using toggle was so you don't have to hold down the gear button.
Realistically the input should not be toggled as that is not how the input worked. This makes it so you cannot use the real/original shifter.
A better method would be to allow selection of how it works, while keeping the driver as clean as posible with the most information about the control as possible.
The definition below works to solve this issue. It also has the flexiblity of using the same control method for the 3 position (2 switch) gas pedal on Change Lanes.
PORT_BIT(MASK, ACTIVE_STATE, TYPE)
MASK = I/O bit mask
DEFAULT = value when inactive. E.g. IP_ACTIVE_LOW will set the default high. Needs to be accurate to hardware so a real/original shifter works.
TYPE:
IPT_SHIFTER - button based shifter
(Maybe XY) If only 2 games (Hard Drivin' & Race Drivin') Then custom PORT_CONF might be better
IPT_SHIFTER_X - Analog XY shifter, x-axis. Use PORT_IPT_SHIFTER_OTHER_XY(NAME, MASK) to link other axis
IPT_SHIFTER_Y - Analog XY shifter, y-axis. Use PORT_IPT_SHIFTER_OTHER_XY(NAME, MASK) to link other axis
PORT_SHIFTER_POS_1(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position. PORT_SHIFTER_POS_1 button will also be used as the Down button when "Up/Down Buttons" is selected or when Toggle is used.
NAME = Position Name - E.g. Low; Gear 1;
The UI will show:
Player 1 Shifter Low; Player 1 Shifter Gear 1; Player 1 Gas Low
PORT_SHIFTER_POS_2(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position. PORT_SHIFTER_POS_2 button will also be used as the Up button when "Up/Down Buttons" is selected.
NAME = Position Name - E.g. High; Gear 2; Medium
The UI will show:
Player 1 Shifter High; Player 1 Shifter Gear 2; Player 1 Gas Medium
PORT_SHIFTER_POS_3 - POS_6(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position.
NAME = Position Name - E.g. Gear 3; High
The UI will show:
Player 1 Shifter Gear 3; Player 1 Gas High
PORT_SHIFTER_DEFAULT(POS)
POS - The position to start at. 1-6 (Not the position state value) Will default to 1 if not used.
PORT_SHIFTER_DOWN_NAME(NAME)
PORT_SHIFTER_UP_NAME(NAME)
NAME - Used to overwrite the default Down Shift; UP Shift names, E.g. Decrease; Increase
The UI name for Down will end up being PLAYER_NUM + PORT_SHIFTER_DOWN_NAME = Player 1 Gas Decrease
PORT_NAME(NAME)
The default name is "Shifter". This will override that.
NAME - "Gas"
---------- Machine Configuration ----------
This definition will add a "Machine Configuration" (or elsewhere) option called PORT_NAME + " Type" with optional Player name if defined. "Player 1 Shifter Type"
This menu will allow selection of "Real"; "Toggle"; "Individual Latched Buttons"; "Up/Down Buttons" and possibly "Defined Buttons"
"Real"
will use the name "Shifter" on the input menu unless overwritten by PORT_NAME.
It will do no processing and will just pass the button state defined by IP_ACTIVE_LOW/IP_ACTIVE_HIGH.
IPT_SHIFTER - Creates the number of buttons needed to fill the mask bits. "Player 1 Shifter IN 0"; "Player 1 Shifter IN 1"; etc.
(Maybe) IPT_SHIFTER_X/Y - Creates X/Y analog axis.
"Toggle"
only appears if there are only 2 positions defined.
PORT_SHIFTER_POS_1 will be the only button displayed. Pressing it will toggle between the 2 positions.
The menu name will be "Toggle " + PORT_SHIFTER_POS_1-Name + "/ " + PORT_SHIFTER_POS_2-Name
The UI will show:
Player 1 Shifter Toggle Low / High
"Individual Latched Buttons"
will use 1 button per defined position. Press that button and the position will latch on and send the value defined by STATE.
The UI will create an entry for each button using NAME from PORT_SHIFTER_POS_
The UI will show:
Player 1 Shifter Gear 1; Player 1 Gas Low
Player 1 Shifter Gear 2; Player 1 Gas Medium
"Up/Down Buttons"
Will only appear with 3+ positions.
will use PORT_SHIFTER_POS_1 button as a Down Shift and PORT_SHIFTER_POS_2 button as Up Shift.
You need to press and release the button to move to the next gear.
It will create 2 UI entries using default info unless overriden.
Player 1 Shift Down; Player 1 Gas Decrease
Player 1 Shift Up; Player 1 Gas Increase
"Analog" - maybe
Map an analog pedal axis so it is divided by the number of positions.
"Analog XY" - maybe. Probably not. But think of an analog stick with plates for different shifters.
Select an XY position and press select to map that position to a gear.
"Defined Buttons" - maybe
will be added if really needed.
It would allow you to map a 3 button shifter to a game that requires 4, etc. A 4 switch on a 3 would not require this as you just don't use 1 switch.
It would bring up sub configuration buttons that would allow entering the button state required for each gear, in effect remapping button input to game required input.
---------- EXAMPLES ----------
// Pole Position:
// 1 switch. Switch On = Low Input = High Gear
PORT_START("IN0")
...
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x01, IPT_BUTTON3, "Low") PORT_SHIFTER_POS_2(0x00, IPT_BUTTON4, "High")
PORT_START("GAS")
// for example only, did not look into correct mapping
// probably also need ability to map analog gas pedal to positions
PORT_BIT( 0x03, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0x02) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CONDITION("DSWA", 0x20, EQUALS, 0x00)
(Maybe) IPT_SHIFTER_X/Y - Creates X/Y analog axis. If only 2 games (Hard Drivin' & Race Drivin') Then custom PORT_CONF might be better
Hard Drivin'
// XY analog axis
PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */
PORT_BIT(0xff, 0x80, IPT_SHIFTER_Y) PORT_SHIFTER_POS_1(0x80, IPT_BUTTON3) PORT_SHIFTER_POS_2(0xff, IPT_BUTTON4) PORT_SHIFTER_POS_3(0x7f, IPT_BUTTON5) PORT_SHIFTER_POS_4(0xff, IPT_BUTTON6) PORT_SHIFTER_POS_5(0x7f, IPT_BUTTON7) PORT_IPT_SHIFTER_OTHER_XY("mainpcb:8BADC.4", 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
========== IPT_SHIFTER ==========
Goals:
Create a flexible routine that can be used for gear shifters and more.
Currently racing games are hardcoded to however the author liked the controls. Such as gear controls in Pole Position and OutRun using a toggle button. The choice of using toggle was so you don't have to hold down the gear button.
Realistically the input should not be toggled as that is not how the input worked. This makes it so you cannot use the real/original shifter.
A better method would be to allow selection of how it works, while keeping the driver as clean as posible with the most information about the control as possible.
The definition below works to solve this issue. It also has the flexiblity of using the same control method for the 3 position (2 switch) gas pedal on Change Lanes.
`---------- DEFINITION ----------
PORT_BIT(MASK, DEFAULT, TYPE) PORT_SHIFTER_POS_1(STATE, BUTTON, NAME) PORT_SHIFTER_POS_2(STATE, BUTTON, NAME) PORT_SHIFTER_POS_3(STATE, BUTTON, NAME) PORT_SHIFTER_POS_4(STATE, BUTTON, NAME) PORT_SHIFTER_DEFAULT(POS) PORT_NAME(NAME) PORT_PLAYER(PLAYER_NUM)
PORT_BIT(MASK, ACTIVE_STATE, TYPE)
MASK = I/O bit mask
DEFAULT = value when inactive. E.g. IP_ACTIVE_LOW will set the default high. Needs to be accurate to hardware so a real/original shifter works.
TYPE:
(Maybe XY) If only 2 games (Hard Drivin' & Race Drivin') Then custom PORT_CONF might be better
PORT_SHIFTER_POS_1(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position. PORT_SHIFTER_POS_1 button will also be used as the Down button when "Up/Down Buttons" is selected or when Toggle is used.
NAME = Position Name - E.g. Low; Gear 1;
The UI will show:
Player 1 Shifter Low; Player 1 Shifter Gear 1; Player 1 Gas Low
PORT_SHIFTER_POS_2(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position. PORT_SHIFTER_POS_2 button will also be used as the Up button when "Up/Down Buttons" is selected.
NAME = Position Name - E.g. High; Gear 2; Medium
The UI will show:
Player 1 Shifter High; Player 1 Shifter Gear 2; Player 1 Gas Medium
PORT_SHIFTER_POS_3 - POS_6(STATE, BUTTON, NAME)
STATE = the value in the mask required for this position.
BUTTON = button to press to latch this position.
NAME = Position Name - E.g. Gear 3; High
The UI will show:
Player 1 Shifter Gear 3; Player 1 Gas High
PORT_SHIFTER_DEFAULT(POS)
POS - The position to start at. 1-6 (Not the position state value) Will default to 1 if not used.
PORT_SHIFTER_DOWN_NAME(NAME)
PORT_SHIFTER_UP_NAME(NAME)
NAME - Used to overwrite the default Down Shift; UP Shift names, E.g. Decrease; Increase
The UI name for Down will end up being PLAYER_NUM + PORT_SHIFTER_DOWN_NAME = Player 1 Gas Decrease
PORT_NAME(NAME)
The default name is "Shifter". This will override that.
NAME - "Gas"
---------- Machine Configuration ----------
"Real"
will use the name "Shifter" on the input menu unless overwritten by PORT_NAME.
It will do no processing and will just pass the button state defined by IP_ACTIVE_LOW/IP_ACTIVE_HIGH.
IPT_SHIFTER - Creates the number of buttons needed to fill the mask bits. "Player 1 Shifter IN 0"; "Player 1 Shifter IN 1"; etc.
(Maybe) IPT_SHIFTER_X/Y - Creates X/Y analog axis.
"Toggle"
only appears if there are only 2 positions defined.
PORT_SHIFTER_POS_1 will be the only button displayed. Pressing it will toggle between the 2 positions.
The menu name will be "Toggle " + PORT_SHIFTER_POS_1-Name + "/ " + PORT_SHIFTER_POS_2-Name
The UI will show:
Player 1 Shifter Toggle Low / High
"Individual Latched Buttons"
will use 1 button per defined position. Press that button and the position will latch on and send the value defined by STATE.
The UI will create an entry for each button using NAME from PORT_SHIFTER_POS_
The UI will show:
Player 1 Shifter Gear 1; Player 1 Gas Low
Player 1 Shifter Gear 2; Player 1 Gas Medium
"Up/Down Buttons"
Will only appear with 3+ positions.
will use PORT_SHIFTER_POS_1 button as a Down Shift and PORT_SHIFTER_POS_2 button as Up Shift.
You need to press and release the button to move to the next gear.
It will create 2 UI entries using default info unless overriden.
Player 1 Shift Down; Player 1 Gas Decrease
Player 1 Shift Up; Player 1 Gas Increase
"Analog" - maybe
Map an analog pedal axis so it is divided by the number of positions.
"Analog XY" - maybe. Probably not. But think of an analog stick with plates for different shifters.
Select an XY position and press select to map that position to a gear.
"Defined Buttons" - maybe
will be added if really needed.
It would allow you to map a 3 button shifter to a game that requires 4, etc. A 4 switch on a 3 would not require this as you just don't use 1 switch.
It would bring up sub configuration buttons that would allow entering the button state required for each gear, in effect remapping button input to game required input.
---------- EXAMPLES ----------
// Pole Position:
// 1 switch. Switch On = Low Input = High Gear
PORT_START("IN0")
...
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x01, IPT_BUTTON3, "Low") PORT_SHIFTER_POS_2(0x00, IPT_BUTTON4, "High")
// OutRun
// 1 switch. Switch On = Low Input = Low Gear
PORT_START("SERVICE")
...
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x00, IPT_BUTTON3, "L"") PORT_SHIFTER_POS_2(0x01, IPT_BUTTON4, "H")
// Drag Race
// 4 switches. 4 Gears. Switch On = Low Input.
PORT_START("IN0")
...
PORT_BIT(0x1E, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x1c, IPT_BUTTON3, "1") PORT_SHIFTER_POS_2(0x1a, IPT_BUTTON4, "2") PORT_SHIFTER_POS_3(0x16, IPT_BUTTON5, "3") PORT_SHIFTER_POS_4(0x0e, IPT_BUTTON6, "4") PORT_PLAYER(1)
PORT_START("IN1")
...
PORT_BIT(0x1E, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x1c, IPT_BUTTON3, "1") PORT_SHIFTER_POS_2(0x1a, IPT_BUTTON4, "2") PORT_SHIFTER_POS_3(0x16, IPT_BUTTON5, "3") PORT_SHIFTER_POS_4(0x0e, IPT_BUTTON6, "4") PORT_PLAYER(2)
// Sprint 1
// 3 switches. 4 Gears. Switch On = Low Input.
PORT_START("INB")
PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x07, IPT_BUTTON3, "1") PORT_SHIFTER_POS_2(0x06, IPT_BUTTON4, "2") PORT_SHIFTER_POS_3(0x05, IPT_BUTTON5, "3") PORT_SHIFTER_POS_4(0x03, IPT_BUTTON6, "4")
// Change Lanes
PORT_START("IN0") // 0xDx2C
...
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_SHIFTER) PORT_SHIFTER_POS_1(0x40, IPT_BUTTON3, "forward") PORT_SHIFTER_POS_2(0x00, IPT_BUTTON4, "reverse")
PORT_START("GAS")
// for example only, did not look into correct mapping
// probably also need ability to map analog gas pedal to positions
PORT_BIT( 0x03, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0x02) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CONDITION("DSWA", 0x20, EQUALS, 0x00)
(Maybe) IPT_SHIFTER_X/Y - Creates X/Y analog axis. If only 2 games (Hard Drivin' & Race Drivin') Then custom PORT_CONF might be better
Hard Drivin'
// XY analog axis
PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */
PORT_BIT(0xff, 0x80, IPT_SHIFTER_Y) PORT_SHIFTER_POS_1(0x80, IPT_BUTTON3) PORT_SHIFTER_POS_2(0xff, IPT_BUTTON4) PORT_SHIFTER_POS_3(0x7f, IPT_BUTTON5) PORT_SHIFTER_POS_4(0xff, IPT_BUTTON6) PORT_SHIFTER_POS_5(0x7f, IPT_BUTTON7) PORT_IPT_SHIFTER_OTHER_XY("mainpcb:8BADC.4", 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F)
PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - shifter lever X*/
PORT_BIT(0xff, 0x80, IPT_SHIFTER_X) PORT_SHIFTER_POS_1(0x80, IPT_BUTTON3) PORT_SHIFTER_POS_2(0xff, IPT_BUTTON4) PORT_SHIFTER_POS_3(0xff, IPT_BUTTON5) PORT_SHIFTER_POS_4(0x7f, IPT_BUTTON6) PORT_SHIFTER_POS_5(0x7f, IPT_BUTTON7) PORT_IPT_SHIFTER_OTHER_XY("mainpcb:8BADC.3", 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_NAME("Shifter Lever X")
`
Beta Was this translation helpful? Give feedback.
All reactions