Skip to content

Commit b745534

Browse files
authored
Merge pull request #1957 from wheremyfoodat/splash
Initial splash screen implementation
2 parents d01e438 + 33adecd commit b745534

File tree

7 files changed

+38483
-12
lines changed

7 files changed

+38483
-12
lines changed

pcsx-redux.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
elfio,
2323
tracy,
2424
md4c,
25-
stb,
2625
uriparser,
2726
ucl,
2827
llhttp,
@@ -91,6 +90,12 @@ let
9190
rev = "b1e342774cbb35467dfdd3634d4f0181a76cbc89";
9291
hash = "sha256-LYvO+chDVo6D++fuFbxqSRltGW3y82SESmtFj39TdSA=";
9392
})
93+
({
94+
owner = "nothings";
95+
repo = "stb";
96+
rev = "ae721c50eaf761660b4f90cc590453cdb0c2acd0";
97+
hash = "sha256-BIhbhXV7q5vodJ3N14vN9mEVwqrP6z9zqEEQrfLPzvI=";
98+
})
9499
] ++ lib.optional stdenv.hostPlatform.isAarch {
95100
owner = "grumpycoders";
96101
repo = "vixl";
@@ -127,7 +132,6 @@ in stdenv.mkDerivation {
127132
];
128133

129134
buildInputs = [
130-
stb
131135
ucl
132136
md4c
133137
luajitPackages.libluv

src/gui/gui.cc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ void PCSX::GUI::init(std::function<void()> applyArguments) {
553553
glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
554554
});
555555
m_listener.listen<Events::ExecutionFlow::Run>([this](const auto& event) {
556+
m_enableSplashScreen = false;
557+
556558
glfwSwapInterval(0);
557559
setRawMouseMotion();
558560
});
@@ -951,16 +953,19 @@ void PCSX::GUI::startFrame() {
951953
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[1]);
952954
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_renderSize.x, m_renderSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
953955

954-
if (m_clearTextures) {
955-
const auto allocSize = static_cast<size_t>(std::ceil(m_renderSize.x * m_renderSize.y * sizeof(uint32_t)));
956-
GLubyte* data = new GLubyte[allocSize]();
956+
if (m_clearTextures || m_enableSplashScreen) {
957+
m_clearTextures = false;
958+
std::unique_ptr<uint32_t[]> splashImageData = getSplashScreen(m_renderSize.x, m_renderSize.y);
959+
960+
// Upload to both textures
957961
for (int i = 0; i < 2; i++) {
958962
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[i]);
963+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
964+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
965+
959966
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_renderSize.x, m_renderSize.y, GL_RGBA, GL_UNSIGNED_BYTE,
960-
data);
967+
splashImageData.get());
961968
}
962-
m_clearTextures = false;
963-
delete[] data;
964969
}
965970

966971
glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
@@ -1067,9 +1072,6 @@ void PCSX::GUI::flip() {
10671072
glBindFramebuffer(GL_FRAMEBUFFER, m_offscreenFrameBuffer);
10681073
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[m_currentTexture]);
10691074

1070-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1071-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1072-
10731075
glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
10741076
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_offscreenDepthBuffer);
10751077
GLuint texture = m_offscreenTextures[m_currentTexture];
@@ -2890,4 +2892,4 @@ void PCSX::GUI::changeScale(float scale) {
28902892
m_currentScale = scale;
28912893
m_allScales.emplace(scale);
28922894
ImGui::SetCurrentFont(getMainFont());
2893-
}
2895+
}

src/gui/gui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <functional>
2626
#include <magic_enum_all.hpp>
2727
#include <map>
28+
#include <memory>
2829
#include <set>
2930
#include <string>
3031
#include <string_view>
@@ -454,8 +455,10 @@ class GUI final : public UI {
454455
bool m_updateAvailable = false;
455456
bool m_updateDownloading = false;
456457
bool m_aboutSelectAuthors = false;
458+
bool m_enableSplashScreen = true;
457459

458460
void setDefaultShaders();
461+
std::unique_ptr<uint32_t[]> getSplashScreen(uint32_t destWidth, uint32_t destHeight);
459462

460463
public:
461464
bool hasJapanese() { return m_hasJapanese; }

0 commit comments

Comments
 (0)