mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
namco/namcos22.cpp: Use trackball for Armadillo racing and provide option to use original 45 degree orientation.
This commit is contained in:
parent
b55ba31343
commit
fb6111b788
@ -12,12 +12,13 @@ TODO:
|
||||
- DSW3 is read, not sure where it's used
|
||||
- Keyboard is mapped through test mode, but some bits are unknown, and hopper
|
||||
is not emulated
|
||||
- Map Leds and Coin counters
|
||||
- Map LEDs and coin counters
|
||||
- Remove patches after finding why there are so many pitfalls. Maybe the
|
||||
game expects to read inputs via an external device and expects certain
|
||||
timings
|
||||
- Trojan out internal ROMs for kungfua and double8l
|
||||
- kungfua and double8l have 5 8-DIP banks (sheets available for double8l)
|
||||
- kungfua and double8l have 5 banks of 8 DIP switches (sheets available for
|
||||
double8l)
|
||||
|
||||
Press F1+F2 during reset to see 'pork*ish' test mode :P
|
||||
|
||||
@ -182,8 +183,8 @@ void cabaret_state::nmi_and_coins_w(uint8_t data)
|
||||
{
|
||||
if ((m_nmi_enable ^ data) & (~0xdd))
|
||||
{
|
||||
logerror("PC %06X: nmi_and_coins = %02x\n", m_maincpu->pc(), data);
|
||||
// popmessage("%02x",data);
|
||||
logerror("%s: nmi_and_coins = %02x\n", machine().describe_context(), data);
|
||||
//popmessage("%02x", data);
|
||||
}
|
||||
|
||||
machine().bookkeeping().coin_counter_w(0, data & 0x01); // coin_a
|
||||
@ -191,9 +192,9 @@ void cabaret_state::nmi_and_coins_w(uint8_t data)
|
||||
machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in
|
||||
machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech
|
||||
|
||||
m_led = BIT(data, 6); // led for coin m_out / hopper active
|
||||
m_led = BIT(data, 6); // LED for coin m_out / hopper active
|
||||
|
||||
m_nmi_enable = data; // data & 0x80 // nmi enable?
|
||||
m_nmi_enable = data; // data & 0x80 // NMI enable?
|
||||
|
||||
m_out[0] = data;
|
||||
show_out();
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Oli-Boo-Chu (USA) / Punching Kid (パンチングキッド) (Japan)
|
||||
There's also an English flyer for Ali-Boo-Chu
|
||||
There's also an English language flyer for Ali-Boo-Chu
|
||||
|
||||
driver by Nicola Salmoria
|
||||
|
||||
@ -76,12 +76,12 @@ VIDEO M-47B-A:
|
||||
#include "machine/timer.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/hc55516.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
#include "tilemap.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
namespace {
|
||||
@ -359,7 +359,7 @@ void olibochu_state::sound_command_w(offs_t offset, u8 data)
|
||||
}
|
||||
|
||||
// sound_command high bits = soundlatch d0-d3
|
||||
for (c = 0; c < 16 && !BIT(hi, c); c++) { ; }
|
||||
for (c = 0; c < 16 && !BIT(hi, c); c++) { }
|
||||
m_soundlatch[0]->write((16 - c) & 0xf);
|
||||
}
|
||||
|
||||
|
@ -2914,15 +2914,36 @@ TIMER_DEVICE_CALLBACK_MEMBER(adillor_state::trackball_interrupt)
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(adillor_state::trackball_update)
|
||||
{
|
||||
// arbitrary timer for reading optical trackball
|
||||
u32 const trackval[2] = { m_opt[0]->read(), m_opt[1]->read() };
|
||||
s32 delta[2] = { s32(trackval[0] - m_trackball_count[0]), s32(trackval[1] - m_trackball_count[1]) };
|
||||
m_trackball_count[0] = trackval[0];
|
||||
m_trackball_count[1] = trackval[1];
|
||||
if (delta[0] > 0x8000)
|
||||
delta[0] -= 0x10000;
|
||||
else if (delta[0] < -0x8000)
|
||||
delta[0] += 0x10000;
|
||||
if (delta[1] > 0x8000)
|
||||
delta[1] -= 0x10000;
|
||||
else if (delta[1] < -0x8000)
|
||||
delta[1] += 0x10000;
|
||||
m_trackball_residual[0] += delta[0];
|
||||
m_trackball_residual[1] += delta[1];
|
||||
int const speed[2] = { std::clamp<s32>(m_trackball_residual[0], -0x7f, 0x7f), std::clamp<s32>(m_trackball_residual[1], -0x7f, 0x7f) };
|
||||
m_trackball_residual[0] -= speed[0];
|
||||
m_trackball_residual[1] -= speed[1];
|
||||
|
||||
// -1.0 .. 1.0
|
||||
double x = (double)(int)(m_opt[0]->read() - 0x80) / 127.0;
|
||||
double y = (double)(int)(m_opt[1]->read() - 0x80) / 127.0;
|
||||
double x = speed[0] / 127.0;
|
||||
double y = speed[1] / 127.0;
|
||||
|
||||
// note that it is rotated by 45 degrees, so instead of axes like (+), they are like (x)
|
||||
double ox = x, oy = y;
|
||||
double a = M_PI / 4.0;
|
||||
x = ox*cos(a) - oy*sin(a);
|
||||
y = ox*sin(a) + oy*cos(a);
|
||||
if (BIT(m_config_switches->read(), 1))
|
||||
{
|
||||
double const ox = x, oy = y;
|
||||
double const a = M_PI / 4.0;
|
||||
x = ox*cos(a) - oy*sin(a);
|
||||
y = ox*sin(a) + oy*cos(a);
|
||||
}
|
||||
|
||||
// tied to mcu A2/A3 timer (speed determines frequency)
|
||||
double t[2];
|
||||
@ -3443,10 +3464,10 @@ static INPUT_PORTS_START( adillor )
|
||||
PORT_BIT( 0xfe00, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("OPT.0")
|
||||
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x01, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(8) PORT_NAME("Trackball X")
|
||||
PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(0x100) PORT_KEYDELTA(0x10)
|
||||
|
||||
PORT_START("OPT.1")
|
||||
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(8) PORT_NAME("Trackball Y") PORT_REVERSE
|
||||
PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(0x100) PORT_KEYDELTA(0x10) PORT_REVERSE
|
||||
|
||||
PORT_START("DSW")
|
||||
PORT_DIPNAME( 0x00010000, 0x00010000, "Test Mode" ) PORT_DIPLOCATION("SW4:1")
|
||||
@ -3465,6 +3486,9 @@ static INPUT_PORTS_START( adillor )
|
||||
PORT_CONFNAME( 0x01, 0x00, "Enable Dev Inputs" )
|
||||
PORT_CONFSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_CONFSETTING( 0x01, DEF_STR( Yes ) )
|
||||
PORT_CONFNAME( 0x02, 0x02, "Trackball Orientation" )
|
||||
PORT_CONFSETTING( 0x00, "Direct" )
|
||||
PORT_CONFSETTING( 0x02, "Natural" )
|
||||
|
||||
PORT_START("CUSTOM.0")
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DEV", 0x01, EQUALS, 0x01) PORT_PLAYER(2) PORT_NAME("Dev Service Enter")
|
||||
@ -3739,6 +3763,14 @@ void alpine_state::machine_start()
|
||||
save_item(NAME(m_motor_status));
|
||||
}
|
||||
|
||||
void adillor_state::machine_start()
|
||||
{
|
||||
namcos22s_state::machine_start();
|
||||
|
||||
save_item(NAME(m_trackball_count));
|
||||
save_item(NAME(m_trackball_residual));
|
||||
}
|
||||
|
||||
// System22
|
||||
|
||||
void namcos22_state::namcos22(machine_config &config)
|
||||
|
@ -667,14 +667,22 @@ class adillor_state : public namcos22s_state
|
||||
public:
|
||||
adillor_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
namcos22s_state(mconfig, type, tag),
|
||||
m_trackball_interrupt(*this, "trackball_int%u", 0)
|
||||
m_trackball_interrupt(*this, "trackball_int%u", 0),
|
||||
m_config_switches(*this, "DEV")
|
||||
{ }
|
||||
|
||||
void adillor(machine_config &config);
|
||||
void init_adillor();
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
required_device_array<timer_device, 2> m_trackball_interrupt;
|
||||
required_ioport m_config_switches;
|
||||
|
||||
u32 m_trackball_count[2] = { };
|
||||
s32 m_trackball_residual[2] = { };
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(trackball_update);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(trackball_interrupt);
|
||||
|
Loading…
Reference in New Issue
Block a user