update UI to allow multiple key assignments to functions

This commit is contained in:
DJRobX 2007-11-03 07:28:19 +00:00
parent 4a0294b952
commit a8953de9da
6 changed files with 214 additions and 208 deletions

View File

@ -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

View File

@ -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
@ -704,37 +706,36 @@
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298
#define ID_OPTIONS_FILTER_LCDCOLORS 40299
#define IDD_LINKTAB1 40300
#define IDD_LINKTAB 40301
#define IDD_LINKTAB2 40302
#define IDD_LINKTAB3 40303
#define IDD_SERVERWAIT 40304
#define IDC_TAB1 40305
#define IDC_LINK_SINGLE 40306
#define IDC_LINK_TIMEOUT 40307
#define IDC_LINK_LAN 40308
#define IDC_LINK2P 40309
#define IDC_LINKTCP 40310
#define IDC_SSPEED 40311
#define IDC_SERVERSTART 40312
#define IDC_SERVERIP 40313
#define IDC_CLINKIP 40314
#define IDC_SPEEDOFF 40315
#define IDC_LINKCONNECT 40316
#define IDC_STATIC4 40317
#define ID_OPTIONS_LINK_OPTIONS 40318
#define ID_OPTIONS_LINK_LOG 40319
#define ID_OPTIONS_FILTER_LCDCOLORS 40299
#define IDD_LINKTAB1 40300
#define IDD_LINKTAB 40301
#define IDD_LINKTAB2 40302
#define IDD_LINKTAB3 40303
#define IDD_SERVERWAIT 40304
#define IDC_TAB1 40305
#define IDC_LINK_SINGLE 40306
#define IDC_LINK_TIMEOUT 40307
#define IDC_LINK_LAN 40308
#define IDC_LINK2P 40309
#define IDC_LINKTCP 40310
#define IDC_SSPEED 40311
#define IDC_SERVERSTART 40312
#define IDC_SERVERIP 40313
#define IDC_CLINKIP 40314
#define IDC_SPEEDOFF 40315
#define IDC_LINKCONNECT 40316
#define IDC_STATIC4 40317
#define ID_OPTIONS_LINK_OPTIONS 40318
#define ID_OPTIONS_LINK_LOG 40319
#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320
#define IDC_LINKTIMEOUT 40321
#define IDC_CLINKTCP 40322
#define IDC_SERVERWAIT 40323
#define IDC_LINKUDP 40324
#define IDC_LINK3P 40325
#define IDC_LINK4P 40326
#define IDC_CLINKUDP 40327
#define IDC_SPEEDON 40328
#define IDC_LINKTIMEOUT 40321
#define IDC_CLINKTCP 40322
#define IDC_SERVERWAIT 40323
#define IDC_LINKUDP 40324
#define IDC_LINK3P 40325
#define IDC_LINK4P 40326
#define IDC_CLINKUDP 40327
#define IDC_SPEEDON 40328
// Next default values for new objects
//
@ -742,7 +743,7 @@
#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

View File

@ -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");

View File

@ -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

View File

@ -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)
void AssignKey(KeyList &Key, int Out)
{
if (Key.IsEmpty())
return 0;
return Key.GetHead();
}
void TempWriteFirst(KeyList &Key, int Out)
{
Key.RemoveAll();
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,16 +87,17 @@ 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));
GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus();
return TRUE;
AssignKey(m_Keys, ((wParam<<8)|lParam));
SetWindowText(GetKeyListName(m_Keys));
GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus();
return TRUE;
}
BOOL JoypadEditControl::PreTranslateMessage(MSG *pMsg)
@ -108,22 +125,22 @@ JoypadConfig::JoypadConfig(int w, CWnd* pParent /*=NULL*/)
void JoypadConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(JoypadConfig)
DDX_Control(pDX, IDC_EDIT_UP, up);
DDX_Control(pDX, IDC_EDIT_SPEED, speed);
DDX_Control(pDX, IDC_EDIT_RIGHT, right);
DDX_Control(pDX, IDC_EDIT_LEFT, left);
DDX_Control(pDX, IDC_EDIT_DOWN, down);
DDX_Control(pDX, IDC_EDIT_CAPTURE, capture);
DDX_Control(pDX, IDC_EDIT_BUTTON_START, buttonStart);
DDX_Control(pDX, IDC_EDIT_BUTTON_SELECT, buttonSelect);
DDX_Control(pDX, IDC_EDIT_BUTTON_R, buttonR);
DDX_Control(pDX, IDC_EDIT_BUTTON_L, buttonL);
DDX_Control(pDX, IDC_EDIT_BUTTON_GS, buttonGS);
DDX_Control(pDX, IDC_EDIT_BUTTON_B, buttonB);
DDX_Control(pDX, IDC_EDIT_BUTTON_A, buttonA);
//}}AFX_DATA_MAP
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(JoypadConfig)
DDX_Control(pDX, IDC_EDIT_UP, up);
DDX_Control(pDX, IDC_EDIT_SPEED, speed);
DDX_Control(pDX, IDC_EDIT_RIGHT, right);
DDX_Control(pDX, IDC_EDIT_LEFT, left);
DDX_Control(pDX, IDC_EDIT_DOWN, down);
DDX_Control(pDX, IDC_EDIT_CAPTURE, capture);
DDX_Control(pDX, IDC_EDIT_BUTTON_START, buttonStart);
DDX_Control(pDX, IDC_EDIT_BUTTON_SELECT, buttonSelect);
DDX_Control(pDX, IDC_EDIT_BUTTON_R, buttonR);
DDX_Control(pDX, IDC_EDIT_BUTTON_L, buttonL);
DDX_Control(pDX, IDC_EDIT_BUTTON_GS, buttonGS);
DDX_Control(pDX, IDC_EDIT_BUTTON_B, buttonB);
DDX_Control(pDX, IDC_EDIT_BUTTON_A, buttonA);
//}}AFX_DATA_MAP
}
@ -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);
}
@ -178,47 +209,38 @@ void JoypadConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
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)])));
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)])));
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(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);
}

View File

@ -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,7 +93,8 @@ class JoypadConfig : public CDialog
JoypadEditControl buttonGS;
JoypadEditControl buttonB;
JoypadEditControl buttonA;
//}}AFX_DATA
//}}AFX_DATA
// Overrides
@ -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.