summaryrefslogtreecommitdiff
path: root/win32/plugins/PadSSSPSX
diff options
context:
space:
mode:
Diffstat (limited to 'win32/plugins/PadSSSPSX')
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.cpp2288
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.def44
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.dsp246
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.h94
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.rc240
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSX.vcproj562
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/PadSSSPSXres.h122
-rwxr-xr-x[-rw-r--r--]win32/plugins/PadSSSPSX/readmewip.txt96
8 files changed, 1846 insertions, 1846 deletions
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.cpp b/win32/plugins/PadSSSPSX/PadSSSPSX.cpp
index 8de98114..8c494e4d 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.cpp
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.cpp
@@ -1,1144 +1,1144 @@
-#define WINVER 0x0500
-#define _WIN32_WINNT WINVER
-#define DIRECTINPUT_VERSION 0x0800
-
-// Modified by Wei Mingzhi <whistler_wmz@users.sf.net> at 10/2/2009
-// Added default keys, use registry instead of configuration file
-
-// Modified by Wei Mingzhi <whistler_wmz@users.sf.net> at 12/3/2009
-// Quick hack fix for FF8 "reverting" problem in menus
-// Added configuration for enabling/disabling DualShock
-
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <dinput.h>
-
-#include "PadSSSPSX.h"
-
-static const char* LibraryName = "SSSPSX PAD Plugin Pressure Mod";
-static const unsigned char version = 0x0002;
-static const unsigned char revision = 1;
-static const unsigned char build = 6;
-
-HMODULE hInstance;
-HWND hTargetWnd;
-
-static void (CALLBACK *gpuVisualVibration)(unsigned long, unsigned long) = NULL;
-
-static struct
-{
- Config config;
- int devcnt;
- LPDIRECTINPUT8 pDInput;
- LPDIRECTINPUTDEVICE8 pDKeyboard;
- LPDIRECTINPUTDEVICE8 pDDevice[4];
- LPDIRECTINPUTEFFECT pDEffect[4][2]; /* for Small & Big Motor */
- DIJOYSTATE JoyState[4];
- u16 padStat[2];
- int padID[2];
- int padMode1[2];
- int padMode2[2];
- int padModeE[2];
- int padModeC[2];
- int padModeF[2];
- int padVib0[2];
- int padVib1[2];
- int padVibF[2][4];
- int padVibC[2];
- DWORD padPress[2][16];
- int curPad;
- int curByte;
- int curCmd;
- int cmdLen;
-} global;
-
-static BOOL CALLBACK EnumAxesCallback (LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
-{
- LPDIRECTINPUTDEVICE8 pDDevice = (LPDIRECTINPUTDEVICE8)pvRef;
- DIPROPRANGE diprg;
- diprg.diph.dwSize = sizeof (diprg);
- diprg.diph.dwHeaderSize = sizeof (diprg.diph);
- diprg.diph.dwObj = lpddoi->dwType;
- diprg.diph.dwHow = DIPH_BYID;
- diprg.lMin = -128;
- diprg.lMax = 127;
- pDDevice->SetProperty (DIPROP_RANGE, &diprg.diph);
- return DIENUM_CONTINUE;
-}
-
-static BOOL CALLBACK EnumJoysticksCallback (const DIDEVICEINSTANCE* instance, VOID* pContext)
-{
- const int devno = global.devcnt;
- if (devno >= 4)
- return DIENUM_STOP;
- HRESULT result = global.pDInput->CreateDevice (instance->guidInstance, &global.pDDevice[devno], NULL);
- if (FAILED (result))
- return DIENUM_CONTINUE;
- global.devcnt++;
- return DIENUM_CONTINUE;
-}
-
-static bool ReleaseDirectInput (void)
-{
- int index = 4;
- while (index--)
- {
- if (global.pDEffect[index][0])
- {
- global.pDEffect[index][0]->Unload();
- global.pDEffect[index][0]->Release();
- global.pDEffect[index][0] = NULL;
- }
- if (global.pDEffect[index][1])
- {
- global.pDEffect[index][1]->Unload();
- global.pDEffect[index][1]->Release();
- global.pDEffect[index][1] = NULL;
- }
- if (global.pDDevice[index])
- {
- global.pDDevice[index]->Unacquire();
- global.pDDevice[index]->Release();
- global.pDDevice[index] = NULL;
- }
- }
- if (global.pDKeyboard)
- {
- global.pDKeyboard->Unacquire();
- global.pDKeyboard->Release();
- global.pDKeyboard = NULL;
- }
- if (global.pDInput)
- {
- global.pDInput->Release();
- global.pDInput = NULL;
- }
- global.devcnt = 0;
- return FALSE;
-}
-
-static bool InitDirectInput (void)
-{
- if (global.pDInput)
- return TRUE;
- HRESULT result = DirectInput8Create (hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&global.pDInput, NULL);
- if (FAILED (result))
- return ReleaseDirectInput();
- result = global.pDInput->CreateDevice (GUID_SysKeyboard, &global.pDKeyboard, NULL);
- if (FAILED (result))
- return ReleaseDirectInput();
- result = global.pDInput->EnumDevices (DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY);
- if (FAILED (result))
- return ReleaseDirectInput();
- result = global.pDKeyboard->SetDataFormat (&c_dfDIKeyboard);
- if (FAILED (result))
- return ReleaseDirectInput();
- if (hTargetWnd)
- {
- global.pDKeyboard->Unacquire();
- result = global.pDKeyboard->SetCooperativeLevel (hTargetWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
- if (FAILED (result))
- return ReleaseDirectInput();
- }
- int index = global.devcnt;
- while (index--)
- {
- const LPDIRECTINPUTDEVICE8 pDDevice = global.pDDevice[index];
- result = pDDevice->SetDataFormat (&c_dfDIJoystick);
- if (FAILED (result))
- return ReleaseDirectInput();
- if (hTargetWnd)
- {
- pDDevice->Unacquire();
- result = pDDevice->SetCooperativeLevel (hTargetWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE);
- if (FAILED (result))
- return ReleaseDirectInput();
- }
- struct
- {
- DIPROPDWORD dipdw;
- DWORD rgdwAxes[2];
- LONG rglDirection[2];
- DIPERIODIC per;
- DICONSTANTFORCE cf;
- DIEFFECT eff;
- } local;
- memset (&local, 0, sizeof (local));
- local.dipdw.diph.dwSize = sizeof (DIPROPDWORD);
- local.dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
- local.dipdw.diph.dwHow = DIPH_DEVICE;
- local.dipdw.dwData = DIPROPAUTOCENTER_OFF;
- pDDevice->SetProperty (DIPROP_AUTOCENTER, &local.dipdw.diph);
- result = pDDevice->EnumObjects (EnumAxesCallback, pDDevice, DIDFT_AXIS);
- if (FAILED (result))
- return ReleaseDirectInput();
-
- local.rgdwAxes[0] = DIJOFS_X;
- local.rgdwAxes[1] = DIJOFS_Y;
- local.eff.dwSize = sizeof (DIEFFECT);
- local.eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
- local.eff.dwDuration = INFINITE;
- local.eff.dwGain = DI_FFNOMINALMAX;
- local.eff.dwTriggerButton = DIEB_NOTRIGGER;
- local.eff.cAxes = 2;
- local.eff.rgdwAxes = local.rgdwAxes;
- local.eff.rglDirection = local.rglDirection;
-
- /* Small Motor */
- local.eff.cbTypeSpecificParams = sizeof (DIPERIODIC);
- local.eff.lpvTypeSpecificParams = &local.per;
- result = pDDevice->CreateEffect (GUID_Square , &local.eff, &global.pDEffect[index][0], NULL);
- if (FAILED (result))
- global.pDEffect[index][0] = NULL;
-
- /* Big Motor */
- local.eff.cbTypeSpecificParams = sizeof (DICONSTANTFORCE);
- local.eff.lpvTypeSpecificParams = &local.cf;
- result = pDDevice->CreateEffect (GUID_ConstantForce , &local.eff, &global.pDEffect[index][1], NULL);
- if (FAILED (result))
- global.pDEffect[index][1] = NULL;
- }
- return TRUE;
-}
-
-static bool AcquireDevice (LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
-{
- if (FAILED (lpDirectInputDevice->Acquire()))
- {
- HRESULT result = lpDirectInputDevice->Acquire();
- if (result == DIERR_OTHERAPPHASPRIO)
- return FALSE;
- if (FAILED (result))
- return ReleaseDirectInput();
- }
- return TRUE;
-}
-
-/* Small Motor */
-static bool SetDeviceForceS (int pad, DWORD force)
-{
- InitDirectInput();
- if (global.pDEffect[pad][0])
- {
- if ( force == 0) {
- if (FAILED (global.pDEffect[pad][0]->Stop())) {
- AcquireDevice (global.pDDevice[pad]);
- if (FAILED (global.pDEffect[pad][0]->Stop()))
- return ReleaseDirectInput();
- }
- return TRUE;
- }
- LONG rglDirection[2] = { 0, 0 };
- DIPERIODIC per;
- rglDirection[0] = force;
- rglDirection[1] = force;
- per.dwMagnitude = force;
- per.dwPeriod = (DWORD) (0.01 * DI_SECONDS);
- per.lOffset = 0;
- per.dwPhase = 0;
- DIEFFECT eff;
- eff.dwSize = sizeof (DIEFFECT);
- eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
- eff.cAxes = 2;
- eff.rglDirection = rglDirection;
- eff.lpEnvelope = 0;
- eff.cbTypeSpecificParams = sizeof (DIPERIODIC);
- eff.lpvTypeSpecificParams = &per;
- if (FAILED (global.pDEffect[pad][0]->SetParameters (&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START)))
- return ReleaseDirectInput();
- if (FAILED (global.pDEffect[pad][0]->Start (1, 0)))
- {
- AcquireDevice (global.pDDevice[pad]);
- if (FAILED (global.pDEffect[pad][0]->Start (1, 0)))
- return ReleaseDirectInput();
- }
- }
- return TRUE;
-}
-
-/* Big Motor */
-static bool SetDeviceForceB (int pad, DWORD force)
-{
- InitDirectInput();
- if (global.pDEffect[pad][1])
- {
- if ( force == 0) {
- if (FAILED (global.pDEffect[pad][1]->Stop())) {
- AcquireDevice (global.pDDevice[pad]);
- if (FAILED (global.pDEffect[pad][1]->Stop()))
- return ReleaseDirectInput();
- }
- return TRUE;
- }
- LONG rglDirection[2] = { 0, 0 };
- DICONSTANTFORCE cf;
- rglDirection[0] = force;
- rglDirection[1] = force;
- cf.lMagnitude = force;
- DIEFFECT eff;
- eff.dwSize = sizeof (DIEFFECT);
- eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
- eff.cAxes = 2;
- eff.rglDirection = rglDirection;
- eff.lpEnvelope = 0;
- eff.cbTypeSpecificParams = sizeof (DICONSTANTFORCE);
- eff.lpvTypeSpecificParams = &cf;
- if (FAILED (global.pDEffect[pad][1]->SetParameters (&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START)))
- return ReleaseDirectInput();
- if (FAILED (global.pDEffect[pad][1]->Start (1, 0)))
- {
- AcquireDevice (global.pDDevice[pad]);
- if (FAILED (global.pDEffect[pad][1]->Start (1, 0)))
- return ReleaseDirectInput();
- }
- }
- return TRUE;
-}
-
-static bool GetJoyState (const int devno)
-{
- InitDirectInput();
- if (global.pDDevice[devno] == NULL)
- return FALSE;
- global.pDDevice[devno]->Poll();
- if (FAILED (global.pDDevice[devno]->GetDeviceState (sizeof (DIJOYSTATE), &global.JoyState[devno])))
- {
- AcquireDevice (global.pDDevice[devno]);
- return FALSE;
- }
- return TRUE;
-}
-
-static bool GetKeyState (u8* keyboard)
-{
- InitDirectInput();
- if (global.pDKeyboard == NULL)
- return FALSE;
- global.pDKeyboard->Poll();
- if (FAILED (global.pDKeyboard->GetDeviceState (256, keyboard)))
- {
- AcquireDevice (global.pDKeyboard);
- return FALSE;
- }
- return TRUE;
-}
-
-static void SetDefaultConfig (void)
-{
- memset (&global.config, 0, sizeof(global.config));
-
- global.config.keys[0][0] = 0x2E;
- global.config.keys[0][3] = 0x2F;
- global.config.keys[0][4] = 0xC8;
- global.config.keys[0][5] = 0xCD;
- global.config.keys[0][6] = 0xD0;
- global.config.keys[0][7] = 0xCB;
- global.config.keys[0][8] = 0x12;
- global.config.keys[0][9] = 0x14;
- global.config.keys[0][10] = 0x11;
- global.config.keys[0][11] = 0x13;
- global.config.keys[0][12] = 0x20;
- global.config.keys[0][13] = 0x2D;
- global.config.keys[0][14] = 0x2C;
- global.config.keys[0][15] = 0x1F;
-
- global.config.dualshock = FALSE;
-}
-
-static void SaveConfig (void)
-{
- HKEY myKey;
- DWORD myDisp;
-
- RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Vision Thing\\PSEmu Pro\\PAD\\PadSSSPSX", 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp);
-
- RegSetValueEx(myKey, "cfg", 0, REG_BINARY, (CONST BYTE *)&global.config, sizeof(global.config));
-
- RegCloseKey(myKey);
-}
-
-static void LoadConfig (void)
-{
- HKEY myKey;
- DWORD type, size;
-
- SetDefaultConfig ();
-
- if (RegOpenKeyEx (HKEY_CURRENT_USER, "Software\\Vision Thing\\PSEmu Pro\\PAD\\PadSSSPSX", 0,
- KEY_ALL_ACCESS, &myKey) == ERROR_SUCCESS)
- {
- size = sizeof(global.config);
- RegQueryValueEx (myKey, "cfg", NULL, &type, (LPBYTE)&global.config, &size);
- RegCloseKey (myKey);
- }
-
- global.padVibC[0] = global.padVibC[1] = -1;
- for (int cnt = 21; cnt--; )
- {
- const int key0 = global.config.keys[0][cnt];
- if (key0 >= 0x1000)
- global.padVibC[0] = (key0 & 0xfff) / 0x100;
- const int key1 = global.config.keys[1][cnt];
- if (key1 >= 0x1000)
- global.padVibC[1] = (key1 & 0xfff) / 0x100;
- }
-}
-
-static void PADsetMode (const int pad, const int mode)
-{
- static const u8 padID[] = { 0x41, 0x73, 0x41, 0x79 };
- global.padMode1[pad] = mode;
- global.padVib0[pad] = 0;
- global.padVib1[pad] = 0;
- global.padVibF[pad][0] = 0;
- global.padVibF[pad][1] = 0;
- global.padID[pad] = padID[global.padMode2[pad] * 2 + mode];
-}
-
-static void KeyPress (const int pad, const int index, const bool press)
-{
- if (index < 16)
- {
- if (press)
- {
- global.padStat[pad] &= ~(1 << index);
- if (global.padPress[pad][index] == 0)
- global.padPress[pad][index] = GetTickCount();
- }
- else
- {
- global.padStat[pad] |= 1 << index;
- global.padPress[pad][index] = 0;
- }
- }
- else if (global.config.dualshock)
- {
- static bool prev[2] = { FALSE, FALSE };
- if ((prev[pad] != press) && (global.padModeF[pad] == 0))
- {
- prev[pad] = press;
- if (press) PADsetMode (pad, !global.padMode1[pad]);
- }
- }
-}
-
-static void UpdateState (const int pad)
-{
- static int flag_keyboard;
- static int flag_joypad[4];
- if (pad == 0)
- {
- flag_keyboard = 0;
- flag_joypad[0] = 0;
- flag_joypad[1] = 0;
- flag_joypad[2] = 0;
- flag_joypad[3] = 0;
- }
- static u8 keystate[256];
- for (int index = 17; index--; )
- {
- const int key = global.config.keys[pad][index];
- if (key == 0)
- continue;
- else if (key < 0x100)
- {
- if (flag_keyboard == FALSE)
- {
- flag_keyboard = TRUE;
- if (GetKeyState (keystate) == FALSE)
- return;
- }
- KeyPress (pad, index, keystate[key] & 0x80);
- }
- else
- {
- const int joypad = ((key & 0xfff) / 100);
- if (flag_joypad[joypad] == FALSE)
- {
- flag_joypad[joypad] = TRUE;
- if (GetJoyState (joypad) == FALSE)
- return;
- }
- if (key < 0x2000)
- {
- KeyPress (pad, index, global.JoyState[joypad].rgbButtons[key & 0xff]);
- }
- else if (key < 0x3000)
- {
- const int state = ((int*)&global.JoyState[joypad].lX)[(key & 0xff) /2];
- switch (key & 1)
- {
- case 0: KeyPress (pad, index, state < -64); break;
- case 1: KeyPress (pad, index, state >= 64); break;
- }
- }
- else
- {
- const u32 state = global.JoyState[joypad].rgdwPOV[(key & 0xff) /4];
- switch (key & 3)
- {
- case 0: KeyPress (pad, index, (state >= 0 && state <= 4500) || (state >= 31500 && state <= 36000)); break;
- case 1: KeyPress (pad, index, state >= 4500 && state <= 13500); break;
- case 2: KeyPress (pad, index, state >= 13500 && state <= 22500); break;
- case 3: KeyPress (pad, index, state >= 22500 && state <= 31500); break;
- }
- }
- }
- }
-
- /* Small Motor */
- const int vib0 = global.padVibF[pad][0] ? 10000 : 0;
- if ((global.padVibF[pad][2] != vib0) && (global.padVibC[pad] >= 0))
- {
- global.padVibF[pad][2] = vib0;
- SetDeviceForceS (global.padVibC[pad], vib0);
- }
- /* Big Motor */
- const int vib1 = global.padVibF[pad][1] ? 500 + 37*global.padVibF[pad][1] : 0;
- if ((global.padVibF[pad][3] != vib1) && (global.padVibC[pad] >= 0))
- {
- global.padVibF[pad][3] = vib1;
- SetDeviceForceB (global.padVibC[pad], vib1);
- }
-}
-
-static void set_label (const HWND hWnd, const int pad, const int index)
-{
- const int key = global.config.keys[pad][index];
- char buff[64];
- if (key < 0x100)
- {
- if (key == 0)
- strcpy (buff, "NONE");
- else if (GetKeyNameText (key << 16, buff, sizeof (buff)) == 0)
- wsprintf (buff, "Keyboard 0x%02X", key);
- }
- else if (key >= 0x1000 && key < 0x2000)
- {
- wsprintf (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);
- wsprintf (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);
- wsprintf (buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov /4, name[pov % 4]);
- }
- Button_SetText (GetDlgItem (hWnd, IDC_ESELECT + index), buff);
-}
-
-static BOOL CALLBACK ConfigureDlgProc (const HWND hWnd, const UINT msg, const WPARAM wParam, const LPARAM lParam)
-{
- static BYTE keymaps[2][256];
- static DWORD countdown;
- static int disabled;
- static HWND hTabWnd;
- static int pad;
- int cnt1;
- int cnt2;
- int key;
- switch (msg)
- {
- case WM_INITDIALOG:
- hTargetWnd = hWnd;
- pad = disabled = 0;
- LoadConfig();
- for (cnt1 = 21; cnt1--; )
- set_label (hWnd, pad, cnt1);
- hTabWnd = GetDlgItem (hWnd, IDC_TABC);
- TCITEM tcI;
- tcI.mask = TCIF_TEXT;
- tcI.pszText = "PAD1";
- TabCtrl_InsertItem (hTabWnd, 0, &tcI);
- tcI.mask = TCIF_TEXT;
- tcI.pszText = "PAD2";
- TabCtrl_InsertItem (hTabWnd, 1, &tcI);
- CheckDlgButton(hWnd, IDC_DS2, global.config.dualshock);
- CheckDlgButton(hWnd, IDC_VV3, global.config.visualvibration[0]);
- EnableWindow(GetDlgItem(hWnd, IDC_BMODE), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BLAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BLAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BRAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BRAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BL3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BR3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_EMODE), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ELAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ELAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ERAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ERAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_EL3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ER3), global.config.dualshock);
- SetTimer (hWnd, 0x80, 50, NULL);
- return TRUE;
- case WM_DESTROY:
- break;
- case WM_NOTIFY:
- if (wParam == IDC_TABC)
- {
- if (disabled)
- EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
- disabled = 0;
- pad = TabCtrl_GetCurSel (hTabWnd);
- for (cnt1 = 21; cnt1--; )
- set_label (hWnd, pad, cnt1);
- CheckDlgButton(hWnd, IDC_VV3, global.config.visualvibration[pad]);
- }
- break;
- case WM_COMMAND:
- for (cnt1 = 21; cnt1--; )
- {
- if (LOWORD (wParam) == IDC_BSELECT + cnt1)
- {
- if (disabled)
- EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
- EnableWindow (GetDlgItem (hWnd, disabled = wParam), FALSE);
- EnableWindow (GetDlgItem (hWnd, IDC_DS2), FALSE);
- countdown = GetTickCount();
- GetKeyState (keymaps[0]);
- return TRUE;
- }
- }
- if (LOWORD (wParam) == IDOK)
- EndDialog (hWnd, IDOK);
- else if (LOWORD (wParam) == IDCANCEL)
- EndDialog (hWnd, IDCANCEL);
- else if (LOWORD (wParam) == IDC_DS2)
- {
- global.config.dualshock = IsDlgButtonChecked(hWnd, IDC_DS2);
-
- EnableWindow(GetDlgItem(hWnd, IDC_BMODE), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BLAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BLAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BRAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BRAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BL3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_BR3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_EMODE), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ELAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ELAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ERAX), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ERAY), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_EL3), global.config.dualshock);
- EnableWindow(GetDlgItem(hWnd, IDC_ER3), global.config.dualshock);
- }
- else if (LOWORD (wParam) == IDC_VV3)
- {
- global.config.visualvibration[pad] ^= 1;
- }
- break;
- case WM_TIMER:
- if (disabled)
- {
- const int index = disabled - IDC_BSELECT;
- int analog = FALSE;
- if ((GetTickCount() - countdown) / 1000 != 10)
- {
- char buff[64];
- wsprintf (buff, "Timeout: %d", 10 - (GetTickCount() - countdown) / 1000);
- SetWindowText (GetDlgItem (hWnd, IDC_ESELECT + index), buff);
- }
- else
- {
- global.config.keys[pad][index] = 0;
- set_label (hWnd, pad, index);
- EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
- EnableWindow (GetDlgItem (hWnd, IDC_DS2), TRUE);
- disabled = 0;
- break;
- }
- if (GetKeyState (keymaps[1]) == FALSE)
- break;
- for (key = 0x100; key--; )
- {
- if (~keymaps[0][key] & keymaps[1][key] & 0x80)
- break;
- }
- for (cnt1 = global.devcnt; cnt1--;)
- {
- if (GetJoyState (cnt1) == FALSE)
- break;
-
- for (cnt2 = 32; cnt2--; )
- {
- if (global.JoyState[cnt1].rgbButtons[cnt2])
- key = 0x1000 + 0x100 * cnt1 + cnt2;
- }
- for (cnt2 = 8; cnt2--; )
- {
- const int now = ((u32*)&global.JoyState[cnt1].lX)[cnt2];
- if (now < -64)
- {
- key = 0x2000 + 0x100 * cnt1 + cnt2 * 2 +0;
- analog = TRUE;
- }
- else if (now >= 64)
- {
- key = 0x2000 + 0x100 * cnt1 + cnt2 * 2 +1;
- analog = TRUE;
- }
- }
- for (cnt2 = 4; cnt2--; )
- {
- const u32 now = global.JoyState[cnt1].rgdwPOV[cnt2];
- if ((now >= 0 && now < 4500) || (now >= 31500 && now < 36000))
- key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +0;
- if (now >= 4500 && now < 13500)
- key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +1;
- if (now >= 13500 && now < 22500)
- key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +2;
- if (now >= 22500 && now < 31500)
- key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +3;
- }
- }
- if (index >= 17 && index <= 20 && analog == 0)
- key = 0;
- else if (key > 0)
- {
- if (key != 1)
- global.config.keys[pad][index] = key;
- set_label (hWnd, pad, index);
- EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
- EnableWindow (GetDlgItem (hWnd, IDC_DS2), TRUE);
- disabled = 0;
- }
- }
- }
- return FALSE;
-}
-
-u32 CALLBACK PS2EgetLibType (void)
-{
- return 0x02;
-}
-
-const char* CALLBACK PS2EgetLibName (void)
-{
- return LibraryName;
-}
-
-u32 CALLBACK PS2EgetLibVersion2 (u32 type)
-{
- return (version << 16) | (revision << 8) | build;
-}
-
-u32 CALLBACK PSEgetLibType (void)
-{
- return 8;
-}
-
-const char* CALLBACK PSEgetLibName (void)
-{
- return LibraryName;
-}
-
-u32 CALLBACK PSEgetLibVersion (void)
-{
- return (version << 16) | (revision << 8) | build;
-}
-
-s32 CALLBACK PADinit (u32 flags)
-{
- return 0;
-}
-
-void CALLBACK PADshutdown (void)
-{
-}
-
-static int n_open = 0;
-s32 CALLBACK PADopen (HWND hWnd)
-{
- if (!IsWindow (hWnd) && !IsBadReadPtr ((u32*)hWnd, 4))
- hWnd = *(HWND*)hWnd;
- if (!IsWindow (hWnd))
- hWnd = NULL;
- else
- {
- while (GetWindowLong (hWnd, GWL_STYLE) & WS_CHILD)
- hWnd = GetParent (hWnd);
- }
- hTargetWnd = hWnd;
- if (n_open++ == FALSE)
- {
- memset (&global, 0, sizeof (global));
- global.padStat[0] = 0xffff;
- global.padStat[1] = 0xffff;
- LoadConfig();
- PADsetMode (0, 0);
- PADsetMode (1, 0);
- }
- return 0;
-}
-
-void CALLBACK PADclose (void)
-{
- if (--n_open == 0)
- ReleaseDirectInput();
-}
-
-u32 CALLBACK PADquery (void)
-{
- return 3;
-}
-
-u8 CALLBACK PADstartPoll (int pad)
-{
- global.curPad = pad -1;
- global.curByte = 0;
- return 0xff;
-}
-
-static const u8 cmd40[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x5a
-};
-static const u8 cmd41[8] =
-{
- 0xff, 0x5a, 0xff, 0xff, 0x03, 0x00, 0x00, 0x5a,
-};
-static const u8 cmd44[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-static const u8 cmd45[8] =
-{
- 0xff, 0x5a, 0x03, 0x02, 0x01, 0x02, 0x01, 0x00,
-};
-static const u8 cmd46[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0a,
-};
-static const u8 cmd47[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
-};
-static const u8 cmd4c[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-static const u8 cmd4d[8] =
-{
- 0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-};
-static const u8 cmd4f[8] =
-{
- 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a,
-};
-
-static u8 get_analog (const int key)
-{
- const int pad = ((key & 0xf00) / 0x100);
- const int pos = ((key & 0x0ff) /2);
-// return (u8)(((int*)&global.JoyState[pad].lX)[pos] + 128);
- u8 r = (u8)(((int*)&global.JoyState[pad].lX)[pos] + 128);
- if (r == 128) r = 127; // FIXME: ???
- return r;
-}
-
-static u8 get_pressure (const DWORD now, const DWORD press)
-{
- /*if (press == 0)
- return 0;
- return (u8)((now - press > 2550) ? 255 : (now - press) / 10);*/
- return 255;
-}
-
-u8 CALLBACK PADpoll (u8 value)
-{
- const int pad = global.curPad;
- const int cur = global.curByte;
- static u8 buf[20];
-
- if (!global.config.dualshock)
- {
- value = 0x42;
- }
-
- if (cur == 0)
- {
- global.curByte++;
- global.curCmd = value;
- switch (value)
- {
- case 0x40:
- global.cmdLen = sizeof (cmd40);
- memcpy (buf, cmd40, sizeof (cmd40));
- return 0xf3;
- case 0x41:
- global.cmdLen = sizeof (cmd41);
- memcpy (buf, cmd41, sizeof (cmd41));
- return 0xf3;
- case 0x42:
- case 0x43:
- if (value == 0x42) UpdateState (pad);
- global.cmdLen = 2 + 2 * (global.padID[pad] & 0x0f);
- buf[1] = global.padModeC[pad] ? 0x00 : 0x5a;
- *(u16*)&buf[2] = global.padStat[pad];
- if (value == 0x43 && global.padModeE[pad])
- {
- buf[4] = 0;
- buf[5] = 0;
- buf[6] = 0;
- buf[7] = 0;
- return 0xf3;
- }
- else
- {
- buf[ 4] = get_analog (global.config.keys[pad][19]);
- buf[ 5] = get_analog (global.config.keys[pad][20]);
- buf[ 6] = get_analog (global.config.keys[pad][17]);
- buf[ 7] = get_analog (global.config.keys[pad][18]);
-
- if (global.padID[pad] == 0x79)
- {
- const DWORD now = GetTickCount();
- buf[ 8] = get_pressure (now, global.padPress[pad][2]);
- buf[ 9] = get_pressure (now, global.padPress[pad][0]);
- buf[10] = get_pressure (now, global.padPress[pad][3]);
- buf[11] = get_pressure (now, global.padPress[pad][1]);
- buf[12] = get_pressure (now, global.padPress[pad][11]);
- buf[13] = get_pressure (now, global.padPress[pad][10]);
- buf[14] = get_pressure (now, global.padPress[pad][9]);
- buf[15] = get_pressure (now, global.padPress[pad][8]);
- buf[16] = get_pressure (now, global.padPress[pad][13]);
- buf[17] = get_pressure (now, global.padPress[pad][12]);
- buf[18] = get_pressure (now, global.padPress[pad][15]);
- buf[19] = get_pressure (now, global.padPress[pad][14]);
- }
- return (u8)global.padID[pad];
- }
- break;
- case 0x44:
- global.cmdLen = sizeof (cmd44);
- memcpy (buf, cmd44, sizeof (cmd44));
- return 0xf3;
- case 0x45:
- global.cmdLen = sizeof (cmd45);
- memcpy (buf, cmd45, sizeof (cmd45));
- buf[4] = (u8)global.padMode1[pad];
- return 0xf3;
- case 0x46:
- global.cmdLen = sizeof (cmd46);
- memcpy (buf, cmd46, sizeof (cmd46));
- return 0xf3;
- case 0x47:
- global.cmdLen = sizeof (cmd47);
- memcpy (buf, cmd47, sizeof (cmd47));
- return 0xf3;
- case 0x4c:
- global.cmdLen = sizeof (cmd4c);
- memcpy (buf, cmd4c, sizeof (cmd4c));
- return 0xf3;
- case 0x4d:
- global.cmdLen = sizeof (cmd4d);
- memcpy (buf, cmd4d, sizeof (cmd4d));
- return 0xf3;
- case 0x4f:
- global.padID[pad] = 0x79;
- global.padMode2[pad] = 1;
- global.cmdLen = sizeof (cmd4f);
- memcpy (buf, cmd4f, sizeof (cmd4f));
- return 0xf3;
- }
- }
- switch (global.curCmd)
- {
- case 0x42:
- if (global.config.dualshock)
- {
- if (cur == global.padVib0[pad])
- {
- global.padVibF[pad][0] = value;
-
- if (gpuVisualVibration != NULL && (global.padVibF[pad][0] || global.padVibF[pad][1]) &&
- global.config.visualvibration[pad])
- gpuVisualVibration(global.padVibF[pad][0], global.padVibF[pad][1]);
- }
-
- if (cur == global.padVib1[pad])
- {
- global.padVibF[pad][1] = value;
-
- if (gpuVisualVibration != NULL && (global.padVibF[pad][0] || global.padVibF[pad][1]) &&
- global.config.visualvibration[pad])
- gpuVisualVibration(global.padVibF[pad][0], global.padVibF[pad][1]);
- }
- }
- break;
- case 0x43:
- if (cur == 2)
- {
- global.padModeE[pad] = value;
- global.padModeC[pad] = 0;
- }
- break;
- case 0x44:
- if (cur == 2)
- PADsetMode (pad, value);
- if (cur == 3)
- global.padModeF[pad] = (value == 3);
- break;
- case 0x46:
- if (cur == 2)
- {
- switch(value)
- {
- case 0:
- buf[5] = 0x02;
- buf[6] = 0x00;
- buf[7] = 0x0A;
- break;
- case 1:
- buf[5] = 0x01;
- buf[6] = 0x01;
- buf[7] = 0x14;
- break;
- }
- }
- break;
- case 0x4c:
- if (cur == 2)
- {
- static const u8 buf5[] = { 0x04, 0x07, 0x02, 0x05 };
- buf[5] = buf5[value & 3];
- }
- break;
- case 0x4d:
- if (cur >= 2)
- {
- if (cur == global.padVib0[pad])
- buf[cur] = 0x00;
- if (cur == global.padVib1[pad])
- buf[cur] = 0x01;
- if (value == 0x00)
- {
- global.padVib0[pad] = cur;
- if ((global.padID[pad] & 0x0f) < (cur - 1) / 2)
- global.padID[pad] = (global.padID[pad] & 0xf0) + (cur - 1) / 2;
- }
- else if (value == 0x01)
- {
- global.padVib1[pad] = cur;
- if ((global.padID[pad] & 0x0f) < (cur - 1) / 2)
- global.padID[pad] = (global.padID[pad] & 0xf0) + (cur - 1) / 2;
- }
- }
- break;
- }
- if (cur >= global.cmdLen)
- return 0;
- return buf[global.curByte++];
-}
-
-typedef struct
-{
- unsigned char controllerType;
- unsigned short buttonStatus;
- unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
- unsigned char moveX, moveY;
- unsigned char reserved[91];
-} PadDataS;
-
-long PADreadPort1 (PadDataS* pads)
-{
- memset (pads, 0, sizeof (PadDataS));
- if ((global.padID[0] & 0xf0) == 0x40)
- pads->controllerType = 4;
- else
- pads->controllerType = 7;
- pads->buttonStatus = global.padStat[0];
- pads->leftJoyX = get_analog (global.config.keys[0][17]);
- pads->leftJoyY = get_analog (global.config.keys[0][18]);
- pads->rightJoyX = get_analog (global.config.keys[0][19]);
- pads->rightJoyY = get_analog (global.config.keys[0][20]);
- pads->moveX = 0;
- pads->moveY = 0;
- return 0;
-}
-
-long PADreadPort2 (PadDataS* pads)
-{
- memset (pads, 0, sizeof (PadDataS));
- if ((global.padID[1] & 0xf0) == 0x40)
- pads->controllerType = 4;
- else
- pads->controllerType = 7;
- pads->buttonStatus = global.padStat[1];
- pads->leftJoyX = get_analog (global.config.keys[1][17]);
- pads->leftJoyY = get_analog (global.config.keys[1][18]);
- pads->rightJoyX = get_analog (global.config.keys[1][19]);
- pads->rightJoyY = get_analog (global.config.keys[1][20]);
- pads->moveX = 0;
- pads->moveY = 0;
- return 0;
-}
-
-keyEvent* CALLBACK PADkeyEvent (void)
-{
- static keyEvent ev;
- static u8 state[2][256];
- if (n_open)
- {
- memcpy (state[0], state[1], sizeof (state[0]));
- GetKeyState (state[1]);
- for (int cnt = 0; cnt < 256; cnt++)
- {
- if (~state[0][cnt] & state[1][cnt] & 0x80)
- {
- ev.event = (state[1][cnt] & 0x80) ? 1 : 2;
- ev.key = MapVirtualKey (cnt, 1);
- return &ev;
- }
- }
- }
- return NULL;
-}
-
-void CALLBACK PADconfigure (void)
-{
- if (n_open == 0)
- {
- memset (&global, 0, sizeof (global));
- if (DialogBox (hInstance, MAKEINTRESOURCE (IDD_DIALOG1), GetActiveWindow(), (DLGPROC)ConfigureDlgProc) == IDOK)
- SaveConfig();
- ReleaseDirectInput();
- }
-}
-
-void CALLBACK PADabout (void)
-{
- MessageBox (0, "Copyright (C) 2004-2005 Nagisa", "SSSPSX PAD plugin", 0);
-}
-
-s32 CALLBACK PADtest (void)
-{
- return 0;
-}
-
-void CALLBACK PADregisterVibration(void (CALLBACK *callback)(unsigned long, unsigned long)) {
- gpuVisualVibration = callback;
-}
-
-//#ifdef _WIN64
-BOOL APIENTRY DllMain(HMODULE hInst, DWORD dwReason, LPVOID lpReserved)
-{
- hInstance = hInst;
- return TRUE;
-}
-//#else
-BOOL APIENTRY EntryPoint (HMODULE hInst, DWORD dwReason, LPVOID lpReserved)
-{
- hInstance = hInst;
- return TRUE;
-}
-//#endif
+#define WINVER 0x0500
+#define _WIN32_WINNT WINVER
+#define DIRECTINPUT_VERSION 0x0800
+
+// Modified by Wei Mingzhi <whistler_wmz@users.sf.net> at 10/2/2009
+// Added default keys, use registry instead of configuration file
+
+// Modified by Wei Mingzhi <whistler_wmz@users.sf.net> at 12/3/2009
+// Quick hack fix for FF8 "reverting" problem in menus
+// Added configuration for enabling/disabling DualShock
+
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <dinput.h>
+
+#include "PadSSSPSX.h"
+
+static const char* LibraryName = "SSSPSX PAD Plugin Pressure Mod";
+static const unsigned char version = 0x0002;
+static const unsigned char revision = 1;
+static const unsigned char build = 6;
+
+HMODULE hInstance;
+HWND hTargetWnd;
+
+static void (CALLBACK *gpuVisualVibration)(unsigned long, unsigned long) = NULL;
+
+static struct
+{
+ Config config;
+ int devcnt;
+ LPDIRECTINPUT8 pDInput;
+ LPDIRECTINPUTDEVICE8 pDKeyboard;
+ LPDIRECTINPUTDEVICE8 pDDevice[4];
+ LPDIRECTINPUTEFFECT pDEffect[4][2]; /* for Small & Big Motor */
+ DIJOYSTATE JoyState[4];
+ u16 padStat[2];
+ int padID[2];
+ int padMode1[2];
+ int padMode2[2];
+ int padModeE[2];
+ int padModeC[2];
+ int padModeF[2];
+ int padVib0[2];
+ int padVib1[2];
+ int padVibF[2][4];
+ int padVibC[2];
+ DWORD padPress[2][16];
+ int curPad;
+ int curByte;
+ int curCmd;
+ int cmdLen;
+} global;
+
+static BOOL CALLBACK EnumAxesCallback (LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
+{
+ LPDIRECTINPUTDEVICE8 pDDevice = (LPDIRECTINPUTDEVICE8)pvRef;
+ DIPROPRANGE diprg;
+ diprg.diph.dwSize = sizeof (diprg);
+ diprg.diph.dwHeaderSize = sizeof (diprg.diph);
+ diprg.diph.dwObj = lpddoi->dwType;
+ diprg.diph.dwHow = DIPH_BYID;
+ diprg.lMin = -128;
+ diprg.lMax = 127;
+ pDDevice->SetProperty (DIPROP_RANGE, &diprg.diph);
+ return DIENUM_CONTINUE;
+}
+
+static BOOL CALLBACK EnumJoysticksCallback (const DIDEVICEINSTANCE* instance, VOID* pContext)
+{
+ const int devno = global.devcnt;
+ if (devno >= 4)
+ return DIENUM_STOP;
+ HRESULT result = global.pDInput->CreateDevice (instance->guidInstance, &global.pDDevice[devno], NULL);
+ if (FAILED (result))
+ return DIENUM_CONTINUE;
+ global.devcnt++;
+ return DIENUM_CONTINUE;
+}
+
+static bool ReleaseDirectInput (void)
+{
+ int index = 4;
+ while (index--)
+ {
+ if (global.pDEffect[index][0])
+ {
+ global.pDEffect[index][0]->Unload();
+ global.pDEffect[index][0]->Release();
+ global.pDEffect[index][0] = NULL;
+ }
+ if (global.pDEffect[index][1])
+ {
+ global.pDEffect[index][1]->Unload();
+ global.pDEffect[index][1]->Release();
+ global.pDEffect[index][1] = NULL;
+ }
+ if (global.pDDevice[index])
+ {
+ global.pDDevice[index]->Unacquire();
+ global.pDDevice[index]->Release();
+ global.pDDevice[index] = NULL;
+ }
+ }
+ if (global.pDKeyboard)
+ {
+ global.pDKeyboard->Unacquire();
+ global.pDKeyboard->Release();
+ global.pDKeyboard = NULL;
+ }
+ if (global.pDInput)
+ {
+ global.pDInput->Release();
+ global.pDInput = NULL;
+ }
+ global.devcnt = 0;
+ return FALSE;
+}
+
+static bool InitDirectInput (void)
+{
+ if (global.pDInput)
+ return TRUE;
+ HRESULT result = DirectInput8Create (hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&global.pDInput, NULL);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ result = global.pDInput->CreateDevice (GUID_SysKeyboard, &global.pDKeyboard, NULL);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ result = global.pDInput->EnumDevices (DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ result = global.pDKeyboard->SetDataFormat (&c_dfDIKeyboard);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ if (hTargetWnd)
+ {
+ global.pDKeyboard->Unacquire();
+ result = global.pDKeyboard->SetCooperativeLevel (hTargetWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ }
+ int index = global.devcnt;
+ while (index--)
+ {
+ const LPDIRECTINPUTDEVICE8 pDDevice = global.pDDevice[index];
+ result = pDDevice->SetDataFormat (&c_dfDIJoystick);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ if (hTargetWnd)
+ {
+ pDDevice->Unacquire();
+ result = pDDevice->SetCooperativeLevel (hTargetWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ }
+ struct
+ {
+ DIPROPDWORD dipdw;
+ DWORD rgdwAxes[2];
+ LONG rglDirection[2];
+ DIPERIODIC per;
+ DICONSTANTFORCE cf;
+ DIEFFECT eff;
+ } local;
+ memset (&local, 0, sizeof (local));
+ local.dipdw.diph.dwSize = sizeof (DIPROPDWORD);
+ local.dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
+ local.dipdw.diph.dwHow = DIPH_DEVICE;
+ local.dipdw.dwData = DIPROPAUTOCENTER_OFF;
+ pDDevice->SetProperty (DIPROP_AUTOCENTER, &local.dipdw.diph);
+ result = pDDevice->EnumObjects (EnumAxesCallback, pDDevice, DIDFT_AXIS);
+ if (FAILED (result))
+ return ReleaseDirectInput();
+
+ local.rgdwAxes[0] = DIJOFS_X;
+ local.rgdwAxes[1] = DIJOFS_Y;
+ local.eff.dwSize = sizeof (DIEFFECT);
+ local.eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
+ local.eff.dwDuration = INFINITE;
+ local.eff.dwGain = DI_FFNOMINALMAX;
+ local.eff.dwTriggerButton = DIEB_NOTRIGGER;
+ local.eff.cAxes = 2;
+ local.eff.rgdwAxes = local.rgdwAxes;
+ local.eff.rglDirection = local.rglDirection;
+
+ /* Small Motor */
+ local.eff.cbTypeSpecificParams = sizeof (DIPERIODIC);
+ local.eff.lpvTypeSpecificParams = &local.per;
+ result = pDDevice->CreateEffect (GUID_Square , &local.eff, &global.pDEffect[index][0], NULL);
+ if (FAILED (result))
+ global.pDEffect[index][0] = NULL;
+
+ /* Big Motor */
+ local.eff.cbTypeSpecificParams = sizeof (DICONSTANTFORCE);
+ local.eff.lpvTypeSpecificParams = &local.cf;
+ result = pDDevice->CreateEffect (GUID_ConstantForce , &local.eff, &global.pDEffect[index][1], NULL);
+ if (FAILED (result))
+ global.pDEffect[index][1] = NULL;
+ }
+ return TRUE;
+}
+
+static bool AcquireDevice (LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
+{
+ if (FAILED (lpDirectInputDevice->Acquire()))
+ {
+ HRESULT result = lpDirectInputDevice->Acquire();
+ if (result == DIERR_OTHERAPPHASPRIO)
+ return FALSE;
+ if (FAILED (result))
+ return ReleaseDirectInput();
+ }
+ return TRUE;
+}
+
+/* Small Motor */
+static bool SetDeviceForceS (int pad, DWORD force)
+{
+ InitDirectInput();
+ if (global.pDEffect[pad][0])
+ {
+ if ( force == 0) {
+ if (FAILED (global.pDEffect[pad][0]->Stop())) {
+ AcquireDevice (global.pDDevice[pad]);
+ if (FAILED (global.pDEffect[pad][0]->Stop()))
+ return ReleaseDirectInput();
+ }
+ return TRUE;
+ }
+ LONG rglDirection[2] = { 0, 0 };
+ DIPERIODIC per;
+ rglDirection[0] = force;
+ rglDirection[1] = force;
+ per.dwMagnitude = force;
+ per.dwPeriod = (DWORD) (0.01 * DI_SECONDS);
+ per.lOffset = 0;
+ per.dwPhase = 0;
+ DIEFFECT eff;
+ eff.dwSize = sizeof (DIEFFECT);
+ eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
+ eff.cAxes = 2;
+ eff.rglDirection = rglDirection;
+ eff.lpEnvelope = 0;
+ eff.cbTypeSpecificParams = sizeof (DIPERIODIC);
+ eff.lpvTypeSpecificParams = &per;
+ if (FAILED (global.pDEffect[pad][0]->SetParameters (&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START)))
+ return ReleaseDirectInput();
+ if (FAILED (global.pDEffect[pad][0]->Start (1, 0)))
+ {
+ AcquireDevice (global.pDDevice[pad]);
+ if (FAILED (global.pDEffect[pad][0]->Start (1, 0)))
+ return ReleaseDirectInput();
+ }
+ }
+ return TRUE;
+}
+
+/* Big Motor */
+static bool SetDeviceForceB (int pad, DWORD force)
+{
+ InitDirectInput();
+ if (global.pDEffect[pad][1])
+ {
+ if ( force == 0) {
+ if (FAILED (global.pDEffect[pad][1]->Stop())) {
+ AcquireDevice (global.pDDevice[pad]);
+ if (FAILED (global.pDEffect[pad][1]->Stop()))
+ return ReleaseDirectInput();
+ }
+ return TRUE;
+ }
+ LONG rglDirection[2] = { 0, 0 };
+ DICONSTANTFORCE cf;
+ rglDirection[0] = force;
+ rglDirection[1] = force;
+ cf.lMagnitude = force;
+ DIEFFECT eff;
+ eff.dwSize = sizeof (DIEFFECT);
+ eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
+ eff.cAxes = 2;
+ eff.rglDirection = rglDirection;
+ eff.lpEnvelope = 0;
+ eff.cbTypeSpecificParams = sizeof (DICONSTANTFORCE);
+ eff.lpvTypeSpecificParams = &cf;
+ if (FAILED (global.pDEffect[pad][1]->SetParameters (&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START)))
+ return ReleaseDirectInput();
+ if (FAILED (global.pDEffect[pad][1]->Start (1, 0)))
+ {
+ AcquireDevice (global.pDDevice[pad]);
+ if (FAILED (global.pDEffect[pad][1]->Start (1, 0)))
+ return ReleaseDirectInput();
+ }
+ }
+ return TRUE;
+}
+
+static bool GetJoyState (const int devno)
+{
+ InitDirectInput();
+ if (global.pDDevice[devno] == NULL)
+ return FALSE;
+ global.pDDevice[devno]->Poll();
+ if (FAILED (global.pDDevice[devno]->GetDeviceState (sizeof (DIJOYSTATE), &global.JoyState[devno])))
+ {
+ AcquireDevice (global.pDDevice[devno]);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static bool GetKeyState (u8* keyboard)
+{
+ InitDirectInput();
+ if (global.pDKeyboard == NULL)
+ return FALSE;
+ global.pDKeyboard->Poll();
+ if (FAILED (global.pDKeyboard->GetDeviceState (256, keyboard)))
+ {
+ AcquireDevice (global.pDKeyboard);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void SetDefaultConfig (void)
+{
+ memset (&global.config, 0, sizeof(global.config));
+
+ global.config.keys[0][0] = 0x2E;
+ global.config.keys[0][3] = 0x2F;
+ global.config.keys[0][4] = 0xC8;
+ global.config.keys[0][5] = 0xCD;
+ global.config.keys[0][6] = 0xD0;
+ global.config.keys[0][7] = 0xCB;
+ global.config.keys[0][8] = 0x12;
+ global.config.keys[0][9] = 0x14;
+ global.config.keys[0][10] = 0x11;
+ global.config.keys[0][11] = 0x13;
+ global.config.keys[0][12] = 0x20;
+ global.config.keys[0][13] = 0x2D;
+ global.config.keys[0][14] = 0x2C;
+ global.config.keys[0][15] = 0x1F;
+
+ global.config.dualshock = FALSE;
+}
+
+static void SaveConfig (void)
+{
+ HKEY myKey;
+ DWORD myDisp;
+
+ RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Vision Thing\\PSEmu Pro\\PAD\\PadSSSPSX", 0, NULL,
+ REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp);
+
+ RegSetValueEx(myKey, "cfg", 0, REG_BINARY, (CONST BYTE *)&global.config, sizeof(global.config));
+
+ RegCloseKey(myKey);
+}
+
+static void LoadConfig (void)
+{
+ HKEY myKey;
+ DWORD type, size;
+
+ SetDefaultConfig ();
+
+ if (RegOpenKeyEx (HKEY_CURRENT_USER, "Software\\Vision Thing\\PSEmu Pro\\PAD\\PadSSSPSX", 0,
+ KEY_ALL_ACCESS, &myKey) == ERROR_SUCCESS)
+ {
+ size = sizeof(global.config);
+ RegQueryValueEx (myKey, "cfg", NULL, &type, (LPBYTE)&global.config, &size);
+ RegCloseKey (myKey);
+ }
+
+ global.padVibC[0] = global.padVibC[1] = -1;
+ for (int cnt = 21; cnt--; )
+ {
+ const int key0 = global.config.keys[0][cnt];
+ if (key0 >= 0x1000)
+ global.padVibC[0] = (key0 & 0xfff) / 0x100;
+ const int key1 = global.config.keys[1][cnt];
+ if (key1 >= 0x1000)
+ global.padVibC[1] = (key1 & 0xfff) / 0x100;
+ }
+}
+
+static void PADsetMode (const int pad, const int mode)
+{
+ static const u8 padID[] = { 0x41, 0x73, 0x41, 0x79 };
+ global.padMode1[pad] = mode;
+ global.padVib0[pad] = 0;
+ global.padVib1[pad] = 0;
+ global.padVibF[pad][0] = 0;
+ global.padVibF[pad][1] = 0;
+ global.padID[pad] = padID[global.padMode2[pad] * 2 + mode];
+}
+
+static void KeyPress (const int pad, const int index, const bool press)
+{
+ if (index < 16)
+ {
+ if (press)
+ {
+ global.padStat[pad] &= ~(1 << index);
+ if (global.padPress[pad][index] == 0)
+ global.padPress[pad][index] = GetTickCount();
+ }
+ else
+ {
+ global.padStat[pad] |= 1 << index;
+ global.padPress[pad][index] = 0;
+ }
+ }
+ else if (global.config.dualshock)
+ {
+ static bool prev[2] = { FALSE, FALSE };
+ if ((prev[pad] != press) && (global.padModeF[pad] == 0))
+ {
+ prev[pad] = press;
+ if (press) PADsetMode (pad, !global.padMode1[pad]);
+ }
+ }
+}
+
+static void UpdateState (const int pad)
+{
+ static int flag_keyboard;
+ static int flag_joypad[4];
+ if (pad == 0)
+ {
+ flag_keyboard = 0;
+ flag_joypad[0] = 0;
+ flag_joypad[1] = 0;
+ flag_joypad[2] = 0;
+ flag_joypad[3] = 0;
+ }
+ static u8 keystate[256];
+ for (int index = 17; index--; )
+ {
+ const int key = global.config.keys[pad][index];
+ if (key == 0)
+ continue;
+ else if (key < 0x100)
+ {
+ if (flag_keyboard == FALSE)
+ {
+ flag_keyboard = TRUE;
+ if (GetKeyState (keystate) == FALSE)
+ return;
+ }
+ KeyPress (pad, index, keystate[key] & 0x80);
+ }
+ else
+ {
+ const int joypad = ((key & 0xfff) / 100);
+ if (flag_joypad[joypad] == FALSE)
+ {
+ flag_joypad[joypad] = TRUE;
+ if (GetJoyState (joypad) == FALSE)
+ return;
+ }
+ if (key < 0x2000)
+ {
+ KeyPress (pad, index, global.JoyState[joypad].rgbButtons[key & 0xff]);
+ }
+ else if (key < 0x3000)
+ {
+ const int state = ((int*)&global.JoyState[joypad].lX)[(key & 0xff) /2];
+ switch (key & 1)
+ {
+ case 0: KeyPress (pad, index, state < -64); break;
+ case 1: KeyPress (pad, index, state >= 64); break;
+ }
+ }
+ else
+ {
+ const u32 state = global.JoyState[joypad].rgdwPOV[(key & 0xff) /4];
+ switch (key & 3)
+ {
+ case 0: KeyPress (pad, index, (state >= 0 && state <= 4500) || (state >= 31500 && state <= 36000)); break;
+ case 1: KeyPress (pad, index, state >= 4500 && state <= 13500); break;
+ case 2: KeyPress (pad, index, state >= 13500 && state <= 22500); break;
+ case 3: KeyPress (pad, index, state >= 22500 && state <= 31500); break;
+ }
+ }
+ }
+ }
+
+ /* Small Motor */
+ const int vib0 = global.padVibF[pad][0] ? 10000 : 0;
+ if ((global.padVibF[pad][2] != vib0) && (global.padVibC[pad] >= 0))
+ {
+ global.padVibF[pad][2] = vib0;
+ SetDeviceForceS (global.padVibC[pad], vib0);
+ }
+ /* Big Motor */
+ const int vib1 = global.padVibF[pad][1] ? 500 + 37*global.padVibF[pad][1] : 0;
+ if ((global.padVibF[pad][3] != vib1) && (global.padVibC[pad] >= 0))
+ {
+ global.padVibF[pad][3] = vib1;
+ SetDeviceForceB (global.padVibC[pad], vib1);
+ }
+}
+
+static void set_label (const HWND hWnd, const int pad, const int index)
+{
+ const int key = global.config.keys[pad][index];
+ char buff[64];
+ if (key < 0x100)
+ {
+ if (key == 0)
+ strcpy (buff, "NONE");
+ else if (GetKeyNameText (key << 16, buff, sizeof (buff)) == 0)
+ wsprintf (buff, "Keyboard 0x%02X", key);
+ }
+ else if (key >= 0x1000 && key < 0x2000)
+ {
+ wsprintf (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);
+ wsprintf (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);
+ wsprintf (buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov /4, name[pov % 4]);
+ }
+ Button_SetText (GetDlgItem (hWnd, IDC_ESELECT + index), buff);
+}
+
+static BOOL CALLBACK ConfigureDlgProc (const HWND hWnd, const UINT msg, const WPARAM wParam, const LPARAM lParam)
+{
+ static BYTE keymaps[2][256];
+ static DWORD countdown;
+ static int disabled;
+ static HWND hTabWnd;
+ static int pad;
+ int cnt1;
+ int cnt2;
+ int key;
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ hTargetWnd = hWnd;
+ pad = disabled = 0;
+ LoadConfig();
+ for (cnt1 = 21; cnt1--; )
+ set_label (hWnd, pad, cnt1);
+ hTabWnd = GetDlgItem (hWnd, IDC_TABC);
+ TCITEM tcI;
+ tcI.mask = TCIF_TEXT;
+ tcI.pszText = "PAD1";
+ TabCtrl_InsertItem (hTabWnd, 0, &tcI);
+ tcI.mask = TCIF_TEXT;
+ tcI.pszText = "PAD2";
+ TabCtrl_InsertItem (hTabWnd, 1, &tcI);
+ CheckDlgButton(hWnd, IDC_DS2, global.config.dualshock);
+ CheckDlgButton(hWnd, IDC_VV3, global.config.visualvibration[0]);
+ EnableWindow(GetDlgItem(hWnd, IDC_BMODE), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BLAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BLAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BRAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BRAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BL3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BR3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_EMODE), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ELAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ELAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ERAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ERAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_EL3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ER3), global.config.dualshock);
+ SetTimer (hWnd, 0x80, 50, NULL);
+ return TRUE;
+ case WM_DESTROY:
+ break;
+ case WM_NOTIFY:
+ if (wParam == IDC_TABC)
+ {
+ if (disabled)
+ EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
+ disabled = 0;
+ pad = TabCtrl_GetCurSel (hTabWnd);
+ for (cnt1 = 21; cnt1--; )
+ set_label (hWnd, pad, cnt1);
+ CheckDlgButton(hWnd, IDC_VV3, global.config.visualvibration[pad]);
+ }
+ break;
+ case WM_COMMAND:
+ for (cnt1 = 21; cnt1--; )
+ {
+ if (LOWORD (wParam) == IDC_BSELECT + cnt1)
+ {
+ if (disabled)
+ EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
+ EnableWindow (GetDlgItem (hWnd, disabled = wParam), FALSE);
+ EnableWindow (GetDlgItem (hWnd, IDC_DS2), FALSE);
+ countdown = GetTickCount();
+ GetKeyState (keymaps[0]);
+ return TRUE;
+ }
+ }
+ if (LOWORD (wParam) == IDOK)
+ EndDialog (hWnd, IDOK);
+ else if (LOWORD (wParam) == IDCANCEL)
+ EndDialog (hWnd, IDCANCEL);
+ else if (LOWORD (wParam) == IDC_DS2)
+ {
+ global.config.dualshock = IsDlgButtonChecked(hWnd, IDC_DS2);
+
+ EnableWindow(GetDlgItem(hWnd, IDC_BMODE), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BLAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BLAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BRAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BRAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BL3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_BR3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_EMODE), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ELAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ELAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ERAX), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ERAY), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_EL3), global.config.dualshock);
+ EnableWindow(GetDlgItem(hWnd, IDC_ER3), global.config.dualshock);
+ }
+ else if (LOWORD (wParam) == IDC_VV3)
+ {
+ global.config.visualvibration[pad] ^= 1;
+ }
+ break;
+ case WM_TIMER:
+ if (disabled)
+ {
+ const int index = disabled - IDC_BSELECT;
+ int analog = FALSE;
+ if ((GetTickCount() - countdown) / 1000 != 10)
+ {
+ char buff[64];
+ wsprintf (buff, "Timeout: %d", 10 - (GetTickCount() - countdown) / 1000);
+ SetWindowText (GetDlgItem (hWnd, IDC_ESELECT + index), buff);
+ }
+ else
+ {
+ global.config.keys[pad][index] = 0;
+ set_label (hWnd, pad, index);
+ EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
+ EnableWindow (GetDlgItem (hWnd, IDC_DS2), TRUE);
+ disabled = 0;
+ break;
+ }
+ if (GetKeyState (keymaps[1]) == FALSE)
+ break;
+ for (key = 0x100; key--; )
+ {
+ if (~keymaps[0][key] & keymaps[1][key] & 0x80)
+ break;
+ }
+ for (cnt1 = global.devcnt; cnt1--;)
+ {
+ if (GetJoyState (cnt1) == FALSE)
+ break;
+
+ for (cnt2 = 32; cnt2--; )
+ {
+ if (global.JoyState[cnt1].rgbButtons[cnt2])
+ key = 0x1000 + 0x100 * cnt1 + cnt2;
+ }
+ for (cnt2 = 8; cnt2--; )
+ {
+ const int now = ((u32*)&global.JoyState[cnt1].lX)[cnt2];
+ if (now < -64)
+ {
+ key = 0x2000 + 0x100 * cnt1 + cnt2 * 2 +0;
+ analog = TRUE;
+ }
+ else if (now >= 64)
+ {
+ key = 0x2000 + 0x100 * cnt1 + cnt2 * 2 +1;
+ analog = TRUE;
+ }
+ }
+ for (cnt2 = 4; cnt2--; )
+ {
+ const u32 now = global.JoyState[cnt1].rgdwPOV[cnt2];
+ if ((now >= 0 && now < 4500) || (now >= 31500 && now < 36000))
+ key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +0;
+ if (now >= 4500 && now < 13500)
+ key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +1;
+ if (now >= 13500 && now < 22500)
+ key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +2;
+ if (now >= 22500 && now < 31500)
+ key = 0x3000 + 0x100 * cnt1 + cnt2 * 4 +3;
+ }
+ }
+ if (index >= 17 && index <= 20 && analog == 0)
+ key = 0;
+ else if (key > 0)
+ {
+ if (key != 1)
+ global.config.keys[pad][index] = key;
+ set_label (hWnd, pad, index);
+ EnableWindow (GetDlgItem (hWnd, disabled), TRUE);
+ EnableWindow (GetDlgItem (hWnd, IDC_DS2), TRUE);
+ disabled = 0;
+ }
+ }
+ }
+ return FALSE;
+}
+
+u32 CALLBACK PS2EgetLibType (void)
+{
+ return 0x02;
+}
+
+const char* CALLBACK PS2EgetLibName (void)
+{
+ return LibraryName;
+}
+
+u32 CALLBACK PS2EgetLibVersion2 (u32 type)
+{
+ return (version << 16) | (revision << 8) | build;
+}
+
+u32 CALLBACK PSEgetLibType (void)
+{
+ return 8;
+}
+
+const char* CALLBACK PSEgetLibName (void)
+{
+ return LibraryName;
+}
+
+u32 CALLBACK PSEgetLibVersion (void)
+{
+ return (version << 16) | (revision << 8) | build;
+}
+
+s32 CALLBACK PADinit (u32 flags)
+{
+ return 0;
+}
+
+void CALLBACK PADshutdown (void)
+{
+}
+
+static int n_open = 0;
+s32 CALLBACK PADopen (HWND hWnd)
+{
+ if (!IsWindow (hWnd) && !IsBadReadPtr ((u32*)hWnd, 4))
+ hWnd = *(HWND*)hWnd;
+ if (!IsWindow (hWnd))
+ hWnd = NULL;
+ else
+ {
+ while (GetWindowLong (hWnd, GWL_STYLE) & WS_CHILD)
+ hWnd = GetParent (hWnd);
+ }
+ hTargetWnd = hWnd;
+ if (n_open++ == FALSE)
+ {
+ memset (&global, 0, sizeof (global));
+ global.padStat[0] = 0xffff;
+ global.padStat[1] = 0xffff;
+ LoadConfig();
+ PADsetMode (0, 0);
+ PADsetMode (1, 0);
+ }
+ return 0;
+}
+
+void CALLBACK PADclose (void)
+{
+ if (--n_open == 0)
+ ReleaseDirectInput();
+}
+
+u32 CALLBACK PADquery (void)
+{
+ return 3;
+}
+
+u8 CALLBACK PADstartPoll (int pad)
+{
+ global.curPad = pad -1;
+ global.curByte = 0;
+ return 0xff;
+}
+
+static const u8 cmd40[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x5a
+};
+static const u8 cmd41[8] =
+{
+ 0xff, 0x5a, 0xff, 0xff, 0x03, 0x00, 0x00, 0x5a,
+};
+static const u8 cmd44[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const u8 cmd45[8] =
+{
+ 0xff, 0x5a, 0x03, 0x02, 0x01, 0x02, 0x01, 0x00,
+};
+static const u8 cmd46[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0a,
+};
+static const u8 cmd47[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+};
+static const u8 cmd4c[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const u8 cmd4d[8] =
+{
+ 0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+};
+static const u8 cmd4f[8] =
+{
+ 0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a,
+};
+
+static u8 get_analog (const int key)
+{
+ const int pad = ((key & 0xf00) / 0x100);
+ const int pos = ((key & 0x0ff) /2);
+// return (u8)(((int*)&global.JoyState[pad].lX)[pos] + 128);
+ u8 r = (u8)(((int*)&global.JoyState[pad].lX)[pos] + 128);
+ if (r == 128) r = 127; // FIXME: ???
+ return r;
+}
+
+static u8 get_pressure (const DWORD now, const DWORD press)
+{
+ /*if (press == 0)
+ return 0;
+ return (u8)((now - press > 2550) ? 255 : (now - press) / 10);*/
+ return 255;
+}
+
+u8 CALLBACK PADpoll (u8 value)
+{
+ const int pad = global.curPad;
+ const int cur = global.curByte;
+ static u8 buf[20];
+
+ if (!global.config.dualshock)
+ {
+ value = 0x42;
+ }
+
+ if (cur == 0)
+ {
+ global.curByte++;
+ global.curCmd = value;
+ switch (value)
+ {
+ case 0x40:
+ global.cmdLen = sizeof (cmd40);
+ memcpy (buf, cmd40, sizeof (cmd40));
+ return 0xf3;
+ case 0x41:
+ global.cmdLen = sizeof (cmd41);
+ memcpy (buf, cmd41, sizeof (cmd41));
+ return 0xf3;
+ case 0x42:
+ case 0x43:
+ if (value == 0x42) UpdateState (pad);
+ global.cmdLen = 2 + 2 * (global.padID[pad] & 0x0f);
+ buf[1] = global.padModeC[pad] ? 0x00 : 0x5a;
+ *(u16*)&buf[2] = global.padStat[pad];
+ if (value == 0x43 && global.padModeE[pad])
+ {
+ buf[4] = 0;
+ buf[5] = 0;
+ buf[6] = 0;
+ buf[7] = 0;
+ return 0xf3;
+ }
+ else
+ {
+ buf[ 4] = get_analog (global.config.keys[pad][19]);
+ buf[ 5] = get_analog (global.config.keys[pad][20]);
+ buf[ 6] = get_analog (global.config.keys[pad][17]);
+ buf[ 7] = get_analog (global.config.keys[pad][18]);
+
+ if (global.padID[pad] == 0x79)
+ {
+ const DWORD now = GetTickCount();
+ buf[ 8] = get_pressure (now, global.padPress[pad][2]);
+ buf[ 9] = get_pressure (now, global.padPress[pad][0]);
+ buf[10] = get_pressure (now, global.padPress[pad][3]);
+ buf[11] = get_pressure (now, global.padPress[pad][1]);
+ buf[12] = get_pressure (now, global.padPress[pad][11]);
+ buf[13] = get_pressure (now, global.padPress[pad][10]);
+ buf[14] = get_pressure (now, global.padPress[pad][9]);
+ buf[15] = get_pressure (now, global.padPress[pad][8]);
+ buf[16] = get_pressure (now, global.padPress[pad][13]);
+ buf[17] = get_pressure (now, global.padPress[pad][12]);
+ buf[18] = get_pressure (now, global.padPress[pad][15]);
+ buf[19] = get_pressure (now, global.padPress[pad][14]);
+ }
+ return (u8)global.padID[pad];
+ }
+ break;
+ case 0x44:
+ global.cmdLen = sizeof (cmd44);
+ memcpy (buf, cmd44, sizeof (cmd44));
+ return 0xf3;
+ case 0x45:
+ global.cmdLen = sizeof (cmd45);
+ memcpy (buf, cmd45, sizeof (cmd45));
+ buf[4] = (u8)global.padMode1[pad];
+ return 0xf3;
+ case 0x46:
+ global.cmdLen = sizeof (cmd46);
+ memcpy (buf, cmd46, sizeof (cmd46));
+ return 0xf3;
+ case 0x47:
+ global.cmdLen = sizeof (cmd47);
+ memcpy (buf, cmd47, sizeof (cmd47));
+ return 0xf3;
+ case 0x4c:
+ global.cmdLen = sizeof (cmd4c);
+ memcpy (buf, cmd4c, sizeof (cmd4c));
+ return 0xf3;
+ case 0x4d:
+ global.cmdLen = sizeof (cmd4d);
+ memcpy (buf, cmd4d, sizeof (cmd4d));
+ return 0xf3;
+ case 0x4f:
+ global.padID[pad] = 0x79;
+ global.padMode2[pad] = 1;
+ global.cmdLen = sizeof (cmd4f);
+ memcpy (buf, cmd4f, sizeof (cmd4f));
+ return 0xf3;
+ }
+ }
+ switch (global.curCmd)
+ {
+ case 0x42:
+ if (global.config.dualshock)
+ {
+ if (cur == global.padVib0[pad])
+ {
+ global.padVibF[pad][0] = value;
+
+ if (gpuVisualVibration != NULL && (global.padVibF[pad][0] || global.padVibF[pad][1]) &&
+ global.config.visualvibration[pad])
+ gpuVisualVibration(global.padVibF[pad][0], global.padVibF[pad][1]);
+ }
+
+ if (cur == global.padVib1[pad])
+ {
+ global.padVibF[pad][1] = value;
+
+ if (gpuVisualVibration != NULL && (global.padVibF[pad][0] || global.padVibF[pad][1]) &&
+ global.config.visualvibration[pad])
+ gpuVisualVibration(global.padVibF[pad][0], global.padVibF[pad][1]);
+ }
+ }
+ break;
+ case 0x43:
+ if (cur == 2)
+ {
+ global.padModeE[pad] = value;
+ global.padModeC[pad] = 0;
+ }
+ break;
+ case 0x44:
+ if (cur == 2)
+ PADsetMode (pad, value);
+ if (cur == 3)
+ global.padModeF[pad] = (value == 3);
+ break;
+ case 0x46:
+ if (cur == 2)
+ {
+ switch(value)
+ {
+ case 0:
+ buf[5] = 0x02;
+ buf[6] = 0x00;
+ buf[7] = 0x0A;
+ break;
+ case 1:
+ buf[5] = 0x01;
+ buf[6] = 0x01;
+ buf[7] = 0x14;
+ break;
+ }
+ }
+ break;
+ case 0x4c:
+ if (cur == 2)
+ {
+ static const u8 buf5[] = { 0x04, 0x07, 0x02, 0x05 };
+ buf[5] = buf5[value & 3];
+ }
+ break;
+ case 0x4d:
+ if (cur >= 2)
+ {
+ if (cur == global.padVib0[pad])
+ buf[cur] = 0x00;
+ if (cur == global.padVib1[pad])
+ buf[cur] = 0x01;
+ if (value == 0x00)
+ {
+ global.padVib0[pad] = cur;
+ if ((global.padID[pad] & 0x0f) < (cur - 1) / 2)
+ global.padID[pad] = (global.padID[pad] & 0xf0) + (cur - 1) / 2;
+ }
+ else if (value == 0x01)
+ {
+ global.padVib1[pad] = cur;
+ if ((global.padID[pad] & 0x0f) < (cur - 1) / 2)
+ global.padID[pad] = (global.padID[pad] & 0xf0) + (cur - 1) / 2;
+ }
+ }
+ break;
+ }
+ if (cur >= global.cmdLen)
+ return 0;
+ return buf[global.curByte++];
+}
+
+typedef struct
+{
+ unsigned char controllerType;
+ unsigned short buttonStatus;
+ unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
+ unsigned char moveX, moveY;
+ unsigned char reserved[91];
+} PadDataS;
+
+long PADreadPort1 (PadDataS* pads)
+{
+ memset (pads, 0, sizeof (PadDataS));
+ if ((global.padID[0] & 0xf0) == 0x40)
+ pads->controllerType = 4;
+ else
+ pads->controllerType = 7;
+ pads->buttonStatus = global.padStat[0];
+ pads->leftJoyX = get_analog (global.config.keys[0][17]);
+ pads->leftJoyY = get_analog (global.config.keys[0][18]);
+ pads->rightJoyX = get_analog (global.config.keys[0][19]);
+ pads->rightJoyY = get_analog (global.config.keys[0][20]);
+ pads->moveX = 0;
+ pads->moveY = 0;
+ return 0;
+}
+
+long PADreadPort2 (PadDataS* pads)
+{
+ memset (pads, 0, sizeof (PadDataS));
+ if ((global.padID[1] & 0xf0) == 0x40)
+ pads->controllerType = 4;
+ else
+ pads->controllerType = 7;
+ pads->buttonStatus = global.padStat[1];
+ pads->leftJoyX = get_analog (global.config.keys[1][17]);
+ pads->leftJoyY = get_analog (global.config.keys[1][18]);
+ pads->rightJoyX = get_analog (global.config.keys[1][19]);
+ pads->rightJoyY = get_analog (global.config.keys[1][20]);
+ pads->moveX = 0;
+ pads->moveY = 0;
+ return 0;
+}
+
+keyEvent* CALLBACK PADkeyEvent (void)
+{
+ static keyEvent ev;
+ static u8 state[2][256];
+ if (n_open)
+ {
+ memcpy (state[0], state[1], sizeof (state[0]));
+ GetKeyState (state[1]);
+ for (int cnt = 0; cnt < 256; cnt++)
+ {
+ if (~state[0][cnt] & state[1][cnt] & 0x80)
+ {
+ ev.event = (state[1][cnt] & 0x80) ? 1 : 2;
+ ev.key = MapVirtualKey (cnt, 1);
+ return &ev;
+ }
+ }
+ }
+ return NULL;
+}
+
+void CALLBACK PADconfigure (void)
+{
+ if (n_open == 0)
+ {
+ memset (&global, 0, sizeof (global));
+ if (DialogBox (hInstance, MAKEINTRESOURCE (IDD_DIALOG1), GetActiveWindow(), (DLGPROC)ConfigureDlgProc) == IDOK)
+ SaveConfig();
+ ReleaseDirectInput();
+ }
+}
+
+void CALLBACK PADabout (void)
+{
+ MessageBox (0, "Copyright (C) 2004-2005 Nagisa", "SSSPSX PAD plugin", 0);
+}
+
+s32 CALLBACK PADtest (void)
+{
+ return 0;
+}
+
+void CALLBACK PADregisterVibration(void (CALLBACK *callback)(unsigned long, unsigned long)) {
+ gpuVisualVibration = callback;
+}
+
+//#ifdef _WIN64
+BOOL APIENTRY DllMain(HMODULE hInst, DWORD dwReason, LPVOID lpReserved)
+{
+ hInstance = hInst;
+ return TRUE;
+}
+//#else
+BOOL APIENTRY EntryPoint (HMODULE hInst, DWORD dwReason, LPVOID lpReserved)
+{
+ hInstance = hInst;
+ return TRUE;
+}
+//#endif
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.def b/win32/plugins/PadSSSPSX/PadSSSPSX.def
index dd5e4ed2..8e493d6b 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.def
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.def
@@ -1,23 +1,23 @@
-LIBRARY "PadSSSPSX"
-
-EXPORTS
- PSEgetLibType @1
- PSEgetLibName @2
- PSEgetLibVersion @3
- PS2EgetLibType @4
- PS2EgetLibName @5
- PS2EgetLibVersion2 @6
- PADinit @7
- PADshutdown @8
- PADopen @9
- PADclose @10
- PADkeyEvent @11
- PADstartPoll @12
- PADpoll @13
- PADreadPort1 @14
- PADreadPort2 @15
- PADquery @16
- PADconfigure @17
- PADtest @18
- PADabout @19
+LIBRARY "PadSSSPSX"
+
+EXPORTS
+ PSEgetLibType @1
+ PSEgetLibName @2
+ PSEgetLibVersion @3
+ PS2EgetLibType @4
+ PS2EgetLibName @5
+ PS2EgetLibVersion2 @6
+ PADinit @7
+ PADshutdown @8
+ PADopen @9
+ PADclose @10
+ PADkeyEvent @11
+ PADstartPoll @12
+ PADpoll @13
+ PADreadPort1 @14
+ PADreadPort2 @15
+ PADquery @16
+ PADconfigure @17
+ PADtest @18
+ PADabout @19
PADregisterVibration @20 \ No newline at end of file
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.dsp b/win32/plugins/PadSSSPSX/PadSSSPSX.dsp
index e816d306..8f26f4a6 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.dsp
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.dsp
@@ -1,123 +1,123 @@
-# Microsoft Developer Studio Project File - Name="SSSPSXpad" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=SSSPSXpad - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "PadSSSPSX.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "PadSSSPSX.mak" CFG="SSSPSXpad - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SSSPSXpad - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "SSSPSXpad - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SSSPSXpad - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x804 /d "NDEBUG"
-# ADD RSC /l 0x804 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dinput8.lib dxguid.lib /nologo /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "SSSPSXpad - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x804 /d "_DEBUG"
-# ADD RSC /l 0x804 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dinput8.lib dxguid.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "SSSPSXpad - Win32 Release"
-# Name "SSSPSXpad - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\PadSSSPSX.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\PadSSSPSX.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\PadSSSPSX.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\PadSSSPSXres.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\PadSSSPSX.rc
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="SSSPSXpad" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=SSSPSXpad - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "PadSSSPSX.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "PadSSSPSX.mak" CFG="SSSPSXpad - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "SSSPSXpad - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "SSSPSXpad - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "SSSPSXpad - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x804 /d "NDEBUG"
+# ADD RSC /l 0x804 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dinput8.lib dxguid.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "SSSPSXpad - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SSSPSXPAD_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x804 /d "_DEBUG"
+# ADD RSC /l 0x804 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dinput8.lib dxguid.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "SSSPSXpad - Win32 Release"
+# Name "SSSPSXpad - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\PadSSSPSX.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PadSSSPSX.def
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\PadSSSPSX.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PadSSSPSXres.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\PadSSSPSX.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.h b/win32/plugins/PadSSSPSX/PadSSSPSX.h
index 85a0d2dd..b53f64d4 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.h
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.h
@@ -1,47 +1,47 @@
-/* PADwin
- * Copyright (C) 2002-2004 PADwin Team
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PAD_H__
-#define __PAD_H__
-
-#include "PadSSSPSXres.h"
-
-typedef signed char s8;
-typedef signed short s16;
-typedef signed int s32;
-typedef __int64 s64;
-
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef unsigned __int64 u64;
-
-typedef struct
-{
- u32 key;
- u32 event;
-} keyEvent;
-
-typedef struct
-{
- u32 keys[2][21];
- u32 dualshock;
- u32 visualvibration[2];
-} Config;
-
-#endif
+/* PADwin
+ * Copyright (C) 2002-2004 PADwin Team
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAD_H__
+#define __PAD_H__
+
+#include "PadSSSPSXres.h"
+
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+typedef __int64 s64;
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef unsigned __int64 u64;
+
+typedef struct
+{
+ u32 key;
+ u32 event;
+} keyEvent;
+
+typedef struct
+{
+ u32 keys[2][21];
+ u32 dualshock;
+ u32 visualvibration[2];
+} Config;
+
+#endif
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.rc b/win32/plugins/PadSSSPSX/PadSSSPSX.rc
index 3901a74a..e3f1c178 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.rc
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.rc
@@ -1,120 +1,120 @@
-#include "PadSSSPSXres.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-
-#include "afxres.h"
-
-#undef APSTUDIO_READONLY_SYMBOLS
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
-#ifdef _WIN32
-//LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
-//#pragma code_page(932)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-
-1 TEXTINCLUDE
-BEGIN
- "PadSSSPSXres.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif
-
-IDD_DIALOG1 DIALOGEX 0, 0, 442, 239
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
-CAPTION "PAD Settings"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- CONTROL "",IDC_TABC,"SysTabControl32",0x0,6,6,432,210
- PUSHBUTTON "L2",IDC_BL2,54,24,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_EL2,54,36,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "L1",IDC_BL1,54,48,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_EL1,54,60,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "Up",IDC_BUP,54,78,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_EUP,54,90,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "Left",IDC_BLEFT,12,102,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ELEFT,12,114,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "Right",IDC_BRIGHT,96,102,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ERIGHT,96,114,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "Down",IDC_BDOWN,54,126,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_EDOWN,54,138,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "Select",IDC_BSELECT,144,36,72,12,NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- EDITTEXT IDC_ESELECT,144,48,72,12,ES_READONLY | NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- PUSHBUTTON "Start",IDC_BSTART,228,36,72,12,NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- EDITTEXT IDC_ESTART,228,48,72,12,ES_READONLY | NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- PUSHBUTTON "Analog",IDC_BMODE,186,66,72,12,NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- EDITTEXT IDC_EMODE,186,78,72,12,ES_READONLY | NOT WS_TABSTOP,
- WS_EX_TRANSPARENT
- PUSHBUTTON "R2",IDC_BR2,318,24,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ER2,318,36,72,12,ES_AUTOHSCROLL | ES_READONLY | NOT
- WS_TABSTOP
- PUSHBUTTON "R1",IDC_BR1,318,48,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ER1,318,60,72,12,ES_AUTOHSCROLL | ES_READONLY | NOT
- WS_TABSTOP
- PUSHBUTTON "Triangle",IDC_BTRIANGLE,318,78,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ETRIANGLE,318,90,72,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_TABSTOP
- PUSHBUTTON "Square",IDC_BSQUARE,276,102,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ESQUARE,276,114,72,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_TABSTOP
- PUSHBUTTON "Circle",IDC_BCIRCLE,360,102,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ECIRCLE,360,114,72,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_TABSTOP
- PUSHBUTTON "Cross",IDC_BCROSS,318,126,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ECROSS,318,138,72,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_TABSTOP
- PUSHBUTTON "L3",IDC_BL3,144,132,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_EL3,144,144,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "LX",IDC_BLAX,144,162,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ELAX,144,174,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "LY",IDC_BLAY,144,186,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ELAY,144,198,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "R3",IDC_BR3,228,132,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ER3,228,144,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "RX",IDC_BRAX,228,162,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ERAX,228,174,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "RY",IDC_BRAY,228,186,72,12,NOT WS_TABSTOP
- EDITTEXT IDC_ERAY,228,198,72,12,ES_READONLY | NOT WS_TABSTOP
- PUSHBUTTON "OK",IDOK,330,222,48,12,NOT WS_TABSTOP
- PUSHBUTTON "Cancel",IDCANCEL,390,222,48,12,NOT WS_TABSTOP
- CTEXT "",IDC_STATIC,318,174,108,30,0,WS_EX_STATICEDGE
- CONTROL "DUALSHOCK2 INSIDE",IDC_DS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,331,179,84,8
- CONTROL "VISUAL VIBRATION",IDC_VV3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,331,191,84,8
-END
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_DIALOG1, DIALOG
- BEGIN
- RIGHTMARGIN, 432
- BOTTOMMARGIN, 233
- END
-END
-#endif
-
-#endif
-
-
-#ifndef APSTUDIO_INVOKED
-
-#endif
-
+#include "PadSSSPSXres.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+#include "afxres.h"
+
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+//LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+//#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+
+1 TEXTINCLUDE
+BEGIN
+ "PadSSSPSXres.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif
+
+IDD_DIALOG1 DIALOGEX 0, 0, 442, 239
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
+CAPTION "PAD Settings"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_TABC,"SysTabControl32",0x0,6,6,432,210
+ PUSHBUTTON "L2",IDC_BL2,54,24,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_EL2,54,36,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "L1",IDC_BL1,54,48,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_EL1,54,60,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "Up",IDC_BUP,54,78,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_EUP,54,90,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "Left",IDC_BLEFT,12,102,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ELEFT,12,114,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "Right",IDC_BRIGHT,96,102,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ERIGHT,96,114,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "Down",IDC_BDOWN,54,126,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_EDOWN,54,138,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "Select",IDC_BSELECT,144,36,72,12,NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ EDITTEXT IDC_ESELECT,144,48,72,12,ES_READONLY | NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ PUSHBUTTON "Start",IDC_BSTART,228,36,72,12,NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ EDITTEXT IDC_ESTART,228,48,72,12,ES_READONLY | NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ PUSHBUTTON "Analog",IDC_BMODE,186,66,72,12,NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ EDITTEXT IDC_EMODE,186,78,72,12,ES_READONLY | NOT WS_TABSTOP,
+ WS_EX_TRANSPARENT
+ PUSHBUTTON "R2",IDC_BR2,318,24,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ER2,318,36,72,12,ES_AUTOHSCROLL | ES_READONLY | NOT
+ WS_TABSTOP
+ PUSHBUTTON "R1",IDC_BR1,318,48,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ER1,318,60,72,12,ES_AUTOHSCROLL | ES_READONLY | NOT
+ WS_TABSTOP
+ PUSHBUTTON "Triangle",IDC_BTRIANGLE,318,78,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ETRIANGLE,318,90,72,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_TABSTOP
+ PUSHBUTTON "Square",IDC_BSQUARE,276,102,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ESQUARE,276,114,72,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_TABSTOP
+ PUSHBUTTON "Circle",IDC_BCIRCLE,360,102,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ECIRCLE,360,114,72,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_TABSTOP
+ PUSHBUTTON "Cross",IDC_BCROSS,318,126,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ECROSS,318,138,72,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_TABSTOP
+ PUSHBUTTON "L3",IDC_BL3,144,132,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_EL3,144,144,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "LX",IDC_BLAX,144,162,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ELAX,144,174,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "LY",IDC_BLAY,144,186,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ELAY,144,198,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "R3",IDC_BR3,228,132,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ER3,228,144,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "RX",IDC_BRAX,228,162,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ERAX,228,174,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "RY",IDC_BRAY,228,186,72,12,NOT WS_TABSTOP
+ EDITTEXT IDC_ERAY,228,198,72,12,ES_READONLY | NOT WS_TABSTOP
+ PUSHBUTTON "OK",IDOK,330,222,48,12,NOT WS_TABSTOP
+ PUSHBUTTON "Cancel",IDCANCEL,390,222,48,12,NOT WS_TABSTOP
+ CTEXT "",IDC_STATIC,318,174,108,30,0,WS_EX_STATICEDGE
+ CONTROL "DUALSHOCK2 INSIDE",IDC_DS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,331,179,84,8
+ CONTROL "VISUAL VIBRATION",IDC_VV3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,331,191,84,8
+END
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_DIALOG1, DIALOG
+ BEGIN
+ RIGHTMARGIN, 432
+ BOTTOMMARGIN, 233
+ END
+END
+#endif
+
+#endif
+
+
+#ifndef APSTUDIO_INVOKED
+
+#endif
+
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSX.vcproj b/win32/plugins/PadSSSPSX/PadSSSPSX.vcproj
index 96db2cc1..4a412622 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSX.vcproj
+++ b/win32/plugins/PadSSSPSX/PadSSSPSX.vcproj
@@ -1,281 +1,281 @@
-<?xml version="1.0" encoding="gb2312"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="SSSPSXpad"
- ProjectGUID="{0639CDF3-8C1F-47F4-A760-F5568194A083}"
- RootNamespace="SSSPSXpad"
- TargetFrameworkVersion="0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Debug/PadSSSPSX.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SSSPSXPAD_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- PrecompiledHeaderFile=".\Debug/PadSSSPSX.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="2052"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib dinput8.lib dxguid.lib"
- OutputFile=".\Debug/PadSSSPSX.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ModuleDefinitionFile=".\PadSSSPSX.def"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/PadSSSPSX.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=".\Debug/PadSSSPSX.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Debug/PadSSSPSX.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/PadSSSPSX.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SSSPSXPAD_EXPORTS"
- StringPooling="true"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile=".\Release/PadSSSPSX.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="2052"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib dinput8.lib dxguid.lib"
- OutputFile=".\Release/PadSSSPSX.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ModuleDefinitionFile=".\PadSSSPSX.def"
- ProgramDatabaseFile=".\Release/PadSSSPSX.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=".\Release/PadSSSPSX.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Release/PadSSSPSX.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="PadSSSPSX.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="PadSSSPSX.def"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath="PadSSSPSX.h"
- >
- </File>
- <File
- RelativePath="PadSSSPSXres.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- <File
- RelativePath="PadSSSPSX.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="SSSPSXpad"
+ ProjectGUID="{0639CDF3-8C1F-47F4-A760-F5568194A083}"
+ RootNamespace="SSSPSXpad"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/PadSSSPSX.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SSSPSXPAD_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/PadSSSPSX.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2052"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib dinput8.lib dxguid.lib"
+ OutputFile=".\Debug/PadSSSPSX.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\PadSSSPSX.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/PadSSSPSX.pdb"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/PadSSSPSX.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/PadSSSPSX.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/PadSSSPSX.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SSSPSXPAD_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/PadSSSPSX.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2052"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib dinput8.lib dxguid.lib"
+ OutputFile=".\Release/PadSSSPSX.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\PadSSSPSX.def"
+ ProgramDatabaseFile=".\Release/PadSSSPSX.pdb"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release/PadSSSPSX.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/PadSSSPSX.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="PadSSSPSX.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PadSSSPSX.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="PadSSSPSX.h"
+ >
+ </File>
+ <File
+ RelativePath="PadSSSPSXres.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="PadSSSPSX.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/win32/plugins/PadSSSPSX/PadSSSPSXres.h b/win32/plugins/PadSSSPSX/PadSSSPSXres.h
index 70b10f39..3134e9a5 100644..100755
--- a/win32/plugins/PadSSSPSX/PadSSSPSXres.h
+++ b/win32/plugins/PadSSSPSX/PadSSSPSXres.h
@@ -1,61 +1,61 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by PadSSSPSX.rc
-//
-#define IDD_DIALOG1 100
-#define IDC_BSELECT 1000
-#define IDC_BL3 1001
-#define IDC_BR3 1002
-#define IDC_BSTART 1003
-#define IDC_BUP 1004
-#define IDC_BRIGHT 1005
-#define IDC_BDOWN 1006
-#define IDC_BLEFT 1007
-#define IDC_BL2 1008
-#define IDC_BR2 1009
-#define IDC_BL1 1010
-#define IDC_BR1 1011
-#define IDC_BTRIANGLE 1012
-#define IDC_BCIRCLE 1013
-#define IDC_BCROSS 1014
-#define IDC_BSQUARE 1015
-#define IDC_BMODE 1016
-#define IDC_BLAX 1017
-#define IDC_BLAY 1018
-#define IDC_BRAX 1019
-#define IDC_BRAY 1020
-#define IDC_ESELECT 1030
-#define IDC_EL3 1031
-#define IDC_ER3 1032
-#define IDC_ESTART 1033
-#define IDC_EUP 1034
-#define IDC_ERIGHT 1035
-#define IDC_EDOWN 1036
-#define IDC_ELEFT 1037
-#define IDC_EL2 1038
-#define IDC_ER2 1039
-#define IDC_EL1 1040
-#define IDC_ER1 1041
-#define IDC_ETRIANGLE 1042
-#define IDC_ECIRCLE 1043
-#define IDC_ECROSS 1044
-#define IDC_ESQUARE 1045
-#define IDC_EMODE 1046
-#define IDC_ELAX 1047
-#define IDC_ELAY 1048
-#define IDC_ERAX 1049
-#define IDC_ERAY 1050
-#define IDC_TABC 1060
-#define IDC_DS2 1070
-#define IDC_VV3 1071
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1061
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by PadSSSPSX.rc
+//
+#define IDD_DIALOG1 100
+#define IDC_BSELECT 1000
+#define IDC_BL3 1001
+#define IDC_BR3 1002
+#define IDC_BSTART 1003
+#define IDC_BUP 1004
+#define IDC_BRIGHT 1005
+#define IDC_BDOWN 1006
+#define IDC_BLEFT 1007
+#define IDC_BL2 1008
+#define IDC_BR2 1009
+#define IDC_BL1 1010
+#define IDC_BR1 1011
+#define IDC_BTRIANGLE 1012
+#define IDC_BCIRCLE 1013
+#define IDC_BCROSS 1014
+#define IDC_BSQUARE 1015
+#define IDC_BMODE 1016
+#define IDC_BLAX 1017
+#define IDC_BLAY 1018
+#define IDC_BRAX 1019
+#define IDC_BRAY 1020
+#define IDC_ESELECT 1030
+#define IDC_EL3 1031
+#define IDC_ER3 1032
+#define IDC_ESTART 1033
+#define IDC_EUP 1034
+#define IDC_ERIGHT 1035
+#define IDC_EDOWN 1036
+#define IDC_ELEFT 1037
+#define IDC_EL2 1038
+#define IDC_ER2 1039
+#define IDC_EL1 1040
+#define IDC_ER1 1041
+#define IDC_ETRIANGLE 1042
+#define IDC_ECIRCLE 1043
+#define IDC_ECROSS 1044
+#define IDC_ESQUARE 1045
+#define IDC_EMODE 1046
+#define IDC_ELAX 1047
+#define IDC_ELAY 1048
+#define IDC_ERAX 1049
+#define IDC_ERAY 1050
+#define IDC_TABC 1060
+#define IDC_DS2 1070
+#define IDC_VV3 1071
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1061
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win32/plugins/PadSSSPSX/readmewip.txt b/win32/plugins/PadSSSPSX/readmewip.txt
index 14443362..fe3e66ea 100644..100755
--- a/win32/plugins/PadSSSPSX/readmewip.txt
+++ b/win32/plugins/PadSSSPSX/readmewip.txt
@@ -1,48 +1,48 @@
-SSSPSX Pad - An Open Source Pad plugin for PSX and PS2 emulators
-Author: Nagisa
-Homepage: http://www.asahi-net.or.jp/~bz7t-skmt/
-
-Overview:
--Small executable program
--Source code under 1000 step,20kb binary
--Open Source,under the GPL Licence
-
-
-Features:
-
-For PS1 emulators
-- Force feedback support (PCSX only)
- Delete the following PCSX sorce code.
- File: sio.c Line: 138
- ---------------------
- if (buf[parp] == 0x41) {
-  switch (value) {
-   case 0x43:
-    buf[1] = 0x43;
-    break;
-   case 0x45:
-    buf[1] = 0xf3;
-    break;
-  }
- }
- ---------------------
-
-For PCSX2
--Force feedback support (maybe)
--PADKeyEvent API support
--Using DirectInput 9 (game controller and keyboard)
-
-Thanks to:
-http://www.hm5.aitai.ne.jp/~takuya/index.html#ds2_analisys for the valuable info
-PCSX2 team for the PadWinKeyb source code
-bositman for some report
-
-Version History:
-v1.0: -Initial Release
-v1.1: -Changed to DirectInput 9
-v1.2: -PADKeyEvent API support added
-v1.3: -DirectInput collision problem fixed
-v1.4: -Added timeout on settings dialog.If the countdown ends, the key will be set to "NONE".
- -Changed "ESC" key action on settings dialog.If you press the "ESC" key, the setting will keep the previous one.
- -Fixed silly bug. (dont ask me about it).
-v1.5: -Fixed 0x4D packet.
+SSSPSX Pad - An Open Source Pad plugin for PSX and PS2 emulators
+Author: Nagisa
+Homepage: http://www.asahi-net.or.jp/~bz7t-skmt/
+
+Overview:
+-Small executable program
+-Source code under 1000 step,20kb binary
+-Open Source,under the GPL Licence
+
+
+Features:
+
+For PS1 emulators
+- Force feedback support (PCSX only)
+ Delete the following PCSX sorce code.
+ File: sio.c Line: 138
+ ---------------------
+ if (buf[parp] == 0x41) {
+  switch (value) {
+   case 0x43:
+    buf[1] = 0x43;
+    break;
+   case 0x45:
+    buf[1] = 0xf3;
+    break;
+  }
+ }
+ ---------------------
+
+For PCSX2
+-Force feedback support (maybe)
+-PADKeyEvent API support
+-Using DirectInput 9 (game controller and keyboard)
+
+Thanks to:
+http://www.hm5.aitai.ne.jp/~takuya/index.html#ds2_analisys for the valuable info
+PCSX2 team for the PadWinKeyb source code
+bositman for some report
+
+Version History:
+v1.0: -Initial Release
+v1.1: -Changed to DirectInput 9
+v1.2: -PADKeyEvent API support added
+v1.3: -DirectInput collision problem fixed
+v1.4: -Added timeout on settings dialog.If the countdown ends, the key will be set to "NONE".
+ -Changed "ESC" key action on settings dialog.If you press the "ESC" key, the setting will keep the previous one.
+ -Fixed silly bug. (dont ask me about it).
+v1.5: -Fixed 0x4D packet.