Skip to content

Implement resolution enhancements and adaptive scaling - #1759

Open
Meloon33 wants to merge 10 commits into
utkarshdalal:masterfrom
Meloon33:feat/resolution-enhancements
Open

Implement resolution enhancements and adaptive scaling#1759
Meloon33 wants to merge 10 commits into
utkarshdalal:masterfrom
Meloon33:feat/resolution-enhancements

Conversation

@Meloon33

@Meloon33 Meloon33 commented Jul 22, 2026

Copy link
Copy Markdown

Description

This PR enhances the resolution selection logic in the container settings to provide better defaults for modern mobile devices and flexible scaling options based on hardware.

Key changes:

  • Added Standard Presets: Included 1600x720 (20:9) and 1200x540 (20:9) as hardcoded options in arrays.xml.
  • Native Resolution Detection: The app now detects the device's physical screen resolution at runtime.
  • Dynamic Scaling Options: Automatically generates and injects "Native", "75% Scaling (Quality)", and "50% Scaling (Performance)" options into the dropdown menu.
  • Driver Compatibility: Dimensions are automatically rounded to even numbers to prevent rendering artifacts and ensure compatibility with Vulkan/OpenGL drivers.
  • UI Improvements: Aspect ratios are automatically calculated and displayed for all dynamic options.

Recording

[Placeholder: Resolution dropdown showing Native/75%/50% options]

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Adds adaptive resolution scaling with even-pixel rounding and aspect‑ratio labels, plus new 20:9 presets for modern phones. Also rounds and validates custom inputs to prevent driver issues and bad aspect ratios.

  • New Features

    • Detects screen resolution and inserts “Native”, “Optimized (75%)”, and “Half (50%)” only when missing; labels include aspect ratio (e.g., “2400x1080 (20:9, Native)”).
    • Calculates aspect ratios after rounding, including 19.5:9 and 21.5:9.
    • Adds 1600x720 (20:9) and 1200x540 (20:9) presets.
  • Refactors

    • Rounds adaptive and custom resolutions using evenRound; custom dialog now rounds before validating width > height and saves even values. Added unit tests for evenRound, gcd, and ratio formatting.
    • Promotes evenRound, gcd, and calculateAspectRatio to top-level helpers and expands KDoc across all config tabs.
    • Localizes language names in the General tab via strings.xml for schinese, tchinese, koreana, latam, brazilian.

Written for commit d6e092f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added Native, Optimized, and Half resolution modes.
    • Expanded resolution presets with 1200×540 and 1600×720, including device-adaptive options with computed aspect-ratio labels.
  • Bug Fixes
    • Improved adaptive/custom resolution handling by enforcing even-numbered dimensions and more accurate aspect-ratio labeling (including 19.5:9 and 21.5:9).
  • Documentation
    • Added/updated KDoc across the dialog tabs and related UI components.
  • Tests
    • Added unit tests covering resolution rounding, GCD calculation, and aspect-ratio formatting.

@Meloon33
Meloon33 requested a review from utkarshdalal as a code owner July 22, 2026 22:04
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The container configuration dialog now combines resource-defined presets with device-specific native, optimized, and half-resolution entries, applies even-pixel rounding, and calculates aspect-ratio labels. Language dropdown names use localized resources, resolution utilities are tested, and dialog composables receive KDoc documentation.

Changes

Resolution and localization updates

Layer / File(s) Summary
Adaptive resolution generation and validation
app/src/main/res/values/arrays.xml, app/src/main/res/values/strings.xml, app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt, app/src/test/.../ResolutionUtilsTest.kt
Adds resolution resources, derives even-rounded adaptive entries with calculated ratios, normalizes custom resolutions, and tests rounding, GCD, and aspect-ratio formatting.
Localized language display
app/src/main/java/app/gamenative/ui/component/dialog/GeneralTab.kt
Uses localized string resources for supported language codes while preserving title-casing for unknown codes.
Dialog component documentation
app/src/main/java/app/gamenative/ui/component/dialog/*Tab.kt, app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt
Adds KDoc to the affected dialog composables without changing their signatures.
Resolution implementation records
.artifacts/a5345eb0-*/..., .artifacts/de870e5b-*/...
Records resolution implementation details, task completion, walkthrough content, and verification steps.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Dialog as rememberContainerConfigDialogStaticData
  participant Metrics as displayMetrics
  participant Resources as Android resources
  participant Tests as ResolutionUtilsTest
  Dialog->>Resources: load presets and resolution labels
  Dialog->>Metrics: derive native, optimized, and half resolutions
  Dialog->>Dialog: round dimensions and calculate aspect ratios
  Dialog->>Dialog: append missing adaptive entries
  Tests->>Dialog: verify resolution utility behavior
Loading

Possibly related PRs

Suggested reviewers: utkarshdalal, utkarshdalal

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: resolution enhancements and adaptive scaling.
Description check ✅ Passed The description matches the template sections and is mostly complete, with a placeholder recording instead of an attached GIF.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt`:
- Around line 226-233: Update the adaptive-entry construction in the resolution
list’s forEach to compute a reduced aspect ratio from each final device
resolution and include it in the label, matching the existing resolution (ratio)
format while retaining the resolution token first so parsing remains unchanged.
Apply this consistently to Native, Optimized, and Half entries.
- Around line 217-221: Update the resolution construction near deviceRes,
halfRes, and optimizedRes to normalize every width and height to even numbers,
including the unscaled native dimensions. Add one shared helper for
even-dimension normalization and apply it after calculating each scaled value
before constructing the resolution strings.

In `@app/src/main/res/values/arrays.xml`:
- Around line 10-13: Correct the aspect-ratio labels for the 1200x540 and
1600x720 entries in the preset array from 16:9 to 20:9. Leave the existing
labels for the other presets unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 86f9b2ad-6517-43f3-a544-a01ef100ec58

📥 Commits

Reviewing files that changed from the base of the PR and between 7127305 and 89a730f.

📒 Files selected for processing (3)
  • app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt
  • app/src/main/res/values/arrays.xml
  • app/src/main/res/values/strings.xml

Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt Outdated
Comment thread app/src/main/res/values/arrays.xml Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/res/values/arrays.xml Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt Outdated
Git Branch Manager added 2 commits July 23, 2026 12:19
- Corrected aspect ratio labels for 1200x540 and 1600x720 in arrays.xml.
- Implemented even-rounding for adaptive resolutions in ContainerConfigDialog.kt to ensure GPU driver compatibility.
- Added dynamic aspect ratio calculation for adaptive resolution labels.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.artifacts/a5345eb0-5a51-42f9-84d8-40ce8706dc06/walkthrough.artifact.md:
- Around line 14-25: Update the walkthrough’s references to
ContainerConfigDialogKt and the toEven helper to match the final evenRound
nearest-even implementation and its actual rounding behavior, including the
Logic Verification examples; alternatively, clearly mark this walkthrough as
historical and retain the implementation plan as authoritative.

In @.artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/task.artifact.md:
- Around line 1-12: Update the checklist in the task artifact to mark the
completed implementation and verification items as [x], including the
strings.xml, ContainerConfigDialog.kt, GeneralTab.kt, GraphicsTab.kt, and
verification tasks, so it accurately reflects the finished work.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90aaea6b-7684-4a7c-a106-1f5a08b635f2

📥 Commits

Reviewing files that changed from the base of the PR and between ccf5eed and 071a269.

📒 Files selected for processing (10)
  • .artifacts/a5345eb0-5a51-42f9-84d8-40ce8706dc06/implementation_plan.artifact.md
  • .artifacts/a5345eb0-5a51-42f9-84d8-40ce8706dc06/task.artifact.md
  • .artifacts/a5345eb0-5a51-42f9-84d8-40ce8706dc06/walkthrough.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/task.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/walkthrough.artifact.md
  • app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/GeneralTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/GraphicsTab.kt
  • app/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/res/values/strings.xml
  • app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt

Comment thread .artifacts/a5345eb0-5a51-42f9-84d8-40ce8706dc06/walkthrough.artifact.md Outdated
Comment thread .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/task.artifact.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
@.artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md:
- Line 3: Remove the implementation_plan artifact describing PR `#1760`, or
retarget it to accurately document PR `#1759`’s resolution and localization
changes. Ensure no references to the out-of-scope cross-store/source-switcher
work remain.
- Around line 9-10: Update all machine-local file links in the implementation
plan, including the references to StringUtils.kt and the additionally affected
entries, to use repository-relative Markdown links. Preserve each link’s
displayed filename and target the corresponding path relative to the repository
root.

In
@.artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md:
- Around line 28-30: Correct the implementation plan’s testing sections by
moving the manual code inspection and mental KDoc coverage bullets out of
“Automated Tests” into the manual-verification section. Replace them in
“Automated Tests” with the actual unit-test coverage from
ResolutionUtilsTest.kt, describing the tests that verify the ResolutionUtils
behavior.
- Line 20: Update the task.artifact.md link in the implementation plan to use
the repository-relative target task.artifact.md instead of the author-specific
file:///E:/... URI, preserving the existing MODIFY reference and link text.

In `@app/src/main/java/app/gamenative/ui/component/dialog/AdvancedTab.kt`:
- Around line 12-18: Limit each tab’s KDoc to controls actually rendered by its
composable: remove the suspend-policy claim from AdvancedTab.kt lines 12-18,
shooter-mode and physical-mapping claims from ControllerTab.kt lines 19-26, and
TSO/x87 claims from EmulationTab.kt lines 16-22; do not add controls.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c33d1f7e-645c-4f48-8146-ae4e87a8d83b

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd7f2e and 4d5b291.

📒 Files selected for processing (15)
  • .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md
  • .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/task.artifact.md
  • .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/walkthrough.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/task.artifact.md
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/walkthrough.artifact.md
  • app/src/main/java/app/gamenative/ui/component/dialog/AdvancedTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/ControllerTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/DrivesTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/EmulationTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/WinComponentsTab.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/WineTab.kt
  • app/src/test/java/app/gamenative/ui/component/dialog/ResolutionUtilsTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/walkthrough.artifact.md

@@ -0,0 +1,57 @@
# Implementation Plan - Cross-Store Awareness and Source Switcher Improvements

This plan addresses the feedback from PR #1760 regarding the "cross-store awareness and source switcher" feature. It aims to improve name normalization, sibling filtering logic, data scope for source switching, and UI accessibility/layout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove or retarget this out-of-scope artifact.

This plan describes PR #1760’s cross-store/source-switcher work, while the reviewed PR objectives cover PR #1759’s resolution and localization changes. Keeping it here misrepresents the PR scope and can confuse implementation and audit records.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
@.artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md
at line 3, Remove the implementation_plan artifact describing PR `#1760`, or
retarget it to accurately document PR `#1759`’s resolution and localization
changes. Ensure no references to the out-of-scope cross-store/source-switcher
work remain.

Comment thread .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md Outdated
Comment thread .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md Outdated
Comment thread .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/AdvancedTab.kt

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 15 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt">

<violation number="1" location="app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt:1118">
P2: Custom resolutions can become square after passing validation: e.g. `4x3` is accepted, then independent nearest-even rounding saves `4x4`. Validate the rounded dimensions (or round before validation) so saved resolutions still meet the width-greater-than-height constraint.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/walkthrough.artifact.md Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/AdvancedTab.kt Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/EmulationTab.kt Outdated
val widthInt = customScreenWidth.toIntOrNull() ?: 0
val heightInt = customScreenHeight.toIntOrNull() ?: 0
if (widthInt != 0 && heightInt != 0) {
"${evenRound(widthInt.toFloat())}x${evenRound(heightInt.toFloat())}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Custom resolutions can become square after passing validation: e.g. 4x3 is accepted, then independent nearest-even rounding saves 4x4. Validate the rounded dimensions (or round before validation) so saved resolutions still meet the width-greater-than-height constraint.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/ui/component/dialog/ContainerConfigDialog.kt, line 1118:

<comment>Custom resolutions can become square after passing validation: e.g. `4x3` is accepted, then independent nearest-even rounding saves `4x4`. Validate the rounded dimensions (or round before validation) so saved resolutions still meet the width-greater-than-height constraint.</comment>

<file context>
@@ -1113,8 +1112,10 @@ fun ContainerConfigDialog(
+                val widthInt = customScreenWidth.toIntOrNull() ?: 0
+                val heightInt = customScreenHeight.toIntOrNull() ?: 0
+                if (widthInt != 0 && heightInt != 0) {
+                    "${evenRound(widthInt.toFloat())}x${evenRound(heightInt.toFloat())}"
                 } else {
                     config.screenSize
</file context>

Comment thread .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/ControllerTab.kt Outdated
Comment thread app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt Outdated
Comment thread .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md Outdated
Comment thread .artifacts/6d5f4ef6-352e-4825-ae35-a9fd50d40231/implementation_plan.artifact.md Outdated
Comment thread .artifacts/de870e5b-22ce-4650-9bd4-dcd53c8444da/implementation_plan.artifact.md Outdated
Meloon33 and others added 3 commits July 23, 2026 15:35
…_plan.artifact.md

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…pect ratio validation, and cleanup documentation

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 15 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/ui/component/dialog/GeneralTab.kt">

<violation number="1" location="app/src/main/java/app/gamenative/ui/component/dialog/GeneralTab.kt:127">
P2: Custom resolutions with a positive dimension below 1 effective pixel can pass validation but be saved with a zero dimension after `applyScreenSizeToConfig()` rounds the raw input (for example, `1x2` becomes `0x2`). Validating the rounded dimensions should also require `widthInt > 0 && heightInt > 0`, or the rounded values should be passed directly into the applied configuration.</violation>
</file>

<file name="gradle.properties">

<violation number="1" location="gradle.properties:27">
P2: The later `org.gradle.jvmargs` definition overrides the existing JVM settings, silently reducing Gradle's heap from 8 GB to 4 GB and removing `HeapDumpOnOutOfMemoryError` and `file.encoding=UTF-8`. Please merge the intended new option into the existing property instead of defining the key twice.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

val widthInt = evenRound(widthRaw.toFloat())
val heightInt = evenRound(heightRaw.toFloat())

if (widthRaw == 0 || heightRaw == 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Custom resolutions with a positive dimension below 1 effective pixel can pass validation but be saved with a zero dimension after applyScreenSizeToConfig() rounds the raw input (for example, 1x2 becomes 0x2). Validating the rounded dimensions should also require widthInt > 0 && heightInt > 0, or the rounded values should be passed directly into the applied configuration.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/ui/component/dialog/GeneralTab.kt, line 127:

<comment>Custom resolutions with a positive dimension below 1 effective pixel can pass validation but be saved with a zero dimension after `applyScreenSizeToConfig()` rounds the raw input (for example, `1x2` becomes `0x2`). Validating the rounded dimensions should also require `widthInt > 0 && heightInt > 0`, or the rounded values should be passed directly into the applied configuration.</comment>

<file context>
@@ -119,9 +119,12 @@ fun GeneralTabContent(
+                        val widthInt = evenRound(widthRaw.toFloat())
+                        val heightInt = evenRound(heightRaw.toFloat())
+
+                        if (widthRaw == 0 || heightRaw == 0) {
                             state.customResolutionValidationError.value = nonzeroResolutionError
                         } else if (widthInt <= heightInt) {
</file context>
Suggested change
if (widthRaw == 0 || heightRaw == 0) {
if (widthInt <= 0 || heightInt <= 0) {

Comment thread gradle.properties
android.nonTransitiveRClass=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The later org.gradle.jvmargs definition overrides the existing JVM settings, silently reducing Gradle's heap from 8 GB to 4 GB and removing HeapDumpOnOutOfMemoryError and file.encoding=UTF-8. Please merge the intended new option into the existing property instead of defining the key twice.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At gradle.properties, line 27:

<comment>The later `org.gradle.jvmargs` definition overrides the existing JVM settings, silently reducing Gradle's heap from 8 GB to 4 GB and removing `HeapDumpOnOutOfMemoryError` and `file.encoding=UTF-8`. Please merge the intended new option into the existing property instead of defining the key twice.</comment>

<file context>
@@ -22,3 +22,10 @@ kotlin.code.style=official
 android.nonTransitiveRClass=true
+org.gradle.daemon=true
+org.gradle.parallel=true
+org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
+# Skip tests by default in some tasks
+
</file context>

@utkarshdalal

Copy link
Copy Markdown
Owner

Hey @Meloon33 - please don't make PRs without discussing in #code-changes in Discord. As these are clearly AI-generated without any human input at all, and touch critical areas of the app, they are unlikely to be approved or merged. Still, we need to discuss each change you're making or planning to make on Discord first.

christopher-s added a commit to christopher-s/GameNative that referenced this pull request Jul 29, 2026
Resolved strings.xml tail conflict (kept both fork mod-import strings and
PR aspect-ratio/language strings). Dropped PR junk: .artifacts/ agent
output dirs and touched_files.txt.
christopher-s added a commit to christopher-s/GameNative that referenced this pull request Jul 29, 2026
…CPU, GPU, KISS)

- Revert gradle.properties to fork version (PR silently downgraded
  jvmargs 8g->4g, dropped UTF-8/HeapDump flags, added dead config)
- Extract resolution helpers to ui/util/ResolutionUtils.kt; test moved
  to matching package and extended to 8 tests incl. adaptive generation
- Fix contains() substring collision in screenSize index resolution:
  custom '200x540' matched preset '1200x540 (20:9)' - now exact token
- Coerce restored screenSizeIndex against rebuilt adaptive list (OOB risk)
- Validate custom resolution post-rounding (negative raw could save 0)
- deviceNativeResolution uses WindowMetrics on API 30+ (multi-window safe)
- Hoist getGPUCards/preset managers into remember{} (config-change jank)
- Replace startsWith dedupe with parsed-resolution comparison; dedupe
  among adaptive scales; guard zero dimensions; aspect map for special
  ratios; delete dead aspect_ratio string resources
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