Zeropad: Windows is back to compiling, though the config dialog is still broken.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1288 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-29 08:39:32 +00:00
parent 6d6e7fba36
commit e384d001da
8 changed files with 46 additions and 33 deletions

View File

@ -20,13 +20,12 @@
using namespace std; using namespace std;
HINSTANCE hInst = NULL;
extern u16 status[2]; extern u16 status[2];
extern string s_strIniPath; extern string s_strIniPath;
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDPROC GSwndProc = NULL; WNDPROC GSwndProc = NULL;
HWND GShwnd = NULL; HWND GShwnd = NULL;
HINSTANCE hInst = NULL;
extern keyEvent event; extern keyEvent event;
@ -94,7 +93,7 @@ string GetKeyLabel(const int pad, const int index)
} }
else if (key >= 0x3000 && key < 0x4000) // IS_POV; 0x30000 - 0x50000 else if (key >= 0x3000 && key < 0x4000) // IS_POV; 0x30000 - 0x50000
{ {
static const char name[][7] = { "FORWARD", "RIGHT", "BACK", "LEFT" }; static const char name[][8] = { "FORWARD", "RIGHT", "BACK", "LEFT" };
const int pov = (key & 0xff); const int pov = (key & 0xff);
sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]); sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]);
@ -107,8 +106,9 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
HWND hWC; HWND hWC;
TCITEM tcI; TCITEM tcI;
int i, key, numkeys; int i, key;
u8* pkeyboard; int numkeys;
//u8* pkeyboard;
static int disabled = 0; static int disabled = 0;
static int padn = 0; static int padn = 0;
@ -141,18 +141,19 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER: case WM_TIMER:
if (disabled) if (disabled)
{ {
key = 0;
//pkeyboard = SDL_GetKeyState(&numkeys); //pkeyboard = SDL_GetKeyState(&numkeys);
// Yeah, there's no way this will work, given that it's disabled. // Well, this doesn't exactly work either, but it's close...
numkeys = 256;
for (int i = 0; i < numkeys; ++i) for (int i = 0; i < numkeys; ++i)
{ {
if (pkeyboard[i]) if (GetAsyncKeyState(i))
{ {
key = i; key = i;
break; break;
} }
} }
if (key == 0) if (key == 0)
{ {
// check joystick // check joystick
@ -183,8 +184,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
EnableWindow(GetDlgItem(hW, disabled = wParam), FALSE); EnableWindow(GetDlgItem(hW, disabled = wParam), FALSE);
// Wait a silly amount of time for a keypress. SetTimer(hW, 0x80, 2500, NULL);
SetTimer(hW, 0x80, 250, NULL);
return TRUE; return TRUE;
} }
@ -250,10 +250,9 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
void CALLBACK PADconfigure() void CALLBACK PADconfigure()
{ {
DialogBox(hInst, INT_PTR ret;
MAKEINTRESOURCE(IDD_DIALOG1),
GetActiveWindow(), ret = DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_DIALOG1),GetActiveWindow(),(DLGPROC)ConfigureDlgProc,1);
(DLGPROC)ConfigureDlgProc);
} }
void CALLBACK PADabout() void CALLBACK PADabout()

View File

@ -31,3 +31,4 @@ extern void SaveConfig();
extern void LoadConfig(); extern void LoadConfig();
extern void SysMessage(char *fmt, ...); extern void SysMessage(char *fmt, ...);
extern LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); extern LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern HINSTANCE hInst;

View File

