try to fix a debugger usability issue for kujakiller involving stuck keyboard keys when switching between debugger and main emu window with debugger snaps
This commit is contained in:
parent
689c700b0c
commit
8da54eff69
|
@ -53,63 +53,62 @@ void KeyboardUpdateState(void)
|
||||||
switch(ddrval)
|
switch(ddrval)
|
||||||
{
|
{
|
||||||
case DI_OK: //memcpy(keys,tk,256);break;
|
case DI_OK: //memcpy(keys,tk,256);break;
|
||||||
{
|
break;
|
||||||
extern int soundoptions;
|
|
||||||
|
case DIERR_INPUTLOST:
|
||||||
|
case DIERR_NOTACQUIRED:
|
||||||
|
memset(tk,0,256);
|
||||||
|
IDirectInputDevice7_Acquire(lpdid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//process keys
|
||||||
|
extern int soundoptions;
|
||||||
#define SO_OLDUP 32
|
#define SO_OLDUP 32
|
||||||
|
|
||||||
extern int soundo;
|
extern int soundo;
|
||||||
extern int32 fps_scale;
|
extern int32 fps_scale;
|
||||||
int notAlternateThrottle = !(soundoptions&SO_OLDUP) && soundo && ((NoWaiting&1)?(256*16):fps_scale) >= 64;
|
int notAlternateThrottle = !(soundoptions&SO_OLDUP) && soundo && ((NoWaiting&1)?(256*16):fps_scale) >= 64;
|
||||||
#define KEY_REPEAT_INITIAL_DELAY ((!notAlternateThrottle) ? (16) : (64)) // must be >= 0 and <= 255
|
#define KEY_REPEAT_INITIAL_DELAY ((!notAlternateThrottle) ? (16) : (64)) // must be >= 0 and <= 255
|
||||||
#define KEY_REPEAT_REPEATING_DELAY (6) // must be >= 1 and <= 255
|
#define KEY_REPEAT_REPEATING_DELAY (6) // must be >= 1 and <= 255
|
||||||
#define KEY_JUST_DOWN_DURATION (4) // must be >= 1 and <= 255
|
#define KEY_JUST_DOWN_DURATION (4) // must be >= 1 and <= 255
|
||||||
|
|
||||||
for(int i = 0 ; i < 256 ; i++)
|
for(int i = 0 ; i < 256 ; i++)
|
||||||
if(tk[i])
|
if(tk[i])
|
||||||
if(keys_nr[i] < 255)
|
if(keys_nr[i] < 255)
|
||||||
keys_nr[i]++; // activate key, and count up for repeat
|
keys_nr[i]++; // activate key, and count up for repeat
|
||||||
else
|
else
|
||||||
keys_nr[i] = 255 - KEY_REPEAT_REPEATING_DELAY; // oscillate for repeat
|
keys_nr[i] = 255 - KEY_REPEAT_REPEATING_DELAY; // oscillate for repeat
|
||||||
else
|
else
|
||||||
keys_nr[i] = 0; // deactivate key
|
keys_nr[i] = 0; // deactivate key
|
||||||
|
|
||||||
memcpy(keys,keys_nr,256);
|
memcpy(keys,keys_nr,256);
|
||||||
|
|
||||||
// key-down detection
|
// key-down detection
|
||||||
for(int i = 0 ; i < 256 ; i++)
|
for(int i = 0 ; i < 256 ; i++)
|
||||||
if(!keys_nr[i])
|
if(!keys_nr[i])
|
||||||
{
|
{
|
||||||
keys_jd[i] = 0;
|
keys_jd[i] = 0;
|
||||||
keys_jd_lock[i] = 0;
|
keys_jd_lock[i] = 0;
|
||||||
}
|
|
||||||
else if(keys_jd_lock[i])
|
|
||||||
{}
|
|
||||||
else if(keys_jd[i]
|
|
||||||
/*&& (i != 0x2A && i != 0x36 && i != 0x1D && i != 0x38)*/)
|
|
||||||
{
|
|
||||||
if(++keys_jd[i] > KEY_JUST_DOWN_DURATION)
|
|
||||||
{
|
|
||||||
keys_jd[i] = 0;
|
|
||||||
keys_jd_lock[i] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
keys_jd[i] = 1;
|
|
||||||
|
|
||||||
// key repeat
|
|
||||||
for(int i = 0 ; i < 256 ; i++)
|
|
||||||
if((int)keys[i] >= KEY_REPEAT_INITIAL_DELAY && !(keys[i]%KEY_REPEAT_REPEATING_DELAY))
|
|
||||||
keys[i] = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
else if(keys_jd_lock[i])
|
||||||
|
{}
|
||||||
|
else if(keys_jd[i]
|
||||||
|
/*&& (i != 0x2A && i != 0x36 && i != 0x1D && i != 0x38)*/)
|
||||||
|
{
|
||||||
|
if(++keys_jd[i] > KEY_JUST_DOWN_DURATION)
|
||||||
|
{
|
||||||
|
keys_jd[i] = 0;
|
||||||
|
keys_jd_lock[i] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
keys_jd[i] = 1;
|
||||||
|
|
||||||
|
// key repeat
|
||||||
case DIERR_INPUTLOST:
|
for(int i = 0 ; i < 256 ; i++)
|
||||||
case DIERR_NOTACQUIRED:
|
if((int)keys[i] >= KEY_REPEAT_INITIAL_DELAY && !(keys[i]%KEY_REPEAT_REPEATING_DELAY))
|
||||||
memset(keys,0,256);
|
keys[i] = 0;
|
||||||
IDirectInputDevice7_Acquire(lpdid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern uint8 autoHoldOn, autoHoldReset;
|
extern uint8 autoHoldOn, autoHoldReset;
|
||||||
autoHoldOn = autoHoldKey && keys[autoHoldKey] != 0;
|
autoHoldOn = autoHoldKey && keys[autoHoldKey] != 0;
|
||||||
|
|
Loading…
Reference in New Issue