mirror of https://github.com/PCSX2/pcsx2.git
ZeroPad: Revert the changes to the Windows files in ZeroPad, and ifdef off the changes in the common areas, as the Windows version of ZeroPad is clearly only working by voodoo and bailing wire on Windows. (Note: unable to reproduce ZeroPad working properly in any revision [including playground days] on any version of Windows available. Likely because I don't have any poultry handy to sacrifice.)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1130 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
66a8c03ded
commit
b02d6a19dd
|
@ -54,10 +54,8 @@ void SaveConfig()
|
|||
if(!szTemp) return;
|
||||
strcpy(szTemp, "\\inis\\zeropad.ini");
|
||||
|
||||
for (j = 0; j < 2 * PADSUBKEYS; j++)
|
||||
{
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
{
|
||||
for (j=0; j<2; 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);
|
||||
|
@ -100,18 +98,15 @@ void LoadConfig()
|
|||
if(!szTemp) return ;
|
||||
strcpy(szTemp, "\\inis\\zeropad.ini");
|
||||
fp=fopen("inis\\zeropad.ini","rt");//check if usbnull.ini really exists
|
||||
if (!fp)
|
||||
{
|
||||
if (!fp) {
|
||||
CreateDirectory("inis",NULL);
|
||||
SaveConfig();//save and return
|
||||
return ;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
for (j = 0; j < 2 * PADSUBKEYS; j++)
|
||||
{
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
{
|
||||
for (j=0; j<2; j++) {
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
sprintf(szProf, "%d_%d", j, i);
|
||||
GetPrivateProfileString("Interface", szProf, NULL, szValue, 20, szIniFile);
|
||||
conf.keys[j][i] = strtoul(szValue, NULL, 10);
|
||||
|
@ -122,8 +117,7 @@ void LoadConfig()
|
|||
conf.log = strtoul(szValue, NULL, 10);
|
||||
}
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
void SysMessage(char *fmt, ...) {
|
||||
va_list list;
|
||||
char tmp[512];
|
||||
|
||||
|
@ -141,8 +135,7 @@ s32 _PADopen(void *pDsp)
|
|||
s_keyPress[0] = s_keyPress[1] = 0;
|
||||
s_keyRelease[0] = s_keyRelease[1] = 0;
|
||||
|
||||
if (GShwnd != NULL && GSwndProc != NULL)
|
||||
{
|
||||
if( GShwnd != NULL && GSwndProc != NULL ) {
|
||||
// revert
|
||||
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
||||
}
|
||||
|
@ -156,8 +149,7 @@ s32 _PADopen(void *pDsp)
|
|||
|
||||
void _PADclose()
|
||||
{
|
||||
if (GShwnd != NULL && GSwndProc != NULL)
|
||||
{
|
||||
if( GShwnd != NULL && GSwndProc != NULL ) {
|
||||
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
||||
GSwndProc = NULL;
|
||||
GShwnd = NULL;
|
||||
|
@ -184,27 +176,37 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
int i,pad,keyPress[2]={0},keyRelease[2]={0};
|
||||
static bool lbutton=false,rbutton=false;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_KEYDOWN:
|
||||
if (lParam & 0x40000000)
|
||||
return TRUE;
|
||||
|
||||
i = FindKey(wParam, pad);
|
||||
if (i != -1) {
|
||||
for(pad = 0; pad < 2; ++pad ) {
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
if (wParam == conf.keys[pad][i]) {
|
||||
keyPress[pad] |=(1<<i);
|
||||
keyRelease[pad] &=~(1<<i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.evt = KEYPRESS;
|
||||
event.key = wParam;
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
i = FindKey(wParam, pad);
|
||||
if (i != -1) {
|
||||
for(pad = 0; pad < 2; ++pad ) {
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
if (wParam == conf.keys[pad][i]) {
|
||||
keyPress[pad] &=~(1<<i);
|
||||
keyRelease[pad] |= (1<<i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
event.evt = KEYRELEASE;
|
||||
event.key = wParam;
|
||||
break;
|
||||
|
@ -261,8 +263,7 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
|
||||
pthread_spin_lock(&s_mutexStatus);
|
||||
for (pad = 0; pad < 2; ++pad)
|
||||
{
|
||||
for(pad = 0; pad < 2; ++pad ) {
|
||||
s_keyPress[pad] |= keyPress[pad];
|
||||
s_keyPress[pad] &= ~keyRelease[pad];
|
||||
s_keyRelease[pad] |= keyRelease[pad];
|
||||
|
@ -277,17 +278,15 @@ string GetKeyLabel(const int pad, const int index)
|
|||
{
|
||||
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)
|
||||
else {
|
||||
if(key>=0x60 && key<=0x69) {
|
||||
sprintf(buff, "NumPad %c", '0' + key - 0x60);
|
||||
else
|
||||
sprintf(buff, "%c", key);
|
||||
}
|
||||
else sprintf(buff, "%c", key);
|
||||
}
|
||||
}
|
||||
else if (key >= 0x1000 && key < 0x2000)
|
||||
|
@ -298,9 +297,9 @@ string GetKeyLabel(const int pad, const int index)
|
|||
{
|
||||
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';
|
||||
if (index >= 17 && index <= 20)
|
||||
buff[strlen (buff) -4] = '\0';
|
||||
}
|
||||
else if (key >= 0x3000 && key < 0x4000)
|
||||
{
|
||||
|
@ -312,8 +311,7 @@ string GetKeyLabel(const int pad, const int index)
|
|||
return buff;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
HWND hWC;
|
||||
TCITEM tcI;
|
||||
int i,key, numkeys;
|
||||
|
@ -321,15 +319,13 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
static int disabled=0;
|
||||
static int padn=0;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
LoadConfig();
|
||||
padn = 0;
|
||||
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE);
|
||||
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
{
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
hWC = GetDlgItem(hW, IDC_L2 + i*2);
|
||||
Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
|
||||
}
|
||||
|
@ -348,26 +344,21 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
|
||||
case WM_TIMER:
|
||||
if (disabled)
|
||||
{
|
||||
if (disabled){
|
||||
key = 0;
|
||||
//pkeyboard = SDL_GetKeyState(&numkeys);
|
||||
for (int i = 0; i < numkeys; ++i)
|
||||
{
|
||||
if (pkeyboard[i])
|
||||
{
|
||||
for (int i = 0; i < numkeys; ++i) {
|
||||
if( pkeyboard[i] ) {
|
||||
key = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (key == 0)
|
||||
{
|
||||
if( key == 0 ) {
|
||||
// check joystick
|
||||
}
|
||||
|
||||
if (key != 0)
|
||||
{
|
||||
if (key != 0){
|
||||
KillTimer(hW, 0x80);
|
||||
hWC = GetDlgItem(hW, disabled);
|
||||
conf.keys[padn][disabled-IDC_L2] = key;
|
||||
|
@ -395,21 +386,16 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
KillTimer(hW, 0x80);
|
||||
EndDialog(hW, TRUE);
|
||||
return TRUE;
|
||||
|
||||
case IDOK:
|
||||
KillTimer(hW, 0x80);
|
||||
|
||||
if (IsDlgButtonChecked(hW, IDC_LOG))
|
||||
conf.log = 1;
|
||||
else
|
||||
conf.log = 0;
|
||||
|
||||
else conf.log = 0;
|
||||
SaveConfig();
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
|
@ -417,18 +403,17 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (wParam)
|
||||
{
|
||||
switch (wParam) {
|
||||
case IDC_TABC:
|
||||
hWC = GetDlgItem(hW, IDC_TABC);
|
||||
padn = TabCtrl_GetCurSel(hWC);
|
||||
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
{
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
hWC = GetDlgItem(hW, IDC_EL3 + i);
|
||||
Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -436,16 +421,13 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
|
@ -454,28 +436,24 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void CALLBACK PADconfigure()
|
||||
{
|
||||
void CALLBACK PADconfigure() {
|
||||
DialogBox(hInst,
|
||||
MAKEINTRESOURCE(IDD_DIALOG1),
|
||||
GetActiveWindow(),
|
||||
(DLGPROC)ConfigureDlgProc);
|
||||
}
|
||||
|
||||
void CALLBACK PADabout()
|
||||
{
|
||||
void CALLBACK PADabout() {
|
||||
SysMessage("Author: zerofrog\nThanks to SSSPSXPad, TwinPAD, and PADwin plugins");
|
||||
}
|
||||
|
||||
s32 CALLBACK PADtest()
|
||||
{
|
||||
s32 CALLBACK PADtest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||
DWORD dwReason,
|
||||
LPVOID lpReserved)
|
||||
{
|
||||
LPVOID lpReserved) {
|
||||
hInst = (HINSTANCE)hModule;
|
||||
return TRUE; // very quick :)
|
||||
}
|
||||
|
|
|
@ -136,6 +136,14 @@ void _KeyPress(int pad, u32 key)
|
|||
{
|
||||
int i;
|
||||
|
||||
#ifdef _WIN32
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
if (key == conf.keys[pad][i]) {
|
||||
status[pad]&=~(1<<i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int p = 0; p < PADSUBKEYS; p++)
|
||||
{
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
|
@ -147,6 +155,7 @@ void _KeyPress(int pad, u32 key)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
event.evt = KEYPRESS;
|
||||
event.key = key;
|
||||
|
@ -156,6 +165,14 @@ void _KeyRelease(int pad, u32 key)
|
|||
{
|
||||
int i;
|
||||
|
||||
#ifdef _WIN32
|
||||
for (i=0; i<PADKEYS; i++) {
|
||||
if (key == conf.keys[pad][i]) {
|
||||
status[pad]|= (1<<i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int p = 0; p < PADSUBKEYS; p++)
|
||||
{
|
||||
for (i = 0; i < PADKEYS; i++)
|
||||
|
@ -167,7 +184,7 @@ void _KeyRelease(int pad, u32 key)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
event.evt = KEYRELEASE;
|
||||
event.key = key;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,12 @@ extern char libraryName[256];
|
|||
#define PADOPTION_REVERTRX 0x8
|
||||
#define PADOPTION_REVERTRY 0x10
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PADSUBKEYS 1
|
||||
#else
|
||||
#define PADSUBKEYS 2
|
||||
#endif
|
||||
|
||||
extern int PadEnum[2][2];
|
||||
|
||||
typedef struct
|
||||
|
|
Loading…
Reference in New Issue