/* ZeroPAD - author: zerofrog(@gmail.com) * Copyright (C) 2006-2007 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "resource.h" #include "../zeropad.h" #include #include using namespace std; 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; extern keyEvent event; void SaveConfig() { char *szTemp; char szIniFile[256], szValue[256], szProf[256]; int i, j; GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); if(!szTemp) return; strcpy(szTemp, "\\inis\\zeropad.ini"); 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]); } 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; switch(uMsg) { case WM_INITDIALOG: LoadConfig(); padn = 0; if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE); for (i=0; i