X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fwin32%2FGenaDrive%2FInput.cpp;fp=platform%2Fwin32%2FGenaDrive%2FInput.cpp;h=0000000000000000000000000000000000000000;hb=91842de3ea98d6fdd6c8f85c542a0eb45a84c242;hp=86fa94f56a872edc9f899e121f90c291c60fc5f8;hpb=823b9004c44f2123da164a80d2644b34e3d1997b;p=picodrive.git diff --git a/platform/win32/GenaDrive/Input.cpp b/platform/win32/GenaDrive/Input.cpp deleted file mode 100644 index 86fa94f..0000000 --- a/platform/win32/GenaDrive/Input.cpp +++ /dev/null @@ -1,193 +0,0 @@ - -#include "app.h" -#include - -struct Input Inp; - -// --------------------- XBox Input ----------------------------- -#ifdef _XBOX -static HANDLE GamePad=NULL; -static XINPUT_STATE Pad; - -static int DeadZone(short *paxis) -{ - int zone=0x2000; - int a=*paxis; - - if (a<-zone) a+=zone; - else if (a> zone) a-=zone; else a=0; - - *paxis=(short)a; - return 0; -} - -static int DeviceRead() -{ - int but=0,a=0; - - memset(Inp.axis, 0,sizeof(Inp.axis)); - memset(Inp.button,0,sizeof(Inp.button)); - - if (GamePad==NULL) GamePad=XInputOpen(XDEVICE_TYPE_GAMEPAD,0,XDEVICE_NO_SLOT,NULL); - if (GamePad==NULL) return 1; - - // Read XBox joypad: - XInputGetState(GamePad,&Pad); - - // Get analog axes: - Inp.axis[0]=Pad.Gamepad.sThumbLX; - Inp.axis[1]=Pad.Gamepad.sThumbLY; - Inp.axis[2]=Pad.Gamepad.sThumbRX; - Inp.axis[3]=Pad.Gamepad.sThumbRY; - - for (a=0;a<4;a++) DeadZone(Inp.axis+a); - - // Get digital buttons: - but=Pad.Gamepad.wButtons; - for (a=0;a<8;a++) - { - if (but&(1<= push) Inp.button[0]|=0xff; // Up - if (Inp.axis[1]<=-push) Inp.button[1]|=0xff; // Down - if (Inp.axis[0]<=-push) Inp.button[2]|=0xff; // Left - if (Inp.axis[0]>= push) Inp.button[3]|=0xff; // Right - - // Update debounce/time held information: - for (i=0;i30) Inp.held[i]=1; // Just pressed - } - else - { - // Is the button still being held down? - Inp.held[i]++; - if (Inp.held[i]>=0x80) Inp.held[i]&=0xbf; // (Keep looping around) - - if (Inp.button[i]<25) Inp.held[i]=0; // No - } - } - - // Work out some key repeat values: - for (i=0;i=0x20 && (held&1)) rep=1; - - Inp.repeat[i]=rep; - } - - return 0; -} - -// Set Lightgun calibration values: -int InputLightCal(int cx,int cy,int ux,int uy) -{ -#ifdef _XBOX - XINPUT_LIGHTGUN_CALIBRATION_OFFSETS cal; - - memset(&cal,0,sizeof(cal)); - - cal.wCenterX =(WORD)cx; - cal.wCenterY =(WORD)cy; - cal.wUpperLeftX=(WORD)ux; - cal.wUpperLeftY=(WORD)uy; - XInputSetLightgunCalibration(GamePad,&cal); - -#endif - - (void)(cx+cy+ux+uy); - - return 0; -}