mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +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
|
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
|
- Stopped sending double the number of wheel events as appropriate to the
|
||||||
console under Linux.
|
console under Linux.
|
||||||
- Added middle mouse button selection pasting for X systems.
|
- Added middle mouse button selection pasting for X systems.
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
|
#include "v_text.h"
|
||||||
|
|
||||||
#define DINPUT_BUFFERSIZE 32
|
#define DINPUT_BUFFERSIZE 32
|
||||||
|
|
||||||
|
@ -1451,30 +1452,32 @@ bool I_InitInput (void *hwnd)
|
||||||
|
|
||||||
// Try for DirectInput 8 first, then DirectInput 3 for NT 4's benefit.
|
// 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);
|
DInputDLL = LoadLibrary("dinput8.dll");
|
||||||
|
if (DInputDLL != NULL)
|
||||||
|
{
|
||||||
|
typedef HRESULT (*blah)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
|
||||||
|
blah di8c = (blah)GetProcAddress(DInputDLL, "DirectInput8Create");
|
||||||
|
if (di8c != NULL)
|
||||||
|
{
|
||||||
|
hr = di8c(g_hInst, DIRECTINPUT_VERSION, IID_IDirectInput8A, (void **)&g_pdi, NULL);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
g_pdi = NULL;
|
Printf(TEXTCOLOR_ORANGE "DirectInput8Create failed: %08lx", hr);
|
||||||
|
g_pdi = NULL; // Just to be sure DirectInput8Create didn't change it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hr = g_pdi->Initialize (g_hInst, 0x0800);
|
Printf(TEXTCOLOR_ORANGE "Could not find DirectInput8Create in dinput8.dll\n");
|
||||||
if (FAILED (hr))
|
|
||||||
{
|
|
||||||
g_pdi->Release ();
|
|
||||||
g_pdi = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pdi == NULL)
|
if (g_pdi == NULL)
|
||||||
{
|
{
|
||||||
hr = CoCreateInstance (CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, IID_IDirectInputA, (void**)&g_pdi3);
|
if (DInputDLL != NULL)
|
||||||
if (hr == REGDB_E_CLASSNOTREG)
|
|
||||||
{
|
{
|
||||||
// NT 4 has the wrong GUID in the registry for CLSID_DirectInput unless somebody has already
|
FreeLibrary(DInputDLL);
|
||||||
// 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");
|
DInputDLL = LoadLibrary ("dinput.dll");
|
||||||
if (DInputDLL == NULL)
|
if (DInputDLL == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1494,23 +1497,6 @@ bool I_InitInput (void *hwnd)
|
||||||
{
|
{
|
||||||
I_FatalError ("DirectInputCreate failed: %08lx", hr);
|
I_FatalError ("DirectInputCreate failed: %08lx", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf ("Tip for NT 4: \"regsvr32 dinput.dll\"\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf ("I_StartupMouse\n");
|
Printf ("I_StartupMouse\n");
|
||||||
|
|
Loading…
Reference in a new issue