Skip to content

fix(launch): check assets for old versions#1341

Open
icgnos wants to merge 1 commit intoUNIkeEN:mainfrom
icgnos:virtual
Open

fix(launch): check assets for old versions#1341
icgnos wants to merge 1 commit intoUNIkeEN:mainfrom
icgnos:virtual

Conversation

@icgnos
Copy link
Collaborator

@icgnos icgnos commented Jan 29, 2026

Checklist

  • Changes have been tested locally and work as expected.
  • All tests in workflows pass successfully.
  • Documentation has been updated if necessary.
  • Code formatting and commit messages align with the project's conventions.
  • Comments have been added for any complex logic or functionality if possible.

This PR is a ..

  • 🆕 New feature
  • 🐞 Bug fix
  • 🛠 Refactoring
  • ⚡️ Performance improvement
  • 🌐 Internationalization
  • 📄 Documentation improvement
  • 🎨 Code style optimization
  • ❓ Other (Please specify below)

Related Issues

Description

  • SJMCL 缺少对{$game_assets}(只在1.7.3之前存在)的解析,这里加以补全。
  • 启动时会检查assets/virtual/legacy//versions/xxx/resources/,并从assets/objects/拷贝缺失文件

Additional Context

  • 修复后
image

Copy link
Owner

@UNIkeEN UNIkeEN left a comment

Choose a reason for hiding this comment

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

  1. 复制文件请使用 src-tauri/src/utils/fs.rs 里的工具函数
  2. assets 处理是不是在 file_validator 阶段更合适?
  3. 请给出 HMCL 相关逻辑的链接和简单解释~

@icgnos
Copy link
Collaborator Author

icgnos commented Feb 2, 2026

  1. utils/fs.rs 里的 copy_whole_dir 是同步操作,在复制上千个文件上可能会增加性能开销
  2. 一方面当前 file_validator 负责下载缺失的文件,而 check_virtual_assets 只是在本地复制文件(文件不是不完整,而是位置不对),且复制文件要求下载任务已经完成,两者逻辑分开或许会更好;另一方面HMCL也是这么做的
  3. HMCL在生成启动参数时,
    DefaultLauncher.java#L266
    首先会获取assets的实际位置,
    DefaultGameRepository.java#L417
    同时完成对资源文件的复制。
    DefaultGameRepository.java#L463

@UNIkeEN
Copy link
Owner

UNIkeEN commented Feb 6, 2026

  1. utils/fs.rs 里的 copy_whole_dir 是同步操作,在复制上千个文件上可能会增加性能开销

你可以看着改成 async 的

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.

[Bug] 1.7.2 启动后图标不对

2 participants

Comments