Exemple #1
0
        static void Main(string[] args)
        {
            LockConsole();
            LoadSettings();
#if DEBUG
            args = new string[] { "-t", "-s", "-p", "-f", "-i:FastLoader", "-k:A61E-01A07376003", "-m:AAVE-01A03965611" };
            Settings.DivaPatches.GlutCursor   = GlutCursor.RIGHT_ARROW;
            Settings.DivaPatches.FreePlay     = true;
            Settings.DivaPatches.RamPathFix   = true;
            Settings.DivaPatches.MdataPathFix = true;
            Settings.DivaPatches.CardIcon     = StatusIcon.OK;
            Settings.DivaPatches.NetIcon      = StatusIcon.OK;
            Settings.System.TemporalAA        = false;
            Settings.System.MorphologicalAA   = false;
#endif
            SaveSettings(args);

            Console.Clear();
            PrintProgramInfo();
            components = new List <Component>();

            consoleY = Console.CursorTop;
            if (!Manipulator.IsProcessRunning(DIVA_PROCESS_NAME))
            {
                StartDiva();
            }
            Console.CursorTop = consoleY;
            if (Manipulator.TryAttachToProcess(DIVA_PROCESS_NAME))
            {
                Console.WriteLine("    DIVA HOOK        : OK      ");
            }
            else
            {
                Console.WriteLine("    DIVA HOOK        : NG      "); Thread.Sleep(5000); return;
            }
            Manipulator.SetMainWindowActive();

            components.Add(new Watchdog(Manipulator, Settings));
            if (Settings.Components.TouchEmulator)
            {
                components.Add(new TouchEmulator(Manipulator));
            }
            if (Settings.Components.ScaleComponent)
            {
                components.Add(new ScaleComponent(Manipulator));
            }
            if (Settings.Components.PlayerDataManager)
            {
                components.Add(new PlayerDataManager(Manipulator));
            }

            foreach (var component in components)
            {
                component.Start();
            }

            foreach (var plugin in Settings.DivaPlugins)
            {
                var file = Assembly.GetSaveDataPath(String.Format("{0}.dll", plugin));
                if (File.Exists(file) && Manipulator.InjectDll(file))
                {
                    Console.WriteLine(String.Format("    {0} : OK", GetPluginLabel(plugin)));
                }
                else
                {
                    Console.WriteLine(String.Format("    {0} : NG", GetPluginLabel(plugin)));
                }
            }

            Thread.Sleep(1000);
            SaveSettings();

            consoleY = Console.CursorTop;
            Console.WriteLine("    APPLICATION      : OK");
            Console.WriteLine("------------------------------------------------------------");

            while (!stopFlag && Manipulator.IsProcessRunning())
            {
                Application.DoEvents();
            }

            Console.CursorTop = consoleY;
            Console.WriteLine("    APPLICATION      : EXITED");

            if (!stopFlag)
            {
                Stop();
            }
            Thread.Sleep(5000);
        }