-
-
Notifications
You must be signed in to change notification settings - Fork 128
Initial splash screen implementation #1957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a splash-screen path to the GUI: a private m_enableSplashScreen flag and getSplashScreen helper; uploads a generated RGBA splash into both offscreen textures with GL_NEAREST filtering (using unique_ptr-managed data); disables splash on ExecutionFlow::Run; adds a splash data generator script and integrates splash.cc into the VS project. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant ExecutionFlow
participant GUI
participant Textures
App->>ExecutionFlow: Run()
ExecutionFlow->>GUI: Initialize / StartFrame()
alt first frame or clear with splash enabled
GUI->>GUI: getSplashScreen(w,h) -> unique_ptr data
GUI->>Textures: glBind + glTexSubImage2D(upload splash)
GUI->>Textures: set GL_TEXTURE_MIN/MAG_FILTER = NEAREST
GUI->>App: flip() (present offscreen texture)
end
ExecutionFlow->>ExecutionFlow: m_enableSplashScreen = false
loop subsequent frames
GUI->>Textures: render normal frame content
GUI->>App: flip()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
src/gui/gui.h (1)
461-462
: Consider annotating getSplashScreen for intent and misuse preventionOptional refinements:
- Mark as [[nodiscard]] to prevent accidental ignoring of the returned buffer.
- Mark noexcept if you’re confident stbir won’t throw in this context (it shouldn’t).
- Since it doesn’t depend on object state, consider making it static.
- std::unique_ptr<uint32_t[]> getSplashScreen(uint32_t destWidth, uint32_t destHeight); + [[nodiscard]] static std::unique_ptr<uint32_t[]> getSplashScreen(uint32_t destWidth, uint32_t destHeight) noexcept;tools/splash-generator/splash.py (3)
1-1
: Use python3 in the shebang for portabilityMany environments map python to Python 2 or don’t provide it at all. Using python3 avoids ambiguity.
-#!/usr/bin/env python +#!/usr/bin/env python3
12-15
: Use a context manager to ensure the image file is closed and add basic error handlingThis avoids leaking file descriptors on exceptions and provides a clearer error if Pillow can’t open the file.
-img = Image.open(filename).convert("RGBA") -width, height = img.size -pixels = list(img.getdata()) +try: + with Image.open(filename) as img: + img = img.convert("RGBA") + width, height = img.size + pixels = list(img.getdata()) +except Exception as e: + print(f"Error: failed to open or process image '{filename}': {e}", file=sys.stderr) + sys.exit(2)
25-25
: Remove extraneous f-string prefix (Ruff F541)There are no placeholders; drop the f to satisfy linters and avoid confusion.
-print(f"static const uint32_t s_splashImageData[] = {{") +print("static const uint32_t s_splashImageData[] = {")src/gui/gui.cc (1)
956-969
: Texture parameterization before data upload fixes the macOS driver issueSetting GL_TEXTURE_MAG_FILTER/MIN_FILTER to GL_NEAREST before calling glTexSubImage2D addresses the Apple driver error where writes occur before filters are set. Uploading the splash to both offscreen textures is sound.
Two small optional improvements:
- Avoid recomputing the resized splash if m_setupScreenSize toggles repeatedly (e.g., during window resizing): cache the last (w,h) and the buffer to reuse within a frame or until size changes.
- Consider documenting that glTexImage2D is used solely to allocate storage (pixels=0), so it’s not considered a “write” in the context of the driver issue.
- std::unique_ptr<uint32_t[]> splashImageData = getSplashScreen(m_renderSize.x, m_renderSize.y); + // Optional: cache the resized splash per (w,h) to avoid recompute storms during resize. + std::unique_ptr<uint32_t[]> splashImageData = getSplashScreen(m_renderSize.x, m_renderSize.y);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (5)
src/gui/gui.cc
(3 hunks)src/gui/gui.h
(2 hunks)tools/splash-generator/splash.py
(1 hunks)vsprojects/gui/gui.vcxproj
(1 hunks)vsprojects/gui/gui.vcxproj.filters
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/gui/gui.h (1)
src/gui/splash.cc (2)
getSplashScreen
(38411-38424)getSplashScreen
(38411-38411)
src/gui/gui.cc (1)
src/gui/splash.cc (2)
getSplashScreen
(38411-38424)getSplashScreen
(38411-38411)
🪛 Ruff (0.12.2)
tools/splash-generator/splash.py
25-25: f-string without any placeholders
Remove extraneous f
prefix
(F541)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: pcsx-redux (aarch64-linux)
- GitHub Check: pcsx-redux (x86_64-linux)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: macos-build-and-test-toolchain
- GitHub Check: coverage
- GitHub Check: toolchain
- GitHub Check: build
- GitHub Check: cross-arm64
- GitHub Check: asan
🔇 Additional comments (6)
vsprojects/gui/gui.vcxproj.filters (1)
106-108
: Include of splash.cc in filters looks correctThe new translation unit is properly categorized under "Source Files". This aligns with the project file change and will make the file show up correctly in the VS Solution Explorer.
src/gui/gui.h (2)
28-28
: Include is appropriate for unique_ptr usageThis is needed for the new helper returning std::unique_ptr. No issues here.
458-458
: m_enableSplashScreen defaulting to true fits the startup-flowThis keeps the splash visible until emulation starts (disabled on Run). Looks good.
vsprojects/gui/gui.vcxproj (1)
131-131
: splash.cc added to the GUI buildThis ensures the splash functionality is compiled in all configurations. Good.
tools/splash-generator/splash.py (1)
16-21
: Endianness and channel order note (FYI)Packing as 0xAABBGGRR for each pixel is correct for little-endian RGBA8888 consumption (bytes in memory: R G B A). This matches the downstream use with STBIR_RGBA and GL_RGBA/GL_UNSIGNED_BYTE.
src/gui/gui.cc (1)
556-559
: Disable splash on Run event is correct and low-riskThis ensures the splash is only shown prior to execution. Clean, simple, and consistent with the PR description.
The current splash screen is a sample and not necessarily final. This code will also likely be replaced when nanovg/nanosvg are replaced. Also worth noting that this relies on stb-image-resize2 for resizing the splash image to the render resolution. This can be avoided, but might require adding a fair bit of code.
Screen.Recording.2025-08-15.at.2.54.46.PM.mov
Image used for the splash screen in the video (Made in Canva, so I sadly can't share the project files easily)
