Refactor platform variant management and detection#54
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the platform variant management system to provide a unified, table-driven approach for detecting and configuring hardware variants across different handheld gaming devices. The refactor replaces ad-hoc global is_* boolean flags with a centralized PlatformVariant structure and detection framework.
Key changes:
- Introduces shared
platform_variant.h/cwith unified detection API and device registry system - Migrates three multi-variant platforms (rg35xxplus, miyoomini, tg5040) to use structured device/variant/mapping tables
- Updates eight single-variant platforms with standardized documentation headers and variant detection sections
- Provides convenience macros (
VARIANT_IS(),HAS_FEATURE()) for cleaner variant and feature checking
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| workspace/all/common/platform_variant.h | New core header defining PlatformVariant structure, VariantType enum, DeviceInfo struct, hardware feature flags, and detection API |
| workspace/all/common/platform_variant.c | Global platform_variant instance and PLAT_getDeviceName() implementation with null-safe fallbacks |
| workspace/all/common/build.mk | Adds platform_variant.c to common source list for build system |
| workspace/all/minui/makefile | Includes platform_variant.c in minui build sources |
| workspace/all/minarch/makefile | Includes platform_variant.c in minarch build sources |
| workspace/tg5040/platform/platform.h | Defines TG5040 variant constants, includes platform_variant.h, migrates macros to use platform_variant fields |
| workspace/tg5040/platform/platform.c | Implements device registry, variant config table, device mapping, and PLAT_detectVariant() for standard/Brick detection |
| workspace/rg35xxplus/platform/platform.h | Defines RG35XX family variants (VGA/Square/Wide), migrates display/feature macros to platform_variant |
| workspace/rg35xxplus/platform/platform.c | Implements detection for 9 devices across 3 variants with HDMI override, replaces PLAT_getModel() with PLAT_getDeviceName() |
| workspace/miyoomini/platform/platform.h | Defines Mini family variants, uses HAS_FEATURE() for button mappings, uses variant comparison for Plus detection |
| workspace/miyoomini/platform/platform.c | Implements PMIC/560p detection, special MY285 Flip handling, replaces PLAT_getModel() with PLAT_getDeviceName() |
| workspace/zero28/platform/platform.h | Updates header doc to standardized format with SoC info, adds variant detection section comment |
| workspace/trimuismart/platform/platform.h | Updates header doc to standardized format, adds variant detection section comment |
| workspace/rgb30/platform/platform.h | Corrects manufacturer to PowKiddy, updates header doc, adds variant detection section |
| workspace/rg35xx/platform/platform.h | Updates header doc with SoC info and clarification note about RG35XX vs RG35XX Plus, adds variant detection section |
| workspace/my355/platform/platform.h | Updates header doc with device name and SoC info, adds clarification note about similar platforms |
| workspace/my282/platform/platform.h | Updates header doc to use Miyoo A30 name with SoC info, adds variant detection section |
| workspace/magicmini/platform/platform.h | Updates header doc to standardized format, adds variant detection section comment |
| workspace/m17/platform/platform.h | Updates header doc to standardized format, adds variant detection section comment |
| docs/platform-variants.md | Comprehensive 269-line documentation covering architecture, usage patterns, detection methods, and migration guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.