Ejemplo n.º 1
0
 HRESULT _stdcall GetDeviceState(THIS_ DWORD a,LPVOID b) {
     //This needs to be modified to use b instead of bytes - it would save one copymemory
     BYTE bytes[256];
     HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
     //push escape to skip the intro
     if(SkipIntro) {
         if(SkipIntro2) {
             bytes[0x01]=0x80;
             SkipIntro2=false;
         } else {
             SkipIntro2=true;
         }
     } else if(FinishedFake) {
         FinishedFake=false;
         bytes[0x29]=0x80;
     } else if(UseFakeBuffer==0) {
         //Only want to respond to keypresses if the buffer is empty
         for(BYTE b=0;b<32;b++) {
             if(FakeKeys[b].KeyCode==0) break;
             if(KEYDOWN(bytes,FakeKeys[b].KeyCode)&&!KEYDOWN(LastBytes,FakeKeys[b].KeyCode)) {
                 bytes[0x29]=0x80;
                 bytes[FakeKeys[b].KeyCode]=0x00;
                 FakeString(FakeKeys[b].chars,FakeKeys[b].data,FakeKeys[b].size);
             }
         }
     }
     ::CopyMemory(b,bytes,a);
     ::CopyMemory(LastBytes,bytes,a);
     return hr;
 }
Ejemplo n.º 2
0
 HRESULT _stdcall GetDeviceState(DWORD a,LPVOID b) {
     if(DeviceType==DeviceType_KEYBOARD) {
         //If this is a keyboard
         BYTE bytes[256];
         HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
         if(KEYDOWN(bytes,0x30)) {
             AttackType=3;
         } else if(KEYDOWN(bytes,0x31)) {
             AttackType=2;
         } else if(KEYDOWN(bytes,0x32)) {
             AttackType=1;
         } else {
             AttackType=0;
         }
         if(AttackType) {
             //left 0x1e
             //right 0x20
             //up 0x11
             //down 0x1f
             bytes[0x1e]=bytes[0x20]=bytes[0x11]=bytes[0x1f]=0;
             bytes[0x4f]=bytes[0x50]=bytes[0x51]=0;
             switch(AttackType+(3*HammerMouse2)) {
                 case 1:bytes[0x11]=0x80; break;
                 case 2:bytes[0x1e]=0x80; break;
                 case 3:bytes[0x11]=bytes[0x1e]=0x80; break;
                 case 4:bytes[0x1f]=0x80; break;
                 case 5:bytes[0x20]=0x80; break;
                 case 6:bytes[0x1f]=bytes[0x20]=0x80; break;
             }
         }
         ::CopyMemory(b,bytes,a);
         return hr;
     } else {    //This is the mouse
         if(AttackType) {
             DIMOUSESTATE2 di;
             HRESULT hr=RealDevice->GetDeviceState(sizeof(di),&di);
             di.rgbButtons[0]=0x80*(HammerMouse2=!HammerMouse2);
             *((DIMOUSESTATE2*)b)=di;
             return hr;
         } else {
             return RealDevice->GetDeviceState(a,b);
         }
     }
 }
Ejemplo n.º 3
0
 HRESULT _stdcall GetDeviceState(DWORD a,LPVOID b) {
     //if(DeviceType==DeviceType_KEYBOARD) {
         //If this is a keyboard
         BYTE bytes[256];
         HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
         DWORD d=GetTickCount();
         if(d > Ticks+120000) {
             Ticks=d;
             bytes[0x3f]=0x80;
         }
         ::CopyMemory(b,bytes,a);
         return hr;
     /*} else {    //This is the mouse
         /*if(AttackType) {
             DIMOUSESTATE2 di;
             HRESULT hr=RealDevice->GetDeviceState(sizeof(di),&di);
             di.rgbButtons[0]=0x80*(HammerMouse2=!HammerMouse2);
             *((DIMOUSESTATE2*)b)=di;
             return hr;
         } else {
             return RealDevice->GetDeviceState(a,b);
         }*/
     //}
 }