diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index bd9db6025..d8291ebff 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -119,6 +119,8 @@ OptionString NetworkServer("server", "", "network"); Option EmulateBBA("EmulateBBA", false, "network"); Option GGPOEnable("GGPO", false, "network"); Option GGPODelay("GGPODelay", 0, "network"); +Option NetworkStats("Stats", true, "network"); +Option GGPOAnalogAxes("GGPOAnalogAxes", 0, "network"); #ifdef SUPPORT_DISPMANX Option DispmanxMaintainAspect("maintain_aspect", true, "dispmanx"); diff --git a/core/cfg/option.h b/core/cfg/option.h index 9f0f6c4ee..a8dd399e8 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -494,6 +494,8 @@ extern OptionString NetworkServer; extern Option EmulateBBA; extern Option GGPOEnable; extern Option GGPODelay; +extern Option NetworkStats; +extern Option GGPOAnalogAxes; #ifdef SUPPORT_DISPMANX extern Option DispmanxMaintainAspect; diff --git a/core/network/ggpo.cpp b/core/network/ggpo.cpp index 82b79153c..f162792f5 100644 --- a/core/network/ggpo.cpp +++ b/core/network/ggpo.cpp @@ -77,7 +77,6 @@ static time_point lastFrameTime; static int msPerFrameAvg; static bool _endOfFrame; static MiniUPnP miniupnp; -static int analogInputs = 0; struct MemPages { @@ -370,7 +369,7 @@ void startSession(int localPort, int localPlayerNum) synchronized = true; NOTICE_LOG(NETWORK, "GGPO synctest session started"); #else - u32 inputSize = sizeof(kcode[0]) + analogInputs; + u32 inputSize = sizeof(kcode[0]) + config::GGPOAnalogAxes; GGPOErrorCode result = ggpo_start_session(&ggpoSession, &cb, config::Settings::instance().getGameId().c_str(), MAX_PLAYERS, inputSize, localPort); if (result != GGPO_OK) { @@ -448,7 +447,7 @@ void getInput(MapleInputState inputState[4]) for (int player = 0; player < 4; player++) inputState[player] = {}; - u32 inputSize = sizeof(u32) + analogInputs; + u32 inputSize = sizeof(u32) + config::GGPOAnalogAxes; std::vector inputs(inputSize * MAX_PLAYERS); // should not call any callback ggpo_synchronize_input(ggpoSession, (void *)&inputs[0], inputs.size(), nullptr); @@ -457,10 +456,10 @@ void getInput(MapleInputState inputState[4]) { MapleInputState& state = inputState[player]; state.kcode = ~(*(u32 *)&inputs[player * inputSize]); - if (analogInputs > 0) + if (config::GGPOAnalogAxes > 0) { state.fullAxes[PJAI_X1] = inputs[player * inputSize + 4]; - if (analogInputs == 2) + if (config::GGPOAnalogAxes == 2) state.fullAxes[PJAI_Y1] = inputs[player * inputSize + 5]; } state.halfAxes[PJTI_R] = (state.kcode & EMU_BTN_TRIGGER_RIGHT) == 0 ? 255 : 0; @@ -505,13 +504,13 @@ bool nextFrame() else input &= ~EMU_BTN_TRIGGER_LEFT; } - u32 inputSize = sizeof(input) + analogInputs; + u32 inputSize = sizeof(input) + config::GGPOAnalogAxes; std::vector allInput(inputSize); *(u32 *)&allInput[0] = input; - if (analogInputs > 0) + if (config::GGPOAnalogAxes > 0) { allInput[4] = joyx[localPlayerNum]; - if (analogInputs == 2) + if (config::GGPOAnalogAxes == 2) allInput[5] = joyy[localPlayerNum]; } GGPOErrorCode result = ggpo_add_local_input(ggpoSession, localPlayer, &allInput[0], inputSize); diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index a454af79b..ed544a007 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1742,7 +1742,7 @@ static void gui_display_settings() "Enable networking for supported Naomi games"); if (config::GGPOEnable) { - OptionCheckbox("Play as player 1", config::ActAsServer, + OptionCheckbox("Play as Player 1", config::ActAsServer, "Deselect to play as player 2"); char server_name[256]; strcpy(server_name, config::NetworkServer.get().c_str()); @@ -1753,6 +1753,15 @@ static void gui_display_settings() OptionSlider("Frame Delay", config::GGPODelay, 0, 20, "Sets Frame Delay, advisable for sessions with ping >100 ms"); + ImGui::Text("Left Thumbstick:"); + OptionRadioButton("Disabled", config::GGPOAnalogAxes, 0, "Left thumbstick not used"); + ImGui::SameLine(); + OptionRadioButton("Horizontal", config::GGPOAnalogAxes, 1, "Use the left thumbstick horizontal axis only"); + ImGui::SameLine(); + OptionRadioButton("Full", config::GGPOAnalogAxes, 2, "Use the left thumbstick horizontal and vertical axes"); + + OptionCheckbox("Network Statistics", config::NetworkStats, + "Display network statistics on screen"); } else if (config::NetworkEnable) { @@ -2263,7 +2272,7 @@ void gui_display_osd() if (message.empty()) message = getFPSNotification(); - if (!message.empty() || config::FloatVMUs || crosshairsNeeded() || ggpo::active()) + if (!message.empty() || config::FloatVMUs || crosshairsNeeded() || (ggpo::active() && config::NetworkStats)) { ImGui_Impl_NewFrame(); ImGui::NewFrame(); @@ -2284,7 +2293,8 @@ void gui_display_osd() if (config::FloatVMUs) display_vmus(); // gui_plot_render_time(screen_width, screen_height); - ggpo::displayStats(); + if (ggpo::active() && config::NetworkStats) + ggpo::displayStats(); ImGui::Render(); ImGui_impl_RenderDrawData(ImGui::GetDrawData()); diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index f31f436d0..d1bd3b47d 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -110,6 +110,8 @@ OptionString NetworkServer("", ""); Option EmulateBBA("", false); // TODO Option GGPOEnable("", false); Option GGPODelay("", 0); +Option NetworkStats("", false); +Option GGPOAnalogAxes("", 0); // Maple