xbox updates

This commit is contained in:
Chris Danford
2003-11-13 00:39:36 +00:00
parent 5b076e16fa
commit 47def7d3dc
40 changed files with 1358 additions and 19 deletions
@@ -12,6 +12,8 @@
#include "InputHandler_SDL.h"
#include "SDL_utils.h"
#include "RageLog.h"
#include "RageDisplay.h"
#include "PrefsManager.h"
static const Sint8 Handled_SDL_Events[] = {
SDL_KEYDOWN, SDL_KEYUP, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP,
@@ -23,6 +25,11 @@ InputHandler_SDL::InputHandler_SDL()
{
SDL_InitSubSystem( SDL_INIT_JOYSTICK );
#ifdef _XBOX
//strange hardware timing issue with 3rd party controllers
Sleep(750) ;
#endif
SDL_EnableKeyRepeat( 0, 0 );
/* We can do this to get Unicode values in the key struct, which (with
@@ -80,6 +87,16 @@ InputHandler_SDL::~InputHandler_SDL()
void InputHandler_SDL::Update(float fDeltaTime)
{
#ifdef _XBOX
static int lastValX1 = 0 ;
static int lastValY1 = 0 ;
static int lastValX2 = 0 ;
static int lastValY2 = 0 ;
static int resolutionChanged = 0 ;
#endif
SDL_Event event;
while(SDL_GetEvent(event, SDL_EventMask))
{
@@ -115,11 +132,67 @@ void InputHandler_SDL::Update(float fDeltaTime)
case SDL_JOYAXISMOTION:
{
#ifdef _XBOX
resolutionChanged = 1 ;
if ( abs(event.jaxis.value) > 15600 )
{
switch ( event.jaxis.axis )
{
case 0 :
{
lastValX1 = event.jaxis.value ;
break;
}
case 1 :
{
lastValY1 = event.jaxis.value ;
break;
}
case 2 :
{
lastValX2 = event.jaxis.value ;
break;
}
case 3 :
{
lastValY2 = event.jaxis.value ;
break;
}
}
}
else
{
switch ( event.jaxis.axis )
{
case 0 :
{
lastValX1 = 0;
break;
}
case 1 :
{
lastValY1 = 0 ;
break;
}
case 2 :
{
lastValX2 = 0;
break;
}
case 3 :
{
lastValY2 = 0;
break;
}
}
}
#else
InputDevice i = InputDevice(DEVICE_JOY1 + event.jaxis.which);
JoystickButton neg = (JoystickButton)(JOY_LEFT+2*event.jaxis.axis);
JoystickButton pos = (JoystickButton)(JOY_RIGHT+2*event.jaxis.axis);
ButtonPressed(DeviceInput(i, neg), event.jaxis.value < -16000);
ButtonPressed(DeviceInput(i, pos), event.jaxis.value > +16000);
#endif
continue;
}
@@ -135,6 +208,32 @@ void InputHandler_SDL::Update(float fDeltaTime)
}
}
#ifdef _XBOX
if ( resolutionChanged )
{
if ( lastValX1 || lastValY1 || lastValX2 || lastValY2 )
{
PREFSMAN->m_fScreenPosX += ((float)lastValX1/32767.0f) ;
if ( PREFSMAN->m_fScreenPosX < 0)
PREFSMAN->m_fScreenPosX = 0 ;
PREFSMAN->m_fScreenPosY -= ((float)lastValY1/32767.0f) ;
if ( PREFSMAN->m_fScreenPosY < 0)
PREFSMAN->m_fScreenPosY = 0 ;
PREFSMAN->m_fScreenWidth += ((float)lastValX2/32767.0f) ;
PREFSMAN->m_fScreenHeight -= ((float)lastValY2/32767.0f) ;
DISPLAY->ResolutionChanged() ;
}
else
{
resolutionChanged = 0 ;
}
}
#endif
InputHandler::UpdateTimer();
}