Skip to content

Commit ed45cb0

Browse files
committed
fetch aquamai 155 fix
1 parent 7043d0c commit ed45cb0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

AquaMai.Mods/GameSystem/Assets/MovieLoader.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using AquaMai.Config.Attributes;
4+
using AquaMai.Core.Attributes;
45
using AquaMai.Core.Helpers;
56
using CriMana;
67
using HarmonyLib;
78
using MAI2.Util;
89
using Manager;
910
using MelonLoader;
11+
using Monitor;
1012
using Monitor.Game;
1113
using UnityEngine;
1214
using UnityEngine.Video;
@@ -171,13 +173,15 @@ public static async void GetMovie() {
171173
}
172174

173175
// 异步调用后处理函数
176+
//MelonLogger.Msg($"[MovieLoader] start {musicID}"); //DEBUG
174177
jacket = await JacketPostProcess(jacket);
175178
if (jacket is null) {
176179
MelonLogger.Msg($"[MovieLoader] post-process return null for {musicID}");
177180
return;
178181
}
179182
movieInfo.Type = MovieInfo.MovieType.Jacket; // 后处理完成
180183
movieInfo.JacketTexture = jacket;
184+
//MelonLogger.Msg($"[MovieLoader] success {musicID}"); //DEBUG
181185
}
182186
} catch (System.Exception e) {MelonLogger.Msg($"[MovieLoader] GetMovie() error: {e}");}
183187
}
@@ -274,11 +278,16 @@ private static async Task<Texture2D> JacketPostProcess(Texture2D jacket) {
274278
}
275279

276280
private static VideoPlayer[] _videoPlayers = new VideoPlayer[2];
281+
private static bool _isReplaced = false;
277282

278283
[HarmonyPostfix]
279284
[HarmonyPatch(typeof(GameCtrl), "Initialize")]
280285
public static void LoadLocalBgaAwake(GameObject ____movieMaskObj, int ___monitorIndex)
281286
{
287+
//if (___monitorIndex == 0) MelonLogger.Msg($"[MovieLoader] Load"); //DEBUG
288+
289+
_isReplaced = false;
290+
282291
if (!movieInfo.IsValid) return;
283292

284293
string mp4Path = "";
@@ -309,6 +318,8 @@ public static void LoadLocalBgaAwake(GameObject ____movieMaskObj, int ___monitor
309318
return;
310319
}
311320

321+
_isReplaced = true;
322+
312323
if (mp4Exists)
313324
{
314325
if (_videoPlayers[___monitorIndex] == null)
@@ -368,6 +379,17 @@ public static void LoadLocalBgaAwake(GameObject ____movieMaskObj, int ___monitor
368379
}
369380
}
370381

382+
[HarmonyPrefix]
383+
[HarmonyPatch(typeof(GameMonitor), "SetMovieMaterial")]
384+
[EnableGameVersion(minVersion: 25500)]
385+
public static bool SetMovieMaterial(Material material, int ___monitorIndex)
386+
{
387+
# if DEBUG
388+
MelonLogger.Msg("SetMovieMaterial");
389+
# endif
390+
return !_isReplaced;
391+
}
392+
371393
[HarmonyPostfix]
372394
[HarmonyPatch(typeof(MovieController), "GetMovieHeight")]
373395
public static void GetMovieHeightPostfix(ref uint __result)

0 commit comments

Comments
 (0)