예제 #1
0
        public Sideloader()
        {
            //ilmerge
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                if (args.Name == "I18N, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" ||
                    args.Name == "I18N.West, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
                {
                    return(Assembly.GetExecutingAssembly());
                }

                return(null);
            };

            //install hooks
            Hooks.InstallHooks();
            AutoResolver.Hooks.InstallHooks();
            ResourceRedirector.ResourceRedirector.AssetResolvers.Add(RedirectHook);

            //check mods directory
            string modDirectory = Path.Combine(Utility.ExecutingDirectory, "mods");

            if (!Directory.Exists(modDirectory))
            {
                return;
            }


            //load zips
            foreach (string archivePath in Directory.GetFiles(modDirectory, "*.zip"))
            {
                var archive = new ZipFile(archivePath);

                if (!Manifest.TryLoadFromZip(archive, out Manifest manifest))
                {
                    BepInLogger.Log($"[SIDELOADER] Cannot load {Path.GetFileName(archivePath)} due to missing/invalid manifest.");
                    continue;
                }

                string name = manifest.Name ?? Path.GetFileName(archivePath);
                BepInLogger.Log($"[SIDELOADER] Loaded {name} {manifest.Version ?? ""}");

                Archives.Add(archive);

                LoadAllUnityArchives(archive);

                LoadAllLists(archive, manifest);
            }
        }
예제 #2
0
        internal void Awake()
        {
#if KK
            ZipConstants.DefaultCodePage = 0;
#endif
            Logger = base.Logger;

            Hooks.InstallHooks();
            UniversalAutoResolver.Hooks.InstallHooks();
            Lists.Hooks.InstallHooks();

            ResourceRedirection.EnableSyncOverAsyncAssetLoads();
            ResourceRedirection.EnableRedirectMissingAssetBundlesToEmptyAssetBundle(-1000);
            ResourceRedirection.EnableRandomizeCabIfConflict(-2000, false);
            ResourceRedirection.RegisterAsyncAndSyncAssetLoadingHook(RedirectHook);
            ResourceRedirection.RegisterAsyncAndSyncAssetBundleLoadingHook(AssetBundleLoadingHook);

            MissingModWarning = Config.Bind("Logging", "Show missing mod warnings", true,
                                            "Whether missing mod warnings will be displayed on screen. Messages will still be written to the log.");
            DebugLogging = Config.Bind("Logging", "Debug logging", false,
                                       "Enable additional logging useful for debugging issues with Sideloader and sideloader mods.\nWarning: Will increase load and save times noticeably and will result in very large log sizes.");
            DebugLoggingResolveInfo = Config.Bind("Logging", "Debug resolve info logging", false,
                                                  "Enable verbose logging for debugging issues with Sideloader and sideloader mods.\nWarning: Will increase game start up time and will result in very large log sizes.");
            DebugLoggingModLoading = Config.Bind("Logging", "Debug mod loading logging", false,
                                                 "Enable verbose logging when loading mods.");

            KeepMissingAccessories = Config.Bind("General", "Keep missing accessories", false,
                                                 "Missing accessories will be replaced by a default item with color and position information intact when loaded in the character maker.");
            MigrationEnabled = Config.Bind("General", "Migration enabled", true,
                                           "Attempt to change the GUID and/or ID of mods based on the data configured in the manifest.xml. Helps keep backwards compatibility when updating mods.");
            AdditionalModsDirectory = Config.Bind("General", "Additional mods directory", FindKoiZipmodDir(),
                                                  "Additional directory to load zipmods from.");

            if (!Directory.Exists(ModsDirectory))
            {
                Logger.LogWarning("Could not find the mods directory: " + ModsDirectory);
            }

            if (!AdditionalModsDirectory.Value.IsNullOrWhiteSpace() && !Directory.Exists(AdditionalModsDirectory.Value))
            {
                Logger.LogWarning("Could not find the additional mods directory specified in config: " + AdditionalModsDirectory.Value);
            }

            LoadModsFromDirectories(ModsDirectory, AdditionalModsDirectory.Value);
        }
예제 #3
0
        public Sideloader()
        {
            Logger = base.Logger;

            Hooks.InstallHooks();
            AutoResolver.Hooks.InstallHooks();
            ResourceRedirector.ResourceRedirector.AssetResolvers.Add(RedirectHook);
            ResourceRedirector.ResourceRedirector.AssetBundleResolvers.Add(AssetBundleRedirectHook);

            MissingModWarning       = Config.Wrap("Settings", "Show missing mod warnings", "Whether missing mod warnings will be displayed on screen. Messages will still be written to the log.", true);
            DebugLogging            = Config.Wrap("Settings", "Debug logging", "Enable additional logging useful for debugging issues with Sideloader and sideloader mods.\nWarning: Will increase load and save times noticeably and will result in very large log sizes.", false);
            DebugResolveInfoLogging = Config.Wrap("Settings", "Debug resolve info logging", "Enable verbose logging for debugging issues with Sideloader and sideloader mods.\nWarning: Will increase game start up time and will result in very large log sizes.", false);
            KeepMissingAccessories  = Config.Wrap("Settings", "Keep missing accessories", "Missing accessories will be replaced by a default item with color and position information intact when loaded in the character maker.", false);

            if (Directory.Exists(ModsDirectory))
            {
                LoadModsFromDirectory();
            }
            else
            {
                Logger.Log(LogLevel.Warning, "[SIDELOADER] Could not find the \"mods\" directory");
            }
        }
예제 #4
0
        public Sideloader()
        {
            //ilmerge
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                if (args.Name == "I18N, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" ||
                    args.Name == "I18N.West, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
                {
                    return(Assembly.GetExecutingAssembly());
                }

                return(null);
            };

            //install hooks
            Hooks.InstallHooks();
            AutoResolver.Hooks.InstallHooks();
            ResourceRedirector.ResourceRedirector.AssetResolvers.Add(RedirectHook);
            ResourceRedirector.ResourceRedirector.AssetBundleResolvers.Add(AssetBundleRedirectHook);

            MissingModWarning       = new ConfigWrapper <bool>("MissingModWarning", this, true);
            DebugLogging            = new ConfigWrapper <bool>("DebugLogging", this, false);
            DebugResolveInfoLogging = new ConfigWrapper <bool>("DebugResolveInfoLogging", this, false);
            KeepMissingAccessories  = new ConfigWrapper <bool>("KeepMissingAccessories", this, false);

            //check mods directory
            var modDirectory = Path.Combine(Paths.GameRootPath, "mods");

            if (!Directory.Exists(modDirectory))
            {
                Logger.Log(LogLevel.Warning, "[SIDELOADER] Could not find the \"mods\" directory");
                return;
            }

            LoadModsFromDirectory(modDirectory);
        }