Skip to content

feat: 标题画面播放自定义 BGM 和视频 - #115

Open
WUGqnwvMQPzl wants to merge 8 commits into
MuNET-OSS:mainfrom
WUGqnwvMQPzl:title-video
Open

feat: 标题画面播放自定义 BGM 和视频#115
WUGqnwvMQPzl wants to merge 8 commits into
MuNET-OSS:mainfrom
WUGqnwvMQPzl:title-video

Conversation

@WUGqnwvMQPzl

@WUGqnwvMQPzl WUGqnwvMQPzl commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Sourcery 摘要

在标题画面启用自定义视频和音频播放,并提供可配置的回退与呈现选项。

新功能:

  • 添加可配置的自定义标题画面视频播放,并支持可选的匹配音频文件。
  • 当自定义媒体可用时,允许跳过 SEGA/All.Net 徽标并隐藏标题画面的版权信息。

改进:

  • 当自定义视频准备失败时自动恢复原始标题画面,并在离开该画面时清理媒体资源。
Original summary in English

Sourcery 摘要

支持在标题画面上配置自定义音频和视频,同时在自定义媒体不可用时保留原始体验。

新功能:

  • 添加可配置的自定义标题画面 BGM 和 MP4 视频播放,并支持可选的匹配音频。
  • 添加跳过 SEGA/All.Net 徽标序列以及隐藏标题画面版权信息的选项。

错误修复:

  • 当自定义视频准备失败时,回退到原始标题画面。

增强功能:

  • 将标题画面流程与自定义媒体播放绑定,并在离开标题画面时清理自定义媒体资源。

维护工作:

  • 在配置排序中注册标题画面自定义模组。
Original summary in English

Summary by Sourcery

Enable configurable custom audio and video presentation on the title screen while preserving the original experience when custom media is unavailable.

New Features:

  • Add configurable custom title-screen BGM and MP4 video playback with optional matching audio.
  • Add options to skip the SEGA/All.Net logo sequence and hide title-screen copyright information.

Bug Fixes:

  • Fall back to the original title screen when custom video preparation fails.

Enhancements:

  • Tie title-screen progression to custom media playback and clean up custom media resources when leaving the title screen.

Chores:

  • Register the title-screen customization mod in the configuration ordering.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @WUGqnwvMQPzl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求引入了一个新模组,允许用户在游戏标题画面播放自定义的视频和音频文件。通过替换默认的标题动画,它为玩家提供了更丰富的个性化选项,并旨在重现旧版本游戏中曾有的标题视频功能。该模组通过HarmonyLib对游戏广告流程进行修改,以实现视频和音频的无缝集成和管理。

Highlights

  • 自定义标题视频播放: 实现了在标题画面播放自定义视频和音频的功能,允许用户替换默认的标题动画。
  • HarmonyLib 集成: 通过 HarmonyLib 对 AdvertiseProcessAdvertiseMonitor 的多个方法进行修补,以集成自定义视频播放逻辑。
  • 原版元素禁用: 在自定义视频播放时,禁用了原版标题画面的UI元素和声音,以避免冲突并提供无缝体验。
  • 资源管理: 包含了视频和音频文件的加载、准备、播放和卸载逻辑,并处理了加载失败的情况,确保资源正确释放。
  • 版本兼容性: 考虑了不同游戏版本(如26000及以上)的兼容性,例如禁用特定UI元素。
Changelog
  • AquaMai.Mods/Fancy/TitleScreenVideo.cs
    • 新增了 TitleScreenVideo 类,用于管理自定义标题视频的播放逻辑。
Activity
  • 目前没有记录到任何活动。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist 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.

Code Review

这个 PR 实现了一个很棒的功能,允许在标题画面播放自定义视频。代码结构清晰,并利用 Harmony 来修改游戏行为,实现了预期的效果。

在代码审查中,我发现了一些可以改进的地方,主要集中在并发处理、资源管理和代码健壮性方面。具体来说,存在一个关于视频准备状态的竞态条件,可能会导致不稳定的行为;还有一个小的内存泄漏问题,与动态创建的材质有关。此外,一些硬编码的值和口语化的注释也可以优化,以提高代码的可读性和可维护性。

请查看我提出的具体建议,这些修改将有助于提高这个功能的稳定性和代码质量。

Comment thread AquaMai.Mods/Fancy/TitleScreenVideo.cs Outdated
Comment thread AquaMai.Mods/Fancy/TitleScreenVideo.cs Outdated
Comment thread AquaMai.Mods/Fancy/TitleScreenTweak.cs
Comment thread AquaMai.Mods/Fancy/TitleScreenVideo.cs Outdated
Comment thread AquaMai.Mods/Fancy/TitleScreenVideo.cs Outdated
Comment thread AquaMai.Mods/Fancy/TitleScreenTweak.cs
Comment thread AquaMai.Mods/Fancy/TitleScreenVideo.cs Outdated
Comment thread AquaMai.Mods/Fancy/TitleScreenTweak.cs

@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.

Sourcery assessment

Approved.

@WUGqnwvMQPzl WUGqnwvMQPzl changed the title [+] 标题画面播放自定义视频 feat: 标题画面播放自定义 BGM 和视频 Aug 29, 2026

@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.

3 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="AquaMai.Mods/Fancy/TitleScreenTweak.cs">

<violation number="1" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:139">
P2: 当视频在 `PlayLogo` 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 `prepareCompleted` 结果被忽略。</violation>

<violation number="2" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:168">
P1: `TransitionOut` 持续多帧时,这里会每帧且每个 monitor 重复调用 `SoundManager.StartMusic()`;若该调用重新开始已准备的音乐,`IsEndMusic()` 可能永远无法结束标题画面。仅在进入 `TransitionOut` 时启动一次全局音频,并只启动一次视频播放器。</violation>

<violation number="3" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:229">
P2: 启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 `AllStop`,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。</violation>
</file>

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

Re-trigger cubic

{
// Stop game's original title music and plays our own
SoundManager.StopJingle(i);
SoundManager.StartMusic();

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.

P1: TransitionOut 持续多帧时,这里会每帧且每个 monitor 重复调用 SoundManager.StartMusic();若该调用重新开始已准备的音乐,IsEndMusic() 可能永远无法结束标题画面。仅在进入 TransitionOut 时启动一次全局音频,并只启动一次视频播放器。

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 168:

<comment>`TransitionOut` 持续多帧时,这里会每帧且每个 monitor 重复调用 `SoundManager.StartMusic()`;若该调用重新开始已准备的音乐,`IsEndMusic()` 可能永远无法结束标题画面。仅在进入 `TransitionOut` 时启动一次全局音频,并只启动一次视频播放器。</comment>

<file context>
@@ -0,0 +1,284 @@
+                {
+                    // Stop game's original title music and plays our own
+                    SoundManager.StopJingle(i);
+                    SoundManager.StartMusic();
+
+                    // Stops the "maimai DX" voice, turns out it'll conflicts with the custom BGM feature
</file context>


movieSprite.size = new Vector2(calWidth, calHeight);

Interlocked.Increment(ref _videoPreparedCount);

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.

P2: 当视频在 PlayLogo 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 prepareCompleted 结果被忽略。

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 139:

<comment>当视频在 `PlayLogo` 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 `prepareCompleted` 结果被忽略。</comment>

<file context>
@@ -0,0 +1,284 @@
+
+                    movieSprite.size = new Vector2(calWidth, calHeight);
+
+                    Interlocked.Increment(ref _videoPreparedCount);
+                };
+
</file context>

{
// So uhh... When I was testing the feature, this method makes title screen suddently go black before transition
// I don't like the sudden cutout so I disabled it, not sure about the side effect or compatibility though
return false;

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.

P2: 启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 AllStop,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 229:

<comment>启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 `AllStop`,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。</comment>

<file context>
@@ -0,0 +1,284 @@
+    {
+        // So uhh... When I was testing the feature, this method makes title screen suddently go black before transition
+        // I don't like the sudden cutout so I disabled it, not sure about the side effect or compatibility though
+        return false;
+    }
+
</file context>

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.

1 participant