Repository navigation
fix(jacket): 打包自制封面时限制尺寸,避免超大纹理导致选歌卡顿 - #81
Conversation
自制封面会把原图尺寸直接写进 AB,且固定为未压缩的 RGBA32。实测游戏数据里 存在 3000x3000 的封面(34 MB 显存 / 18.6 MB 文件),而官方封面是 400x400 BC7(0.16 MB / 130 KB),游戏同步加载时会造成明显掉帧。 - AssetBundleCreator 新增 MaxJacketDimension = 400,大封面按长边等比缩放 (只缩不放,保持原宽高比,Lanczos3) - 导入封面、改 ID 重打包、图片转 AB 工具、mcm makeab 统一应用该上限 - jacket_s 仍然是 200x200,不受影响
审查者指南API公开 400 像素的封面尺寸上限,以及纹理创建和重新打包时可选的
API 的使用场景在导入、传输、图像转换和 CLI 打包流程中创建大封面时,应用封面尺寸限制。
实现先执行显式拉伸,再独立检查最大尺寸并保持宽高比;同时将尺寸限制传递给创建和重新打包辅助方法。
提示和命令与 Sourcery 互动
自定义体验访问你的控制面板,即可:
获取帮助Original review guide in EnglishReviewer's GuideAPIExpose the 400-pixel jacket limit and optional maxDimension parameters on texture creation and repacking, documenting how they interact with explicit resize dimensions.
Uses of the APIApply the jacket dimension limit to large-cover creation in import, transfer, image conversion, and CLI packaging paths.
ImplementationImplement explicit stretching followed by an independent, aspect-ratio-preserving maximum-dimension check, and forward the limit through the creation and repacking helpers.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嘿——我发现了 1 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="MaiChartManager/Utils/AssetBundleCreator.cs" line_range="34" />
<code_context>
int? resizeWidth = null,
- int? resizeHeight = null)
+ int? resizeHeight = null,
+ int? maxDimension = null)
{
if (!File.Exists(imagePath))
</code_context>
<issue_to_address>
**Previously compiled callers fail**
When an external consumer has compiled against the previous `MaiChartManager` assembly and runs against this version, the CLR method signatures change, so an already-compiled consumer still requesting the old overload gets `MissingMethodException` when it calls `CreateTextureAssetBundle` or `RepackTextureAssetBundle`. Optional parameters only preserve source compatibility after recompilation; they do not preserve the old method entries in the assembly.
Retain the original public signatures as forwarding overloads and expose the new parameter through additional overloads.
Also at `MaiChartManager/Utils/AssetBundleCreator.cs:50`, `MaiChartManager/Utils/AssetBundleCreator.cs:217`.
</issue_to_address>Sourcery 评估
需要人工审查。 有 1 项发现需要先处理;打包过程现在会在写入资源包之前缩小过大的夹克纹理,因此即使撤销此更改,错误的限制值也可能导致生成的资源包图像细节降低。可以使用原始图像或源资源包重新构建,因此影响范围有限且可以修复。
阻塞性发现:MaiChartManager/Utils/AssetBundleCreator.cs:34
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="MaiChartManager/Utils/AssetBundleCreator.cs" line_range="34" />
<code_context>
int? resizeWidth = null,
- int? resizeHeight = null)
+ int? resizeHeight = null,
+ int? maxDimension = null)
{
if (!File.Exists(imagePath))
</code_context>
<issue_to_address>
**Previously compiled callers fail**
When an external consumer has compiled against the previous `MaiChartManager` assembly and runs against this version, the CLR method signatures change, so an already-compiled consumer still requesting the old overload gets `MissingMethodException` when it calls `CreateTextureAssetBundle` or `RepackTextureAssetBundle`. Optional parameters only preserve source compatibility after recompilation; they do not preserve the old method entries in the assembly.
Retain the original public signatures as forwarding overloads and expose the new parameter through additional overloads.
Also at `MaiChartManager/Utils/AssetBundleCreator.cs:50`, `MaiChartManager/Utils/AssetBundleCreator.cs:217`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and packaging now downsizes oversized jacket textures before writing the asset bundle, so a mistaken limit can leave generated bundles with reduced image detail even after this change is reverted. The original image or source bundle can be used to rebuild them, making the impact bounded and repairable.
Blocking findings: MaiChartManager/Utils/AssetBundleCreator.cs:34
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- 显式尺寸与 maxDimension 的优先级改用 GetResizeOptions 显式表达,不再靠 else if 静默吞掉 maxDimension - 显式尺寸分支必须指定 Mode = Stretch:ResizeOptions 默认值是 Crop,直接替换 Resize(w, h) 会变成居中裁剪 - 给 CreateTextureAssetBundle 补 XML 文档,说明 resizeWidth/resizeHeight/maxDimension 的优先级与是否保持宽高比
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Re-trigger cubic
- 原来写成 else if,同时给 resizeWidth/resizeHeight 和 maxDimension 时上限会被整体跳过,超大纹理照样写进 AB - 现在显式尺寸先应用,随后独立判断长边是否超上限,任何调用组合都不会产出超限纹理 - 去掉仅为表达优先级而引入的 GetResizeOptions,逻辑回到一处,显式尺寸分支显式写 Stretch 避免 ResizeOptions 默认 Crop 造成裁剪
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Auto-approved: 打包大封面时统一按最长边 400 等比缩小(只缩不放、不裁剪),避免超大 RGBA32 纹理同步加载导致选歌卡顿;改动只影响新写入的封面,小封面保持 200 不变,行为边界清晰且收益明确。
View guided diff | Re-trigger cubic
问题
导入自制曲目时,MCM 会把原图尺寸直接写进大封面 AB(
jacket),并且纹理格式固定为未压缩的 RGBA32、无 mipmap。官方封面是 400×400 的 BC7。实测某游戏数据(
A5xx包,329 首自制曲):共 69 个封面 ≥400 KB,合计 158 MB 文件、347 MB 显存(同样数量的官方封面只需约 11 MB)。游戏的
AssetBundleDB.load()是同步LoadFromFile+LoadAsset,换成这种超大纹理时会出现明显掉帧。改动
AssetBundleCreator新增MaxJacketDimension = 400,并给CreateTextureAssetBundle/RepackTextureAssetBundle增加maxDimension参数:超过上限时按长边等比缩放(ResizeMode.Max,Lanczos3,只缩不放,不裁剪、不改变宽高比)CreateMusicJacketAssetBundles)、改 ID 重打包(MusicTransferController)、图片转 AB 工具(ImageToAbToolController)、mcm makeabjacket_s仍然是 200×200,不受影响验证
dotnet build MaiChartManager.CLI -c Crack通过mcm makeab处理 3000×3000 与 1736×1604 的测试图,产物为 400×400 与 400×370注意
只影响新写入的封面。已经导入的曲目需要重新导入封面,或者用一次性脚本把现有的大封面重打包(我可以另外提供,未包含在本 PR 内)。
Sourcery 摘要
在创建资源包时限制大型夹克纹理的尺寸,以降低内存使用量并提升加载性能。
错误修复:
功能增强:
Original summary in English
Sourcery 总结
将新生成的封面纹理最长边限制为 400 像素,以减少加载开销并防止游戏界面卡顿。
错误修复:
增强功能:
Original summary in English
Sourcery 总结
将生成的封面纹理最长边限制为 400 像素,以减小资源体积并提升加载性能。
错误修复:
功能增强:
Original summary in English
Summary by Sourcery
Limit generated jacket textures to a maximum 400-pixel edge to reduce asset size and improve loading performance.
Bug Fixes:
Enhancements: