mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
- Changed I_InitInput() to acquire the IDirectInput8A interface by using
DirectInput8Create() instead of CoCreateInstance(). This allows the Steam GameOverlayRenderer.dll to properly hook it. SVN r1422 (trunk)
This commit is contained in:
parent
d444fc54fd
commit
085be22a30
2 changed files with 38 additions and 49 deletions
|
@ -1,4 +1,7 @@
|
|||
February 9, 2009
|
||||
- Changed I_InitInput() to acquire the IDirectInput8A interface by using
|
||||
DirectInput8Create() instead of CoCreateInstance(). This allows the Steam
|
||||
GameOverlayRenderer.dll to properly hook it.
|
||||
- Stopped sending double the number of wheel events as appropriate to the
|
||||
console under Linux.
|
||||
- Added middle mouse button selection pasting for X systems.
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
#include "templates.h"
|
||||
#include "cmdlib.h"
|
||||
#include "d_event.h"
|
||||
#include "v_text.h"
|
||||
|
||||
#define DINPUT_BUFFERSIZE 32
|
||||
|
||||
|
@ -1451,65 +1452,50 @@ bool I_InitInput (void *hwnd)
|
|||
|
||||
// Try for DirectInput 8 first, then DirectInput 3 for NT 4's benefit.
|
||||
|
||||
hr = CoCreateInstance (CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, IID_IDirectInput8A, (void**)&g_pdi);
|
||||
if (FAILED(hr))
|
||||
DInputDLL = LoadLibrary("dinput8.dll");
|
||||
if (DInputDLL != NULL)
|
||||
{
|
||||
g_pdi = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = g_pdi->Initialize (g_hInst, 0x0800);
|
||||
if (FAILED (hr))
|
||||
typedef HRESULT (*blah)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
|
||||
blah di8c = (blah)GetProcAddress(DInputDLL, "DirectInput8Create");
|
||||
if (di8c != NULL)
|
||||
{
|
||||
g_pdi->Release ();
|
||||
g_pdi = NULL;
|
||||
hr = di8c(g_hInst, DIRECTINPUT_VERSION, IID_IDirectInput8A, (void **)&g_pdi, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "DirectInput8Create failed: %08lx", hr);
|
||||
g_pdi = NULL; // Just to be sure DirectInput8Create didn't change it
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "Could not find DirectInput8Create in dinput8.dll\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (g_pdi == NULL)
|
||||
{
|
||||
hr = CoCreateInstance (CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, IID_IDirectInputA, (void**)&g_pdi3);
|
||||
if (hr == REGDB_E_CLASSNOTREG)
|
||||
if (DInputDLL != NULL)
|
||||
{
|
||||
// NT 4 has the wrong GUID in the registry for CLSID_DirectInput unless somebody has already
|
||||
// used "regsvr32 dinput.dll" to properly register the class. This means the only sure way to
|
||||
// obtain an IDirectInputA interface under NT 4 is to actually load the DLL and use
|
||||
// the function it provides. Grrr.
|
||||
DInputDLL = LoadLibrary ("dinput.dll");
|
||||
if (DInputDLL == NULL)
|
||||
{
|
||||
I_FatalError ("Could not load dinput.dll: %08lx", GetLastError());
|
||||
}
|
||||
|
||||
typedef HRESULT (*blah)(HINSTANCE, DWORD, LPDIRECTINPUT*, LPUNKNOWN);
|
||||
blah dic = (blah)GetProcAddress (DInputDLL, "DirectInputCreateA");
|
||||
|
||||
if (dic == NULL)
|
||||
{
|
||||
I_FatalError ("dinput.dll is corrupt");
|
||||
}
|
||||
|
||||
hr = dic (g_hInst, 0x0300, &g_pdi3, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
I_FatalError ("DirectInputCreate failed: %08lx", hr);
|
||||
}
|
||||
|
||||
Printf ("Tip for NT 4: \"regsvr32 dinput.dll\"\n");
|
||||
FreeLibrary(DInputDLL);
|
||||
}
|
||||
else
|
||||
DInputDLL = LoadLibrary ("dinput.dll");
|
||||
if (DInputDLL == NULL)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
I_FatalError ("Could not create DirectInput interface: %08lx", hr);
|
||||
}
|
||||
hr = g_pdi3->Initialize (g_hInst, 0x0300);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
g_pdi3->Release ();
|
||||
g_pdi3 = NULL;
|
||||
I_FatalError ("Could not initialize DirectInput interface: %08lx", hr);
|
||||
}
|
||||
I_FatalError ("Could not load dinput.dll: %08lx", GetLastError());
|
||||
}
|
||||
|
||||
typedef HRESULT (*blah)(HINSTANCE, DWORD, LPDIRECTINPUT*, LPUNKNOWN);
|
||||
blah dic = (blah)GetProcAddress (DInputDLL, "DirectInputCreateA");
|
||||
|
||||
if (dic == NULL)
|
||||
{
|
||||
I_FatalError ("dinput.dll is corrupt");
|
||||
}
|
||||
|
||||
hr = dic (g_hInst, 0x0300, &g_pdi3, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
I_FatalError ("DirectInputCreate failed: %08lx", hr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue