This commit is contained in:
copecone committed 2026-10-07 11:47:40 +09:00
1 parent 8567878f07
commit 671bdda9a1
4 files changed
+18 -16

No files matched your search

+3
View File
@@ -82,6 +82,9 @@
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>$(ADOFAI_PATH)\A Dance of Fire and Ice_Data\Managed\Newtonsoft.Json.dll</HintPath> <HintPath>$(ADOFAI_PATH)\A Dance of Fire and Ice_Data\Managed\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="UniTask">
<HintPath>$(ADOFAI_PATH)\A Dance of Fire and Ice_Data\Managed\UniTask.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+11 -8
View File
@@ -1,5 +1,5 @@
using System.Collections;
using System.Reflection; using System.Reflection;
using Cysharp.Threading.Tasks;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
@@ -9,6 +9,7 @@ namespace ADOFAIRenderer.Core;
internal class PostRenderHook : MonoBehaviour internal class PostRenderHook : MonoBehaviour
{ {
private FieldInfo? _camQuadMeshField; private FieldInfo? _camQuadMeshField;
private MeshRenderer? _camQuadMeshRenderer;
private void Awake() private void Awake()
{ {
@@ -20,15 +21,17 @@ internal class PostRenderHook : MonoBehaviour
if (RenderManager.Instance) if (RenderManager.Instance)
RenderManager.Instance.OnLastUpdate(); RenderManager.Instance.OnLastUpdate();
StartCoroutine(PostFrameCoroutine()); PostFrameAsync().Forget();
} }
private IEnumerator PostFrameCoroutine() private async UniTaskVoid PostFrameAsync()
{ {
yield return new WaitForEndOfFrame(); await UniTask.WaitForEndOfFrame(this, destroyCancellationToken);
var val = (MeshRenderer)_camQuadMeshField!.GetValue(scrCamera.instance); if (!_camQuadMeshRenderer && scrCamera.instance)
if (RenderManager.Instance) _camQuadMeshRenderer = _camQuadMeshField?.GetValue(scrCamera.instance) as MeshRenderer;
RenderManager.Instance.OnPostFrame(val.sharedMaterial.mainTexture as RenderTexture);
if (RenderManager.Instance && _camQuadMeshRenderer)
RenderManager.Instance.OnPostFrame(_camQuadMeshRenderer.sharedMaterial.mainTexture as RenderTexture);
} }
} }
-1
View File
@@ -40,7 +40,6 @@ public static class EndscreenLanternsPatch
for (var i = 0; i < lampSequencesArray.Length; i++) for (var i = 0; i < lampSequencesArray.Length; i++)
{ {
var item = lampSequencesArray.GetValue(i); var item = lampSequencesArray.GetValue(i);
if (item == null) continue;
try try
{ {
var killMethod = item.GetType().GetMethod("Kill", new[] { typeof(bool) }); var killMethod = item.GetType().GetMethod("Kill", new[] { typeof(bool) });
+4 -7
View File
@@ -78,10 +78,8 @@ public static class scnGamePatch
{ {
// Remove FFmpeg player if it was attached previously // Remove FFmpeg player if it was attached previously
var oldPlayer = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>(); var oldPlayer = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>();
if (oldPlayer != null) if (oldPlayer) Object.Destroy(oldPlayer);
{
Object.Destroy(oldPlayer);
}
// Re-enable native player component // Re-enable native player component
__instance.videoBG.enabled = true; __instance.videoBG.enabled = true;
return true; // Execute original return true; // Execute original
@@ -125,8 +123,7 @@ public static class scnGamePatch
__instance.videoBG.enabled = false; __instance.videoBG.enabled = false;
// Add or retrieve our custom FFmpeg video background player // Add or retrieve our custom FFmpeg video background player
var player = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>(); if (!__instance.videoBG.gameObject.TryGetComponent<FFmpegVideoBGPlayer>(out var player))
if (player == null)
{ {
player = __instance.videoBG.gameObject.AddComponent<FFmpegVideoBGPlayer>(); player = __instance.videoBG.gameObject.AddComponent<FFmpegVideoBGPlayer>();
} }
@@ -134,7 +131,7 @@ public static class scnGamePatch
var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo"); var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo");
// Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera. // Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera.
player.Init(videoPath, __instance.videoBG.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject); player.Init(videoPath, __instance.videoBG?.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject);
return false; // Skip original UpdateVideo return false; // Skip original UpdateVideo
} }