Add shader presets (CRT/Scanlines) and a functional screenshot hotkey - #3
Merged
Merged
Conversation
Shaders: bundle CRT and Scanlines presets (3 strength tiers each) for the existing GLSL preset loader (src/glsl_shader.c), which had zero presets shipped. GameInfo.has_shader now enables the launcher's shader dropdown (previously wired but never turned on for SM), and CMakeLists.txt gains a robust asset-staging target that removes+recopies assets/shaders/ so renamed/deleted sources never leave stale duplicates behind. Raw .glsl sources live in a shaders/.src/ subdirectory (dot-prefixed, not underscore) so the launcher's "private path" filter hides them from the picker without colliding with this repo's root _* scratch-file gitignore rule. Also closes the loop the launcher's Settings screen needed to actually persist a shader choice: the selected path/backend now round-trips through RecompLauncherCSettings.shader_path into g_config.shader (backed by static storage, since g_config.shader normally points into the parsed config.ini buffer) and gets written back via WriteConfigFile's OutputMethod and Shader keys, which weren't in its persisted-fields table before. Screenshot: new Screenshot hotkey (F12 by default), OpenGL backend only (matches the existing shader limitation and warns the same way). Captures the final composited framebuffer via glReadPixels -- includes the custom widescreen renderer and any active GLSL shader, not just the native SNES raster -- and writes a timestamped BMP to screenshots/. A 0.5s debounce guards against SDL's key auto-repeat (the input loop doesn't check event.key.repeat), and a brief time-based white flash gives feedback in fullscreen where the terminal isn't visible. Verified: ctest 5/5 on both Debug and Release builds; manual launcher round-trip (shader selection persists and renders, F12 saves + flashes); confirmed via sm_render_capture + a game_state trace that stock-fallback during the attract demo (state 30, outside sm_renderer.c's room_state() allowlist) is a pre-existing, documented renderer limitation unrelated to this change -- widescreen renders correctly once in real gameplay.
mstan
force-pushed
the
feat/shaders-screenshot-16x9
branch
from
September 13, 2026 03:02
beff7ed to
cb131e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds GLSL shader presets (CRT + Scanlines, 3 strength tiers each) to the
existing but unused shader preset loader, and a functional player-facing
screenshot hotkey (F12). Also fixes the launcher round-trip that was
silently dropping the selected shader instead of persisting/applying it.
What changed
assets/shaders/{crt,scanlines}{,-light,-strong}.glslpfor
src/glsl_shader.c's existing RetroArch-style preset loader, whichhad zero presets shipped.
GameInfo.has_shader = 1turns on thelauncher's Settings → Video → Shader dropdown (already implemented in
the shared launcher, just never enabled for this game).
through
RecompLauncherCSettings.shader_pathintog_config.shaderand gets written back via
WriteConfigFile's newOutputMethod/Shaderkeys — previously the picker showed a choice but it neverreached
config.inior the renderer.Screenshotcommand (F12default,OpenGL backend only — same limitation the shader path already has).
Captures the fully composited framebuffer via
glReadPixels(customwidescreen renderer + any active shader included), writes a timestamped
BMP to
screenshots/, with a 0.5s debounce against SDL key auto-repeatand a brief time-based flash for feedback in fullscreen.
CMakeLists.txtgains a shader-asset stagingtarget that removes+recopies
assets/shaders/on every build (a plainPOST_BUILDcopy only ran when the executable itself relinked, leavingstale files behind after a rename/delete).
Testing
ctest5/5 on both Debug and Release builds.F12 saves a valid BMP and shows the flash; verified with a diagnostic
solid-color shader that the full launcher → config.ini → OpenGL
pipeline works end to end.
the attract demo's
game_state(30) falling outsidesm_renderer.c'sroom_state()allowlist — a pre-existing, documentedrenderer limitation for the demo/menu path, unrelated to this change.
Confirmed widescreen renders correctly in real gameplay.
Notes
snesrecomporrecomp-ui(submodule) changes — everything isscoped to this repo.
.glslshader sources live underassets/shaders/.src/(dot-, notunderscore-, prefixed) so the launcher's picker treats them as private
without colliding with this repo's
_*scratch-file.gitignorerule.Note: this code was made with AI assistance, tested and validated by me.