Repository navigation
Handle zero C2S meter in UGC export - #7
Conversation
审查者指南导出器现在可以通过在节拍图构建期间发出警告并忽略无效的零值拍号,避免因时序相关问题导致的崩溃;必要时会回退到有效的默认拍号,并增加回归测试以确认后续音符的时序仍然正确。 具备容错能力的 UGC 节拍图导出时序图sequenceDiagram
participant Serialize
participant FillUgcBeats
participant Alerts
participant BeatMap
participant Notes
Serialize->>FillUgcBeats: FillUgcBeats(metList)
loop each meter
alt Numerator <= 0 or Denominator <= 0
FillUgcBeats->>Alerts: Add(Alert.Warning)
FillUgcBeats-->>FillUgcBeats: Ignore invalid meter
else Valid meter
FillUgcBeats->>BeatMap: Add valid beat entry
end
end
opt No valid beat entries
FillUgcBeats->>BeatMap: Add default 4/4 entry
end
FillUgcBeats-->>Serialize: Return beat map
Serialize->>Notes: Serialize note timing using beat map
文件级变更
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideThe exporter now avoids timing-related crashes from invalid zero-valued meters by warning and ignoring them during beat-map construction, falls back to a valid default meter when necessary, and adds regression coverage confirming later note timing remains correct. Sequence diagram for resilient UGC beat-map exportsequenceDiagram
participant Serialize
participant FillUgcBeats
participant Alerts
participant BeatMap
participant Notes
Serialize->>FillUgcBeats: FillUgcBeats(metList)
loop each meter
alt Numerator <= 0 or Denominator <= 0
FillUgcBeats->>Alerts: Add(Alert.Warning)
FillUgcBeats-->>FillUgcBeats: Ignore invalid meter
else Valid meter
FillUgcBeats->>BeatMap: Add valid beat entry
end
end
opt No valid beat entries
FillUgcBeats->>BeatMap: Add default 4/4 entry
end
FillUgcBeats-->>Serialize: Return beat map
Serialize->>Notes: Serialize note timing using beat map
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| _ugcBeats = []; | ||
| foreach (var met in metList) | ||
| { | ||
| if (met.Numerator <= 0 || met.Denominator <= 0) |
There was a problem hiding this comment.
To be honest, your example 2503_03.zip is the first time that I know, MET line's numerator can be zero, so thank you very much. Since in the official game, MET controls the "beat line" interval, so I think by using MET x x 4 0, the official chart designer may want to implement that there is no "beat lines".
Thus, in my opinion, rather than directly ignore the MET line when met.Numerator <= 0, a better plan is forcing met.Numerator to be equal with met.Denominator. This behaves as turning MET x x 4 0 into MET x x 4 4, just recovering the dropped "beat lines" while keeping the denominator.
I may make the changes mentioned above by myself.
There was a problem hiding this comment.
I implement the changes I proposed above in 457d827 .
There was a problem hiding this comment.
1 issue found across 2 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. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="generator/chu/UgcGenerator.cs">
<violation number="1" location="generator/chu/UgcGenerator.cs:96">
P1: `Denominator` 为 0 时该分支不会修正或跳过拍号,随后 `T` 会用零分母构造 `Rational`,导致导出仍然抛异常。请在写入 `_ugcBeats` 前对 `Denominator <= 0` 发出警告并跳过该条目。</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| foreach (var origMet in metList) | ||
| { | ||
| var met = origMet; | ||
| if (met.Numerator <= 0) |
There was a problem hiding this comment.
P1: Denominator 为 0 时该分支不会修正或跳过拍号,随后 T 会用零分母构造 Rational,导致导出仍然抛异常。请在写入 _ugcBeats 前对 Denominator <= 0 发出警告并跳过该条目。
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At generator/chu/UgcGenerator.cs, line 96:
<comment>`Denominator` 为 0 时该分支不会修正或跳过拍号,随后 `T` 会用零分母构造 `Rational`,导致导出仍然抛异常。请在写入 `_ugcBeats` 前对 `Denominator <= 0` 发出警告并跳过该条目。</comment>
<file context>
@@ -90,13 +90,15 @@ void Dfs(ChuNote n)
{
- if (met.Numerator <= 0 || met.Denominator <= 0)
+ var met = origMet;
+ if (met.Numerator <= 0)
{
- alerts.Add(new Alert(Alert.LEVEL.Warning,
</file context>
| if (met.Numerator <= 0) | |
| if (met.Denominator <= 0) | |
| { | |
| alerts.Add(new Alert(Alert.LEVEL.Warning, | |
| $"UGC Generator忽略无效拍号: {met.Numerator}/{met.Denominator}", met.Time)); | |
| continue; | |
| } | |
| if (met.Numerator <= 0) |
There was a problem hiding this comment.
目前为止没见过Denominator为0的情况,我想也没有意义,所以如果真的遇到的话,我觉得报个错是合理的
f7f8fc3 to
457d827
Compare
Sourcery withdrew this approval because the latest commits introduced blocking findings.
fix crashes due to timing issue
example chart:
2503_03.zip
Sourcery 总结
使 UGC 导出能够稳健处理无效拍号,同时保留有效的节拍和音符时序。
错误修复:
增强功能:
测试:
Original summary in English
Sourcery 摘要
在无效节拍定义的情况下增强 UGC 导出的稳定性,同时保留音符的时序。
错误修复:
改进:
测试:
Original summary in English
Sourcery 总结
使 UGC 导出能够稳健处理无效的节拍定义,同时保留音符的时间信息。
错误修复:
增强功能:
测试:
Original summary in English
Sourcery 总结
增强 UGC 导出功能,使其能够稳健处理无效的拍号定义,同时保留音符的时间安排。
错误修复:
改进:
测试:
Original summary in English
Summary by Sourcery
Make UGC export robust against invalid meter definitions while preserving note timing.
Bug Fixes:
Enhancements:
Tests: