update UI to allow multiple key assignments to functions
This commit is contained in:
parent
4a0294b952
commit
a8953de9da
60
res/VBA.rc
60
res/VBA.rc
|
@ -199,26 +199,26 @@ BEGIN
|
|||
PUSHBUTTON "Reset",IDC_CAPTURE_DIR_RESET,228,83,50,14
|
||||
END
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 135, 211
|
||||
IDD_CONFIG DIALOGEX 0, 0, 209, 230
|
||||
STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Joypad configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_UP,47,5,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DOWN,47,19,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_LEFT,47,33,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_RIGHT,47,47,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_A,47,61,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_B,47,75,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_L,47,89,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_R,47,103,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_SELECT,47,117,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_START,47,131,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SPEED,47,145,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_CAPTURE,47,159,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_GS,47,173,81,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "OK",ID_OK,20,190,40,14
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,74,190,40,14
|
||||
EDITTEXT IDC_EDIT_UP,45,5,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DOWN,45,19,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_LEFT,45,33,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_RIGHT,45,47,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_A,45,61,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_B,45,75,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_L,45,89,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_R,45,103,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_SELECT,45,117,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_START,45,131,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SPEED,45,145,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_CAPTURE,45,159,157,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_BUTTON_GS,45,173,157,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "OK",ID_OK,63,209,40,14
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,113,209,40,14
|
||||
LTEXT "Up:",IDC_STATIC,5,5,35,10
|
||||
LTEXT "Down:",IDC_STATIC,5,19,35,10
|
||||
LTEXT "Left:",IDC_STATIC,5,33,35,10
|
||||
|
@ -232,6 +232,8 @@ BEGIN
|
|||
LTEXT "Turbo:",IDC_STATIC,5,145,35,10
|
||||
LTEXT "Capture:",IDC_STATIC,5,159,35,10
|
||||
LTEXT "GS:",IDC_STATIC,5,173,35,10
|
||||
CONTROL "Assign additional keys to functions",IDC_APPENDMODE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,193,135,10
|
||||
END
|
||||
|
||||
IDD_CHEATS DIALOG 0, 0, 276, 253
|
||||
|
@ -433,21 +435,23 @@ BEGIN
|
|||
GROUPBOX "Print Size",IDC_STATIC,7,156,162,25
|
||||
END
|
||||
|
||||
IDD_MOTION_CONFIG DIALOG 0, 0, 135, 78
|
||||
IDD_MOTION_CONFIG DIALOGEX 0, 0, 219, 114
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Motion Sensor"
|
||||
FONT 8, "MS Sans Serif"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_UP,47,2,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DOWN,47,16,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_LEFT,47,30,81,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_RIGHT,47,44,81,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "OK",ID_OK,20,60,40,14
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,74,60,40,14
|
||||
EDITTEXT IDC_EDIT_UP,49,2,163,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DOWN,49,16,163,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_LEFT,49,30,163,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_RIGHT,49,44,163,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "OK",ID_OK,61,92,40,14
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,115,92,40,14
|
||||
LTEXT "Up:",IDC_STATIC,5,2,35,10
|
||||
LTEXT "Down:",IDC_STATIC,5,16,35,10
|
||||
LTEXT "Left:",IDC_STATIC,5,30,35,10
|
||||
LTEXT "Right:",IDC_STATIC,5,44,35,10
|
||||
CONTROL "Assign additional keys to functions",IDC_APPENDMODE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,70,135,10
|
||||
END
|
||||
|
||||
IDD_LANG_SELECT DIALOG 0, 0, 186, 68
|
||||
|
@ -1149,9 +1153,9 @@ BEGIN
|
|||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 128
|
||||
RIGHTMARGIN, 202
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 204
|
||||
BOTTOMMARGIN, 223
|
||||
END
|
||||
|
||||
IDD_CHEATS, DIALOG
|
||||
|
@ -1229,9 +1233,9 @@ BEGIN
|
|||
IDD_MOTION_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 128
|
||||
RIGHTMARGIN, 212
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 71
|
||||
BOTTOMMARGIN, 107
|
||||
END
|
||||
|
||||
IDD_LANG_SELECT, DIALOG
|
||||
|
|
|
@ -465,6 +465,8 @@
|
|||
#define IDC_BIT_10 1260
|
||||
#define IDC_CHECK_STRETCHTOFIT 1260
|
||||
#define IDC_BIT_11 1261
|
||||
#define IDC_CHECK1 1261
|
||||
#define IDC_APPENDMODE 1261
|
||||
#define IDC_BIT_12 1262
|
||||
#define IDC_BIT_13 1263
|
||||
#define IDC_BIT_14 1264
|
||||
|
@ -735,14 +737,13 @@
|
|||
#define IDC_CLINKUDP 40327
|
||||
#define IDC_SPEEDON 40328
|
||||
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 159
|
||||
#define _APS_NEXT_COMMAND_VALUE 40300
|
||||
#define _APS_NEXT_CONTROL_VALUE 1261
|
||||
#define _APS_NEXT_CONTROL_VALUE 1262
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -660,6 +660,7 @@ int openLinkLog(void){
|
|||
if(linklog){
|
||||
sprintf(filename, "vbalog%1d.txt", vbaid+1);
|
||||
if((linklogfile=fopen(filename, "wt"))==NULL){
|
||||
linklog=false;
|
||||
return 0;
|
||||
}
|
||||
fprintf(linklogfile, "GBA0 GBA1 GBA2 GBA3 clocks between transfers\n");
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#define JOYCONFIG_MESSAGE (WM_USER + 1000)
|
||||
|
||||
typedef CList<USHORT,USHORT> KeyList;
|
||||
typedef CList<int,int> KeyList;
|
||||
//typedef CList<USHORT,USHORT> KeyList;
|
||||
|
||||
#define JOYPADS 4
|
||||
#define MOTION_KEYS 4
|
||||
|
|
|
@ -31,24 +31,40 @@
|
|||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Todo: Expand UI to allow user to enter multiple keys here.
|
||||
// these are temporary quick hacks to make the new lists
|
||||
// work with the old code.
|
||||
BOOL bAppendMode;
|
||||
|
||||
int TempReadFirst(KeyList &Key)
|
||||
{
|
||||
if (Key.IsEmpty())
|
||||
return 0;
|
||||
|
||||
return Key.GetHead();
|
||||
}
|
||||
|
||||
void TempWriteFirst(KeyList &Key, int Out)
|
||||
void AssignKey(KeyList &Key, int Out)
|
||||
{
|
||||
if (!bAppendMode)
|
||||
Key.RemoveAll();
|
||||
Key.AddTail(Out);
|
||||
}
|
||||
|
||||
|
||||
CString GetKeyListName(KeyList& Keys)
|
||||
{
|
||||
CString txtKeys;
|
||||
|
||||
POSITION p = Keys.GetHeadPosition();
|
||||
while(p!=NULL)
|
||||
{
|
||||
txtKeys+=theApp.input->getKeyName(Keys.GetNext(p));
|
||||
if (p!=NULL)
|
||||
txtKeys+=", ";
|
||||
}
|
||||
return txtKeys;
|
||||
}
|
||||
|
||||
void CopyKeys(KeyList &Out, KeyList &In)
|
||||
{
|
||||
Out.RemoveAll();
|
||||
POSITION p = In.GetHeadPosition();
|
||||
while(p!=NULL)
|
||||
Out.AddTail(In.GetNext(p));
|
||||
}
|
||||
|
||||
#define AssignKeys(in, out) CopyKeys(out, in);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// JoypadEditControl
|
||||
|
||||
|
@ -71,14 +87,15 @@ BEGIN_MESSAGE_MAP(JoypadEditControl, CEdit)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// JoypadEditControl message handlers
|
||||
|
||||
|
||||
void JoypadEditControl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT JoypadEditControl::OnJoyConfig(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SetWindowLong(GetSafeHwnd(), GWL_USERDATA,((wParam<<8)|lParam));
|
||||
SetWindowText(theApp.input->getKeyName((wParam<<8)|lParam));
|
||||
AssignKey(m_Keys, ((wParam<<8)|lParam));
|
||||
SetWindowText(GetKeyListName(m_Keys));
|
||||
GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus();
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -136,7 +153,8 @@ BEGIN_MESSAGE_MAP(JoypadConfig, CDialog)
|
|||
ON_WM_TIMER()
|
||||
ON_WM_KEYDOWN()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
ON_BN_CLICKED(IDC_APPENDMODE, &JoypadConfig::OnBnClickedAppendmode)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// JoypadConfig message handlers
|
||||
|
@ -148,7 +166,20 @@ void JoypadConfig::OnCancel()
|
|||
|
||||
void JoypadConfig::OnOk()
|
||||
{
|
||||
assignKeys();
|
||||
AssignKeys(up.m_Keys,joypad[JOYPAD(which,KEY_UP)]);
|
||||
AssignKeys(speed.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SPEED)]);
|
||||
AssignKeys(right.m_Keys,joypad[JOYPAD(which,KEY_RIGHT)]);
|
||||
AssignKeys(left.m_Keys,joypad[JOYPAD(which,KEY_LEFT)]);
|
||||
AssignKeys(down.m_Keys,joypad[JOYPAD(which,KEY_DOWN)]);
|
||||
AssignKeys(capture.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]);
|
||||
AssignKeys(buttonStart.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_START)]);
|
||||
AssignKeys(buttonSelect.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SELECT)]);
|
||||
AssignKeys(buttonR.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_R)]);
|
||||
AssignKeys(buttonL.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_L)]);
|
||||
AssignKeys(buttonGS.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_GS)]);
|
||||
AssignKeys(buttonB.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_B)]);
|
||||
AssignKeys(buttonA.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_A)]);
|
||||
|
||||
theApp.input->checkKeys();
|
||||
EndDialog(TRUE);
|
||||
}
|
||||
|
@ -179,46 +210,37 @@ BOOL JoypadConfig::OnInitDialog()
|
|||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
bAppendMode = FALSE;
|
||||
|
||||
timerId = SetTimer(0,200,NULL);
|
||||
|
||||
SetWindowLong(up, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_UP)]));
|
||||
up.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_UP)])));
|
||||
CopyKeys(up.m_Keys,joypad[JOYPAD(which,KEY_UP)]);
|
||||
CopyKeys(speed.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SPEED)]);
|
||||
CopyKeys(right.m_Keys,joypad[JOYPAD(which,KEY_RIGHT)]);
|
||||
CopyKeys(left.m_Keys,joypad[JOYPAD(which,KEY_LEFT)]);
|
||||
CopyKeys(down.m_Keys,joypad[JOYPAD(which,KEY_DOWN)]);
|
||||
CopyKeys(capture.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]);
|
||||
CopyKeys(buttonStart.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_START)]);
|
||||
CopyKeys(buttonSelect.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SELECT)]);
|
||||
CopyKeys(buttonR.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_R)]);
|
||||
CopyKeys(buttonL.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_L)]);
|
||||
CopyKeys(buttonGS.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_GS)]);
|
||||
CopyKeys(buttonB.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_B)]);
|
||||
CopyKeys(buttonA.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_A)]);
|
||||
|
||||
SetWindowLong(down, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_DOWN)]));
|
||||
down.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_DOWN)])));
|
||||
|
||||
SetWindowLong(left, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_LEFT)]));
|
||||
left.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_LEFT)])));
|
||||
|
||||
SetWindowLong(right, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_RIGHT)]));
|
||||
right.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_RIGHT)])));
|
||||
|
||||
SetWindowLong(buttonA, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_A)]));
|
||||
buttonA.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_A)])));
|
||||
|
||||
SetWindowLong(buttonB, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_B)]));
|
||||
buttonB.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_B)])));
|
||||
|
||||
SetWindowLong(buttonL, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_L)]));
|
||||
buttonL.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_L)])));
|
||||
|
||||
SetWindowLong(buttonR, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_R)]));
|
||||
buttonR.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_R)])));
|
||||
|
||||
SetWindowLong(buttonSelect, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_SELECT)]));
|
||||
buttonSelect.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_SELECT)])));
|
||||
|
||||
SetWindowLong(buttonStart, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_START)]));
|
||||
buttonStart.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_START)])));
|
||||
|
||||
SetWindowLong(speed, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_SPEED)]));
|
||||
speed.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_SPEED)])));
|
||||
|
||||
SetWindowLong(capture, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]));
|
||||
capture.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)])));
|
||||
|
||||
SetWindowLong(buttonGS, GWL_USERDATA,TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_GS)]));
|
||||
buttonGS.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[JOYPAD(which,KEY_BUTTON_GS)])));
|
||||
up.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_UP)]));
|
||||
down.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_DOWN)]));
|
||||
left.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_LEFT)]));
|
||||
right.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_RIGHT)]));
|
||||
buttonA.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_A)]));
|
||||
buttonB.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_B)]));
|
||||
buttonL.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_L)]));
|
||||
buttonR.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_R)]));
|
||||
buttonSelect.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_SELECT)]));
|
||||
buttonStart.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_START)]));
|
||||
speed.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_SPEED)]));
|
||||
capture.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]));
|
||||
buttonGS.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_GS)]));
|
||||
|
||||
CenterWindow();
|
||||
|
||||
|
@ -230,92 +252,47 @@ void JoypadConfig::assignKey(int id, int key)
|
|||
{
|
||||
switch(id) {
|
||||
case IDC_EDIT_LEFT:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_LEFT)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_LEFT)],key);
|
||||
break;
|
||||
case IDC_EDIT_RIGHT:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_RIGHT)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_RIGHT)],key);
|
||||
break;
|
||||
case IDC_EDIT_UP:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_UP)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_UP)],key);
|
||||
break;
|
||||
case IDC_EDIT_SPEED:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_SPEED)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_SPEED)],key);
|
||||
break;
|
||||
case IDC_EDIT_CAPTURE:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)],key);
|
||||
break;
|
||||
case IDC_EDIT_DOWN:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_DOWN)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_DOWN)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_A:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_A)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_A)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_B:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_B)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_B)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_L:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_L)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_L)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_R:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_R)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_R)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_START:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_START)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_START)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_SELECT:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_SELECT)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_SELECT)],key);
|
||||
break;
|
||||
case IDC_EDIT_BUTTON_GS:
|
||||
TempWriteFirst(joypad[JOYPAD(which,KEY_BUTTON_GS)],key);
|
||||
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_GS)],key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void JoypadConfig::assignKeys()
|
||||
{
|
||||
int id;
|
||||
|
||||
id = IDC_EDIT_UP;
|
||||
assignKey(id, GetWindowLong(up, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_DOWN;
|
||||
assignKey(id, GetWindowLong(down, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_LEFT;
|
||||
assignKey(id, GetWindowLong(left, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_RIGHT;
|
||||
assignKey(id, GetWindowLong(right, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_A;
|
||||
assignKey(id, GetWindowLong(buttonA, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_B;
|
||||
assignKey(id, GetWindowLong(buttonB, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_L;
|
||||
assignKey(id, GetWindowLong(buttonL, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_R;
|
||||
assignKey(id, GetWindowLong(buttonR, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_SELECT;
|
||||
assignKey(id, GetWindowLong(buttonSelect, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_START;
|
||||
assignKey(id, GetWindowLong(buttonStart, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_SPEED;
|
||||
assignKey(id, GetWindowLong(speed, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_CAPTURE;
|
||||
assignKey(id, GetWindowLong(capture, GWL_USERDATA));
|
||||
|
||||
id = IDC_EDIT_BUTTON_GS;
|
||||
assignKey(id, GetWindowLong(buttonGS, GWL_USERDATA));
|
||||
|
||||
// winSaveKeys();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MotionConfig dialog
|
||||
|
@ -328,6 +305,7 @@ MotionConfig::MotionConfig(CWnd* pParent /*=NULL*/)
|
|||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
timerId = 0;
|
||||
bAppendMode = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -352,7 +330,8 @@ BEGIN_MESSAGE_MAP(MotionConfig, CDialog)
|
|||
ON_WM_KEYDOWN()
|
||||
ON_WM_TIMER()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
ON_BN_CLICKED(IDC_APPENDMODE, &MotionConfig::OnBnClickedAppendmode)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MotionConfig message handlers
|
||||
|
@ -364,7 +343,6 @@ void MotionConfig::OnCancel()
|
|||
|
||||
void MotionConfig::OnOk()
|
||||
{
|
||||
assignKeys();
|
||||
theApp.input->checkKeys();
|
||||
EndDialog( TRUE);
|
||||
}
|
||||
|
@ -373,6 +351,8 @@ void MotionConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MotionConfig::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
|
@ -380,23 +360,24 @@ void MotionConfig::OnDestroy()
|
|||
KillTimer(timerId);
|
||||
}
|
||||
|
||||
|
||||
BOOL MotionConfig::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
timerId = SetTimer(0,200,NULL);
|
||||
|
||||
SetWindowLong(up, GWL_USERDATA,TempReadFirst(joypad[MOTION(KEY_UP)]));
|
||||
up.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[MOTION(KEY_UP)])));
|
||||
CopyKeys(up.m_Keys, joypad[MOTION(KEY_UP)]);
|
||||
up.SetWindowText(GetKeyListName(joypad[MOTION(KEY_UP)]));
|
||||
|
||||
SetWindowLong(down, GWL_USERDATA,TempReadFirst(joypad[MOTION(KEY_DOWN)]));
|
||||
down.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[MOTION(KEY_DOWN)])));
|
||||
CopyKeys(down.m_Keys, joypad[MOTION(KEY_DOWN)]);
|
||||
down.SetWindowText(GetKeyListName(joypad[MOTION(KEY_DOWN)]));
|
||||
|
||||
SetWindowLong(left, GWL_USERDATA,TempReadFirst(joypad[MOTION(KEY_LEFT)]));
|
||||
left.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[MOTION(KEY_LEFT)])));
|
||||
CopyKeys(left.m_Keys, joypad[MOTION(KEY_LEFT)]);
|
||||
left.SetWindowText(GetKeyListName(joypad[MOTION(KEY_LEFT)]));
|
||||
|
||||
SetWindowLong(right, GWL_USERDATA,TempReadFirst(joypad[MOTION(KEY_RIGHT)]));
|
||||
right.SetWindowText(theApp.input->getKeyName(TempReadFirst(joypad[MOTION(KEY_RIGHT)])));
|
||||
CopyKeys(right.m_Keys, joypad[MOTION(KEY_RIGHT)]);
|
||||
right.SetWindowText(GetKeyListName(joypad[MOTION(KEY_RIGHT)]));
|
||||
|
||||
CenterWindow();
|
||||
|
||||
|
@ -419,16 +400,16 @@ void MotionConfig::assignKey(int id, int key)
|
|||
{
|
||||
switch(id) {
|
||||
case IDC_EDIT_LEFT:
|
||||
TempWriteFirst(joypad[MOTION(KEY_LEFT)],key);
|
||||
AssignKey(joypad[MOTION(KEY_LEFT)],key);
|
||||
break;
|
||||
case IDC_EDIT_RIGHT:
|
||||
TempWriteFirst(joypad[MOTION(KEY_RIGHT)],key);
|
||||
AssignKey(joypad[MOTION(KEY_RIGHT)],key);
|
||||
break;
|
||||
case IDC_EDIT_UP:
|
||||
TempWriteFirst(joypad[MOTION(KEY_UP)],key);
|
||||
AssignKey(joypad[MOTION(KEY_UP)],key);
|
||||
break;
|
||||
case IDC_EDIT_DOWN:
|
||||
TempWriteFirst(joypad[MOTION(KEY_DOWN)],key);
|
||||
AssignKey(joypad[MOTION(KEY_DOWN)],key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -449,3 +430,13 @@ void MotionConfig::assignKeys()
|
|||
id = IDC_EDIT_RIGHT;
|
||||
assignKey(id, GetWindowLong(right, GWL_USERDATA));
|
||||
}
|
||||
|
||||
void JoypadConfig::OnBnClickedAppendmode()
|
||||
{
|
||||
bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0);
|
||||
}
|
||||
|
||||
void MotionConfig::OnBnClickedAppendmode()
|
||||
{
|
||||
bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "afxwin.h"
|
||||
#if !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_)
|
||||
#define AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_
|
||||
|
||||
|
@ -32,9 +33,12 @@
|
|||
class JoypadEditControl : public CEdit
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
public:
|
||||
|
||||
JoypadEditControl();
|
||||
|
||||
KeyList m_Keys;
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
|
@ -70,7 +74,6 @@ class JoypadConfig : public CDialog
|
|||
{
|
||||
// Construction
|
||||
public:
|
||||
void assignKeys();
|
||||
void assignKey(int id, int key);
|
||||
JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
|
@ -90,6 +93,7 @@ class JoypadConfig : public CDialog
|
|||
JoypadEditControl buttonGS;
|
||||
JoypadEditControl buttonB;
|
||||
JoypadEditControl buttonA;
|
||||
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
|
@ -116,7 +120,9 @@ class JoypadConfig : public CDialog
|
|||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
public:
|
||||
afx_msg void OnBnClickedAppendmode();
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MotionConfig dialog
|
||||
|
||||
|
@ -161,6 +167,8 @@ class MotionConfig : public CDialog
|
|||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
UINT timerId;
|
||||
public:
|
||||
afx_msg void OnBnClickedAppendmode();
|
||||
};
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
|
Loading…
Reference in New Issue