SHA256
Merge remote-tracking branch 'origin/main'
This commit is contained in:
21 files changed
+1049
-1767
No files matched your search
+6
-37
@@ -2,12 +2,11 @@ using System;
|
||||
using ADOFAIRenderer;
|
||||
using ADOFAIRenderer.Core;
|
||||
using ADOFAIRenderer.Data;
|
||||
using ADOFAIRenderer.Util;
|
||||
using ADOFAIRenderer.UI;
|
||||
using FFmpeg.AutoGen;
|
||||
using MelonLoader;
|
||||
using MelonLoader.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.2.0-INDEV", "ADOFAI Editor Forum")]
|
||||
@@ -17,57 +16,27 @@ namespace ADOFAIRenderer;
|
||||
|
||||
internal class RenderMod : MelonMod
|
||||
{
|
||||
public static AssetBundle FontBundle = null!;
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public static AssetBundle SceneBundle = null!;
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public static AssetBundle ShaderBundle = null!;
|
||||
public static ComputeShader ColorConversionShader = null!;
|
||||
public static bool IsFeatureDisabled = false;
|
||||
public static DateTime ExpirationTime = new(2026, 11, 21, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
GlobalSettings.Load();
|
||||
Localization.LocalizationManager.Initialize();
|
||||
ffmpeg.RootPath = MelonEnvironment.UserLibsDirectory;
|
||||
|
||||
var renderManagerObj = new GameObject("Render Manager");
|
||||
var updateHookerObj = new GameObject("Update Hooker");
|
||||
var uiManagerObj = new GameObject("Renderer UI Manager");
|
||||
Object.DontDestroyOnLoad(renderManagerObj);
|
||||
Object.DontDestroyOnLoad(updateHookerObj);
|
||||
Object.DontDestroyOnLoad(uiManagerObj);
|
||||
|
||||
renderManagerObj.AddComponent<RenderManager>();
|
||||
updateHookerObj.AddComponent<FirstUpdateHook>();
|
||||
LoadBundles();
|
||||
}
|
||||
|
||||
private static void LoadBundles()
|
||||
{
|
||||
FontBundle = BundleLoader.GetBundle("fonts");
|
||||
SceneBundle = BundleLoader.GetBundle("scenes");
|
||||
SceneBundle.GetAllScenePaths();
|
||||
try
|
||||
{
|
||||
ShaderBundle = BundleLoader.GetBundle("shaders");
|
||||
ColorConversionShader = ShaderBundle.LoadAsset<ComputeShader>("ColorConversion");
|
||||
Melon<RenderMod>.Logger.Msg("Color conversion Compute Shader loaded successfully.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Melon<RenderMod>.Logger.Warning($"Failed to load Shader AssetBundle. GPU color conversion will be disabled and fallback to CPU. Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void FixEventSystem()
|
||||
{
|
||||
if (EventSystem.current == null) return;
|
||||
var currentModule = EventSystem.current.currentInputModule;
|
||||
|
||||
if (currentModule) return;
|
||||
Melon<RenderMod>.Logger.Msg("Ported Unity 6 Input Module.");
|
||||
|
||||
var newModule = EventSystem.current.gameObject.AddComponent<StandaloneInputModule>();
|
||||
newModule.enabled = true;
|
||||
uiManagerObj.AddComponent<RendererUIManager>();
|
||||
ModAssets.Load();
|
||||
}
|
||||
|
||||
public override void OnApplicationQuit()
|
||||
|
||||
Reference in new issue
Block a user