add sfc ext support, fix broken cc analog stick

This commit is contained in:
dborth 2008-10-17 06:00:38 +00:00
parent b6273051f8
commit 8ce34860a3
2 changed files with 51 additions and 9 deletions

View File

@ -283,7 +283,9 @@ bool IsValidROM(int method)
if(p != NULL) if(p != NULL)
{ {
if (stricmp(p, ".smc") == 0 || stricmp(p, ".fig") == 0) if (stricmp(p, ".smc") == 0 ||
stricmp(p, ".fig") == 0 ||
stricmp(p, ".sfc") == 0)
{ {
return true; return true;
} }

View File

@ -299,13 +299,33 @@ void decodepad (int pad)
{ {
/*** we don't want division by zero ***/ /*** we don't want division by zero ***/
if (wm_ax > 0 && wm_ay == 0) if (wm_ax > 0 && wm_ay == 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_RIGHT;
else
wp |= WPAD_BUTTON_RIGHT; wp |= WPAD_BUTTON_RIGHT;
}
if (wm_ax < 0 && wm_ay == 0) if (wm_ax < 0 && wm_ay == 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_LEFT;
else
wp |= WPAD_BUTTON_LEFT; wp |= WPAD_BUTTON_LEFT;
}
if (wm_ax == 0 && wm_ay > 0) if (wm_ax == 0 && wm_ay > 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_UP;
else
wp |= WPAD_BUTTON_UP; wp |= WPAD_BUTTON_UP;
}
if (wm_ax == 0 && wm_ay < 0) if (wm_ax == 0 && wm_ay < 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_DOWN;
else
wp |= WPAD_BUTTON_DOWN; wp |= WPAD_BUTTON_DOWN;
}
if (wm_ax != 0 && wm_ay != 0) if (wm_ax != 0 && wm_ay != 0)
{ {
@ -314,22 +334,42 @@ void decodepad (int pad)
if (t >= -2.41421356237 && t < 2.41421356237) if (t >= -2.41421356237 && t < 2.41421356237)
{ {
if (wm_ax >= 0) if (wm_ax >= 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_RIGHT;
else
wp |= WPAD_BUTTON_RIGHT; wp |= WPAD_BUTTON_RIGHT;
}
else
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_LEFT;
else else
wp |= WPAD_BUTTON_LEFT; wp |= WPAD_BUTTON_LEFT;
} }
}
/*** Recalc up / down ***/ /*** Recalc up / down ***/
t = (float) wm_ax / wm_ay; t = (float) wm_ax / wm_ay;
if (t >= -2.41421356237 && t < 2.41421356237) if (t >= -2.41421356237 && t < 2.41421356237)
{ {
if (wm_ay >= 0) if (wm_ay >= 0)
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_UP;
else
wp |= WPAD_BUTTON_UP; wp |= WPAD_BUTTON_UP;
}
else
{
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_DOWN;
else else
wp |= WPAD_BUTTON_DOWN; wp |= WPAD_BUTTON_DOWN;
} }
} }
} }
}
#endif #endif
/*** Fix offset to pad ***/ /*** Fix offset to pad ***/