Exemplo n.º 1
0
        // Keyboard will be used to use Grenade
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    switch (s.scanCode)
                    {
                    case _P1_Grenade_ScanCode:
                    {
                        Apply_OR_ByteMask((int)_TargetProcess_MemoryBaseAddress + _P1_Buttons_Offset, 0x04);
                    } break;

                    default:
                        break;
                    }
                }
                else if ((UInt32)wParam == Win32.WM_KEYUP)
                {
                    switch (s.scanCode)
                    {
                    case _P1_Grenade_ScanCode:
                    {
                        Apply_AND_ByteMask((int)_TargetProcess_MemoryBaseAddress + _P1_Buttons_Offset, 0xFB);
                    } break;

                    default:
                        break;
                    }
                }
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }
Exemplo n.º 2
0
 // Keyboard callback used for pedal-mode
 protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0)
     {
         Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
         if ((UInt32)wParam == Win32.WM_KEYDOWN)
         {
             if (s.scanCode == _P1_Start_Key)
             {
                 Apply_OR_ByteMask(_P1_ButtonsStatus, 0x10);
             }
             else if (s.scanCode == _P2_Start_Key)
             {
                 Apply_OR_ByteMask(_P2_ButtonsStatus, 0x10);
             }
         }
         else if ((UInt32)wParam == Win32.WM_KEYUP)
         {
             if (s.scanCode == _P1_Start_Key)
             {
                 Apply_AND_ByteMask(_P1_ButtonsStatus, 0x00);
             }
             else if (s.scanCode == _P2_Start_Key)
             {
                 Apply_AND_ByteMask(_P2_ButtonsStatus, 0x00);
             }
         }
     }
     return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
 }
Exemplo n.º 3
0
        // Keyboard only used with -parrotloader switch to overwrite all parrot controls
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    switch (s.scanCode)
                    {
                    case _ParrotLoader_P1_Start_ScanCode:
                    {
                        Apply_OR_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P1_Buttons_Offset, 0x80);
                    } break;

                    case _ParrotLoader_P2_Start_ScanCode:
                    {
                        Apply_OR_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P2_Buttons_Offset, 0x80);
                    } break;

                    case _ParrotLoader_Service_ScanCode:
                    {
                        Apply_OR_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P1_Buttons_Offset, 0x40);
                    } break;

                    default:
                        break;
                    }
                }
                else if ((UInt32)wParam == Win32.WM_KEYUP)
                {
                    switch (s.scanCode)
                    {
                    case _ParrotLoader_P1_Start_ScanCode:
                    {
                        Apply_AND_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P1_Buttons_Offset, 0x7F);
                    } break;

                    case _ParrotLoader_P2_Start_ScanCode:
                    {
                        Apply_AND_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P2_Buttons_Offset, 0x7F);
                    } break;

                    case _ParrotLoader_Service_ScanCode:
                    {
                        Apply_AND_ByteMask((int)_TargetProcess.MainModule.BaseAddress + _P1_Buttons_Offset, 0xBF);
                    } break;

                    default:
                        break;
                    }
                }
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }
Exemplo n.º 4
0
        // Keyboard will be used to use Grenade
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    switch (s.scanCode)
                    {
                    case 0x22:     //G
                    {
                        try
                        {
                            byte[] bBuffer     = ReadBytes_x64((Int64)_TargetProcess_MemoryBaseAddress + 0x01285E70, 8);
                            Int64  MouseDeltaX = BitConverter.ToInt64(bBuffer, 0) + 8;
                            WriteLog("MouseDeltaX = 0x" + MouseDeltaX.ToString("X16"));
                            bBuffer = ReadBytes_x64(MouseDeltaX, 4);
                            //WriteLog(bBuffer[0].ToString("X2") + ", " + bBuffer[1].ToString("X2") + ", " + bBuffer[2].ToString("X2") + ", " + bBuffer[3].ToString("X2"));
                            float f = BitConverter.ToSingle(bBuffer, 0);
                            WriteLog("MouseDeltaX value = " + f.ToString());
                            f       = f + 10.0f;
                            bBuffer = BitConverter.GetBytes(f);
                            WriteBytes_x64(MouseDeltaX, bBuffer);
                        } catch (Exception ex)
                        {
                            WriteLog("Convertion error : " + ex.Message.ToString());
                        }
                    }
                    break;

                    default:
                        break;
                    }
                }

                /*else if ((UInt32)wParam == Win32.WM_KEYUP)
                 * {
                 *  switch (s.scanCode)
                 *  {
                 *      case _P1_Grenade_ScanCode:
                 *          {
                 *              Apply_AND_ByteMask((int)_TargetProcess_MemoryBaseAddress + _P1_Buttons_Offset, 0xFB);
                 *          } break;
                 *      default:
                 *          break;
                 *  }
                 * }*/
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }
Exemplo n.º 5
0
 // Keyboard callback used for adding coins
 protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0)
     {
         Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
         if ((UInt32)wParam == Win32.WM_KEYDOWN)
         {
             if (s.scanCode == 0x06 /* [5] Key */)
             {
                 byte Credits = ReadByte((int)_TargetProcess_MemoryBaseAddress + 0x5C8E60);
                 Credits++;
                 WriteByte((int)_TargetProcess_MemoryBaseAddress + 0x5C8E60, Credits);
                 if (_SndPlayer != null)
                 {
                     _SndPlayer.Play();
                 }
             }
         }
     }
     return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
 }
