-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor effects and rendering pipelines #53
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
Conversation
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).
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.
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_systemfor 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.
No description provided.