Esempio n. 1
0
        protected override void FillCrashReport(Exception exception, StringBuilder report)
        {
            base.FillCrashReport(exception, report);

            report.Append("-- AsiSupport state --\n");
            report.Append("Initialized: " + this.initialized + '\n');
            AsiInterface.FillCrashReport(report);

            if (this.Loader != null)
            {
                report.Append("\n-- Loaded plugins --\n");

                if (this.Loader.LoadedPlugins.Count == 0)
                {
                    report.Append("*None*\n");
                }
                else
                {
                    foreach (AsiPlugin plugin in this.Loader.LoadedPlugins)
                    {
                        report.Append(plugin.Name + " (" + plugin.UASIPath + ") - " + plugin.Type + " - loaded at " + plugin.Module.ToString("X") + '\n');
                    }
                }
            }
        }
Esempio n. 2
0
        private void Initialize()
        {
            Game.FadeScreenOut(0);
            GameFiber.Wait(1000);

            Log.Info("Intializing AsiSupport version " + this.Version + "...");
            Log.Info("Using PursuitLib " + typeof(Log).GetVersion());
            Log.Info("Using PursuitLib.RPH " + typeof(RPHPlugin).GetVersion());

            ResourceManager.RegisterProvider("data", new DirectoryResourceProvider(this.DataDirectory));
            this.EnsureResourcesAvailable();
            if (this.IsStopped)
            {
                return;
            }

            ManifestFile gameVersions = new ManifestFile(Path.Combine(this.DataDirectory, "Versions.manifest"));
            string       versionStr   = Game.ProductVersion.ToString();
            bool         isSteamVer   = File.Exists("steam_api64.dll");

            for (int i = 0; i < gameVersions.Entries.Count; i++)
            {
                string entry   = gameVersions.Entries[i];
                bool   isSteam = entry[0] == 's';
                string version = entry.Substring(1);

                if (isSteam == isSteamVer && versionStr == version)
                {
                    this.GameVersion = i;
                    break;
                }
            }

            this.Loader          = new AsiLoader(Path.Combine("", "AsiPlugins"));
            this.TextureManager  = new TextureManager();
            this.KeyboardManager = new KeyboardManager();
            AsiInterface.Initialize();

            Log.Info("AsiSupport initialized.");

            if (this.Config.LoadAllPluginsOnStartup)
            {
                this.Loader.LoadAllPlugins();
            }

            if (this.Config.EnableSHVDNSupport)
            {
                SHVDN.Init();
            }

            Log.Info("All scripts are loaded. Fading screen back in...");

            Game.FadeScreenIn(1000);
            this.initialized = true;
        }
Esempio n. 3
0
        public override void Unload(bool canSleep)
        {
            this.Loader?.UnloadAllPlugins();

            Log.Info("Disposing KeyboardManager...");
            this.KeyboardManager?.ReleaseHandle();

            Log.Info("Disposing AsiInterface...");
            AsiInterface.Dispose();

            base.Unload(canSleep);
            Log.Info("AsiSupport unloaded successfully.");
        }