예제 #1
0
        // ReSharper disable once InconsistentNaming
        // ReSharper disable once RedundantAssignment
        public static bool Prefix(ref Object __result, string path, Il2CppSystem.Type systemTypeInstance)
        {
            MelonDebug.Msg($"Resources::Load({path}, {systemTypeInstance.Name})");

            var exist = GoCache.TryGet(path, out __result);

            return(!exist);
        }
예제 #2
0
파일: Hylas.cs 프로젝트: rfcclub/ModBahuang
        public override void OnSceneWasInitialized(int buildIndex, string sceneName)
        {
            if (buildIndex != 0)
            {
                return;
            }
            var sw = new Stopwatch();

            MelonLogger.Msg("Prefetch start...");
            sw.Start();
            GoCache.Prefetch();
            sw.Stop();
            MelonLogger.Msg($"Prefetch end, total: {sw.Elapsed}");
        }
예제 #3
0
        public static bool Prefix(ref string path, Action <Object> call)
        {
            MelonDebug.Msg($"ResMgr::LoadAsync({path})");

            var exist = GoCache.TryGet(path, out var go);

            if (!exist)
            {
                return(true);
            }

            // It's a workaround for `call` that used in `Wrapper` got freed in Il2cpp domain
            // I have no idea why/how this could work. But, though, anyway, it just WORKS.
            // A reason might be the `native` will keep a gc handle to prevent `call` from freeing.
            Il2CppSystem.Action <Object> native = call;

            native.Invoke(go);

            return(false);
        }