Skip to content

Conversation

@nchapman
Copy link
Collaborator

@nchapman nchapman commented Dec 2, 2025

No description provided.

Extract duplicated rendering code from 10 platform files into shared
modules: - effect_system.c/h: Effect state management, opacity formula,
pattern paths - render_common.c/h: Destination rect calculation,
hard_scale, color conversion - render_sdl2.c/h: Unified SDL2 rendering
backend for 7 platforms

SDL2 platforms (tg5040, rg35xxplus, rgb30, my282, my355, zero28,
magicmini) now use render_sdl2 for video init, scaling, effects, and
flip.

SDL1 platforms (miyoomini, trimuismart, rg35xx) use effect_system for
consistent effect state management and pattern selection.

All effects now use scale-specific patterns (line-N.png, grid-N.png,
crt-N.png) with a unified linear opacity formula: opacity = 40 + (scale
* 20).

Net reduction: ~4,700 lines (45% of original platform rendering code).
Copilot AI review requested due to automatic review settings December 2, 2025 05:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the effects and rendering pipeline architecture across multiple handheld gaming device platforms. The changes consolidate duplicated rendering code into shared modules (render_sdl2, effect_system, effect_utils, effect_surface) while maintaining platform-specific behaviors. Key improvements include:

  • Unified effect state management via effect_system for consistent behavior
  • Shared SDL2 rendering backend for platforms using SDL2
  • Support for new effect types (grille, slot, dot, dmg, gbc, lcd) beyond existing line/grid
  • Buffer safety improvements in minui.c (sprintf → snprintf with bounds checking)
  • Better error handling in collections.c

Reviewed changes

Copilot reviewed 37 out of 66 changed files in this pull request and generated no comments.

Show a summary per file
File Description
zero28/platform/platform.c Migrated to render_sdl2 backend, removed 638 lines of duplicated video code
tg5040/platform/platform.c Migrated to render_sdl2 backend, removed 457 lines of duplicated code
rgb30/platform/platform.c Migrated to render_sdl2 backend, removed 610 lines of duplicated code
rg35xxplus/platform/platform.c Migrated to render_sdl2 backend with HDMI support, removed 540 lines
my355/platform/platform.c Migrated to render_sdl2 backend with HDMI/rotation support
my282/platform/platform.c Migrated to render_sdl2 backend, removed 604 lines
trimuismart/platform/platform.c Migrated to effect_system for state management, added effect overlay support
rg35xx/platform/platform.c Migrated to effect_system, added effect overlay blending via effect_surface
miyoomini/platform/platform.c Migrated to effect_system, added MI_GFX hardware blitting with alpha channel fixes
desktop/platform/platform.c Added stub effect implementation for desktop platform
minui/minui.c Fixed buffer overflow risks (sprintf→snprintf, 256→MAX_PATH)
minarch/minarch.c Updated effect labels to include new effect types
collections.c Added error handling for strdup failures in Hash_set
nointro_parser.c Added null pointer checks in classifyTag and parseNoIntroName
makefiles Added conditional compilation for SDL vs SDL2 effect modules
README.md Documented MI_GFX alpha blending issue on miyoomini platform

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nchapman nchapman merged commit ccf0b55 into develop Dec 2, 2025
10 checks passed
@nchapman nchapman deleted the feature/retro-effects branch December 2, 2025 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants