Skip to content

在 SystemInfo 中采集内存信息#3903

Merged
Glavo merged 6 commits into
HMCL-dev:mainfrom
Glavo:system-info
May 10, 2025
Merged

在 SystemInfo 中采集内存信息#3903
Glavo merged 6 commits into
HMCL-dev:mainfrom
Glavo:system-info

Conversation

@Glavo

@Glavo Glavo commented May 10, 2025

Copy link
Copy Markdown
Member

No description provided.

@Glavo Glavo requested a review from Copilot May 10, 2025 01:50

This comment was marked as resolved.

@Glavo Glavo requested a review from Copilot May 10, 2025 01:59

Copilot AI 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.

Pull Request Overview

This PR introduces a unified approach for collecting and formatting memory information on Linux (and other platforms) by moving the logic into SystemInfo along with a new PhysicalMemoryStatus object and a DataSizeUnit utility. Key changes include:

  • Adding parsing for /proc/meminfo in LinuxHardwareDetector.
  • Introducing PhysicalMemoryStatus and DataSizeUnit for consistent memory unit conversion and display.
  • Updating multiple modules (UI components, VersionSetting, Launcher, language resources, etc.) to use the new SystemInfo methods and adopt MiB/GiB units.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/linux/LinuxHardwareDetector.java Adds memory parsing from /proc/meminfo and new memory size methods.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/hardware/PhysicalMemoryStatus.java New immutable class representing physical memory status.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/hardware/HardwareDetector.java Updates memory retrieval using OperatingSystemMXBean with fallback.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/SystemInfo.java Refactors memory collection and exposes new memory methods.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/OperatingSystem.java Removes deprecated memory-related code.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/DataSizeUnit.java Introduces unit conversion and formatting for memory sizes.
Various UI and language files (e.g., VersionSettingsPage.java, I18N_*.properties) Update to use new memory info methods and consistently use MiB/GiB notation.
Other related files (e.g., VersionSetting.java, Launcher.java, HMCLGameRepository.java) Updates to refer to SystemInfo and new formatting in memory allocation logic.
Comments suppressed due to low confidence (1)

HMCL/src/main/resources/assets/lang/I18N_ja.properties:510

  • There appears to be a typographic error in the unit. '1024i' should likely be '1024 MiB' for consistency.
launch.advice.too_large_memory_for_32bit=32ビットJavaランタイム環境が原因で、割り当てたメモリが多すぎるため、ゲームがクラッシュする可能性があります。32ビットシステムの最大メモリ容量は1024iです.

@Glavo Glavo merged commit 48ca2d6 into HMCL-dev:main May 10, 2025
3 checks passed
@Glavo Glavo deleted the system-info branch May 10, 2025 04:06
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