sdlports: fix bizarre occasional touchpad failure
This commit is contained in:
parent
b395a819e1
commit
c3bd9cd6e4
|
@ -3639,6 +3639,9 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case REG_EXTKEYIN: //readonly
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
case REG_POWCNT2:
|
case REG_POWCNT2:
|
||||||
{
|
{
|
||||||
|
@ -4107,12 +4110,20 @@ u16 FASTCALL _MMU_ARM7_read16(u32 adr)
|
||||||
return MMU.AUX_SPI_CNT;
|
return MMU.AUX_SPI_CNT;
|
||||||
|
|
||||||
case REG_KEYINPUT:
|
case REG_KEYINPUT:
|
||||||
case REG_EXTKEYIN:
|
|
||||||
//here is an example of what not to do:
|
//here is an example of what not to do:
|
||||||
//since the arm7 polls this every frame, we shouldnt count this as an input check
|
//since the arm7 polls this (and EXTKEYIN) every frame, we shouldnt count this as an input check
|
||||||
//LagFrameFlag=0;
|
//LagFrameFlag=0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case REG_EXTKEYIN:
|
||||||
|
{
|
||||||
|
//this is gross. we should generate this whole reg instead of poking it in ndssystem
|
||||||
|
u16 ret = MMU.ARM7_REG[0x136];
|
||||||
|
if(nds.isTouch) ret &= ~64;
|
||||||
|
else ret |= 64;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
case REG_POSTFLG:
|
case REG_POSTFLG:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,13 @@
|
||||||
#include "saves.h"
|
#include "saves.h"
|
||||||
#include "SPU.h"
|
#include "SPU.h"
|
||||||
#include "commandline.h"
|
#include "commandline.h"
|
||||||
|
#include "NDSSystem.h"
|
||||||
|
|
||||||
u16 keyboard_cfg[NB_KEYS];
|
u16 keyboard_cfg[NB_KEYS];
|
||||||
u16 joypad_cfg[NB_KEYS];
|
u16 joypad_cfg[NB_KEYS];
|
||||||
u16 nbr_joy;
|
u16 nbr_joy;
|
||||||
mouse_status mouse;
|
mouse_status mouse;
|
||||||
|
|
||||||
extern volatile BOOL execute;
|
|
||||||
|
|
||||||
static SDL_Joystick **open_joysticks = NULL;
|
static SDL_Joystick **open_joysticks = NULL;
|
||||||
|
|
||||||
/* Keypad key names */
|
/* Keypad key names */
|
||||||
|
@ -299,17 +298,22 @@ void set_mouse_coord(signed long x,signed long y)
|
||||||
/* Update NDS keypad */
|
/* Update NDS keypad */
|
||||||
void update_keypad(u16 keys)
|
void update_keypad(u16 keys)
|
||||||
{
|
{
|
||||||
#ifdef WORDS_BIGENDIAN
|
NDS_beginProcessingInput();
|
||||||
MMU.ARM9_REG[0x130] = ~keys & 0xFF;
|
UserButtons& input = NDS_getProcessingUserInput().buttons;
|
||||||
MMU.ARM9_REG[0x131] = (~keys >> 8) & 0x3;
|
input.G = (keys>>12)&1;
|
||||||
MMU.ARM7_REG[0x130] = ~keys & 0xFF;
|
input.E = (keys>>8)&1;
|
||||||
MMU.ARM7_REG[0x131] = (~keys >> 8) & 0x3;
|
input.W = (keys>>9)&1;
|
||||||
#else
|
input.X = (keys>>10)&1;
|
||||||
((u16 *)MMU.ARM9_REG)[0x130>>1] = ~keys & 0x3FF;
|
input.Y = (keys>>11)&1;
|
||||||
((u16 *)MMU.ARM7_REG)[0x130>>1] = ~keys & 0x3FF;
|
input.A = (keys>>0)&1;
|
||||||
#endif
|
input.S = (keys>>3)&1;
|
||||||
/* Update X and Y buttons */
|
input.T = (keys>>2)&1;
|
||||||
MMU.ARM7_REG[0x136] = ( ~( keys >> 10) & 0x3 ) | (MMU.ARM7_REG[0x136] & ~0x3);
|
input.U = (keys>>6)&1;
|
||||||
|
input.D = (keys>>7)&1;
|
||||||
|
input.L = (keys>>5)&1;
|
||||||
|
input.R = (keys>>4)&1;
|
||||||
|
input.F = 0;
|
||||||
|
NDS_endProcessingInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve current NDS keypad */
|
/* Retrieve current NDS keypad */
|
||||||
|
|
Loading…
Reference in New Issue