From 742bae8d944ae23a6d5e87351d23f072870aa716 Mon Sep 17 00:00:00 2001 From: "MattMenke@gmail.com" Date: Thu, 11 Feb 2010 16:09:00 +0000 Subject: [PATCH] SSSPSX: Slight change to analog stick zero position, at rama1's suggestion. Zero should be 0x7F instead of 0x80. Untested, as I don't use the plugin and am rather lazy. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2587 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/SSSPSXPAD/PadSSSPSX.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/SSSPSXPAD/PadSSSPSX.cpp b/plugins/SSSPSXPAD/PadSSSPSX.cpp index 9a4a821b2a..a495cde467 100644 --- a/plugins/SSSPSXPAD/PadSSSPSX.cpp +++ b/plugins/SSSPSXPAD/PadSSSPSX.cpp @@ -140,7 +140,7 @@ static bool ReleaseDirectInput (void) static bool InitDirectInput (void) { EnterScopedSection initlock( init_lock ); - + if (global.pDInput) return TRUE; HRESULT result = DirectInput8Create (hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&global.pDInput, NULL); @@ -349,7 +349,7 @@ static std::string MakeConfigFileName() { //GetModuleFileName (hInstance, fname, 256); //strcpy (fname + strlen (fname) - 3, "cfg"); - + return s_strIniPath + "PadSSSPSX.cfg"; } @@ -852,7 +852,12 @@ 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); + int value = (((int*)&global.JoyState[pad].lX)[pos] + 0x7F); + if (value >= 0xC0) value++; + if (value < 0) value = 0; + // Don't think this happens, but just in case... + if (value > 0xFF) value = 0xFF; + return (u8)value; } static u8 get_pressure (const DWORD now, const DWORD press) @@ -1146,14 +1151,14 @@ s32 CALLBACK PADfreeze (int mode, freezeData *data) case FREEZE_SIZE: data->size = 0; break; - + case FREEZE_LOAD: break; - + case FREEZE_SAVE: break; } - + return 0; } @@ -1165,7 +1170,7 @@ BOOL APIENTRY DllMain(HMODULE hInst, DWORD dwReason, LPVOID lpReserved) hInstance = hInst; InitializeCriticalSection( &update_lock ); InitializeCriticalSection( &init_lock ); - } + } else if( dwReason == DLL_PROCESS_DETACH ) { DeleteCriticalSection( &update_lock );