Enabled the lid open/close key.
This commit is contained in:
parent
f9c98a3202
commit
52fc632ec7
|
@ -242,24 +242,24 @@ extern volatile BOOL paused;
|
|||
|
||||
#define MAXKEYPAD 15
|
||||
|
||||
#define WM_CUSTKEYDOWN (WM_USER+50)
|
||||
#define WM_CUSTKEYUP (WM_USER+51)
|
||||
|
||||
#define NUM_HOTKEY_CONTROLS 20
|
||||
|
||||
#define COUNT(a) (sizeof (a) / sizeof (a[0]))
|
||||
|
||||
const int IDC_LABEL_HK_Table[NUM_HOTKEY_CONTROLS] = {
|
||||
IDC_LABEL_HK1 , IDC_LABEL_HK2 , IDC_LABEL_HK3 , IDC_LABEL_HK4 , IDC_LABEL_HK5 ,
|
||||
IDC_LABEL_HK6 , IDC_LABEL_HK7 , IDC_LABEL_HK8 , IDC_LABEL_HK9 , IDC_LABEL_HK10,
|
||||
IDC_LABEL_HK11, IDC_LABEL_HK12, IDC_LABEL_HK13, IDC_LABEL_HK14, IDC_LABEL_HK15,
|
||||
IDC_LABEL_HK16, IDC_LABEL_HK17, IDC_LABEL_HK18, IDC_LABEL_HK19, IDC_LABEL_HK20,
|
||||
};
|
||||
const int IDC_HOTKEY_Table[NUM_HOTKEY_CONTROLS] = {
|
||||
IDC_HOTKEY1 , IDC_HOTKEY2 , IDC_HOTKEY3 , IDC_HOTKEY4 , IDC_HOTKEY5 ,
|
||||
IDC_HOTKEY6 , IDC_HOTKEY7 , IDC_HOTKEY8 , IDC_HOTKEY9 , IDC_HOTKEY10,
|
||||
IDC_HOTKEY11, IDC_HOTKEY12, IDC_HOTKEY13, IDC_HOTKEY14, IDC_HOTKEY15,
|
||||
IDC_HOTKEY16, IDC_HOTKEY17, IDC_HOTKEY18, IDC_HOTKEY19, IDC_HOTKEY20,
|
||||
#define WM_CUSTKEYDOWN (WM_USER+50)
|
||||
#define WM_CUSTKEYUP (WM_USER+51)
|
||||
|
||||
#define NUM_HOTKEY_CONTROLS 20
|
||||
|
||||
#define COUNT(a) (sizeof (a) / sizeof (a[0]))
|
||||
|
||||
const int IDC_LABEL_HK_Table[NUM_HOTKEY_CONTROLS] = {
|
||||
IDC_LABEL_HK1 , IDC_LABEL_HK2 , IDC_LABEL_HK3 , IDC_LABEL_HK4 , IDC_LABEL_HK5 ,
|
||||
IDC_LABEL_HK6 , IDC_LABEL_HK7 , IDC_LABEL_HK8 , IDC_LABEL_HK9 , IDC_LABEL_HK10,
|
||||
IDC_LABEL_HK11, IDC_LABEL_HK12, IDC_LABEL_HK13, IDC_LABEL_HK14, IDC_LABEL_HK15,
|
||||
IDC_LABEL_HK16, IDC_LABEL_HK17, IDC_LABEL_HK18, IDC_LABEL_HK19, IDC_LABEL_HK20,
|
||||
};
|
||||
const int IDC_HOTKEY_Table[NUM_HOTKEY_CONTROLS] = {
|
||||
IDC_HOTKEY1 , IDC_HOTKEY2 , IDC_HOTKEY3 , IDC_HOTKEY4 , IDC_HOTKEY5 ,
|
||||
IDC_HOTKEY6 , IDC_HOTKEY7 , IDC_HOTKEY8 , IDC_HOTKEY9 , IDC_HOTKEY10,
|
||||
IDC_HOTKEY11, IDC_HOTKEY12, IDC_HOTKEY13, IDC_HOTKEY14, IDC_HOTKEY15,
|
||||
IDC_HOTKEY16, IDC_HOTKEY17, IDC_HOTKEY18, IDC_HOTKEY19, IDC_HOTKEY20,
|
||||
};
|
||||
|
||||
typedef char TcDIBuf[512];
|
||||
|
@ -348,23 +348,23 @@ static void LoadHotkeyConfig()
|
|||
{
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
|
||||
while (!IsLastCustomKey(key)) {
|
||||
ReadHotkey(key->code,key->key);
|
||||
std::string modname = (std::string)key->code + (std::string)" MOD";
|
||||
ReadHotkey(modname.c_str(),key->modifiers);
|
||||
key++;
|
||||
}
|
||||
while (!IsLastCustomKey(key)) {
|
||||
ReadHotkey(key->code,key->key);
|
||||
std::string modname = (std::string)key->code + (std::string)" MOD";
|
||||
ReadHotkey(modname.c_str(),key->modifiers);
|
||||
key++;
|
||||
}
|
||||
}
|
||||
|
||||
static void SaveHotkeyConfig()
|
||||
{
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
|
||||
while (!IsLastCustomKey(key)) {
|
||||
WritePrivateProfileInt("Hotkeys",(char*)key->code,key->key,IniName);
|
||||
std::string modname = (std::string)key->code + (std::string)" MOD";
|
||||
WritePrivateProfileInt("Hotkeys",(char*)modname.c_str(),key->modifiers,IniName);
|
||||
key++;
|
||||
while (!IsLastCustomKey(key)) {
|
||||
WritePrivateProfileInt("Hotkeys",(char*)key->code,key->key,IniName);
|
||||
std::string modname = (std::string)key->code + (std::string)" MOD";
|
||||
WritePrivateProfileInt("Hotkeys",(char*)modname.c_str(),key->modifiers,IniName);
|
||||
key++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1001,23 +1001,23 @@ int GetNumHotKeysAssignedTo (WORD Key, int modifiers)
|
|||
{
|
||||
int count = 0;
|
||||
{
|
||||
#define MATCHES_KEY(k) \
|
||||
(Key != 0 && Key != VK_ESCAPE \
|
||||
&& ((Key == k->key && modifiers == k->modifiers) \
|
||||
|| (Key == VK_SHIFT && k->modifiers & CUSTKEY_SHIFT_MASK) \
|
||||
|| (Key == VK_MENU && k->modifiers & CUSTKEY_ALT_MASK) \
|
||||
|| (Key == VK_CONTROL && k->modifiers & CUSTKEY_CTRL_MASK) \
|
||||
|| (k->key == VK_SHIFT && modifiers & CUSTKEY_SHIFT_MASK) \
|
||||
|| (k->key == VK_MENU && modifiers & CUSTKEY_ALT_MASK) \
|
||||
#define MATCHES_KEY(k) \
|
||||
(Key != 0 && Key != VK_ESCAPE \
|
||||
&& ((Key == k->key && modifiers == k->modifiers) \
|
||||
|| (Key == VK_SHIFT && k->modifiers & CUSTKEY_SHIFT_MASK) \
|
||||
|| (Key == VK_MENU && k->modifiers & CUSTKEY_ALT_MASK) \
|
||||
|| (Key == VK_CONTROL && k->modifiers & CUSTKEY_CTRL_MASK) \
|
||||
|| (k->key == VK_SHIFT && modifiers & CUSTKEY_SHIFT_MASK) \
|
||||
|| (k->key == VK_MENU && modifiers & CUSTKEY_ALT_MASK) \
|
||||
|| (k->key == VK_CONTROL && modifiers & CUSTKEY_CTRL_MASK)))
|
||||
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
while (!IsLastCustomKey(key)) {
|
||||
if (MATCHES_KEY(key)) {
|
||||
count++;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
while (!IsLastCustomKey(key)) {
|
||||
if (MATCHES_KEY(key)) {
|
||||
count++;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
|
||||
|
||||
#undef MATCHES_KEY
|
||||
|
@ -1697,7 +1697,7 @@ void EnableDisableKeyFields (int index, HWND hDlg)
|
|||
EnableWindow(GetDlgItem(hDlg,IDC_DWNRIGHT), false);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_DWNLEFT), false);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_DEBUG), false);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_LID), false);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_LID), true);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK DlgInputConfig(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -1858,9 +1858,11 @@ switch(msg)
|
|||
case IDC_DWNRIGHT:
|
||||
Joypad[index].Right_Down = wParam;
|
||||
|
||||
break;
|
||||
case IDC_LID:
|
||||
Joypad[index].Lid = wParam;
|
||||
|
||||
break;
|
||||
case IDC_DEBUG:
|
||||
Joypad[index].Debug = wParam;
|
||||
|
||||
|
@ -2198,149 +2200,149 @@ void input_process()
|
|||
NDS_setPad( R, L, D, U, T, S, B, A, Y, X, W, E, G, F);
|
||||
}
|
||||
|
||||
static void set_hotkeyinfo(HWND hDlg)
|
||||
{
|
||||
HotkeyPage page = (HotkeyPage) SendDlgItemMessage(hDlg,IDC_HKCOMBO,CB_GETCURSEL,0,0);
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
int i = 0;
|
||||
|
||||
while (!IsLastCustomKey(key) && i < NUM_HOTKEY_CONTROLS) {
|
||||
if (page == key->page) {
|
||||
SendDlgItemMessage(hDlg, IDC_HOTKEY_Table[i], WM_USER+44, key->key, key->modifiers);
|
||||
SetDlgItemTextW(hDlg, IDC_LABEL_HK_Table[i], key->name.c_str());
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_HOTKEY_Table[i]), SW_SHOW);
|
||||
i++;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
// disable unused controls
|
||||
for (; i < NUM_HOTKEY_CONTROLS; i++) {
|
||||
SendDlgItemMessage(hDlg, IDC_HOTKEY_Table[i], WM_USER+44, 0, 0);
|
||||
SetDlgItemText(hDlg, IDC_LABEL_HK_Table[i], INPUTCONFIG_LABEL_UNUSED);
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_HOTKEY_Table[i]), SW_HIDE);
|
||||
}
|
||||
}
|
||||
static void set_hotkeyinfo(HWND hDlg)
|
||||
{
|
||||
HotkeyPage page = (HotkeyPage) SendDlgItemMessage(hDlg,IDC_HKCOMBO,CB_GETCURSEL,0,0);
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
int i = 0;
|
||||
|
||||
while (!IsLastCustomKey(key) && i < NUM_HOTKEY_CONTROLS) {
|
||||
if (page == key->page) {
|
||||
SendDlgItemMessage(hDlg, IDC_HOTKEY_Table[i], WM_USER+44, key->key, key->modifiers);
|
||||
SetDlgItemTextW(hDlg, IDC_LABEL_HK_Table[i], key->name.c_str());
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_HOTKEY_Table[i]), SW_SHOW);
|
||||
i++;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
// disable unused controls
|
||||
for (; i < NUM_HOTKEY_CONTROLS; i++) {
|
||||
SendDlgItemMessage(hDlg, IDC_HOTKEY_Table[i], WM_USER+44, 0, 0);
|
||||
SetDlgItemText(hDlg, IDC_LABEL_HK_Table[i], INPUTCONFIG_LABEL_UNUSED);
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_HOTKEY_Table[i]), SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DlgHotkeyConfig
|
||||
INT_PTR CALLBACK DlgHotkeyConfig(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int i, which;
|
||||
static HotkeyPage page = (HotkeyPage) 0;
|
||||
|
||||
|
||||
static SCustomKeys keys;
|
||||
|
||||
//HBRUSH g_hbrBackground;
|
||||
switch(msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint (hDlg, &ps);
|
||||
|
||||
EndPaint (hDlg, &ps);
|
||||
}
|
||||
return true;
|
||||
case WM_INITDIALOG:
|
||||
//if(DirectX.Clipped) S9xReRefresh();
|
||||
SetWindowText(hDlg,HOTKEYS_TITLE);
|
||||
|
||||
// insert hotkey page list items
|
||||
for(i = 0 ; i < NUM_HOTKEY_PAGE ; i++)
|
||||
{
|
||||
SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)hotkeyPageTitle[i]);
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hDlg,IDC_HKCOMBO,CB_SETCURSEL,(WPARAM)0,0);
|
||||
|
||||
InitCustomKeys(&keys);
|
||||
CopyCustomKeys(&keys, &CustomKeys);
|
||||
for( i=0;i<256;i++)
|
||||
{
|
||||
GetAsyncKeyState(i);
|
||||
}
|
||||
|
||||
SetDlgItemText(hDlg,IDC_LABEL_BLUE,HOTKEYS_LABEL_BLUE);
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
|
||||
PostMessage(hDlg,WM_COMMAND, CBN_SELCHANGE<<16, 0);
|
||||
|
||||
SetFocus(GetDlgItem(hDlg,IDC_HKCOMBO));
|
||||
|
||||
|
||||
return true;
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg, 0);
|
||||
return TRUE;
|
||||
case WM_USER+46:
|
||||
// refresh command, for clicking away from a selected field
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
set_hotkeyinfo(hDlg);
|
||||
return TRUE;
|
||||
case WM_USER+43:
|
||||
{
|
||||
//MessageBox(hDlg,"USER+43 CAUGHT","moo",MB_OK);
|
||||
int modifiers = GetModifiers(wParam);
|
||||
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
wchar_t text[256];
|
||||
|
||||
which = GetDlgCtrlID((HWND)lParam);
|
||||
for (i = 0; i < NUM_HOTKEY_CONTROLS; i++) {
|
||||
if (which == IDC_HOTKEY_Table[i])
|
||||
break;
|
||||
}
|
||||
GetDlgItemTextW(hDlg, IDC_LABEL_HK_Table[i], text, COUNT(text));
|
||||
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
while (!IsLastCustomKey(key)) {
|
||||
if (page == key->page) {
|
||||
if(text == key->name) {
|
||||
key->key = wParam;
|
||||
key->modifiers = modifiers;
|
||||
break;
|
||||
}
|
||||
}
|
||||
key++;
|
||||
}
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
PostMessage(hDlg,WM_NEXTDLGCTL,0,0);
|
||||
// PostMessage(hDlg,WM_KILLFOCUS,0,0);
|
||||
}
|
||||
return true;
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL:
|
||||
CopyCustomKeys(&CustomKeys, &keys);
|
||||
EndDialog(hDlg,0);
|
||||
break;
|
||||
case IDOK:
|
||||
SaveHotkeyConfig();
|
||||
EndDialog(hDlg,0);
|
||||
break;
|
||||
}
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case CBN_SELCHANGE:
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_SETCURSEL, (WPARAM)page, 0);
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
|
||||
SetFocus(GetDlgItem(hDlg, IDC_HKCOMBO));
|
||||
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
// DlgHotkeyConfig
|
||||
INT_PTR CALLBACK DlgHotkeyConfig(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int i, which;
|
||||
static HotkeyPage page = (HotkeyPage) 0;
|
||||
|
||||
|
||||
static SCustomKeys keys;
|
||||
|
||||
//HBRUSH g_hbrBackground;
|
||||
switch(msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint (hDlg, &ps);
|
||||
|
||||
EndPaint (hDlg, &ps);
|
||||
}
|
||||
return true;
|
||||
case WM_INITDIALOG:
|
||||
//if(DirectX.Clipped) S9xReRefresh();
|
||||
SetWindowText(hDlg,HOTKEYS_TITLE);
|
||||
|
||||
// insert hotkey page list items
|
||||
for(i = 0 ; i < NUM_HOTKEY_PAGE ; i++)
|
||||
{
|
||||
SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)hotkeyPageTitle[i]);
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hDlg,IDC_HKCOMBO,CB_SETCURSEL,(WPARAM)0,0);
|
||||
|
||||
InitCustomKeys(&keys);
|
||||
CopyCustomKeys(&keys, &CustomKeys);
|
||||
for( i=0;i<256;i++)
|
||||
{
|
||||
GetAsyncKeyState(i);
|
||||
}
|
||||
|
||||
SetDlgItemText(hDlg,IDC_LABEL_BLUE,HOTKEYS_LABEL_BLUE);
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
|
||||
PostMessage(hDlg,WM_COMMAND, CBN_SELCHANGE<<16, 0);
|
||||
|
||||
SetFocus(GetDlgItem(hDlg,IDC_HKCOMBO));
|
||||
|
||||
|
||||
return true;
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg, 0);
|
||||
return TRUE;
|
||||
case WM_USER+46:
|
||||
// refresh command, for clicking away from a selected field
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
set_hotkeyinfo(hDlg);
|
||||
return TRUE;
|
||||
case WM_USER+43:
|
||||
{
|
||||
//MessageBox(hDlg,"USER+43 CAUGHT","moo",MB_OK);
|
||||
int modifiers = GetModifiers(wParam);
|
||||
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
wchar_t text[256];
|
||||
|
||||
which = GetDlgCtrlID((HWND)lParam);
|
||||
for (i = 0; i < NUM_HOTKEY_CONTROLS; i++) {
|
||||
if (which == IDC_HOTKEY_Table[i])
|
||||
break;
|
||||
}
|
||||
GetDlgItemTextW(hDlg, IDC_LABEL_HK_Table[i], text, COUNT(text));
|
||||
|
||||
SCustomKey *key = &CustomKeys.key(0);
|
||||
while (!IsLastCustomKey(key)) {
|
||||
if (page == key->page) {
|
||||
if(text == key->name) {
|
||||
key->key = wParam;
|
||||
key->modifiers = modifiers;
|
||||
break;
|
||||
}
|
||||
}
|
||||
key++;
|
||||
}
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
PostMessage(hDlg,WM_NEXTDLGCTL,0,0);
|
||||
// PostMessage(hDlg,WM_KILLFOCUS,0,0);
|
||||
}
|
||||
return true;
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL:
|
||||
CopyCustomKeys(&CustomKeys, &keys);
|
||||
EndDialog(hDlg,0);
|
||||
break;
|
||||
case IDOK:
|
||||
SaveHotkeyConfig();
|
||||
EndDialog(hDlg,0);
|
||||
break;
|
||||
}
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case CBN_SELCHANGE:
|
||||
page = (HotkeyPage) SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_GETCURSEL, 0, 0);
|
||||
SendDlgItemMessage(hDlg, IDC_HKCOMBO, CB_SETCURSEL, (WPARAM)page, 0);
|
||||
|
||||
set_hotkeyinfo(hDlg);
|
||||
|
||||
SetFocus(GetDlgItem(hDlg, IDC_HKCOMBO));
|
||||
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue