winport: add options for killing stylus off-screen

This commit is contained in:
zeromus 2016-03-29 22:52:44 +00:00
parent f22f05959d
commit bf911bf571
4 changed files with 56 additions and 7 deletions

View File

@ -259,6 +259,8 @@ SPiano DefaultPiano = { false, 'Z', 'S', 'X', 'D', 'C', 'V', 'G', 'B', 'H', 'N',
SPaddle Paddle;
SPaddle DefaultPaddle = { false, 'K', 'L' };
bool killStylusTopScreen = false;
bool killStylusOffScreen = false;
bool allowUpAndDown = false;
bool allowBackgroundInput = false;
@ -469,6 +471,7 @@ static void LoadInputConfig()
allowUpAndDown = GetPrivateProfileInt("Controls","AllowUpAndDown",0,IniName) != 0;
allowBackgroundInput = GetPrivateProfileInt("Controls","AllowBackgroundInput",0,IniName) != 0;
killStylusTopScreen = GetPrivateProfileInt("Controls","KillStylusTopScreen",0,IniName) != 0;
}
static void WriteControl(char* name, WORD val)
@ -488,6 +491,8 @@ static void SaveInputConfig()
#undef DO
WritePrivateProfileInt("Controls","AllowUpAndDown",allowUpAndDown?1:0,IniName);
WritePrivateProfileInt("Controls","KillStylusTopScreen",killStylusTopScreen?1:0,IniName);
WritePrivateProfileInt("Controls","KillStylusOffScreen",killStylusOffScreen?1:0,IniName);
}
BOOL di_init()
@ -2208,6 +2213,8 @@ switch(msg)
//SendDlgItemMessage(hDlg,IDC_JPTOGGLE,BM_SETCHECK, Joypad[index].Enabled ? (WPARAM)BST_CHECKED : (WPARAM)BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg,IDC_ALLOWLEFTRIGHT,BM_SETCHECK, allowUpAndDown ? (WPARAM)BST_CHECKED : (WPARAM)BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg,IDC_KILLSTYLUSTOP,BM_SETCHECK, killStylusTopScreen ? (WPARAM)BST_CHECKED : (WPARAM)BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg,IDC_KILLSTYLUSOFF,BM_SETCHECK, killStylusOffScreen ? (WPARAM)BST_CHECKED : (WPARAM)BST_UNCHECKED, 0);
set_buttoninfo(index,hDlg);
@ -2322,6 +2329,8 @@ switch(msg)
case IDOK:
allowUpAndDown = IsDlgButtonChecked(hDlg, IDC_ALLOWLEFTRIGHT) != 0;
killStylusTopScreen = IsDlgButtonChecked(hDlg, IDC_KILLSTYLUSTOP) != 0;
killStylusOffScreen = IsDlgButtonChecked(hDlg, IDC_KILLSTYLUSOFF) != 0;
SaveInputConfig();
EndDialog(hDlg,0);
break;

View File

@ -322,6 +322,8 @@ CToolBar* MainWindowToolbar;
DWORD hKeyInputTimer;
bool start_paused;
extern bool killStylusTopScreen;
extern bool killStylusOffScreen;
extern LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
void InitRamSearch();
@ -5082,10 +5084,39 @@ DOKEYDOWN:
const bool isMainGPUFirst = (GPU->GetDisplayMain()->GetEngineID() == GPUEngineID_Main);
if ((video.layout == 2) && ((video.swap == 0) || (video.swap == 2 && isMainGPUFirst) || (video.swap == 3 && !isMainGPUFirst))) return 0;
bool untouch = false;
ToDSScreenRelativeCoords(x,y,1);
if(x<0) x = 0; else if(x>255) x = 255;
if(y<0) y = 0; else if(y>192) y = 192;
NDS_setTouchPos(x, y);
if(x<0)
{
x = 0;
untouch |= killStylusOffScreen;
}
if(x>255)
{
x = 255;
untouch |= killStylusOffScreen;
}
if(y>191)
{
y = 191;
untouch |= killStylusOffScreen;
}
if(y<-191)
{
y = -191;
untouch |= killStylusOffScreen;
}
if(y<0)
{
y = 0;
untouch |= killStylusTopScreen;
}
if(untouch)
NDS_releaseTouch();
else
NDS_setTouchPos(x, y);
winLastTouch.x = x;
winLastTouch.y = y;
userTouchesScreen = true;

View File

@ -998,6 +998,9 @@
#define IDC_LID 50037
#define IDD_INPUTCONFIG 50038
#define IDC_LABEL_BLUE1 50039
#define IDC_KILLSTYLUS 50039
#define IDC_KILLSTYLUSTOP 50039
#define IDC_KILLSTYLUSOFF 50040
#define IDC_LUASCRIPT_RESERVE_START 58000
#define IDC_LUASCRIPT_RESERVE_END 58099
#define IDD_LUARECENT_RESERVE_START 58100

View File

@ -1267,9 +1267,9 @@ BEGIN
CONTROL " ",IDC_UPRIGHT,"InputCustom",WS_TABSTOP,163,81,71,12,WS_EX_CLIENTEDGE
CONTROL " ",IDC_DWNRIGHT,"InputCustom",WS_TABSTOP,163,94,71,12,WS_EX_CLIENTEDGE
CONTROL " ",IDC_DWNLEFT,"InputCustom",WS_TABSTOP,163,107,71,12,WS_EX_CLIENTEDGE
PUSHBUTTON "OK",IDOK,245,119,41,14
PUSHBUTTON "Cancel",IDCANCEL,293,119,39,14
LTEXT "Blue means the button is already mapped.\nPink means it conflicts with a custom hotkey.\nRed means it's reserved by Windows.\nButtons can be disabled using Escape.",IDC_LABEL_BLUE,246,10,80,88
PUSHBUTTON "OK",IDOK,245,129,41,14
PUSHBUTTON "Cancel",IDCANCEL,293,129,39,14
LTEXT "Blue means the button is already mapped.\nPink means it conflicts with a custom hotkey.\nRed means it's reserved by Windows.\nButtons can be disabled using Escape.",IDC_LABEL_BLUE,246,10,80,69
RTEXT "UP",IDC_LABEL_UP,10,18,38,8
RTEXT "RIGHT",IDC_LABEL_RIGHT,8,58,41,8
RTEXT "LEFT",IDC_LABEL_LEFT,11,31,37,8
@ -1286,12 +1286,14 @@ BEGIN
RTEXT "DN RIGHT",IDC_LABEL_DOWNRIGHT,124,97,36,8
RTEXT "UP RIGHT",IDC_LABEL_UPRIGHT,124,84,36,8
RTEXT "DN LEFT",IDC_LABEL_DOWNLEFT,129,109,31,8
CONTROL "Allow Left+Rt/Up+Dn",IDC_ALLOWLEFTRIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,245,102,87,11
CONTROL "Allow Left+Rt/Up+Dn",IDC_ALLOWLEFTRIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,245,86,87,11
GROUPBOX "Buttons",IDC_STATIC,7,7,234,129,0,WS_EX_TRANSPARENT
CONTROL "",IDC_LID,"InputCustom",WS_TABSTOP,52,120,71,12,WS_EX_CLIENTEDGE
RTEXT "LID",IDC_LABEL_X2,8,121,39,8
RTEXT "DEBUG",IDC_LABEL_X3,127,123,29,8
CONTROL " ",IDC_DEBUG,"InputCustom",WS_TABSTOP,163,120,71,12,WS_EX_CLIENTEDGE
CONTROL "Kill stylus on top screen",IDC_KILLSTYLUSTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,245,102,87,11
CONTROL "Kill stylus off-screen",IDC_KILLSTYLUSOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,245,114,87,11
END
IDD_KEYCUSTOM DIALOGEX 0, 0, 382, 180
@ -1906,6 +1908,10 @@ BEGIN
BOTTOMMARGIN, 140
END
IDD_INPUTCONFIG, DIALOG
BEGIN
END
IDD_GBASLOT_PIANO, DIALOG
BEGIN
LEFTMARGIN, 7