ggpo: UI for analog axes settings. Display stats option
This commit is contained in:
parent
99a0dce8cd
commit
480e85f615
|
@ -119,6 +119,8 @@ OptionString NetworkServer("server", "", "network");
|
||||||
Option<bool> EmulateBBA("EmulateBBA", false, "network");
|
Option<bool> EmulateBBA("EmulateBBA", false, "network");
|
||||||
Option<bool> GGPOEnable("GGPO", false, "network");
|
Option<bool> GGPOEnable("GGPO", false, "network");
|
||||||
Option<int> GGPODelay("GGPODelay", 0, "network");
|
Option<int> GGPODelay("GGPODelay", 0, "network");
|
||||||
|
Option<bool> NetworkStats("Stats", true, "network");
|
||||||
|
Option<int> GGPOAnalogAxes("GGPOAnalogAxes", 0, "network");
|
||||||
|
|
||||||
#ifdef SUPPORT_DISPMANX
|
#ifdef SUPPORT_DISPMANX
|
||||||
Option<bool> DispmanxMaintainAspect("maintain_aspect", true, "dispmanx");
|
Option<bool> DispmanxMaintainAspect("maintain_aspect", true, "dispmanx");
|
||||||
|
|
|
@ -494,6 +494,8 @@ extern OptionString NetworkServer;
|
||||||
extern Option<bool> EmulateBBA;
|
extern Option<bool> EmulateBBA;
|
||||||
extern Option<bool> GGPOEnable;
|
extern Option<bool> GGPOEnable;
|
||||||
extern Option<int> GGPODelay;
|
extern Option<int> GGPODelay;
|
||||||
|
extern Option<bool> NetworkStats;
|
||||||
|
extern Option<int> GGPOAnalogAxes;
|
||||||
|
|
||||||
#ifdef SUPPORT_DISPMANX
|
#ifdef SUPPORT_DISPMANX
|
||||||
extern Option<bool> DispmanxMaintainAspect;
|
extern Option<bool> DispmanxMaintainAspect;
|
||||||
|
|
|
@ -77,7 +77,6 @@ static time_point<steady_clock> lastFrameTime;
|
||||||
static int msPerFrameAvg;
|
static int msPerFrameAvg;
|
||||||
static bool _endOfFrame;
|
static bool _endOfFrame;
|
||||||
static MiniUPnP miniupnp;
|
static MiniUPnP miniupnp;
|
||||||
static int analogInputs = 0;
|
|
||||||
|
|
||||||
struct MemPages
|
struct MemPages
|
||||||
{
|
{
|
||||||
|
@ -370,7 +369,7 @@ void startSession(int localPort, int localPlayerNum)
|
||||||
synchronized = true;
|
synchronized = true;
|
||||||
NOTICE_LOG(NETWORK, "GGPO synctest session started");
|
NOTICE_LOG(NETWORK, "GGPO synctest session started");
|
||||||
#else
|
#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);
|
GGPOErrorCode result = ggpo_start_session(&ggpoSession, &cb, config::Settings::instance().getGameId().c_str(), MAX_PLAYERS, inputSize, localPort);
|
||||||
if (result != GGPO_OK)
|
if (result != GGPO_OK)
|
||||||
{
|
{
|
||||||
|
@ -448,7 +447,7 @@ void getInput(MapleInputState inputState[4])
|
||||||
for (int player = 0; player < 4; player++)
|
for (int player = 0; player < 4; player++)
|
||||||
inputState[player] = {};
|
inputState[player] = {};
|
||||||
|
|
||||||
u32 inputSize = sizeof(u32) + analogInputs;
|
u32 inputSize = sizeof(u32) + config::GGPOAnalogAxes;
|
||||||
std::vector<u8> inputs(inputSize * MAX_PLAYERS);
|
std::vector<u8> inputs(inputSize * MAX_PLAYERS);
|
||||||
// should not call any callback
|
// should not call any callback
|
||||||
ggpo_synchronize_input(ggpoSession, (void *)&inputs[0], inputs.size(), nullptr);
|
ggpo_synchronize_input(ggpoSession, (void *)&inputs[0], inputs.size(), nullptr);
|
||||||
|
@ -457,10 +456,10 @@ void getInput(MapleInputState inputState[4])
|
||||||
{
|
{
|
||||||
MapleInputState& state = inputState[player];
|
MapleInputState& state = inputState[player];
|
||||||
state.kcode = ~(*(u32 *)&inputs[player * inputSize]);
|
state.kcode = ~(*(u32 *)&inputs[player * inputSize]);
|
||||||
if (analogInputs > 0)
|
if (config::GGPOAnalogAxes > 0)
|
||||||
{
|
{
|
||||||
state.fullAxes[PJAI_X1] = inputs[player * inputSize + 4];
|
state.fullAxes[PJAI_X1] = inputs[player * inputSize + 4];
|
||||||
if (analogInputs == 2)
|
if (config::GGPOAnalogAxes == 2)
|
||||||
state.fullAxes[PJAI_Y1] = inputs[player * inputSize + 5];
|
state.fullAxes[PJAI_Y1] = inputs[player * inputSize + 5];
|
||||||
}
|
}
|
||||||
state.halfAxes[PJTI_R] = (state.kcode & EMU_BTN_TRIGGER_RIGHT) == 0 ? 255 : 0;
|
state.halfAxes[PJTI_R] = (state.kcode & EMU_BTN_TRIGGER_RIGHT) == 0 ? 255 : 0;
|
||||||
|
@ -505,13 +504,13 @@ bool nextFrame()
|
||||||
else
|
else
|
||||||
input &= ~EMU_BTN_TRIGGER_LEFT;
|
input &= ~EMU_BTN_TRIGGER_LEFT;
|
||||||
}
|
}
|
||||||
u32 inputSize = sizeof(input) + analogInputs;
|
u32 inputSize = sizeof(input) + config::GGPOAnalogAxes;
|
||||||
std::vector<u8> allInput(inputSize);
|
std::vector<u8> allInput(inputSize);
|
||||||
*(u32 *)&allInput[0] = input;
|
*(u32 *)&allInput[0] = input;
|
||||||
if (analogInputs > 0)
|
if (config::GGPOAnalogAxes > 0)
|
||||||
{
|
{
|
||||||
allInput[4] = joyx[localPlayerNum];
|
allInput[4] = joyx[localPlayerNum];
|
||||||
if (analogInputs == 2)
|
if (config::GGPOAnalogAxes == 2)
|
||||||
allInput[5] = joyy[localPlayerNum];
|
allInput[5] = joyy[localPlayerNum];
|
||||||
}
|
}
|
||||||
GGPOErrorCode result = ggpo_add_local_input(ggpoSession, localPlayer, &allInput[0], inputSize);
|
GGPOErrorCode result = ggpo_add_local_input(ggpoSession, localPlayer, &allInput[0], inputSize);
|
||||||
|
|
|
@ -1742,7 +1742,7 @@ static void gui_display_settings()
|
||||||
"Enable networking for supported Naomi games");
|
"Enable networking for supported Naomi games");
|
||||||
if (config::GGPOEnable)
|
if (config::GGPOEnable)
|
||||||
{
|
{
|
||||||
OptionCheckbox("Play as player 1", config::ActAsServer,
|
OptionCheckbox("Play as Player 1", config::ActAsServer,
|
||||||
"Deselect to play as player 2");
|
"Deselect to play as player 2");
|
||||||
char server_name[256];
|
char server_name[256];
|
||||||
strcpy(server_name, config::NetworkServer.get().c_str());
|
strcpy(server_name, config::NetworkServer.get().c_str());
|
||||||
|
@ -1753,6 +1753,15 @@ static void gui_display_settings()
|
||||||
OptionSlider("Frame Delay", config::GGPODelay, 0, 20,
|
OptionSlider("Frame Delay", config::GGPODelay, 0, 20,
|
||||||
"Sets Frame Delay, advisable for sessions with ping >100 ms");
|
"Sets Frame Delay, advisable for sessions with ping >100 ms");
|
||||||
|
|
||||||
|
ImGui::Text("Left Thumbstick:");
|
||||||
|
OptionRadioButton<int>("Disabled", config::GGPOAnalogAxes, 0, "Left thumbstick not used");
|
||||||
|
ImGui::SameLine();
|
||||||
|
OptionRadioButton<int>("Horizontal", config::GGPOAnalogAxes, 1, "Use the left thumbstick horizontal axis only");
|
||||||
|
ImGui::SameLine();
|
||||||
|
OptionRadioButton<int>("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)
|
else if (config::NetworkEnable)
|
||||||
{
|
{
|
||||||
|
@ -2263,7 +2272,7 @@ void gui_display_osd()
|
||||||
if (message.empty())
|
if (message.empty())
|
||||||
message = getFPSNotification();
|
message = getFPSNotification();
|
||||||
|
|
||||||
if (!message.empty() || config::FloatVMUs || crosshairsNeeded() || ggpo::active())
|
if (!message.empty() || config::FloatVMUs || crosshairsNeeded() || (ggpo::active() && config::NetworkStats))
|
||||||
{
|
{
|
||||||
ImGui_Impl_NewFrame();
|
ImGui_Impl_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
@ -2284,7 +2293,8 @@ void gui_display_osd()
|
||||||
if (config::FloatVMUs)
|
if (config::FloatVMUs)
|
||||||
display_vmus();
|
display_vmus();
|
||||||
// gui_plot_render_time(screen_width, screen_height);
|
// gui_plot_render_time(screen_width, screen_height);
|
||||||
ggpo::displayStats();
|
if (ggpo::active() && config::NetworkStats)
|
||||||
|
ggpo::displayStats();
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_impl_RenderDrawData(ImGui::GetDrawData());
|
ImGui_impl_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
|
@ -110,6 +110,8 @@ OptionString NetworkServer("", "");
|
||||||
Option<bool> EmulateBBA("", false); // TODO
|
Option<bool> EmulateBBA("", false); // TODO
|
||||||
Option<bool> GGPOEnable("", false);
|
Option<bool> GGPOEnable("", false);
|
||||||
Option<int> GGPODelay("", 0);
|
Option<int> GGPODelay("", 0);
|
||||||
|
Option<bool> NetworkStats("", false);
|
||||||
|
Option<int> GGPOAnalogAxes("", 0);
|
||||||
|
|
||||||
// Maple
|
// Maple
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue