/*========================================================================= * IPT_Hist.c : * Historic * * (c) Ubi Studios 1997 *=======================================================================*/ #include #include "IPT_CPA.h" #include "IPT_Hdl.h" #define D_IPT_Input_StructureDefine #include "IPT_KDef.h" #include "IPT_Str.h" #undef D_IPT_Input_StructureDefine #include "IPT_Def.h" #include "IPT_Anal.h" #include "IPT_Hist.h" /*************************************************************************/ #ifndef _FIRE_DEADCODE_U64_ unsigned long IPT_fn_ulSizeOfHistoric() { return(IPT_g_hInputStructure.sEventHistoricSize); } /*************************************************************************/ unsigned char IPT_fn_bIsEmptyHistoricElement(unsigned long _ulElementNumber) { return((IPT_g_hInputStructure.hEventHistoric[_ulElementNumber].bf6DeviceType==0)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ unsigned char IPT_fn_bIsKeyboardHistoricElement(unsigned long _ulElementNumber) { return(((IPT_g_hInputStructure.hEventHistoric[_ulElementNumber].bf6DeviceType)==IPT_E_KeyboardDeviceEvent)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ unsigned char IPT_fn_bIsPadHistoricElement(unsigned long _ulElementNumber) { return(((IPT_g_hInputStructure.hEventHistoric[_ulElementNumber].bf6DeviceType)>=IPT_E_Pad00DeviceEvent&&(IPT_g_hInputStructure.hEventHistoric[_ulElementNumber].bf6DeviceType)<=IPT_E_Pad15DeviceEvent)?IPT_C_TRUE:IPT_C_FALSE); } #endif /* _FIRE_DEADCODE_U64_ */ /*************************************************************************/ void IPT_fn_vActualizeHistoric() { long i,j; long lPadNumber; long lFound = 0; struct IPT_tdstHistoricElement_ hHistoricElement; #if (!defined(U64)) /**** KeyBoard Test ****/ for (i=0;IPT_g_hScriptKeyValue[i].swKeyValue!=-1;i++) { if (fn_wKbJustDown(IPT_g_hScriptKeyValue[i].swKeyValue)==C_wKbTrue) { lFound = 1; hHistoricElement.bf2State = IPT_E_InProgress; hHistoricElement.bf6DeviceType = IPT_E_KeyboardDeviceEvent; hHistoricElement.swDeviceValue = IPT_g_hScriptKeyValue[i].swKeyValue; hHistoricElement.ucCounter = 0; IPT_g_hInputStructure.p_ucKeyboardCounter[IPT_g_hScriptKeyValue[i].swKeyValue] = 0; } else if (fn_wKbJustUp(IPT_g_hScriptKeyValue[i].swKeyValue)==C_wKbTrue) IPT_g_hInputStructure.p_ucKeyboardCounter[IPT_g_hScriptKeyValue[i].swKeyValue] = 0; IPT_g_hInputStructure.p_ucKeyboardCounter[IPT_g_hScriptKeyValue[i].swKeyValue] = min(UCHAR_MAX,IPT_g_hInputStructure.p_ucKeyboardCounter[IPT_g_hScriptKeyValue[i].swKeyValue]+1); } #endif /* !U64 */ /**** Joystick Test ****/ if (!lFound&&IPT_g_hInputStructure.ucOnePadActivate == IPT_C_ActivateDevice) { for (i=IPT_E_Pad00DeviceEvent;!lFound&&i0;i--) { memcpy(&(IPT_g_hInputStructure.hEventHistoric[i]),&(IPT_g_hInputStructure.hEventHistoric[i-1]),sizeof(struct IPT_tdstHistoricElement_)); } memcpy(&(IPT_g_hInputStructure.hEventHistoric[0]),&hHistoricElement,sizeof(struct IPT_tdstHistoricElement_)); */ memmove (& IPT_g_hInputStructure.hEventHistoric [1] , & IPT_g_hInputStructure.hEventHistoric [0] , (IPT_g_hInputStructure.sEventHistoricSize-1) * sizeof (struct IPT_tdstHistoricElement_)); IPT_g_hInputStructure.hEventHistoric [0] = hHistoricElement; /* END ANNECY AV }*/ } /**** Update the counter ****/ for (i=0;i=IPT_E_Pad00DeviceEvent &&IPT_g_hInputStructure.hEventHistoric[i].bf6DeviceType<=IPT_E_Pad15DeviceEvent &&IPT_g_hInputStructure.hEventHistoric[i].bf2State==IPT_E_InProgress) { lPadNumber = IPT_g_hInputStructure.hEventHistoric[i].bf6DeviceType-IPT_E_Pad00DeviceEvent; if ( ( IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue==IPT_E_PadUp &&INO_fn_wIsJoystickUp((unsigned char)(lPadNumber))==C_wJoyTrue) ||( IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue==IPT_E_PadDown &&INO_fn_wIsJoystickDown((unsigned char)(lPadNumber))==C_wJoyTrue) ||( IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue==IPT_E_PadLeft &&INO_fn_wIsJoystickLeft((unsigned char)(lPadNumber))==C_wJoyTrue) ||( IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue==IPT_E_PadRight &&INO_fn_wIsJoystickRight((unsigned char)(lPadNumber))==C_wJoyTrue) ||( IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue>=IPT_E_PadFirstButton &&IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue<=IPT_E_PadLastButton &&INO_fn_wIsJoystickButtonPressed((unsigned char)(lPadNumber),IPT_g_ulPadAndJoyButtonFlag[IPT_g_hInputStructure.hEventHistoric[i].swDeviceValue-IPT_E_PadFirstButton])==C_wJoyTrue) ) { IPT_g_hInputStructure.hEventHistoric[i].ucCounter=min(UCHAR_MAX,IPT_g_hInputStructure.hEventHistoric[i].ucCounter+1); } else { if (IPT_g_hInputStructure.hEventHistoric[i].bf2State==IPT_E_InProgress) IPT_g_hInputStructure.hEventHistoric[i].bf2State = IPT_E_Stopping; else if (IPT_g_hInputStructure.hEventHistoric[i].bf2State==IPT_E_Stopping) IPT_g_hInputStructure.hEventHistoric[i].bf2State = IPT_E_Stopped; } } else { if (IPT_g_hInputStructure.hEventHistoric[i].bf2State==IPT_E_InProgress) IPT_g_hInputStructure.hEventHistoric[i].bf2State = IPT_E_Stopping; else if (IPT_g_hInputStructure.hEventHistoric[i].bf2State==IPT_E_Stopping) IPT_g_hInputStructure.hEventHistoric[i].bf2State = IPT_E_Stopped; } } }