naomi: fix shootout pool inputs

Use button 1 to switch between cue aim and cue roller rotary encoders.
Remap start/mode to start
This commit is contained in:
Flyinghead 2023-07-16 19:10:39 +02:00
parent 7a22318b0f
commit 8e3a48eb6f
3 changed files with 100 additions and 33 deletions

View File

@ -239,6 +239,16 @@ protected:
y = mapleInputState[playerNum].absPos.y;
}
}
virtual s16 readRotaryEncoders(int channel, s16 relX, s16 relY)
{
switch (channel)
{
case 0: return relX;
case 1: return relY;
default: return 0;
}
}
u32 player_count = 0;
u32 digital_in_count = 0;
@ -345,7 +355,49 @@ public:
}
protected:
const char *get_id() override { return "SEGA ENTERPRISES,LTD.;837-13938 ENCORDER BD ;Ver0.01;99/08"; }
};
// Uses btn1 to switch between cue aim and cue roller encoders
class jvs_837_13938_shootout : public jvs_837_13938
{
public:
jvs_837_13938_shootout(u8 node_id, maple_naomi_jamma *parent, int first_player = 0)
: jvs_837_13938(node_id, parent, first_player)
{
memset(lastValue, 0, sizeof(lastValue));
}
protected:
void read_digital_in(const u32 *buttons, u16 *v) override
{
jvs_837_13938::read_digital_in(buttons, v);
btn1down = v[0] & NAOMI_BTN1_KEY;
}
s16 readRotaryEncoders(int channel, s16 relX, s16 relY) override
{
switch (channel)
{
case 0: // CUE AIM L/R
if (!btn1down)
lastValue[0] = relX;
break;
case 1: // CUE AIM U/D
if (!btn1down)
lastValue[1] = relY;
break;
case 2: // CUE ROLLER
if (btn1down)
lastValue[2] = relY;
break;
default:
return 0;
}
return lastValue[channel];
}
bool btn1down = false;
s16 lastValue[3];
};
// Sega Marine Fishing, 18 Wheeler (TODO)
@ -907,7 +959,10 @@ maple_naomi_jamma::maple_naomi_jamma()
io_boards.push_back(std::make_unique<jvs_837_13551_4P>(1, this));
break;
case JVS::RotaryEncoders:
io_boards.push_back(std::make_unique<jvs_837_13938>(1, this));
if (settings.content.gameId.substr(0, 13) == "SHOOTOUT POOL")
io_boards.push_back(std::make_unique<jvs_837_13938_shootout>(1, this));
else
io_boards.push_back(std::make_unique<jvs_837_13938>(1, this));
io_boards.push_back(std::make_unique<jvs_837_13551>(2, this));
break;
case JVS::OutTrigger:
@ -1891,24 +1946,10 @@ u32 jvs_io_board::handle_jvs_message(u8 *buffer_in, u32 length_in, u8 *buffer_ou
LOGJVS("rotenc ");
for (int chan = 0; chan < buffer_in[cmdi + 1]; chan++)
{
if (chan == 0)
{
LOGJVS("%d:%4x ", chan, rotx & 0xFFFF);
JVS_OUT(rotx >> 8); // MSB
JVS_OUT(rotx); // LSB
}
else if (chan == 1)
{
LOGJVS("%d:%4x ", chan, roty & 0xFFFF);
JVS_OUT(roty >> 8); // MSB
JVS_OUT(roty); // LSB
}
else
{
LOGJVS("%d:%4x ", chan, 0);
JVS_OUT(0x00); // MSB
JVS_OUT(0x00); // LSB
}
s16 v = readRotaryEncoders(chan, rotx, roty);
LOGJVS("%d:%4x ", chan, v & 0xFFFF);
JVS_OUT(v >> 8); // MSB
JVS_OUT(v); // LSB
}
cmdi += 2;
}

View File

@ -389,13 +389,9 @@ const Game Games[] =
{ "mtp-23842.ic19s", 0x2000000, 0x800000, 0x0000000, InterleavedWord },
{ "mtp-23843.ic20", 0x2000002, 0x800000, 0x0000000, InterleavedWord },
{ "copy", 0x400000, 0xc00000, 0x0000000, Copy, 0x1000000 },
{ NULL, 0, 0 },
}
// btn0: TOP VIEW, btn2; START/MODE, up: ZOOM IN, down: ZOOM OUT
// mouse: TRACK BALL X/Y
// TODO CUE ROLLER (x8000)
// CUE TIP UD (x80h)
// CUE TIP LR (x80h)
},
nullptr,
&shootout_inputs,
},
// Shootout Pool The Medal / Shootout Pool Prize (Rev A)
{
@ -417,9 +413,9 @@ const Game Games[] =
//ROM_REGION(0x200, "some_eeprom", 0)
//ROM_LOAD( "25lc040.ic13s", 0, 0x200, CRC(d11312d3) SHA1(c444012954f58a9af283ab8439f31cb89de9c14d) )
{ NULL, 0, 0 },
}
},
nullptr,
&shootout_inputs,
},
// Shootout Pool The Medal Ver. B / Shootout Pool Prize Ver. B
{
@ -438,8 +434,9 @@ const Game Games[] =
{ "opr-24176.ic19s", 0x2000000, 0x800000, 0x0000000, InterleavedWord },
{ "opr-24177.ic20", 0x2000002, 0x800000, 0x0000000, InterleavedWord },
{ "copy", 0x400000, 0xc00000, 0x0000000, Copy, 0x1000000 },
{ NULL, 0, 0 },
}
},
nullptr,
&shootout_inputs,
},
// Shootout Pool Prize (Export) / Shootout Pool The Medal (Japan) Version B (prototype)
{
@ -458,8 +455,9 @@ const Game Games[] =
{ "rom3.ic3s", 0x1800000, 0x800000 },
{ "rom4.ic4s", 0x2000000, 0x800000 },
// IC5 - IC21 populated, empty.
{ NULL, 0, 0 },
}
},
nullptr,
&shootout_inputs,
},
// Touch de Uno! 2 (Japan)
@ -4309,6 +4307,19 @@ const Game Games[] =
&zombie_inputs,
zombrvn_eeprom_dump,
},
{
"hopper",
nullptr,
"SWP Hopper Board",
0x0b000000,
0x1e5bb0cd,
NULL,
M2,
ROT0,
{
{ "epr-24083.ic11", 0x000000, 0x400000, 0x2733e65a },
},
},
// Naomi M4 Roms
// Akatsuki Blitzkampf Ausf. Achse (Japan)
{

View File

@ -463,6 +463,21 @@ static InputDescriptors toukon4_inputs = INPUT_5_BUTTONS("X", "Y", "R", "A", "B"
static InputDescriptors hmgeo_inputs = INPUT_4_BUTTONS("Fire", "Attack", "Jump", "Target");
static InputDescriptors shootout_inputs = {
{
{ NAOMI_START_KEY, "START/MODE", NAOMI_BTN2_KEY },
{ NAOMI_BTN0_KEY, "TOP/VIEW" },
{ NAOMI_BTN1_KEY, "CUE ROLLER" }, // only used by emulator. press to use cue roller instead of cue aim
{ NAOMI_UP_KEY, "ZOOM IN" },
{ NAOMI_DOWN_KEY, "ZOOM OUT" },
NAO_BASE_BTN_DESC
},
{
{ "CUE TIP U/D", Full, 1, true },
{ "CUE TIP L/R", Full, 0, true },
}
};
//
// AtomisWave games
//