@ -98,19 +98,19 @@ namespace Analog
switch (padvalue) switch (padvalue)
{ {
case PAD_LX: case PAD_LX:
return (conf.options & PADOPTION_REVERTLX); return ((conf.options & PADOPTION_REVERTLX) != 0);
break; break;
case PAD_RX: case PAD_RX:
return (conf.options & PADOPTION_REVERTRX); return ((conf.options & PADOPTION_REVERTRX) != 0);
break; break;
case PAD_LY: case PAD_LY:
return (conf.options & PADOPTION_REVERTLY); return ((conf.options & PADOPTION_REVERTLY) != 0);
break; break;
case PAD_RY: case PAD_RY:
return (conf.options & PADOPTION_REVERTRY); return ((conf.options & PADOPTION_REVERTRY) != 0);
break; break;
default: default:

View File

@ -19,7 +19,12 @@
#ifndef __JOYSTICK_H__ #ifndef __JOYSTICK_H__
#define __JOYSTICK_H__ #define __JOYSTICK_H__
#ifdef __LINUX__
#include <SDL/SDL.h> #include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "zeropad.h" #include "zeropad.h"
// holds all joystick info // holds all joystick info

View File

@ -36,7 +36,10 @@ char* KeysymToChar(int keysym)
#ifdef __LINUX__ #ifdef __LINUX__
return XKeysymToString(keysym); return XKeysymToString(keysym);
#else #else
return; LPWORD temp;
ToAscii((UINT) keysym, NULL, NULL, temp, NULL);
return (char*)temp;
#endif #endif
} }
@ -172,7 +175,7 @@ bool PollX11Keyboard(char* &temp, u32 &pkey)
#else #else
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
int i, pad, keyPress[2] = {0}, keyRelease[2] = {0}; int keyPress[2] = {0}, keyRelease[2] = {0};
static bool lbutton = false, rbutton = false; static bool lbutton = false, rbutton = false;
switch (msg) switch (msg)
@ -180,9 +183,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_KEYDOWN: case WM_KEYDOWN:
if (lParam & 0x40000000) return TRUE; if (lParam & 0x40000000) return TRUE;
for (pad = 0; pad < 2; ++pad) for (int pad = 0; pad < 2; ++pad)
{ {
for (i = 0; i < PADKEYS; i++) for (int i = 0; i < PADKEYS; i++)
{ {
if (wParam == conf.keys[pad][i]) if (wParam == conf.keys[pad][i])
{ {
@ -198,9 +201,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_KEYUP: case WM_KEYUP:
for (pad = 0; pad < 2; ++pad) for (int pad = 0; pad < 2; ++pad)
{ {
for (i = 0; i < PADKEYS; i++) for (int i = 0; i < PADKEYS; i++)
{ {
if (wParam == conf.keys[pad][i]) if (wParam == conf.keys[pad][i])
{ {
@ -267,9 +270,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return GSwndProc(hWnd, msg, wParam, lParam); return GSwndProc(hWnd, msg, wParam, lParam);
} }
for (pad = 0; pad < 2; ++pad) for (int pad = 0; pad < 2; ++pad)
{ {
UpdateKeys(pad, keyPress, keyRelease) UpdateKeys(pad, keyPress[pad], keyRelease[pad]);
} }
return TRUE; return TRUE;

View File

@ -31,8 +31,8 @@ extern bool PollX11Keyboard(char* &temp, u32 &pkey);
#else #else
extern WNDPROC GSwndProc = NULL; extern WNDPROC GSwndProc;
extern HWND GShwnd = NULL; extern HWND GShwnd;
#endif #endif

View File

@ -23,7 +23,6 @@
#include <stdarg.h> #include <stdarg.h>
#include "zeropad.h" #include "zeropad.h"
#include "joystick.h"
#ifndef _WIN32 #ifndef _WIN32
@ -270,7 +269,9 @@ s32 CALLBACK PADopen(void *pDsp)
s_keyPress[0] = s_keyPress[1] = 0; s_keyPress[0] = s_keyPress[1] = 0;
s_keyRelease[0] = s_keyRelease[1] = 0; s_keyRelease[0] = s_keyRelease[1] = 0;
#ifdef __LINUX__
JoystickInfo::EnumerateJoysticks(s_vjoysticks); JoystickInfo::EnumerateJoysticks(s_vjoysticks);
#endif
return _PADopen(pDsp); return _PADopen(pDsp);
} }

View File

@ -37,6 +37,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <string> #include <string>
#include <pthread.h>
using namespace std; using namespace std;
#define PADdefs #define PADdefs
@ -44,6 +45,9 @@ extern "C"
{ {
#include "PS2Edefs.h" #include "PS2Edefs.h"
} }
#ifdef __LINUX__
#include "joystick.h"
#endif
#include "analog.h" #include "analog.h"
#include "bitwise.h" #include "bitwise.h"