Exemplo n.º 6
0
 // Keyboard callback used for pedal-mode
 protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0)
     {
         Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
         if ((UInt32)wParam == Win32.WM_KEYDOWN)
         {
             if (s.scanCode == _Pedal1_Key && _Pedal1_Enable != 0)
             {
                 _isPedal1_Pushed = true;
                 WriteBytes((int)_Cave_Check1.CaveAddress + 0x21, new byte[] { 0x80, 0x02 }); //640
                 WriteBytes((int)_Cave_Check2.CaveAddress + 0x21, new byte[] { 0x80, 0x02 }); //640
             }
             else if (s.scanCode == _Pedal2_Key && _Pedal2_Enable != 0)
             {
                 _isPedal2_Pushed = true;
                 WriteBytes((int)_Cave_Check1.CaveAddress + 0x54, new byte[] { 0x80, 0x02 }); //640
                 WriteBytes((int)_Cave_Check2.CaveAddress + 0x54, new byte[] { 0x80, 0x02 }); //640
             }
         }
         else if ((UInt32)wParam == Win32.WM_KEYUP)
         {
             if (s.scanCode == _Pedal1_Key && _Pedal1_Enable != 0)
             {
                 _isPedal1_Pushed = false;
                 WriteBytes((int)_Cave_Check1.CaveAddress + 0x21, new byte[] { 0x00, 0x00 }); //0
                 WriteBytes((int)_Cave_Check2.CaveAddress + 0x21, new byte[] { 0x00, 0x00 }); //0
             }
             else if (s.scanCode == _Pedal2_Key && _Pedal2_Enable != 0)
             {
                 _isPedal2_Pushed = false;
                 WriteBytes((int)_Cave_Check1.CaveAddress + 0x54, new byte[] { 0x00, 0x00 }); //0
                 WriteBytes((int)_Cave_Check2.CaveAddress + 0x54, new byte[] { 0x00, 0x00 }); //0
             }
         }
     }
     return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
 }
        // Keyboard will be used to use Grenade and simulate P2 direction for menus
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    switch (s.scanCode)
                    {
                    case _P2_UpArrow_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetDPad_Up(_Player2_X360_Gamepad_Port);
                        }
                    } break;

                    case _P2_DownArrow_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetDPad_Down(_Player2_X360_Gamepad_Port);
                        }
                    } break;

                    case _P1_Grenade_ScanCode:
                    {
                        Apply_OR_ByteMask((int)_TargetProcess_MemoryBaseAddress + _P1_Buttons_Offset, 0x04);
                    } break;

                    case _P2_Grenade_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetButton_L2(_Player2_X360_Gamepad_Port, 0xFF);
                        }
                    } break;

                    default:
                        break;
                    }
                }
                else if ((UInt32)wParam == Win32.WM_KEYUP)
                {
                    switch (s.scanCode)
                    {
                    case _P2_UpArrow_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetDPad_Off(_Player2_X360_Gamepad_Port);
                        }
                    } break;

                    case _P2_DownArrow_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetDPad_Off(_Player2_X360_Gamepad_Port);
                        }
                    } break;

                    case _P1_Grenade_ScanCode:
                    {
                        Apply_AND_ByteMask((int)_TargetProcess_MemoryBaseAddress + _P1_Buttons_Offset, 0xFB);
                    } break;

                    case _P2_Grenade_ScanCode:
                    {
                        if (_EnableP2)
                        {
                            _XOutputManager.SetButton_L2(_Player2_X360_Gamepad_Port, 0x00);
                        }
                    } break;

                    default:
                        break;
                    }
                }
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }
Exemplo n.º 8
0
        // Keyboard callback used for pedal-mode
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    if (s.scanCode == 0x48 /* Up */)
                    {
                        _XOutputManager.SetRAxis_Y(_Player2_X360_Gamepad_Port, 32000);
                    }
                    else if (s.scanCode == 0x50 /* Down */)
                    {
                        _XOutputManager.SetRAxis_Y(_Player2_X360_Gamepad_Port, -32000);
                    }
                    else if (s.scanCode == 0x4B /* Left */)
                    {
                        _XOutputManager.SetRAxis_X(_Player2_X360_Gamepad_Port, -32000);
                    }
                    else if (s.scanCode == 0x4D /* Right */)
                    {
                        byte[] buffer = BitConverter.GetBytes(0.7f);
                        WriteBytes(_P2_X_Address, buffer);

                        _XOutputManager.SetRAxis_X(_Player2_X360_Gamepad_Port, 32000);
                    }

                    else if (s.scanCode == 0x10 /* A */)
                    {
                        _XOutputManager.SetButton_A(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x30 /* B */)
                    {
                        _XOutputManager.SetButton_B(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x2D /* X */)
                    {
                        _XOutputManager.SetButton_X(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x15 /* Y */)
                    {
                        _XOutputManager.SetButton_Y(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x22 /* G */)
                    {
                        _XOutputManager.SetButton_Guide(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x0E /* Backspace */)
                    {
                        _XOutputManager.SetButton_Back(_Player2_X360_Gamepad_Port, true);
                    }
                    else if (s.scanCode == 0x1C /* ENTER */)
                    {
                        _XOutputManager.SetButton_Start(_Player2_X360_Gamepad_Port, true);
                    }
                }
                else if ((UInt32)wParam == Win32.WM_KEYUP)
                {
                    if (s.scanCode == 0x48 /* Up */)
                    {
                        _XOutputManager.SetRAxis_Y(_Player2_X360_Gamepad_Port, 0);
                    }
                    else if (s.scanCode == 0x50 /* Down */)
                    {
                        _XOutputManager.SetRAxis_Y(_Player2_X360_Gamepad_Port, 0);
                    }
                    else if (s.scanCode == 0x4B /* Left */)
                    {
                        _XOutputManager.SetRAxis_X(_Player2_X360_Gamepad_Port, 0);
                    }
                    else if (s.scanCode == 0x4D /* Right */)
                    {
                        _XOutputManager.SetRAxis_X(_Player2_X360_Gamepad_Port, 0);
                    }

                    else if (s.scanCode == 0x10 /* A */)
                    {
                        _XOutputManager.SetButton_A(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x30 /* B */)
                    {
                        _XOutputManager.SetButton_B(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x2D /* X */)
                    {
                        _XOutputManager.SetButton_X(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x15 /* Y */)
                    {
                        _XOutputManager.SetButton_Y(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x22 /* G */)
                    {
                        _XOutputManager.SetButton_Guide(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x0E /* Backspace */)
                    {
                        _XOutputManager.SetButton_Back(_Player2_X360_Gamepad_Port, false);
                    }
                    else if (s.scanCode == 0x1C /* ENTER */)
                    {
                        _XOutputManager.SetButton_Start(_Player2_X360_Gamepad_Port, false);
                    }
                }
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }
Exemplo n.º 9
0
        // Keyboard callback used to bind keyboard keys to start and other buttons
        protected override IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                Win32.KBDLLHOOKSTRUCT s = (Win32.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32.KBDLLHOOKSTRUCT));
                if ((UInt32)wParam == Win32.WM_KEYDOWN)
                {
                    switch (s.scanCode)
                    {
                    case _P1_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P1_Start, 0x01);
                    } break;

                    case _P2_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P2_Start, 0x01);
                    } break;

                    case _P3_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P3_Start, 0x01);
                    } break;

                    case _P4_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P4_Start, 0x01);
                    } break;

                    case _Coin1_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Coin1, 0x01);
                    } break;

                    case _Coin2_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Coin2, 0x01);
                    } break;

                    case _Service_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Service, 0x01);
                    } break;

                    case _Test_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Test, 0x01);
                    } break;

                    default:
                        break;
                    }
                }
                else if ((UInt32)wParam == Win32.WM_KEYUP)
                {
                    switch (s.scanCode)
                    {
                    case _P1_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P1_Start, 0x00);
                    } break;

                    case _P2_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P2_Start, 0x00);
                    } break;

                    case _P3_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P3_Start, 0x00);
                    } break;

                    case _P4_Start_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.P4_Start, 0x00);
                    } break;

                    case _Coin1_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Coin1, 0x00);
                    } break;

                    case _Coin2_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Coin2, 0x00);
                    } break;

                    case _Service_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Service, 0x00);
                    } break;

                    case _Test_ScanCode:
                    {
                        WriteByte((int)_TargetProcess_MemoryBaseAddress + _Buttons_Address + (int)ControlsButton.Test, 0x00);
                    } break;

                    default:
                        break;
                    }
                }
            }
            return(Win32.CallNextHookEx(_KeyboardHookID, nCode, wParam, lParam));
        }