Builds with latest DirectX SDK, which doesn't support Direct 3D 8 & Direct Input 7. If you want to compile in support for earlier versions then you can set DIRECT3D=8 & DIRECTINPUT=7. Based on a diff posted on the mameworld compiling board by RansAckeR, who was helped by uRebelScum.

This commit is contained in:
smf- 2008-07-26 21:13:35 +00:00
parent a08d7977c3
commit 0124a7cc68
4 changed files with 42 additions and 10 deletions

View File

@ -234,7 +234,9 @@ struct _d3d
// PROTOTYPES
//============================================================
#if DIRECT3D_VERSION < 0x0900
d3d *drawd3d8_init(void);
#endif
d3d *drawd3d9_init(void);

View File

@ -455,9 +455,11 @@ int drawd3d_init(win_draw_callbacks *callbacks)
if (version >= 9)
d3dintf = drawd3d9_init();
#if DIRECT3D_VERSION < 0x0900
// if that didn't work, try Direct3D 8
if (d3dintf == NULL && version >= 8)
d3dintf = drawd3d8_init();
#endif
// if we failed, note the error
if (d3dintf == NULL)

View File

@ -18,10 +18,6 @@
// undef WINNT for dinput.h to prevent duplicate definition
#undef WINNT
#ifdef DIRECTINPUT_VERSION
#undef DIRECTINPUT_VERSION
#endif
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h>
// standard C headers
@ -1054,6 +1050,23 @@ static void win32_lightgun_poll(device_info *devinfo)
static void dinput_init(running_machine *machine)
{
HRESULT result;
#if DIRECTINPUT_VERSION >= 0x800
int didevtype_keyboard = DI8DEVCLASS_KEYBOARD;
int didevtype_mouse = DI8DEVCLASS_POINTER;
int didevtype_joystick = DI8DEVCLASS_GAMECTRL;
// first attempt to initialize DirectInput at the current version
dinput_version = DIRECTINPUT_VERSION;
result = DirectInput8Create(GetModuleHandle(NULL), dinput_version, &IID_IDirectInput8, &dinput, NULL);
if (result != DI_OK)
{
dinput_version = 0;
return;
}
#else
int didevtype_keyboard = DIDEVTYPE_KEYBOARD;
int didevtype_mouse = DIDEVTYPE_MOUSE;
int didevtype_joystick = DIDEVTYPE_JOYSTICK;
// first attempt to initialize DirectInput at the current version
dinput_version = DIRECTINPUT_VERSION;
@ -1075,6 +1088,8 @@ static void dinput_init(running_machine *machine)
}
}
}
#endif
mame_printf_verbose("DirectInput: Using DirectInput %d\n", dinput_version >> 8);
// we need an exit callback
@ -1084,7 +1099,7 @@ static void dinput_init(running_machine *machine)
if (keyboard_list == NULL)
{
// enumerate the ones we have
result = IDirectInput_EnumDevices(dinput, DIDEVTYPE_KEYBOARD, dinput_keyboard_enum, 0, DIEDFL_ATTACHEDONLY);
result = IDirectInput_EnumDevices(dinput, didevtype_keyboard, dinput_keyboard_enum, 0, DIEDFL_ATTACHEDONLY);
if (result != DI_OK)
fatalerror("DirectInput: Unable to enumerate keyboards (result=%08X)\n", (UINT32)result);
}
@ -1093,13 +1108,13 @@ static void dinput_init(running_machine *machine)
if (mouse_list == NULL)
{
// enumerate the ones we have
result = IDirectInput_EnumDevices(dinput, DIDEVTYPE_MOUSE, dinput_mouse_enum, 0, DIEDFL_ATTACHEDONLY);
result = IDirectInput_EnumDevices(dinput, didevtype_mouse, dinput_mouse_enum, 0, DIEDFL_ATTACHEDONLY);
if (result != DI_OK)
fatalerror("DirectInput: Unable to enumerate mice (result=%08X)\n", (UINT32)result);
}
// initialize joystick devices
result = IDirectInput_EnumDevices(dinput, DIDEVTYPE_JOYSTICK, dinput_joystick_enum, 0, DIEDFL_ATTACHEDONLY);
result = IDirectInput_EnumDevices(dinput, didevtype_joystick, dinput_joystick_enum, 0, DIEDFL_ATTACHEDONLY);
if (result != DI_OK)
fatalerror("DirectInput: Unable to enumerate joysticks (result=%08X)\n", (UINT32)result);
}

View File

@ -194,8 +194,16 @@ ifdef WIN95_MULTIMON
CFLAGS += -DWIN95_MULTIMON
endif
# add the windows libaries
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldinput -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
# add the windows libraries
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
ifeq ($(DIRECTINPUT),7)
LIBS += -ldinput
CFLAGS += -DDIRECTINPUT_VERSION=0x0700
else
LIBS += -ldinput8
CFLAGS += -DDIRECTINPUT_VERSION=0x0800
endif
ifdef PTR64
ifdef MSVC_BUILD
@ -236,7 +244,6 @@ endif
#-------------------------------------------------
OSDOBJS = \
$(WINOBJ)/d3d8intf.o \
$(WINOBJ)/d3d9intf.o \
$(WINOBJ)/drawd3d.o \
$(WINOBJ)/drawdd.o \
@ -249,6 +256,12 @@ OSDOBJS = \
$(WINOBJ)/window.o \
$(WINOBJ)/winmain.o
ifeq ($(DIRECT3D),8)
OSDOBJS += $(WINOBJ)/d3d8intf.o
else
CFLAGS += -DDIRECT3D_VERSION=0x0900
endif
# extra dependencies
$(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.c
$(WINOBJ)/drawgdi.o : $(SRC)/emu/rendersw.c