feat: handheld auto-configuration for plug-and-play gaming#672
feat: handheld auto-configuration for plug-and-play gaming#672gigachadmma69 wants to merge 1 commit intoutkarshdalal:masterfrom
Conversation
Replace the 3-branch GPU if/else in setContainerDefaults() with a 5-tier device detection system that auto-configures optimal Wine/emulation settings based on SoC and GPU hardware. Detection uses Build.SOC_MODEL (API 31+) with GPU renderer fallback, covering Snapdragon 8 Elite through 855 and non-Adreno devices. Known gaming handhelds (AYN Odin, AYANEO Pocket, Retroid Pocket, GPD XP) are identified by manufacturer/model for logging. Each tier configures: Turnip driver version, DXVK version, FEXCore/Box64 presets, screen resolution, video memory, and startup aggressiveness. PrefManager settings are only written on first detection per device to preserve user customizations across restarts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis change introduces a centralized device profile detection and management system. A new singleton Changes
Sequence DiagramsequenceDiagram
participant App as App Launch
participant HM as HandheldProfileManager
participant DC as Device Detection<br/>(SoC/GPU/Model)
participant Builder as Profile Builder
participant DV as DefaultVersion
participant PM as PrefManager
App->>HM: detectAndApply(context)
HM->>DC: detectDeviceTier(context)
DC-->>HM: DeviceTier (FLAGSHIP/HIGH/MID/LOW)
HM->>DC: detectHandheldName()
DC-->>HM: device name or null
HM->>Builder: buildProfile(tier, context)
Builder-->>HM: DeviceProfile (settings for tier)
HM->>DV: applyDefaultVersion(profile)
DV-->>HM: volatile settings applied
HM->>PM: Check deviceProfileKey
PM-->>HM: key exists (first time or new device)
HM->>PM: Apply PrefManager defaults from profile
PM-->>HM: defaults set
HM-->>App: configuration complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/app/gamenative/utils/HandheldProfileManager.kt (1)
138-139: Consider using the same null/empty check asdetectDeviceTierfor consistent profile keys.On API 31+,
Build.SOC_MODELmight be empty on some devices. WhiledetectDeviceTierhandles this with!soc.isNullOrEmpty(), the profile key construction doesn't apply the same guard. This could lead to keys like"HIGH_"instead of"HIGH_unknown"if the SoC string is empty but tier detection fell back to GPU.Suggested improvement
- val soc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) Build.SOC_MODEL else "unknown" + val soc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + Build.SOC_MODEL.takeIf { !it.isNullOrEmpty() } ?: "unknown" + } else { + "unknown" + } val profileKey = "${tier.name}_${soc}"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/app/gamenative/utils/HandheldProfileManager.kt` around lines 138 - 139, In HandheldProfileManager (around where profileKey is built) ensure the SoC value uses the same null/empty guard as detectDeviceTier: read Build.SOC_MODEL on API >= S, then if that string is null or empty replace it with "unknown" before constructing profileKey (currently val profileKey = "${tier.name}_${soc}"); update the soc computation so empty strings do not produce keys like "HIGH_" and reference detectDeviceTier behavior for how to check !soc.isNullOrEmpty().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/src/main/java/app/gamenative/utils/HandheldProfileManager.kt`:
- Around line 138-139: In HandheldProfileManager (around where profileKey is
built) ensure the SoC value uses the same null/empty guard as detectDeviceTier:
read Build.SOC_MODEL on API >= S, then if that string is null or empty replace
it with "unknown" before constructing profileKey (currently val profileKey =
"${tier.name}_${soc}"); update the soc computation so empty strings do not
produce keys like "HIGH_" and reference detectDeviceTier behavior for how to
check !soc.isNullOrEmpty().
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/src/main/java/app/gamenative/PrefManager.ktapp/src/main/java/app/gamenative/utils/ContainerUtils.ktapp/src/main/java/app/gamenative/utils/HandheldProfileManager.kt
|
AI slop, closing |
Summary
setContainerDefaults()with a 5-tier device detection system that auto-configures optimal Wine/emulation settingsBuild.SOC_MODEL(API 31+) with GPU renderer fallback, covering Snapdragon 8 Elite through 855 and non-Adreno devicesDevice Tiers
How It Works
HandheldProfileManager.detectAndApply()runs inMainActivity.onCreate()viasetContainerDefaults()DefaultVersion.*statics are always set (volatile, needed every launch)PrefManager.*emulation defaults (presets, screen size, VRAM) are only written once per device via adeviceProfileKeyguard — user customizations are preserved across restartsFiles Changed
HandheldProfileManager.kt— device detection, profile building, configuration applicationContainerUtils.kt— delegatessetContainerDefaults()to HandheldProfileManagerPrefManager.kt— addsdeviceProfileKeyto track applied profileTest plan
🤖 Generated with Claude Code
Summary by cubic
Auto-configures Android gaming handhelds by detecting SoC/GPU and applying optimal Turnip/DXVK/FEXCore presets. Replaces the old 3-branch GPU logic with a 5-tier system for plug-and-play game launching.
Written for commit 5f35b26. Summary will update on new commits.
Summary by CodeRabbit
Release Notes