ggpo: always use P1 input in netplay even if playing as P2

fix imgui assert
This commit is contained in:
Flyinghead 2021-10-27 12:26:17 +02:00
parent 46fb331275
commit 146bfb28d1
1 changed files with 17 additions and 17 deletions

View File

@ -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