fixed inputs initialization & controller options, additional SSG-EG fixes (experimental)

This commit is contained in:
ekeeke31 2008-08-13 12:47:56 +00:00
parent bd90f522e1
commit f674126a66
4 changed files with 94 additions and 25 deletions

View File

@ -226,6 +226,10 @@ void cart_hw_init()
} }
else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL) else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL)
{ {
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER; input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x84; input.x_offset = 0x84;
@ -233,6 +237,10 @@ void cart_hw_init()
} }
else if (strstr(rominfo.international,"BODY COUNT") != NULL) else if (strstr(rominfo.international,"BODY COUNT") != NULL)
{ {
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_MOUSE; input.system[0] = SYSTEM_MOUSE;
input.system[1] = SYSTEM_MENACER; input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x44; input.x_offset = 0x44;
@ -244,6 +252,10 @@ void cart_hw_init()
***********************************************/ ***********************************************/
if (strstr(rominfo.international,"LETHAL ENFORCERS II") != NULL) if (strstr(rominfo.international,"LETHAL ENFORCERS II") != NULL)
{ {
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER; input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x18; input.x_offset = 0x18;
@ -251,6 +263,10 @@ void cart_hw_init()
} }
else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL)
{ {
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER; input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x00; input.x_offset = 0x00;

View File

@ -459,9 +459,9 @@ void ConfigureJoypads ()
sprintf (padmenu[1], "Port 2: GAMEPAD"); sprintf (padmenu[1], "Port 2: GAMEPAD");
max_players ++; max_players ++;
} }
else if (input.system[0] == SYSTEM_MOUSE) else if (input.system[1] == SYSTEM_MOUSE)
{ {
sprintf (padmenu[0], "Port 1: MOUSE"); sprintf (padmenu[1], "Port 2: MOUSE");
max_players ++; max_players ++;
} }
else if (input.system[1] == SYSTEM_WAYPLAY) else if (input.system[1] == SYSTEM_WAYPLAY)
@ -535,10 +535,11 @@ void ConfigureJoypads ()
break; break;
} }
input.system[0] ++; input.system[0] ++;
if (input.system[0] == SYSTEM_MENACER) input.system[0] = SYSTEM_TEAMPLAYER; if (input.system[0] == SYSTEM_MENACER) input.system[0] ++;
else if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++; if (input.system[0] == SYSTEM_JUSTIFIER) input.system[0] ++;
else if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY; if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[0] ++;
else if (input.system[0] > SYSTEM_WAYPLAY) if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
if (input.system[0] > SYSTEM_WAYPLAY)
{ {
input.system[0] = NO_SYSTEM; input.system[0] = NO_SYSTEM;
input.system[1] = SYSTEM_GAMEPAD; input.system[1] = SYSTEM_GAMEPAD;
@ -552,9 +553,9 @@ void ConfigureJoypads ()
break; break;
} }
input.system[1] ++; input.system[1] ++;
if ((input.system[1] == SYSTEM_MOUSE) && (input.system[0] == SYSTEM_MOUSE)) input.system[0] ++; if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++;
else if (input.system[1] == SYSTEM_WAYPLAY) input.system[0] = SYSTEM_WAYPLAY; if (input.system[1] == SYSTEM_WAYPLAY) input.system[0] = SYSTEM_WAYPLAY;
else if (input.system[1] > SYSTEM_WAYPLAY) if (input.system[1] > SYSTEM_WAYPLAY)
{ {
input.system[1] = NO_SYSTEM; input.system[1] = NO_SYSTEM;
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;

View File

@ -166,7 +166,7 @@ static void pad_update(s8 num, u8 i)
s8 x = PAD_StickX (num); s8 x = PAD_StickX (num);
s8 y = PAD_StickY (num); s8 y = PAD_StickY (num);
u16 p = PAD_ButtonsHeld(num); u16 p = PAD_ButtonsHeld(num);
u8 sensitivity = 60; u8 sensitivity = 30;
/* get current key config */ /* get current key config */
u16 pad_keymap[MAX_KEYS]; u16 pad_keymap[MAX_KEYS];
@ -221,8 +221,8 @@ static void pad_update(s8 num, u8 i)
/* MOUSE quantity of movement (-256,256) */ /* MOUSE quantity of movement (-256,256) */
else if (input.dev[i] == DEVICE_MOUSE) else if (input.dev[i] == DEVICE_MOUSE)
{ {
input.analog[2][0] = x * 2; input.analog[2][0] = (x / sensitivity) * 2;
input.analog[2][1] = y * 2; input.analog[2][1] = (x / sensitivity) * 2;
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1]; if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
} }
@ -393,13 +393,16 @@ static void wpad_config(u8 num, u8 exp, u8 padtype)
} }
} }
float old_x = 0.0;
float old_y = 0.0;
static void wpad_update(s8 num, u8 i, u32 exp) static void wpad_update(s8 num, u8 i, u32 exp)
{ {
/* get buttons status */ /* get buttons status */
u32 p = WPAD_ButtonsHeld(num); u32 p = WPAD_ButtonsHeld(num);
/* get analog sticks values */ /* get analog sticks values */
u8 sensitivity = 60; u8 sensitivity = 30;
s8 x = 0; s8 x = 0;
s8 y = 0; s8 y = 0;
if (exp != WPAD_EXP_NONE) if (exp != WPAD_EXP_NONE)
@ -483,9 +486,52 @@ static void wpad_update(s8 num, u8 i, u32 exp)
else if (input.dev[i] == DEVICE_MOUSE) else if (input.dev[i] == DEVICE_MOUSE)
{ {
/* analog stick */ /* analog stick */
input.analog[2][0] = x * 2; input.analog[2][0] = x * 2 / sensitivity;
input.analog[2][1] = y * 2; input.analog[2][1] = y * 2 / sensitivity;
if (exp != WPAD_EXP_CLASSIC)
{
/* wiimote IR */
struct ir_t ir;
WPAD_IR(num, &ir);
//if (ir.valid)
{
input.analog[2][0] = ir.x - old_x;
if (input.analog[2][0] > 256)
{
input.analog[2][0] = 256;
old_x += 256;
}
else if (input.analog[2][0] < -256)
{
input.analog[2][0] = -256;
old_x -= 256;
}
else
{
old_x = ir.x;
}
input.analog[2][1] = ir.y - old_y;
if (input.analog[2][1] > 256)
{
input.analog[2][1] = 256;
old_y += 256;
}
else if (input.analog[2][1] < -256)
{
input.analog[2][1] = -256;
old_y -= 256;
}
else
{
old_y = ir.y;
}
}
}
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1]; if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
} }
/* GAMEPAD directional buttons */ /* GAMEPAD directional buttons */

View File

@ -658,11 +658,12 @@ INLINE void FM_KEYON(FM_CH *CH , int s )
{ {
SLOT->key = 1; SLOT->key = 1;
SLOT->phase = 0; /* restart Phase Generator */ SLOT->phase = 0; /* restart Phase Generator */
SLOT->ssgn = (SLOT->ssg & 0x04) >> 1;
if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/)
{ {
SLOT->state = EG_ATT; /* phase -> Attack */ SLOT->state = EG_ATT; /* phase -> Attack */
SLOT->volume = MAX_ATT_INDEX; /* fix Ecco 2 splash sound */ SLOT->volume = 511; /* fix Ecco 2 splash sound */
} }
else else
{ {
@ -682,7 +683,7 @@ INLINE void FM_KEYOFF(FM_CH *CH , int s )
if (SLOT->state>EG_REL) if (SLOT->state>EG_REL)
{ {
SLOT->state = EG_REL; /* phase -> Release */ SLOT->state = EG_REL; /* phase -> Release */
SLOT->ssgn = 0; /* reset Invert Flag (from Nemesis) */ //SLOT->ssgn = 0; /* reset Invert Flag (from Nemesis) */
} }
} }
} }
@ -1024,9 +1025,13 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT)
if ( !(ym2612.OPN.eg_cnt & ((1<<SLOT->eg_sh_rr)-1) ) ) if ( !(ym2612.OPN.eg_cnt & ((1<<SLOT->eg_sh_rr)-1) ) )
{ {
if (SLOT->ssg&0x08) if (SLOT->ssg&0x08)
{
SLOT->volume += 6 * eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)]; /* from Nemesis */ SLOT->volume += 6 * eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)]; /* from Nemesis */
}
else else
{
SLOT->volume += eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)]; SLOT->volume += eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)];
}
if ( SLOT->volume >= MAX_ATT_INDEX ) if ( SLOT->volume >= MAX_ATT_INDEX )
{ {
@ -1040,7 +1045,8 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT)
out = SLOT->tl + ((UINT32)SLOT->volume); out = SLOT->tl + ((UINT32)SLOT->volume);
if ((SLOT->ssg&0x08) && (SLOT->ssgn&2) && (SLOT->state != EG_OFF/*Alone Coder*/)) /* negate output (changes come from alternate bit, init comes from attack bit) */ /* negate output (changes come from alternate bit, init comes from attack bit) */
if ((SLOT->ssg&0x08) && (SLOT->ssgn&2) && ((SLOT->state == EG_DEC) || (SLOT->state == EG_SUS)))
out ^= 511 /* Alone Coder*/; //((1<<ENV_BITS)-1); /* 1023 */ out ^= 511 /* Alone Coder*/; //((1<<ENV_BITS)-1); /* 1023 */
/* we need to store the result here because we are going to change ssgn /* we need to store the result here because we are going to change ssgn