winport: add autohold for stylus
This commit is contained in:
parent
d9534edf36
commit
158852cea2
|
@ -43,6 +43,9 @@ extern LRESULT OpenFile(); //adelikat: Made this an extern here instead of main.
|
|||
SCustomKeys CustomKeys;
|
||||
|
||||
bool AutoHoldPressed=false;
|
||||
bool StylusAutoHoldPressed=false;
|
||||
POINT winLastTouch = { 128, 96 };
|
||||
bool userTouchesScreen = false;
|
||||
|
||||
bool IsLastCustomKey (const SCustomKey *key)
|
||||
{
|
||||
|
@ -185,9 +188,20 @@ void HK_StateQuickLoadSlot(int)
|
|||
void HK_MicrophoneKeyDown(int) { NDS_setMic(1); }
|
||||
void HK_MicrophoneKeyUp(int) { NDS_setMic(0); }
|
||||
|
||||
void HK_AutoHoldKeyDown(int) {AutoHoldPressed = true;}
|
||||
void HK_AutoHoldKeyUp(int) {AutoHoldPressed = false;}
|
||||
|
||||
void HK_StylusAutoHoldKeyDown(int) {
|
||||
StylusAutoHoldPressed = !StylusAutoHoldPressed;
|
||||
if (StylusAutoHoldPressed)
|
||||
NDS_setTouchPos(winLastTouch.x, winLastTouch.y);
|
||||
else if (!userTouchesScreen)
|
||||
NDS_releaseTouch();
|
||||
}
|
||||
|
||||
void HK_AutoHoldClearKeyDown(int) {
|
||||
|
||||
ClearAutoHold();
|
||||
StylusAutoHoldPressed = false;
|
||||
}
|
||||
|
||||
void HK_Reset(int) {ResetGame();}
|
||||
|
@ -257,9 +271,6 @@ void HK_MostRecentLuaScriptDown(int)
|
|||
SendMessage(MainWindow->getHWnd(), WM_COMMAND, IDD_LUARECENT_RESERVE_START, 0);
|
||||
}
|
||||
|
||||
void HK_AutoHoldKeyDown(int) {AutoHoldPressed = true;}
|
||||
void HK_AutoHoldKeyUp(int) {AutoHoldPressed = false;}
|
||||
|
||||
void HK_TurboRightKeyDown(int) { Turbo.R = true; }
|
||||
void HK_TurboRightKeyUp(int) { Turbo.R = false; }
|
||||
|
||||
|
@ -419,6 +430,12 @@ void InitCustomKeys (SCustomKeys *keys)
|
|||
keys->AutoHold.page = HOTKEY_PAGE_MAIN;
|
||||
keys->AutoHold.key = NULL;
|
||||
|
||||
keys->StylusAutoHold.handleKeyDown = HK_StylusAutoHoldKeyDown;
|
||||
keys->StylusAutoHold.code = "StylusAutoHold";
|
||||
keys->StylusAutoHold.name = L"Stylus Auto-Hold";
|
||||
keys->StylusAutoHold.page = HOTKEY_PAGE_MOVIE; // TODO: set more appropriate category?
|
||||
keys->StylusAutoHold.key = NULL;
|
||||
|
||||
keys->AutoHoldClear.handleKeyDown = HK_AutoHoldClearKeyDown;
|
||||
keys->AutoHoldClear.code = "AutoHoldClear";
|
||||
keys->AutoHoldClear.name = L"Auto-Hold Clear";
|
||||
|
|
|
@ -89,6 +89,7 @@ struct SCustomKeys
|
|||
SCustomKey ToggleInput;
|
||||
SCustomKey ToggleLag;
|
||||
SCustomKey ResetLagCounter;
|
||||
SCustomKey StylusAutoHold;
|
||||
SCustomKey LastItem; // dummy, must be last
|
||||
|
||||
//--methods--
|
||||
|
|
|
@ -258,6 +258,10 @@ float DefaultHeight;
|
|||
float widthTradeOff;
|
||||
float heightTradeOff;
|
||||
|
||||
extern bool StylusAutoHoldPressed;
|
||||
extern POINT winLastTouch;
|
||||
extern bool userTouchesScreen;
|
||||
|
||||
/*__declspec(thread)*/ bool inFrameBoundary = false;
|
||||
|
||||
//static char IniName[MAX_PATH];
|
||||
|
@ -3459,17 +3463,24 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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);
|
||||
winLastTouch.x = x;
|
||||
winLastTouch.y = y;
|
||||
userTouchesScreen = true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
NDS_releaseTouch();
|
||||
if (!StylusAutoHoldPressed)
|
||||
NDS_releaseTouch();
|
||||
userTouchesScreen = false;
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
|
||||
ReleaseCapture();
|
||||
NDS_releaseTouch();
|
||||
HudClickRelease(&Hud);
|
||||
if (!StylusAutoHoldPressed)
|
||||
NDS_releaseTouch();
|
||||
userTouchesScreen = false;
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
|
|
Loading…
Reference in New Issue