public void Run(RemoteHooking.IContext context, string channelName)
        {
            server.IsInstalled(RemoteHooking.GetCurrentProcessId());

            List <LocalHook> hooks = new List <LocalHook>()
            {
                LocalHook.Create(
                    new IntPtr(ENGINE_UPDATE_HOOK_TARGET_ADDRESS),
                    new VoidDelegate(PollInputOverride),
                    this),
            };

            foreach (var hook in hooks)
            {
                hook.ThreadACL.SetExclusiveACL(new int[] { 0 });
            }

            InputEmulator.KeyConfig.TryLoadConfig();
            server.ReportString($"DivaHook successfully established\n");
            server.ReportString($"Do not close this application...");

            RemoteHooking.WakeUpProcess();

            try
            {
                while (true)
                {
                    System.Threading.Thread.Sleep(500);

                    string[] queued = null;

                    lock (messageQueue)
                    {
                        queued = messageQueue.ToArray();
                        messageQueue.Clear();
                    }

                    if (queued != null && queued.Length > 0)
                    {
                        server.ReportMessages(queued);
                    }
                    else
                    {
                        server.Ping();
                    }
                }
            }
            catch (Exception ex)
            {
                server.ReportException(ex);
            }

            foreach (var hook in hooks)
            {
                hook.Dispose();
            }

            LocalHook.Release();
        }
Пример #2
0
        public void Run(RemoteHooking.IContext context, string channelName)
        {
            server.IsInstalled(RemoteHooking.GetCurrentProcessId());

            List <LocalHook> hooks = new List <LocalHook>()
            {
                LocalHook.Create(
                    new IntPtr(POLL_INPUT_FUNC_ADDRESS),
                    new VoidDelegate(PollInputOverride),
                    this),

                LocalHook.Create(
                    new IntPtr(TOUCH_REACTION_PLAY_TOUCH_EFF_ADDRESS),
                    new PlayAetTouchEffDelegate(PlayAetTouchEffOverride),
                    this),

                //LocalHook.Create(
                //    new IntPtr(LOG_FUNC_ADDRESS),
                //    new LogDelegate(LogOverride),
                //    this),

                //LocalHook.Create(
                //    new IntPtr(LOG_GAME_STATE_ADDRESS),
                //    new LogGameStateDelegate(LogGameStateOverride),
                //    this),
            };

            foreach (var hook in hooks)
            {
                hook.ThreadACL.SetExclusiveACL(new int[] { 0 });
            }

            InputEmulator.KeyConfig.TryLoadConfig();
            InputEmulator.PlayerConfig.TryLoadConfig();
            server.ReportString($"DivaHook successfully established\n");
            server.ReportString($"Do not close this application...");

            RemoteHooking.WakeUpProcess();

            try
            {
                while (true)
                {
                    System.Threading.Thread.Sleep(500);

                    string[] queued = null;

                    lock (messageQueue)
                    {
                        queued = messageQueue.ToArray();
                        messageQueue.Clear();
                    }

                    if (queued != null && queued.Length > 0)
                    {
                        server.ReportMessages(queued);
                    }
                    else
                    {
                        server.Ping();
                    }
                }
            }
            catch (Exception ex)
            {
                server.ReportException(ex);
            }

            foreach (var hook in hooks)
            {
                hook.Dispose();
            }

            LocalHook.Release();
        }