fix(launch): match IsGBKEncoding behavior with Framework - #3605
Open
fakeboboliu wants to merge 1 commit into
Open
fix(launch): match IsGBKEncoding behavior with Framework#3605fakeboboliu wants to merge 1 commit into
fakeboboliu wants to merge 1 commit into
Conversation
Contributor
审查者指南(小型 PR 中折叠显示)审查者指南该 PR 通过直接调用 kernel32.dll 查询 Windows 的活动代码页,修复了非 .NET Framework 运行时上的 GBK 检测问题,同时保留了 GBK 系统上隔离实例的预期启动行为。 启动期间原生 GBK 检测的时序图sequenceDiagram
participant Launch as Launch process
participant SystemInfo
participant KernelInterop
participant Windows as Windows kernel32.dll
Launch->>SystemInfo: IsGBKEncoding
SystemInfo->>KernelInterop: GetACP()
KernelInterop->>Windows: GetACP()
Windows-->>KernelInterop: Active code page
KernelInterop-->>SystemInfo: 936 or other code page
SystemInfo-->>Launch: true when code page is 936
文件级变更
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes GBK detection on non-.NET Framework runtimes by querying Windows’ active code page directly via kernel32.dll, preserving the intended launch behavior for isolated instances on GBK systems. Sequence diagram for native GBK detection during launchsequenceDiagram
participant Launch as Launch process
participant SystemInfo
participant KernelInterop
participant Windows as Windows kernel32.dll
Launch->>SystemInfo: IsGBKEncoding
SystemInfo->>KernelInterop: GetACP()
KernelInterop->>Windows: GetACP()
Windows-->>KernelInterop: Active code page
KernelInterop-->>SystemInfo: 936 or other code page
SystemInfo-->>Launch: true when code page is 936
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Chiloven945
approved these changes
Sep 11, 2026
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.
问题
PCL-CE/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Lines 2099 to 2108 in d66cb76
在启动过程中,此处使用运行时常量
IsGBKEncoding确定当前 Active CodePage 是否是 GBK,但在此项目迁移到非 Framework 后,Encoding.Default.CodePage 现在永远为 UTF-8,使
IsGBKEncoding永远为false。这一问题造成原本可以在 GBK 系统上运行多版本隔离实例的启动过程错误跳过分支,
从而总是使用同一 natives 目录解压 lwjgl 等,并造成启动多个不同依赖版本实例时,后续实例无法启动。
目的
此修复使启动过程尊重原始开发人员意图。
权衡
此处有两个接近等价的方案,使用:
此方法需要预先修改全局状态,依赖执行顺序,如分离引入 Provider 过程到
Program.cs易被误删或影响行为,故放弃。目前的从
kernel32.dll获取 ACP 的操作可完全等价于 .NET Framework 中代码的行为,且确保相对原子化的可靠工具常量,故选择。Sourcery 摘要
恢复准确的活动代码页检测,以防止 GBK 系统上多个隔离实例启动失败。
错误修复:
增强功能:
IsGBKEncoding的行为与 .NET Framework 保持一致。Original summary in English
Sourcery 摘要
恢复与 Framework 兼容的活动代码页检测,以防止独立的 Minecraft 实例在 GBK 系统上启动失败。
Bug 修复:
增强功能:
IsGBKEncoding的行为与 .NET Framework 保持一致。Original summary in English
Summary by Sourcery
Restore Framework-compatible active code page detection to prevent isolated Minecraft instances from failing on GBK systems.
Bug Fixes:
Enhancements: