예제 #1
0
        public async UniTask <IMessageReceiver <string> > GenerateMessageReceiverAsync(string url, string proxy, CancellationToken cancellationToken)
        {
            await UniTask.Delay(TimeSpan.FromSeconds(2f), cancellationToken : cancellationToken);

            var receiver = new DummyReceiver();

            receiver.Start().Forget();
            _messageReceiver = receiver;

            _getSocketCompletionSource.TrySetResult();
            _waitConnectionCompletionSource.TrySetResult(true);

            return(receiver);
        }
예제 #2
0
    public void AddDummyBot()
    {
        // Debug.Log("Spoofing prereqs...");

        ProtoBufPresentation pp            = new ProtoBufPresentation();
        DummyReceiver        dummyReceiver = new DummyReceiver();

        pp.SetReceiver(dummyReceiver);

        DummyDataLink datalink = new DummyDataLink(pp);

        Communicator com = new Communicator(datalink, pp);

        //create message, set response

        MessageTarget_ target = MessageTarget_.Robot;
        MessageType_   type   = MessageType_.CustomMessage;

        Message DummyMessage = MessageBuilder.CreateMessage(target, type);

        DummyMessage.SetIdentificationResponse("dummyBot");

        /*
         *    First wait for the other identification messages to be processed to prevent race conditions
         */
        if (_ev.WaitOne(10000))
        {
            _ev.Reset();

            _connection           = com;
            _newMessage           = DummyMessage;
            _continueRegistration = true;

            _ev.WaitOne(1000);
        }
    }
예제 #3
0
 /// <summary>
 /// Injects the FOB into DoW2.
 /// </summary>
 /// <param name="o"></param>
 private static void Inject(object o)
 {
     LogMessage("Searching for DoW2 process...");
     Process[] ps = Process.GetProcessesByName("DoW2");
     for (int i = 0; i < 10; i++)
     {
         Thread.Sleep(1000);
         ps = Process.GetProcessesByName("DoW2");
         if (ps.Length > 0)
             break;
     }
     if (ps.Length <= 0)
     {
         LogMessage("TIME OUT! Could not find DoW2 process 10 seconds after launch. Please try again.");
         return;
     }
     LogMessage("Process found!");
     Process dow2 = ps[0];
     // Retribution does not use GFWL anymore, no need to patch the memory
     if (!ToolSettings.IsInRetributionMode)
     {
         
         LogMessage("Preparing process...");
         try
         {
             dow2.ReplaceSequence(s_memoryCheckSignature, s_memoryCheckPatch, "xlive.dll", 1);
         }
         catch (Exception e)
         {
             LoggingManager.SendMessage("DebugManager - Patching failed!");
             LoggingManager.HandleException(e);
              UIHelper.ShowError("Error launching DoW2, please try again.");
             return;
         }
     }
     
     LogMessage("Injecting Cope's Forward Operations Base");
     try
     {
         s_callbackReceiver = new DummyReceiver();
         s_client = dow2.InjectForwardOperationalBase(s_callbackReceiver);
     }
     catch (Exception e)
     {
         LoggingManager.SendMessage("DebugManager - Injecting FOB failed!");
         LoggingManager.HandleException(e);
         UIHelper.ShowError("Failed to start debugging system, please try again");
         return;
     }
     string currentDir = Directory.GetCurrentDirectory() + '\\';
     LogMessage("Injecting ModDebug.dll and initializing DebugManager...");
     try
     {
         //dow2.InjectDll("M:\\Steam\\steamapps\\common\\dawn of war 2\\CopeLua.dll");
         //dow2.InjectDll(currentDir + "LuaLibLoad.dll");
         s_client.LoadAssemblyAndStartMethod(currentDir + "ModDebug.dll", "ModDebug.DebugManager", "Init", true);
     }
     catch (Exception e)
     {
         LoggingManager.SendMessage("DebugManager - Initializtaion of remote DebugManager failed!");
         LoggingManager.HandleException(e);
         UIHelper.ShowError("Initialization of the remote DebugManager failed!");
         return;
     }
     LogMessage("Setup done!");
     dow2.Exited += OnGameExited;
 }
