mirror of https://github.com/PCSX2/pcsx2.git
SSSPSXPAD: Fix for a random crashing bug when doing suspend/resume type stuff (caused by multiple threads trying to initialize directinput at the same time)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2383 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
916cc034ff
commit
3c03e15dc1
|
@ -1,6 +1,6 @@
|
||||||
; FireWire.def : Declares the module parameters for the DLL.
|
; FireWire.def : Declares the module parameters for the DLL.
|
||||||
|
|
||||||
LIBRARY "FWnull"
|
;LIBRARY "GSnull"
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
; Explicit exports can go here
|
; Explicit exports can go here
|
||||||
|
|
|
@ -25,6 +25,7 @@ HWND hTargetWnd;
|
||||||
static std::string s_strIniPath( "inis/" );
|
static std::string s_strIniPath( "inis/" );
|
||||||
|
|
||||||
static CRITICAL_SECTION update_lock;
|
static CRITICAL_SECTION update_lock;
|
||||||
|
static CRITICAL_SECTION init_lock;
|
||||||
|
|
||||||
struct EnterScopedSection
|
struct EnterScopedSection
|
||||||
{
|
{
|
||||||
|
@ -40,7 +41,6 @@ struct EnterScopedSection
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
keyEvent ev;
|
keyEvent ev;
|
||||||
|
@ -139,6 +139,8 @@ static bool ReleaseDirectInput (void)
|
||||||
|
|
||||||
static bool InitDirectInput (void)
|
static bool InitDirectInput (void)
|
||||||
{
|
{
|
||||||
|
EnterScopedSection initlock( init_lock );
|
||||||
|
|
||||||
if (global.pDInput)
|
if (global.pDInput)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
HRESULT result = DirectInput8Create (hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&global.pDInput, NULL);
|
HRESULT result = DirectInput8Create (hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&global.pDInput, NULL);
|
||||||
|
@ -760,12 +762,14 @@ u32 CALLBACK PSEgetLibVersion (void)
|
||||||
s32 CALLBACK PADinit (u32 flags)
|
s32 CALLBACK PADinit (u32 flags)
|
||||||
{
|
{
|
||||||
InitializeCriticalSection( &update_lock );
|
InitializeCriticalSection( &update_lock );
|
||||||
|
InitializeCriticalSection( &init_lock );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK PADshutdown (void)
|
void CALLBACK PADshutdown (void)
|
||||||
{
|
{
|
||||||
DeleteCriticalSection( &update_lock );
|
DeleteCriticalSection( &update_lock );
|
||||||
|
DeleteCriticalSection( &init_lock );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int n_open = 0;
|
static int n_open = 0;
|
||||||
|
|
Loading…
Reference in New Issue