From 70cb4372c1dfea741dbe8a9ef24e6ed21db06342 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Fri, 25 Sep 2015 19:08:48 +0200 Subject: [PATCH] Assorted fixes to auto resolution. Fixes too low resolution and also #8002, plus notification spam --- GPU/Common/FramebufferCommon.cpp | 2 +- GPU/Directx9/FramebufferDX9.cpp | 6 +++--- GPU/GLES/Framebuffer.cpp | 6 +++--- GPU/GLES/TransformPipeline.cpp | 2 +- UI/OnScreenDisplay.cpp | 9 ++++++--- UI/OnScreenDisplay.h | 3 ++- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 6958f9aa3..3eaa795cf 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -847,5 +847,5 @@ void FramebufferManagerCommon::ShowScreenResolution() { messageStream << gr->T("Window Size") << ": "; messageStream << PSP_CoreParameter().pixelWidth << "x" << PSP_CoreParameter().pixelHeight; - osm.Show(messageStream.str(), 2.0f); + osm.Show(messageStream.str(), 2.0f, 0xFFFFFF, -1, true, "resize"); } \ No newline at end of file diff --git a/GPU/Directx9/FramebufferDX9.cpp b/GPU/Directx9/FramebufferDX9.cpp index 8eb265778..0c1797870 100644 --- a/GPU/Directx9/FramebufferDX9.cpp +++ b/GPU/Directx9/FramebufferDX9.cpp @@ -1115,10 +1115,10 @@ namespace DX9 { int zoom = g_Config.iInternalResolution; if (zoom == 0) { // auto mode // Use the longest dimension - if (g_Config.IsPortrait()) { - zoom = (pixelWidth_ + 479) / 480; + if (!g_Config.IsPortrait()) { + zoom = (PSP_CoreParameter().pixelWidth + 479) / 480; } else { - zoom = (pixelHeight_ + 479) / 480; + zoom = (PSP_CoreParameter().pixelHeight + 479) / 480; } } if (zoom <= 1) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index d33fa41d4..f60ef5674 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -1667,10 +1667,10 @@ void FramebufferManager::EndFrame() { int zoom = g_Config.iInternalResolution; if (zoom == 0) { // auto mode // Use the longest dimension - if (g_Config.IsPortrait()) { - zoom = (pixelWidth_ + 479) / 480; + if (!g_Config.IsPortrait()) { + zoom = (PSP_CoreParameter().pixelWidth + 479) / 480; } else { - zoom = (pixelHeight_ + 479) / 480; + zoom = (PSP_CoreParameter().pixelHeight + 479) / 480; } } if (zoom <= 1) diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 0624ba4ab..6b10dfab6 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -807,8 +807,8 @@ rotateVBO: prim, decoded, indexGen.VertexCount(), dec_->VertexType(), inds, GE_VTYPE_IDX_16BIT, dec_->GetDecVtxFmt(), maxIndex, framebufferManager_, textureCache_, transformed, transformedExpanded, drawBuffer, numTrans, drawIndexed, &result, 1.0); - ApplyDrawStateLate(); + LinkedShader *program = shaderManager_->ApplyFragmentShader(vshader, prim, lastVType_); if (result.action == SW_DRAW_PRIMITIVES) { diff --git a/UI/OnScreenDisplay.cpp b/UI/OnScreenDisplay.cpp index b8ead2e42..b0eabd12e 100644 --- a/UI/OnScreenDisplay.cpp +++ b/UI/OnScreenDisplay.cpp @@ -53,14 +53,16 @@ restart: } } -void OnScreenMessages::Show(const std::string &message, float duration_s, uint32_t color, int icon, bool checkUnique) { +void OnScreenMessages::Show(const std::string &text, float duration_s, uint32_t color, int icon, bool checkUnique, const char *id) { double now = time_now_d(); std::lock_guard guard(mutex_); if (checkUnique) { for (auto iter = messages_.begin(); iter != messages_.end(); ++iter) { - if (iter->text == message) { + if (iter->text == text || (id && !strcmp(iter->id, id))) { Message msg = *iter; msg.endTime = now + duration_s; + msg.text = text; + msg.color = color; messages_.erase(iter); messages_.insert(messages_.begin(), msg); return; @@ -68,10 +70,11 @@ void OnScreenMessages::Show(const std::string &message, float duration_s, uint32 } } Message msg; - msg.text = message; + msg.text = text; msg.color = color; msg.endTime = now + duration_s; msg.icon = icon; + msg.id = id; messages_.insert(messages_.begin(), msg); } diff --git a/UI/OnScreenDisplay.h b/UI/OnScreenDisplay.h index 278272821..208f27d27 100644 --- a/UI/OnScreenDisplay.h +++ b/UI/OnScreenDisplay.h @@ -13,7 +13,7 @@ class DrawBuffer; class OnScreenMessages { public: - void Show(const std::string &message, float duration_s = 1.0f, uint32_t color = 0xFFFFFF, int icon = -1, bool checkUnique = true); + void Show(const std::string &message, float duration_s = 1.0f, uint32_t color = 0xFFFFFF, int icon = -1, bool checkUnique = true, const char *id = nullptr); void ShowOnOff(const std::string &message, bool b, float duration_s = 1.0f, uint32_t color = 0xFFFFFF, int icon = -1); bool IsEmpty() const { return messages_.empty(); } @@ -30,6 +30,7 @@ public: int icon; uint32_t color; std::string text; + const char *id; double endTime; double duration; };