jvs: allow p2 buttons to be always on. sgdrvsim improvements
jvs: allow button mapped to jvs P2 to be always on. Don't overflow button descriptors table midiffb: invert axis if needed Launch sgdrvsim network instances automatically. Remap some buttons and make some always on.
This commit is contained in:
parent
f186046c98
commit
8a28ddbfe6
|
@ -166,7 +166,12 @@ protected:
|
|||
// always-on mapping
|
||||
for (u32 i = 0; i < cur_mapping.size(); i++)
|
||||
if (cur_mapping[i] == 0xffffffff)
|
||||
v[player - first_player] |= 1 << i;
|
||||
{
|
||||
if (p2_mapping[i] == 0)
|
||||
v[player - first_player] |= 1 << i;
|
||||
else if (player == 0)
|
||||
v[1] |= p2_mapping[i];
|
||||
}
|
||||
u32 keycode = buttons[player];
|
||||
if (keycode == 0)
|
||||
continue;
|
||||
|
@ -254,7 +259,7 @@ private:
|
|||
// Use default mapping
|
||||
return;
|
||||
|
||||
for (int i = 0; NaomiGameInputs->buttons[i].source != 0; i++)
|
||||
for (size_t i = 0; i < std::size(NaomiGameInputs->buttons) && NaomiGameInputs->buttons[i].source != 0; i++)
|
||||
{
|
||||
u32 source = NaomiGameInputs->buttons[i].source;
|
||||
int keyIdx = 0;
|
||||
|
|
|
@ -752,7 +752,13 @@ static void forceFeedbackMidiReceiver(u8 data)
|
|||
ffbCalibrating = false;
|
||||
|
||||
if (!ffbCalibrating)
|
||||
position = std::clamp(-mapleInputState[0].fullAxes[0] * 64.f + 8192.f, 0.f, 16383.f);
|
||||
{
|
||||
int direction = -1;
|
||||
if (NaomiGameInputs != nullptr)
|
||||
direction = NaomiGameInputs->axes[0].inverted ? 1 : -1;
|
||||
|
||||
position = std::clamp(mapleInputState[0].fullAxes[0] * direction * 64.f + 8192.f, 0.f, 16383.f);
|
||||
}
|
||||
// required: b1 & 0x1f == 0x10 && b1 & 0x40 == 0
|
||||
midiSend(0x90, ((int)position >> 7) & 0x7f, (int)position & 0x7f);
|
||||
|
||||
|
|
|
@ -618,13 +618,40 @@ void naomi_cart_LoadRom(const char* file, LoadProgress *progress)
|
|||
|| gameId == "CLUB KART IN JAPAN"
|
||||
|| gameId == "SAMPLE GAME MAX LONG NAME-") // Driving Simulator
|
||||
{
|
||||
initMidiForceFeedback();
|
||||
if (settings.naomi.drivingSimSlave == 0)
|
||||
initMidiForceFeedback();
|
||||
}
|
||||
else if (gameId == "POKASUKA GHOST (JAPANESE)" // Manic Panic Ghosts
|
||||
|| gameId == "TOUCH DE ZUNO (JAPAN)")
|
||||
{
|
||||
touchscreen::init();
|
||||
}
|
||||
|
||||
if (gameId == "SAMPLE GAME MAX LONG NAME-") // Driving Simulator
|
||||
{
|
||||
config::NetworkEnable.override(true);
|
||||
config::ActAsServer.override(settings.naomi.drivingSimSlave == 0);
|
||||
config::NetworkServer.override("localhost:" + std::to_string(config::LocalPort));
|
||||
config::LocalPort.override(config::LocalPort + settings.naomi.drivingSimSlave);
|
||||
if (settings.naomi.drivingSimSlave == 0)
|
||||
{
|
||||
int x = cfgLoadInt("window", "left", (1920 - 640) / 2);
|
||||
int w = cfgLoadInt("window", "width", 640);
|
||||
std::string region = "config:Dreamcast.Region=" + std::to_string(config::Region);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
std::string slaveNum = "naomi:DrivingSimSlave=" + std::to_string(i + 1);
|
||||
std::string left = "window:left=" + std::to_string(i == 1 ? x - w : x + w);
|
||||
const char *args[] = {
|
||||
"-config", slaveNum.c_str(),
|
||||
"-config", region.c_str(),
|
||||
"-config", left.c_str(),
|
||||
settings.content.path.c_str()
|
||||
};
|
||||
os_RunInstance(std::size(args), args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
NOTICE_LOG(NAOMI, "NAOMI GAME ID [%s]", naomi_game_id);
|
||||
|
|
|
@ -668,13 +668,16 @@ static InputDescriptors drvsim_inputs = {
|
|||
{ NAOMI_BTN3_KEY, "Shift 3" },
|
||||
{ NAOMI_BTN4_KEY, "O/D Switch" },
|
||||
{ NAOMI_BTN5_KEY, "S-Brake" },
|
||||
{ NAOMI_BTN6_KEY, "IG-ON", 0, NAOMI_DOWN_KEY },
|
||||
{ NAOMI_BTN7_KEY, "IG-START", 0, NAOMI_LEFT_KEY },
|
||||
{ NAOMI_BTN8_KEY, "Shift 0", 0, NAOMI_BTN0_KEY },
|
||||
{ NAOMI_BTN6_KEY, "IG-START", 0, NAOMI_LEFT_KEY },
|
||||
{ NAOMI_BTN7_KEY, "Shift 0", 0, NAOMI_BTN0_KEY },
|
||||
{ NAOMI_UP_KEY, "Horn" },
|
||||
{ NAOMI_DOWN_KEY, "Light 0" },
|
||||
{ NAOMI_LEFT_KEY, "Light 1" },
|
||||
{ NAOMI_RIGHT_KEY, "Light 2" },
|
||||
// always on unmappable buttons
|
||||
{ NAOMI_BTN8_KEY, "BELT", 0xffffffff, NAOMI_BTN2_KEY },
|
||||
{ NAOMI_RELOAD_KEY, "IG-ON", 0xffffffff, NAOMI_DOWN_KEY },
|
||||
|
||||
NAO_START_DESC
|
||||
NAO_BASE_BTN_DESC
|
||||
// P2 inputs:
|
||||
|
@ -691,7 +694,7 @@ static InputDescriptors drvsim_inputs = {
|
|||
// WIPER-HI
|
||||
},
|
||||
{
|
||||
{ "Master", Full, 0 },
|
||||
{ "Master", Full, 0, true },
|
||||
{ "Accelerator", Half, 4 },
|
||||
{ "Brake", Half, 5 },
|
||||
{ "Clutch", Full, 1 },
|
||||
|
|
Loading…
Reference in New Issue