From 5fa1476592a2cf831319e83faea14c4a07d87c80 Mon Sep 17 00:00:00 2001 From: R2DLiu Date: Tue, 14 Jul 2020 00:46:30 -0400 Subject: [PATCH] remove margins. Seek bar updates with replay --- Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp | 1 - Source/Core/VideoCommon/OnScreenDisplay.cpp | 17 +++++++++++++---- Source/Core/VideoCommon/RenderBase.cpp | 9 +++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp index eabbcfcc1f..f02cae680e 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp @@ -715,7 +715,6 @@ void CEXISlippi::prepareGameInfo(u8* payload) if (replayCommSettings.rollbackDisplayMethod == "off" && (replayCommSettings.mode == "normal" || replayCommSettings.mode == "queue")) { - OSD::DrawSlippiPlaybackControls(); g_playbackStatus->startThreads(); } } diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 12be9ea397..0178c15a3c 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -20,8 +20,12 @@ #include "Common/Timer.h" #include "Core/Core.h" #include "Core/ConfigManager.h" +#include "Core/Slippi/SlippiPlayback.h" #include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/IconsFontAwesome4.h" + +extern std::unique_ptr g_playbackStatus; + namespace OSD { constexpr float LEFT_MARGIN = 10.0f; // Pixels to the left of OSD messages. @@ -295,6 +299,8 @@ bool SliderCustomBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v if (isHeld) window->DrawList->AddRectFilled(ImVec2(0, 0), ImGui::GetIO().DisplaySize, ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.5f))); + window->DrawList->AddRectFilled(ImVec2(0, ImGui::GetWindowHeight() - 36), ImVec2(ImGui::GetWindowWidth(), ImGui::GetWindowHeight()), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.75f * style.Alpha))); + // Grey background line window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Max.y - 6), ImVec2(bb.Max.x, bb.Max.y - 6), ImGui::ColorConvertFloat4ToU32(ImVec4(1.0f, 1.0f, 1.0f, 0.5f * style.Alpha)), 4); @@ -310,10 +316,10 @@ bool SliderCustomBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v } // Progress bar - if (!isHeld) + if (!isHeld) + frame = g_playbackStatus->currentPlaybackFrame; window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Max.y - 6), ImVec2(curr_grab_bb.Min.x, bb.Max.y - 6), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 1.0f, 0.0f, style.Alpha)), 4); - //window->DrawList->AddRectFilled(ImVec2(grab_bb.Min.x, bb.Min.y + 2), ImVec2(grab_bb.Max.x + valuesize.x, bb.Min.y + 14), ColorConvertFloat4ToU32(ImVec4(0.21f, 0.20f, 0.21f, 1.00f)), 3); return value_changed; } @@ -384,7 +390,11 @@ void DrawSlippiPlaybackControls() s32 diff = currTime - idle_tick; diff = diff < 1000 ? 0 : diff - 1000; auto alpha = std::max(0.0001f, 1.0f - (diff / 1000.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha); + + ImGuiStyle& style = ImGui::GetStyle(); + style.WindowBorderSize = 0.0f; + style.Alpha = alpha; + style.WindowPadding = ImVec2(0.0f, 0.0f); if (ImGui::Begin(window_name.c_str(), nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | @@ -417,7 +427,6 @@ void DrawSlippiPlaybackControls() INFO_LOG(SLIPPI, "fast_foward"); } } - ImGui::PopStyleVar(); ImGui::End(); } } // namespace OSD diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index b000f2f777..06f2ae31bd 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -50,6 +50,8 @@ #include "Core/HW/VideoInterface.h" #include "Core/Host.h" #include "Core/Movie.h" +#include "Core/Slippi/SlippiReplayComm.h" +#include "Core/Slippi/SlippiPlayback.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" @@ -86,6 +88,9 @@ #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" +extern std::unique_ptr g_playbackStatus; +extern std::unique_ptr g_replayComm; + std::unique_ptr g_renderer; static float AspectToWidescreen(float aspect) @@ -1253,8 +1258,12 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 { auto lock = GetImGuiLock(); + if (g_replayComm->getSettings().rollbackDisplayMethod == "off" && g_playbackStatus->inSlippiPlayback) + OSD::DrawSlippiPlaybackControls(); + DrawDebugText(); OSD::DrawMessages(); + ImGui::Render(); }