From e8ae7d1189c512b1b3a793408692d99a2c5c6333 Mon Sep 17 00:00:00 2001 From: routersys Date: Sat, 27 Jun 2026 12:23:08 +0900 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8B=95=E6=8C=AF=E3=82=8A=E5=88=86?= =?UTF-8?q?=E3=81=91=E3=82=92=E6=8E=A1=E7=94=A8=E3=81=97=E3=83=8D=E3=82=A4?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=83=96=E6=9C=AA=E9=85=8D=E5=82=99=E6=99=82?= =?UTF-8?q?=E3=81=AF=E4=B8=80=E5=BA=A6=E3=81=A0=E3=81=91=E8=AD=A6=E5=91=8A?= =?UTF-8?q?(=E3=82=B5=E3=82=A4=E3=83=AC=E3=83=B3=E3=83=88=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=BC=E3=83=AB=E3=83=90=E3=83=83=E3=82=AF=E8=A7=A3?= =?UTF-8?q?=E6=B6=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/LuaScriptEffectProcessor.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/LuaScript/LuaScriptEffectProcessor.cs b/LuaScript/LuaScriptEffectProcessor.cs index 42d4e6a..7338dad 100644 --- a/LuaScript/LuaScriptEffectProcessor.cs +++ b/LuaScript/LuaScriptEffectProcessor.cs @@ -55,6 +55,7 @@ namespace LuaScript private LuaJitWorker? _nativeWorker; private double[]? _nativeFields; + private bool _nativeWarned; private EffectDescription? _frameDesc; private SceneObjectResolver? _frameResolver; @@ -178,8 +179,12 @@ namespace LuaScript try { - if (ScriptDirective.Resolve(script) == ScriptEngineKind.Native && - LuaJitWorker.IsAvailable(NativeDirectory)) + bool wantNative = ScriptDirective.ResolveAuto(script) == ScriptEngineKind.Native; + bool nativeReady = wantNative && LuaJitWorker.IsAvailable(NativeDirectory); + if (wantNative && !nativeReady) + WarnNativeUnavailableOnce(); + + if (nativeReady) { pixelsModified = ExecuteNative(script, ctx, bounds, imgW, imgH); } @@ -344,6 +349,13 @@ namespace LuaScript }; } + private void WarnNativeUnavailableOnce() + { + if (_nativeWarned) return; + _nativeWarned = true; + Log.Default.Write($"LuaScript: native runtime not found at '{NativeDirectory}'. Falling back to MoonSharp (slow). Deploy the 'native' folder next to the plugin."); + } + private bool ExecuteNative(string script, AviUtlScriptContext ctx, RawRectF bounds, int imgW, int imgH) { _nativeWorker ??= new LuaJitWorker(NativeDirectory);