From 146bfb28d1d9b28c6c2298171a80fd1d1303df70 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 27 Oct 2021 12:26:17 +0200 Subject: [PATCH] ggpo: always use P1 input in netplay even if playing as P2 fix imgui assert --- core/network/ggpo.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/core/network/ggpo.cpp b/core/network/ggpo.cpp index 17740b690..9c6700217 100644 --- a/core/network/ggpo.cpp +++ b/core/network/ggpo.cpp @@ -680,40 +680,40 @@ bool nextFrame() if (!config::ThreadedRendering) UpdateInputState(); Inputs inputs; - inputs.kcode = ~kcode[localPlayerNum]; - if (rt[localPlayerNum] >= 64) + inputs.kcode = ~kcode[0]; + if (rt[0] >= 64) inputs.kcode |= BTN_TRIGGER_RIGHT; else inputs.kcode &= ~BTN_TRIGGER_RIGHT; - if (lt[localPlayerNum] >= 64) + if (lt[0] >= 64) inputs.kcode |= BTN_TRIGGER_LEFT; else inputs.kcode &= ~BTN_TRIGGER_LEFT; if (analogAxes > 0) { - inputs.u.analog.x = joyx[localPlayerNum]; + inputs.u.analog.x = joyx[0]; if (analogAxes >= 2) - inputs.u.analog.y = joyy[localPlayerNum]; + inputs.u.analog.y = joyy[0]; } else if (absPointerPos) { - inputs.u.absPos.x = mo_x_abs[localPlayerNum]; - inputs.u.absPos.y = mo_y_abs[localPlayerNum]; + inputs.u.absPos.x = mo_x_abs[0]; + inputs.u.absPos.y = mo_y_abs[0]; } else if (keyboardGame) { - inputs.kbModifiers = kb_shift[localPlayerNum]; - memcpy(inputs.u.keys, kb_key[localPlayerNum], sizeof(kb_key[localPlayerNum])); + inputs.kbModifiers = kb_shift[0]; + memcpy(inputs.u.keys, kb_key[0], sizeof(kb_key[0])); } else if (mouseGame) { - inputs.mouseButtons = ~mo_buttons[localPlayerNum]; - inputs.u.relPos.x = std::round(mo_x_delta[localPlayerNum]); - inputs.u.relPos.y = std::round(mo_y_delta[localPlayerNum]); - inputs.u.relPos.wheel = std::round(mo_wheel_delta[localPlayerNum]); - mo_x_delta[localPlayerNum] -= inputs.u.relPos.x; - mo_y_delta[localPlayerNum] -= inputs.u.relPos.y; - mo_wheel_delta[localPlayerNum] -= inputs.u.relPos.wheel; + inputs.mouseButtons = ~mo_buttons[0]; + inputs.u.relPos.x = std::round(mo_x_delta[0]); + inputs.u.relPos.y = std::round(mo_y_delta[0]); + inputs.u.relPos.wheel = std::round(mo_wheel_delta[0]); + mo_x_delta[0] -= inputs.u.relPos.x; + mo_y_delta[0] -= inputs.u.relPos.y; + mo_wheel_delta[0] -= inputs.u.relPos.wheel; } GGPOErrorCode result = ggpo_add_local_input(ggpoSession, localPlayer, &inputs, inputSize); if (result == GGPO_OK) @@ -808,7 +808,7 @@ void displayStats() ImGui::SetNextWindowPos(ImVec2(10, 10)); ImGui::SetNextWindowSize(ImVec2(95 * scaling, 0)); ImGui::SetNextWindowBgAlpha(0.7f); - ImGui::Begin("", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs); + ImGui::Begin("##ggpostats", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs); ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.557f, 0.268f, 0.965f, 1.f)); // Send Queue