예제 #4
0
        public IEnumerator TestRaw()
        {
            var inputManager = InputManager.Create(new Vector2(1280f, 720f));

            var dependency = new DependencyContainer();

            dependency.CacheAs <IDependencyContainer>(dependency);
            //dependency.CacheAs<IInputManager>(InputManager.Create(new Vector2(1280f, 720f)));

            var qReceiver = new DummyReceiver()
            {
                Key        = inputManager.AddKey(KeyCode.Q),
                InputLayer = 2,
                ShouldPass = true,
            };
            var wReceiver = new DummyReceiver()
            {
                Key        = inputManager.AddKey(KeyCode.W),
                InputLayer = 1,
                ShouldPass = false,
            };

            while (true)
            {
                if (Input.GetKeyDown(KeyCode.A))
                {
                    if (qReceiver.Added)
                    {
                        inputManager.RemoveReceiver(qReceiver);
                    }
                    else
                    {
                        inputManager.AddReceiver(qReceiver);
                    }

                    qReceiver.Added = !qReceiver.Added;
                }
                else if (Input.GetKeyDown(KeyCode.S))
                {
                    if (wReceiver.Added)
                    {
                        inputManager.RemoveReceiver(wReceiver);
                    }
                    else
                    {
                        inputManager.AddReceiver(wReceiver);
                    }

                    wReceiver.Added = !wReceiver.Added;
                }
                else if (Input.GetKeyDown(KeyCode.D))
                {
                    qReceiver.ShouldPass = !qReceiver.ShouldPass;
                    Debug.Log("Passing from Q : " + qReceiver.ShouldPass);
                }
                else if (Input.GetKeyDown(KeyCode.F))
                {
                    wReceiver.ShouldPass = !wReceiver.ShouldPass;
                    Debug.Log("Passing from W : " + wReceiver.ShouldPass);
                }


                if (Input.GetKeyDown(KeyCode.Return))
                {
                    break;
                }
                else if (Input.GetKeyDown(KeyCode.Escape))
                {
                    Assert.Fail();
                }

                yield return(null);
            }
        }
예제 #5
0
        /// <summary>
        /// Injects the FOB into DoW2.
        /// </summary>
        /// <param name="o"></param>
        private static void Inject(object o)
        {
            LogMessage("Searching for DoW2 process...");
            Process[] ps = Process.GetProcessesByName("DoW2");
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(1000);
                ps = Process.GetProcessesByName("DoW2");
                if (ps.Length > 0)
                {
                    break;
                }
            }
            if (ps.Length <= 0)
            {
                LogMessage("TIME OUT! Could not find DoW2 process 10 seconds after launch. Please try again.");
                return;
            }
            LogMessage("Process found!");
            Process dow2 = ps[0];

            // Retribution does not use GFWL anymore, no need to patch the memory
            if (!ToolSettings.IsInRetributionMode)
            {
                LogMessage("Preparing process...");
                try
                {
                    dow2.ReplaceSequence(s_memoryCheckSignature, s_memoryCheckPatch, "xlive.dll", 1);
                }
                catch (Exception e)
                {
                    LoggingManager.SendMessage("DebugManager - Patching failed!");
                    LoggingManager.HandleException(e);
                    UIHelper.ShowError("Error launching DoW2, please try again.");
                    return;
                }
            }

            LogMessage("Injecting Cope's Forward Operations Base");
            try
            {
                s_callbackReceiver = new DummyReceiver();
                s_client           = dow2.InjectForwardOperationalBase(s_callbackReceiver);
            }
            catch (Exception e)
            {
                LoggingManager.SendMessage("DebugManager - Injecting FOB failed!");
                LoggingManager.HandleException(e);
                UIHelper.ShowError("Failed to start debugging system, please try again");
                return;
            }
            string currentDir = Directory.GetCurrentDirectory() + '\\';

            LogMessage("Injecting ModDebug.dll and initializing DebugManager...");
            try
            {
                //dow2.InjectDll("M:\\Steam\\steamapps\\common\\dawn of war 2\\CopeLua.dll");
                //dow2.InjectDll(currentDir + "LuaLibLoad.dll");
                s_client.LoadAssemblyAndStartMethod(currentDir + "ModDebug.dll", "ModDebug.DebugManager", "Init", true);
            }
            catch (Exception e)
            {
                LoggingManager.SendMessage("DebugManager - Initializtaion of remote DebugManager failed!");
                LoggingManager.HandleException(e);
                UIHelper.ShowError("Initialization of the remote DebugManager failed!");
                return;
            }
            LogMessage("Setup done!");
            dow2.Exited += OnGameExited;
        }