summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Michaël Banaan Ananas <happppp@users.noreply.github.com>2012-07-11 10:10:27 +0000
committer Michaël Banaan Ananas <happppp@users.noreply.github.com>2012-07-11 10:10:27 +0000
commit5a1ec4d450118047c1b1c6c459434c2c29afba64 (patch)
tree650fd74f1eb35b16b5d30dded9badf652f9816fb
parentac66a2a218b7d31e17ce6728461290f0623591b6 (diff)
improve dendego controls
-rw-r--r--src/mame/drivers/taitojc.c50
-rw-r--r--src/mame/includes/taitojc.h9
2 files changed, 18 insertions, 41 deletions
diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c
index 2d0ccf5bb64..7c44cee4c3c 100644
--- a/src/mame/drivers/taitojc.c
+++ b/src/mame/drivers/taitojc.c
@@ -823,8 +823,8 @@ WRITE32_MEMBER(taitojc_state::jc_meters_w)
{
switch (offset & 3)
{
- case 0: m_speed_meter = taitojc_odometer_table[(data >> 16) & 0xff]; break;
- case 1: m_brake_meter = taitojc_brake_table[(data >> 16) & 0xff]; break;
+ case 0: m_speed_meter = dendego_odometer_table[(data >> 16) & 0xff]; break;
+ case 1: m_brake_meter = dendego_brake_table[(data >> 16) & 0xff]; break;
case 2: break; // unused?
case 3: break; // ?
}
@@ -832,7 +832,10 @@ WRITE32_MEMBER(taitojc_state::jc_meters_w)
if(ioport("METER")->read_safe(0))
{
- UINT8 mascon_lv = (ioport("MASCON")->read() & 0x70) >> 4;
+ UINT8 btn = (ioport("BUTTONS")->read() & 0x77);
+ int mascon_lv;
+ for (mascon_lv = 0; mascon_lv < 6; mascon_lv++)
+ if (btn == dendego_mascon_table[mascon_lv]) break;
popmessage("%d %.02f km/h %.02f MPa",mascon_lv,m_speed_meter,m_brake_meter/10);
}
@@ -1152,47 +1155,18 @@ static INPUT_PORTS_START( common )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, set_cs_line)
INPUT_PORTS_END
-/* Mascon must always be in a defined state, Densha de Go 2 in particular returns black screen if the Mascon input is undefined
- We convert the 6 lever "shifter" into a fake analog port for now. */
-CUSTOM_INPUT_MEMBER(taitojc_state::mascon_state_r)
-{
- static const UINT8 mascon_table[6] = { 0x01, 0x10, 0x02, 0x20, 0x04, 0x40 };
- UINT8 res = ioport("MASCON")->read();
- int i;
-
- //popmessage("%02x",res);
-
- for(i=0;i<6;i++)
- {
- if((res & 0x70) == (0x10*i))
- return mascon_table[i];
- }
-
- return mascon_table[5];
-}
-
static INPUT_PORTS_START( dendego )
PORT_INCLUDE( common )
PORT_MODIFY("UNUSED")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Horn Button")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Horn Button")
- PORT_MODIFY("BUTTONS")
- /* TODO: fix this */
+ PORT_MODIFY("BUTTONS") // Throttle Lever at left, move down to speed up, 6 positions
+ PORT_BIT( 0x77, 0x00, IPT_POSITIONAL_V ) PORT_POSITIONS(6) PORT_REMAP_TABLE(dendego_mascon_table) PORT_SENSITIVITY(8) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_NAME("Throttle Lever")
PORT_BIT( 0x88, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x77, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitojc_state,mascon_state_r,NULL)
-// PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Mascon 5") // Mascon 5
-// PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Mascon 3") // Mascon 3
-// PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Mascon 1") // Mascon 1
-// PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Mascon 4") // Mascon 4
-// PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Mascon 2") // Mascon 2
-// PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Mascon 0") // Mascon 0
-
- PORT_START("MASCON")
- PORT_BIT( 0x7f, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(0x60) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0)
-
- PORT_START("ANALOG1")
- PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_NAME("Brake Lever")
+
+ PORT_START("ANALOG1") // Brake Lever at right, rotate handle right (anti clockwise) to increase pressure, 11 positions but not at constant intervals like the throttle lever
+ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(20) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_NAME("Brake Lever")
PORT_START("METER")
PORT_CONFNAME( 0x01, 0x01, "Show Meters" )
diff --git a/src/mame/includes/taitojc.h b/src/mame/includes/taitojc.h
index 5b8835a1530..950821d0be8 100644
--- a/src/mame/includes/taitojc.h
+++ b/src/mame/includes/taitojc.h
@@ -115,7 +115,6 @@ public:
DECLARE_READ32_MEMBER(taitojc_char_r);
DECLARE_WRITE32_MEMBER(taitojc_tile_w);
DECLARE_WRITE32_MEMBER(taitojc_char_w);
- DECLARE_CUSTOM_INPUT_MEMBER(mascon_state_r);
};
@@ -127,7 +126,8 @@ void taitojc_render_polygons(running_machine &machine, UINT16 *polygon_fifo, int
VIDEO_START(taitojc);
SCREEN_UPDATE_IND16(taitojc);
-const double taitojc_odometer_table[0x100] =
+// lookup tables for densha de go analog controls/meters
+const double dendego_odometer_table[0x100] =
{
0.0, 0.3, 0.7, 1.0, 1.4, 1.7, 2.1, 2.4, 2.8, 3.1, 3.4, 3.8, 4.1, 4.5, 4.8, 5.2,
5.5, 5.9, 6.2, 6.6, 6.9, 7.2, 7.6, 7.9, 8.3, 8.6, 9.0, 9.3, 9.7, 10.0, 10.5, 11.1,
@@ -147,7 +147,7 @@ const double taitojc_odometer_table[0x100] =
125.3, 125.6, 125.9, 126.2, 126.6, 126.9, 127.2, 127.5, 127.8, 128.1, 128.4, 128.8, 129.1, 129.4, 129.7, 130.0,
};
-const double taitojc_brake_table[0x100] =
+const double dendego_brake_table[0x100] =
{
0.00, 0.00, 0.00, 0.00, 0.05, 0.10, 0.14, 0.19, 0.24, 0.29, 0.33, 0.38, 0.43, 0.48, 0.52, 0.57,
0.62, 0.67, 0.71, 0.76, 0.81, 0.86, 0.90, 0.95, 1.00, 1.06, 1.12, 1.19, 1.25, 1.31, 1.38, 1.44,
@@ -166,3 +166,6 @@ const double taitojc_brake_table[0x100] =
14.71, 14.79, 14.86, 14.93, 15.00, 15.04, 15.07, 15.11, 15.15, 15.19, 15.22, 15.26, 15.30, 15.33, 15.37, 15.41,
15.44, 15.48, 15.52, 15.56, 15.59, 15.63, 15.67, 15.70, 15.74, 15.78, 15.81, 15.85, 15.89, 15.93, 15.96, 16.00,
};
+
+// Mascon must always be in a defined state, Densha de Go 2 in particular returns black screen if the Mascon input is undefined
+const ioport_value dendego_mascon_table[] = { 0x76, 0x67, 0x75, 0x57, 0x73, 0x37 };