Source: MP Turn Counter

This commit is contained in:
Nayla Hanegan 2023-06-05 14:41:52 -04:00
commit 53905e689d
No known key found for this signature in database
GPG key ID: BAFE9001DA16CFA2
7 changed files with 32 additions and 2 deletions

View file

@ -35,6 +35,7 @@ const Info<bool> GFX_SHOW_SPEED{{System::GFX, "Settings", "ShowSpeed"}, false};
const Info<bool> GFX_SHOW_SPEED_COLORS{{System::GFX, "Settings", "ShowSpeedColors"}, true};
const Info<int> GFX_PERF_SAMP_WINDOW{{System::GFX, "Settings", "PerfSampWindowMS"}, 1000};
const Info<bool> GFX_SHOW_NETPLAY_PING{{System::GFX, "Settings", "ShowNetPlayPing"}, false};
const Info<bool> GFX_SHOW_MP_TURN{{System::GFX, "Settings", "ShowMPTurn"}, true};
const Info<bool> GFX_SHOW_NETPLAY_MESSAGES{{System::GFX, "Settings", "ShowNetPlayMessages"}, false};
const Info<bool> GFX_LOG_RENDER_TIME_TO_FILE{{System::GFX, "Settings", "LogRenderTimeToFile"},
false};

View file

@ -38,6 +38,7 @@ extern const Info<bool> GFX_SHOW_SPEED;
extern const Info<bool> GFX_SHOW_SPEED_COLORS;
extern const Info<int> GFX_PERF_SAMP_WINDOW;
extern const Info<bool> GFX_SHOW_NETPLAY_PING;
extern const Info<bool> GFX_SHOW_MP_TURN;
extern const Info<bool> GFX_SHOW_NETPLAY_MESSAGES;
extern const Info<bool> GFX_LOG_RENDER_TIME_TO_FILE;
extern const Info<bool> GFX_OVERLAY_STATS;

View file

@ -88,6 +88,7 @@ void GeneralWidget::CreateWidgets()
auto* m_options_layout = new QGridLayout();
m_show_ping = new GraphicsBool(tr("Show NetPlay Ping"), Config::GFX_SHOW_NETPLAY_PING);
m_show_turn_count = new GraphicsBool(tr("Show MP Turn"), Config::GFX_SHOW_MP_TURN);
m_autoadjust_window_size =
new GraphicsBool(tr("Auto-Adjust Window Size"), Config::MAIN_RENDER_WINDOW_AUTOSIZE);
m_show_messages =
@ -101,6 +102,7 @@ void GeneralWidget::CreateWidgets()
m_options_layout->addWidget(m_show_messages, 0, 1);
m_options_layout->addWidget(m_show_ping, 1, 1);
m_options_layout->addWidget(m_show_turn_count, 2, 0);
// Other
auto* shader_compilation_box = new QGroupBox(tr("Shader Compilation"));

View file

@ -50,6 +50,7 @@ private:
// Options
GraphicsBool* m_show_ping;
GraphicsBool* m_show_turn_count;
GraphicsBool* m_autoadjust_window_size;
GraphicsBool* m_show_messages;
GraphicsBool* m_render_main_window;

View file

@ -12,6 +12,7 @@
#include "Core/HW/VideoInterface.h"
#include "Core/System.h"
#include "VideoCommon/VideoConfig.h"
#include "Core/MarioPartyNetplay/Gamestate.h"
PerformanceMetrics g_perf_metrics;
@ -93,7 +94,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
const double speed = GetSpeed();
// Change Color based on % Speed
float r = 0.0f, g = 1.0f, b = 1.0f;
float r = 1.0f, g = 0.55f, b = 0.00f;
if (g_ActiveConfig.bShowSpeedColors)
{
r = 1.0 - (speed - 0.8) / 0.2;
@ -105,7 +107,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
const float window_width = 93.f * backbuffer_scale;
float window_y = window_padding;
float window_x = ImGui::GetIO().DisplaySize.x - window_padding;
float window_x_turn = 100.0f;
float window_y_turn = 8.0f;
const float graph_width = 50.f * backbuffer_scale + 3.f * window_width + 2.f * window_padding;
const float graph_height =
std::min(200.f * backbuffer_scale, ImGui::GetIO().DisplaySize.y - 85.f * backbuffer_scale);
@ -239,6 +242,26 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
}
}
if (g_ActiveConfig.bShowMPTurn && CurrentState.IsMarioParty && CurrentState.Board && CurrentState.Boards)
{
float window_height = (30.f) * backbuffer_scale;
// Position in the top-left corner of the screen.
ImGui::SetNextWindowPos(ImVec2(window_x_turn, window_y_turn), ImGuiCond_Always,
ImVec2(1.0f, 0.0f));
ImGui::SetNextWindowSize(ImVec2(window_width, window_height));
ImGui::SetNextWindowBgAlpha(bg_alpha);
if (ImGui::Begin("MPStats", nullptr, imgui_flags))
{
if (g_ActiveConfig.bShowMPTurn && CurrentState.IsMarioParty && CurrentState.Board && CurrentState.Boards)
ImGui::TextColored(ImVec4(r, g, b, 1.0f), "Turn: %d/%d",
mpn_read_value(CurrentState.Addresses->CurrentTurn, 1),
mpn_read_value(CurrentState.Addresses->TotalTurns, 1));
ImGui::End();
}
}
if (g_ActiveConfig.bShowVPS || g_ActiveConfig.bShowVTimes)
{
int count = g_ActiveConfig.bShowVPS + 2 * g_ActiveConfig.bShowVTimes;

View file

@ -88,6 +88,7 @@ void VideoConfig::Refresh()
bShowSpeedColors = Config::Get(Config::GFX_SHOW_SPEED_COLORS);
iPerfSampleUSec = Config::Get(Config::GFX_PERF_SAMP_WINDOW) * 1000;
bShowNetPlayPing = Config::Get(Config::GFX_SHOW_NETPLAY_PING);
bShowMPTurn = Config::Get(Config::GFX_SHOW_MP_TURN);
bShowNetPlayMessages = Config::Get(Config::GFX_SHOW_NETPLAY_MESSAGES);
bLogRenderTimeToFile = Config::Get(Config::GFX_LOG_RENDER_TIME_TO_FILE);
bOverlayStats = Config::Get(Config::GFX_OVERLAY_STATS);

View file

@ -112,6 +112,7 @@ struct VideoConfig final
bool bShowSpeedColors = false;
int iPerfSampleUSec = 0;
bool bShowNetPlayPing = false;
bool bShowMPTurn = true;
bool bShowNetPlayMessages = false;
bool bOverlayStats = false;
bool bOverlayProjStats = false;