From e3a2f1cfbe1489938e3016d3eb664e74e463b8e3 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 6 Sep 2021 17:16:41 +0200 Subject: [PATCH] ggpo: transmit RT and LT as digital inputs --- core/network/ggpo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/network/ggpo.cpp b/core/network/ggpo.cpp index 76f42b846..b5dbb0a37 100644 --- a/core/network/ggpo.cpp +++ b/core/network/ggpo.cpp @@ -424,6 +424,13 @@ void getInput(u32 out_kcode[4]) out_kcode[1] = ~inputs[1]; //out_kcode[2] = ~inputs[2]; //out_kcode[3] = ~inputs[3]; + if (settings.platform.system != DC_PLATFORM_NAOMI) + { + rt[0] = (inputs[0] & EMU_BTN_TRIGGER_RIGHT) != 0 ? 255 : 0; + lt[0] = (inputs[0] & EMU_BTN_TRIGGER_LEFT) != 0 ? 255 : 0; + rt[1] = (inputs[1] & EMU_BTN_TRIGGER_RIGHT) != 0 ? 255 : 0; + lt[1] = (inputs[1] & EMU_BTN_TRIGGER_LEFT) != 0 ? 255 : 0; + } } void nextFrame() @@ -449,6 +456,17 @@ void nextFrame() // may call save_game_state do { u32 input = ~kcode[localPlayerNum]; + if (settings.platform.system != DC_PLATFORM_NAOMI) + { + if (rt[localPlayerNum] >= 64) + input |= EMU_BTN_TRIGGER_RIGHT; + else + input &= ~EMU_BTN_TRIGGER_RIGHT; + if (lt[localPlayerNum] >= 64) + input |= EMU_BTN_TRIGGER_LEFT; + else + input &= ~EMU_BTN_TRIGGER_LEFT; + } GGPOErrorCode result = ggpo_add_local_input(ggpoSession, localPlayer, &input, sizeof(input)); if (result == GGPO_OK) break;