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;
HINSTANCE hInst = NULL;
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;
HINSTANCE hInst = NULL;
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
{
static const char name[][7] = { "FORWARD", "RIGHT", "BACK", "LEFT" };
static const char name[][8] = { "FORWARD", "RIGHT", "BACK", "LEFT" };
const int pov = (key & 0xff);
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;
TCITEM tcI;
int i, key, numkeys;
u8* pkeyboard;
int i, key;
int numkeys;
//u8* pkeyboard;
static int disabled = 0;
static int padn = 0;
@ -141,18 +141,19 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER:
if (disabled)
{
key = 0;
//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)
{
if (pkeyboard[i])
if (GetAsyncKeyState(i))
{
key = i;
break;
}
}
if (key == 0)
{
// check joystick
@ -183,8 +184,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
EnableWindow(GetDlgItem(hW, disabled = wParam), FALSE);
// Wait a silly amount of time for a keypress.
SetTimer(hW, 0x80, 250, NULL);
SetTimer(hW, 0x80, 2500, NULL);
return TRUE;
}
@ -250,10 +250,9 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
void CALLBACK PADconfigure()
{
DialogBox(hInst,
MAKEINTRESOURCE(IDD_DIALOG1),
GetActiveWindow(),
(DLGPROC)ConfigureDlgProc);
INT_PTR ret;
ret = DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_DIALOG1),GetActiveWindow(),(DLGPROC)ConfigureDlgProc,1);
}
void CALLBACK PADabout()

View File

@ -30,4 +30,5 @@
extern void SaveConfig();
extern void LoadConfig();
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)
{
case PAD_LX:
return (conf.options & PADOPTION_REVERTLX);
return ((conf.options & PADOPTION_REVERTLX) != 0);
break;
case PAD_RX:
return (conf.options & PADOPTION_REVERTRX);
return ((conf.options & PADOPTION_REVERTRX) != 0);
break;
case PAD_LY:
return (conf.options & PADOPTION_REVERTLY);
return ((conf.options & PADOPTION_REVERTLY) != 0);
break;
case PAD_RY:
return (conf.options & PADOPTION_REVERTRY);
return ((conf.options & PADOPTION_REVERTRY) != 0);
break;
default:

View File

@ -16,10 +16,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __JOYSTICK_H__
#define __JOYSTICK_H__
#ifndef __JOYSTICK_H__
#define __JOYSTICK_H__
#ifdef __LINUX__
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "zeropad.h"
// holds all joystick info

View File

@ -36,7 +36,10 @@ char* KeysymToChar(int keysym)
#ifdef __LINUX__
return XKeysymToString(keysym);
#else
return;
LPWORD temp;
ToAscii((UINT) keysym, NULL, NULL, temp, NULL);
return (char*)temp;
#endif
}
@ -172,7 +175,7 @@ bool PollX11Keyboard(char* &temp, u32 &pkey)
#else
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;
switch (msg)
@ -180,9 +183,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_KEYDOWN:
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])
{
@ -198,9 +201,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
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])
{
@ -267,9 +270,9 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM 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;

View File

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

View File

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

View File

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