Repository navigation
fix: 跳过乐曲开始与开场视频功能冲突 - #154
Conversation
审查者指南该 PR 通过将视频适用性判断提取为共享检查,并将其用作互斥保护条件,解决了自定义开场动画与跳过曲目开始序列之间的冲突:在其他情况下保留正常行为的同时,优先播放自定义开场视频。 自定义开场优先于跳过曲目开始的序列图sequenceDiagram
participant MusicSelectProcess
participant SkipTrackStart
participant CustomIntroCinematic
participant ProcessManager
participant IntroProcess
participant TrackStartProcess
MusicSelectProcess->>SkipTrackStart: GameStart(__instance, container)
SkipTrackStart->>CustomIntroCinematic: WillTakeOver
CustomIntroCinematic->>CustomIntroCinematic: TryGetCurrentVideo(out videoPath)
alt custom intro video applies
SkipTrackStart-->>MusicSelectProcess: return true
MusicSelectProcess->>CustomIntroCinematic: GameStartPrefix(__instance)
CustomIntroCinematic->>CustomIntroCinematic: TryGetCurrentVideo(out videoPath)
CustomIntroCinematic->>ProcessManager: AddProcess(FadeProcess(IntroProcess))
CustomIntroCinematic-->>MusicSelectProcess: return false
else no custom intro video
SkipTrackStart->>ProcessManager: AddProcess(TrackStartProcess)
SkipTrackStart-->>MusicSelectProcess: return false
end
文件级变更
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideThe PR resolves the conflict between custom intro cinematics and skipping the track-start sequence by factoring video applicability into a shared check and using it as a mutual exclusion guard, giving custom intro videos priority while retaining normal behavior otherwise. Sequence diagram for custom intro priority over skipped track startsequenceDiagram
participant MusicSelectProcess
participant SkipTrackStart
participant CustomIntroCinematic
participant ProcessManager
participant IntroProcess
participant TrackStartProcess
MusicSelectProcess->>SkipTrackStart: GameStart(__instance, container)
SkipTrackStart->>CustomIntroCinematic: WillTakeOver
CustomIntroCinematic->>CustomIntroCinematic: TryGetCurrentVideo(out videoPath)
alt custom intro video applies
SkipTrackStart-->>MusicSelectProcess: return true
MusicSelectProcess->>CustomIntroCinematic: GameStartPrefix(__instance)
CustomIntroCinematic->>CustomIntroCinematic: TryGetCurrentVideo(out videoPath)
CustomIntroCinematic->>ProcessManager: AddProcess(FadeProcess(IntroProcess))
CustomIntroCinematic-->>MusicSelectProcess: return false
else no custom intro video
SkipTrackStart->>ProcessManager: AddProcess(TrackStartProcess)
SkipTrackStart-->>MusicSelectProcess: return false
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
您好——我发现了 1 个问题
面向 AI 代理的提示
请处理本次代码审查中的评论:
## 各条评论
### 评论 1
<location path="AquaMai.Mods/Fancy/CustomIntroCinematic.cs" line_range="937" />
<code_context>
+ MelonLogger.Msg($"[CustomIntroCinematic] GameStartPrefix error: {e}");
+ }
+
+ return true; // 正常执行原方法
+ }
+
</code_context>
<issue_to_address>
**问题(更广泛的影响):** 添加自定义的 `FadeProcess` 后,如果 `SoundManager.PreviewEnd()`、`SoundManager.StopBGM(2)` 或后续的前缀处理抛出异常,该异常会被捕获,并且 `GameStartPrefix` 会返回 `true`。随后,原始的 `MusicSelectProcess.GameStart` 会在自定义 intro process 已经排队的情况下执行,从而创建相互竞争的启动进程,并可能导致曲目被启动两次。
**触发条件:** 自定义 intro takeover 已通过创建进程成功接管,但后续的音频操作抛出异常时。
**建议修复:** 跟踪自定义进程是否已排队,并在此类失败后返回 `false`;或者在添加自定义进程之前执行可能失败的音频操作,并在失败时清理已排队的进程。
</issue_to_address>Sourcery 评估
等待批准。 请先处理 1 个发现的问题。
阻塞性发现:AquaMai.Mods/Fancy/CustomIntroCinematic.cs:937
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="AquaMai.Mods/Fancy/CustomIntroCinematic.cs" line_range="937" />
<code_context>
+ MelonLogger.Msg($"[CustomIntroCinematic] GameStartPrefix error: {e}");
+ }
+
+ return true; // 正常执行原方法
+ }
+
</code_context>
<issue_to_address>
**issue (broader_impact):** After the custom `FadeProcess` has been added, an exception from `SoundManager.PreviewEnd()`, `SoundManager.StopBGM(2)`, or subsequent prefix work is caught and `GameStartPrefix` returns `true`. The original `MusicSelectProcess.GameStart` then executes while the custom intro process is already queued, creating competing start processes and potentially starting the track twice.
**Triggers:** When custom intro takeover succeeds through process creation but a later audio operation throws.
**Suggested fix:** Track whether the custom process was queued and return `false` after such a failure, or perform the fallible audio operations before adding the custom process and clean up the queued process on failure.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: AquaMai.Mods/Fancy/CustomIntroCinematic.cs:937
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
开场视频通过在 GameStart 中替换掉 TrackStartProcess 来实现,但是很明显跳过乐曲开始也进行了相关流程。
本 pr 通过加个互斥锁的方式修复了此问题。个人认为自定义开场视频的功能优先级应该是高于跳过乐曲开始的。
最后,本 pr 未经过实际测试,我觉得这么小的修改应该不用测....
重构?我才不重构,加个互斥锁得了。你就说是不是修没修好吧。Sourcery 总结
当两项功能同时适用时,优先播放自定义开场动画,而不是跳过曲目开始序列。
Bug 修复:
增强功能:
Original summary in English
Summary by Sourcery
Prioritize custom intro cinematics over skipping the track-start sequence when both features apply.
Bug Fixes:
Enhancements: