Skip to content

fix: 跳过乐曲开始与开场视频功能冲突 - #154

Merged
clansty merged 1 commit into
MuNET-OSS:mainfrom
s-yh-china:fix-1
Oct 7, 2026
Merged

clansty merged 1 commit into
MuNET-OSS:mainfrom
s-yh-china:fix-1

Conversation

@s-yh-china

@s-yh-china s-yh-china commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

开场视频通过在 GameStart 中替换掉 TrackStartProcess 来实现,但是很明显跳过乐曲开始也进行了相关流程。
本 pr 通过加个互斥锁的方式修复了此问题。个人认为自定义开场视频的功能优先级应该是高于跳过乐曲开始的。
最后,本 pr 未经过实际测试,我觉得这么小的修改应该不用测....
重构?我才不重构,加个互斥锁得了。你就说是不是修没修好吧。

Review in cubic

Sourcery 总结

当两项功能同时适用时,优先播放自定义开场动画,而不是跳过曲目开始序列。

Bug 修复:

  • 当两项功能同时启用时,防止跳过曲目开始序列的逻辑覆盖自定义开场动画。

增强功能:

  • 集中处理自定义开场动画的适用性判断和视频查找,以便各个补丁共享 GameStart 接管决策。
Original summary in English

Summary by Sourcery

Prioritize custom intro cinematics over skipping the track-start sequence when both features apply.

Bug Fixes:

  • Prevent the track-start skip from overriding custom intro cinematics when both features are enabled.

Enhancements:

  • Centralize custom intro eligibility and video lookup so GameStart takeover decisions can be shared across patches.

@sourcery-ai

sourcery-ai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

审查者指南

该 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
Loading

文件级变更

变更 详细信息 文件
集中处理自定义开场视频的适用性和选择逻辑,使两个补丁都能确定动画是否接管流程。
  • 将 GameStart 的适用性检查提取为可复用的视频查找方法。
  • 公开一个供跳过曲目开始补丁使用的接管判断条件。
  • 当不存在适用视频或查找失败时,保留回退到原始 GameStart 行为的逻辑。
AquaMai.Mods/Fancy/CustomIntroCinematic.cs
使自定义开场动画优先于跳过曲目开始序列。
  • 当自定义开场视频适用时,让跳过曲目开始补丁提前结束。
  • 允许自定义动画补丁安装替代的开始流程,同时避免跳过补丁添加相互冲突的流程。
AquaMai.Mods/Tweaks/TimeSaving/SkipTrackStart.cs

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复某条审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复审查评论并使用 @sourcery-ai issue,根据该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中所需位置写入 @sourcery-ai summary,即可在该位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,随时(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从新的审查开始,这尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

The 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 start

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
Loading

File-Level Changes

Change Details Files
Centralize custom intro video eligibility and selection so both patches can determine whether the cinematic takes over.
  • Extract GameStart eligibility checks into a reusable video lookup method.
  • Expose a takeover predicate used by the skip-track-start patch.
  • Preserve fallback to the original GameStart behavior when no applicable video exists or lookup fails.
AquaMai.Mods/Fancy/CustomIntroCinematic.cs
Make custom intro cinematics take precedence over skipping the track-start sequence.
  • Short-circuit the skip-track-start patch when a custom intro video applies.
  • Allow the custom cinematic patch to install its replacement start process without the skip patch adding a competing process.
AquaMai.Mods/Tweaks/TimeSaving/SkipTrackStart.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

您好——我发现了 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


Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread AquaMai.Mods/Fancy/CustomIntroCinematic.cs

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread AquaMai.Mods/Fancy/CustomIntroCinematic.cs

@Starrah Starrah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@clansty
clansty merged commit e1a6050 into MuNET-OSS:main Oct 7, 2026
5 checks passed
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.

3 participants