diff --git a/plugins/zeropad/Windows/win.cpp b/plugins/zeropad/Windows/win.cpp index 34a4eefc18..40e058721a 100644 --- a/plugins/zeropad/Windows/win.cpp +++ b/plugins/zeropad/Windows/win.cpp @@ -29,150 +29,142 @@ using namespace std; -HINSTANCE hInst = NULL; +HINSTANCE hInst=NULL; static pthread_spinlock_t s_mutexStatus; static u32 s_keyPress[2], s_keyRelease[2]; extern u16 status[2]; extern string s_strIniPath; LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -WNDPROC GSwndProc = NULL; -HWND GShwnd = NULL; +WNDPROC GSwndProc=NULL; +HWND GShwnd=NULL; extern keyEvent event; void SaveConfig() { - char *szTemp; - char szIniFile[256], szValue[256], szProf[256]; - int i, j; + char *szTemp; + char szIniFile[256], szValue[256], szProf[256]; + int i, j; - GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); - szTemp = strrchr(szIniFile, '\\'); + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); + szTemp = strrchr(szIniFile, '\\'); - if (!szTemp) return; - strcpy(szTemp, "\\inis\\zeropad.ini"); + if(!szTemp) return; + strcpy(szTemp, "\\inis\\zeropad.ini"); - for (j = 0; j < 2 * PADSUBKEYS; j++) - { - for (i = 0; i < PADKEYS; i++) - { - sprintf(szProf, "%d_%d", j, i); - sprintf(szValue, "%d", conf.keys[j][i]); - WritePrivateProfileString("Interface", szProf, szValue, szIniFile); - } - } + for (j=0; j<2; j++) { + for (i=0; i= 0x60 && key <= 0x69) - sprintf(buff, "NumPad %c", '0' + key - 0x60); - else - sprintf(buff, "%c", key); - } - } - else if (key >= 0x1000 && key < 0x2000) - { - sprintf(buff, "J%d_%d", (key & 0xfff) / 0x100, (key & 0xff) + 1); - } - else if (key >= 0x2000 && key < 0x3000) - { - static const char name[][4] = { "MIN", "MAX" }; - const int axis = (key & 0xff); - - sprintf(buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]); - if (index >= 17 && index <= 20) buff[strlen(buff) -4] = '\0'; - } - else if (key >= 0x3000 && key < 0x4000) - { - static const char name[][7] = { "FOWARD", "RIGHT", "BACK", "LEFT" }; - const int pov = (key & 0xff); - sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]); - } + const int key = conf.keys[pad][index]; + char buff[16]="NONE)"; + if (key < 0x100) + { + if (key == 0) + strcpy (buff, "NONE"); + else { + if(key>=0x60 && key<=0x69) { + sprintf(buff, "NumPad %c", '0' + key - 0x60); + } + else sprintf(buff, "%c", key); + } + } + else if (key >= 0x1000 && key < 0x2000) + { + sprintf (buff, "J%d_%d", (key & 0xfff) / 0x100, (key & 0xff) + 1); + } + else if (key >= 0x2000 && key < 0x3000) + { + static const char name[][4] = { "MIN", "MAX" }; + const int axis = (key & 0xff); + sprintf (buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]); + if (index >= 17 && index <= 20) + buff[strlen (buff) -4] = '\0'; + } + else if (key >= 0x3000 && key < 0x4000) + { + static const char name[][7] = { "FOWARD", "RIGHT", "BACK", "LEFT" }; + const int pov = (key & 0xff); + sprintf (buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov /4, name[pov % 4]); + } - return buff; + return buff; } -BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - HWND hWC; - TCITEM tcI; - int i, key, numkeys; - u8* pkeyboard; - static int disabled = 0; - static int padn = 0; +BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { + HWND hWC; + TCITEM tcI; + int i,key, numkeys; + u8* pkeyboard; + static int disabled=0; + static int padn=0; - switch (uMsg) - { - case WM_INITDIALOG: - LoadConfig(); - padn = 0; - if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE); + switch(uMsg) { + case WM_INITDIALOG: + LoadConfig(); + padn = 0; + if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE); - for (i = 0; i < PADKEYS; i++) - { - hWC = GetDlgItem(hW, IDC_L2 + i * 2); - Button_SetText(hWC, GetKeyLabel(padn, i).c_str()); - } + for (i=0; i