summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-02-28 22:10:06 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-02-28 22:10:06 +0000
commite2757c60d2fa5e74909eff1e7a48ce5841ad47e5 (patch)
treeb30bddf750ef14f54e147b8d214d693af27f5d33 /src/osd
parent42004cf3baf9c0307775c43096df36c1d5884bf4 (diff)
Modified the makefile to support experimental optional C++
compilation: - new option CPP_COMPILE to trigger this (off by default) - split CFLAGS into common, C-only, and C++-only flags - when enabled, CPP_COMPILE causes 'pp' to be appended to the target name NOTE THAT THE SYSTEM CANNOT ACTUALLY BE COMPILED THIS WAY YET. IT IS JUST AN EXPERIMENT. Modified lib.mak to always build zlib/expat as C regardless of CPP_COMPILE. Modified windows.mak to fix warnings with MAXOPT=1, and to leverage the new CFLAGs definitions. Modified vconv.c to do appropriate conversions for new C++ options. Updated sources so that libutil, libocore (Windows), and libosd (Windows) can be cleanly compiled as C or C++. This was mostly adding some casts against void *. Fixed a few more general obvious problems at random locations in the source: - device->class is now device->devclass - TYPES_COMPATIBLE uses typeid() when compiled for C++ - some functions with reserved names ('xor' in particular) were renamed - nested enums and structs were pulled out into separate definitions (under C++ these would need to be scoped to be referenced) - TOKEN_VALUE cannot use .field=x initialization in C++ :(
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/osdcomm.h17
-rw-r--r--src/osd/windows/d3d8intf.c2
-rw-r--r--src/osd/windows/d3d9intf.c2
-rw-r--r--src/osd/windows/debugwin.c12
-rw-r--r--src/osd/windows/drawd3d.c52
-rw-r--r--src/osd/windows/drawdd.c42
-rw-r--r--src/osd/windows/drawgdi.c8
-rw-r--r--src/osd/windows/eivc.h14
-rw-r--r--src/osd/windows/input.c68
-rw-r--r--src/osd/windows/output.c4
-rw-r--r--src/osd/windows/vconv.c293
-rw-r--r--src/osd/windows/video.c4
-rw-r--r--src/osd/windows/windir.c2
-rw-r--r--src/osd/windows/window.c2
-rw-r--r--src/osd/windows/windows.mak28
-rw-r--r--src/osd/windows/winfile.c6
-rw-r--r--src/osd/windows/winmain.h12
-rw-r--r--src/osd/windows/winprefix.h1
-rw-r--r--src/osd/windows/winsync.c2
-rw-r--r--src/osd/windows/winwork.c8
20 files changed, 308 insertions, 271 deletions
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h
index e4f7d7baea1..5a06603081b 100644
--- a/src/osd/osdcomm.h
+++ b/src/osd/osdcomm.h
@@ -19,6 +19,9 @@
#include <string.h>
#include <stdlib.h>
+#ifdef __cplusplus
+#include <typeinfo>
+#endif
/***************************************************************************
@@ -31,6 +34,12 @@
#endif
+/* In C++ we can do type checking via typeid */
+#ifdef __cplusplus
+#define TYPES_COMPATIBLE(a,b) (typeid(a) == typeid(b))
+#endif
+
+
/* Some optimizations/warnings cleanups for GCC */
#if defined(__GNUC__) && (__GNUC__ >= 3)
#define ATTR_UNUSED __attribute__((__unused__))
@@ -42,9 +51,11 @@
#define ATTR_FORCE_INLINE __attribute__((always_inline))
#define ATTR_NONNULL __attribute__((nonnull(1)))
#define UNEXPECTED(exp) __builtin_expect((exp), 0)
-#define TYPES_COMPATIBLE(a,b) __builtin_types_compatible_p(a, b)
#define RESTRICT __restrict__
#define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(1)
+#ifndef TYPES_COMPATIBLE
+#define TYPES_COMPATIBLE(a,b) __builtin_types_compatible_p(a, b)
+#endif
#else
#define ATTR_UNUSED
#define ATTR_NORETURN
@@ -55,9 +66,11 @@
#define ATTR_FORCE_INLINE
#define ATTR_NONNULL
#define UNEXPECTED(exp) (exp)
-#define TYPES_COMPATIBLE(a,b) 1
#define RESTRICT
#define SETJMP_GNUC_PROTECT() do {} while (0)
+#ifndef TYPES_COMPATIBLE
+#define TYPES_COMPATIBLE(a,b) 1
+#endif
#endif
diff --git a/src/osd/windows/d3d8intf.c b/src/osd/windows/d3d8intf.c
index 6e9526c609d..779d57230ff 100644
--- a/src/osd/windows/d3d8intf.c
+++ b/src/osd/windows/d3d8intf.c
@@ -104,7 +104,7 @@ d3d *drawd3d8_init(void)
}
// allocate an object to hold our data
- d3dptr = malloc_or_die(sizeof(*d3dptr));
+ d3dptr = (d3d *)malloc_or_die(sizeof(*d3dptr));
d3dptr->version = 8;
d3dptr->d3dobj = d3d8;
d3dptr->dllhandle = dllhandle;
diff --git a/src/osd/windows/d3d9intf.c b/src/osd/windows/d3d9intf.c
index 4ec727417eb..251201487c8 100644
--- a/src/osd/windows/d3d9intf.c
+++ b/src/osd/windows/d3d9intf.c
@@ -102,7 +102,7 @@ d3d *drawd3d9_init(void)
}
// allocate an object to hold our data
- d3dptr = malloc_or_die(sizeof(*d3dptr));
+ d3dptr = (d3d *)malloc_or_die(sizeof(*d3dptr));
d3dptr->version = 9;
d3dptr->d3dobj = d3d9;
d3dptr->dllhandle = dllhandle;
diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c
index 21b4caf2f28..78e3c794ec0 100644
--- a/src/osd/windows/debugwin.c
+++ b/src/osd/windows/debugwin.c
@@ -503,7 +503,7 @@ static debugwin_info *debugwin_window_create(running_machine *machine, LPCSTR ti
RECT work_bounds;
// allocate memory
- info = malloc_or_die(sizeof(*info));
+ info = (debugwin_info *)malloc_or_die(sizeof(*info));
memset(info, 0, sizeof(*info));
// create the window
@@ -584,7 +584,7 @@ static void debugwin_window_draw_contents(debugwin_info *info, HDC dc)
// fill the background with light gray
GetClientRect(info->wnd, &parent);
- FillRect(dc, &parent, GetStockObject(LTGRAY_BRUSH));
+ FillRect(dc, &parent, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
// get the parent bounds in screen coords
ClientToScreen(info->wnd, &((POINT *)&parent)[0]);
@@ -1007,7 +1007,7 @@ static void debugwin_view_draw_contents(debugview_info *view, HDC windc)
static void debugwin_view_update(debug_view *view, void *osdprivate)
{
- debugview_info *info = osdprivate;
+ debugview_info *info = (debugview_info *)osdprivate;
RECT bounds, vscroll_bounds, hscroll_bounds;
debug_view_xy totalsize, visiblesize, topleft;
int show_vscroll, show_hscroll;
@@ -1727,7 +1727,7 @@ static void memory_create_window(running_machine *machine)
// create an edit box and override its key handling
info->editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE,
0, 0, 100, 100, info->wnd, NULL, GetModuleHandle(NULL), NULL);
- info->original_editproc = (void *)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
+ info->original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info);
SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debugwin_edit_proc);
SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
@@ -2036,7 +2036,7 @@ static void disasm_create_window(running_machine *machine)
// create an edit box and override its key handling
info->editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE,
0, 0, 100, 100, info->wnd, NULL, GetModuleHandle(NULL), NULL);
- info->original_editproc = (void *)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
+ info->original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info);
SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debugwin_edit_proc);
SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
@@ -2370,7 +2370,7 @@ void console_create_window(running_machine *machine)
// create an edit box and override its key handling
info->editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE,
0, 0, 100, 100, info->wnd, NULL, GetModuleHandle(NULL), NULL);
- info->original_editproc = (void *)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
+ info->original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(info->editwnd, GWLP_WNDPROC);
SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info);
SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debugwin_edit_proc);
SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index 150ea5c7449..99f0bff8e14 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -302,9 +302,9 @@ INLINE void set_filter(d3d_info *d3d, int filter)
if (filter != d3d->last_filter)
{
d3d->last_filter = filter;
- result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, D3DTSS_MINFILTER, filter ? D3DTEXF_LINEAR : D3DTEXF_POINT);
+ result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, (D3DTEXTURESTAGESTATETYPE)D3DTSS_MINFILTER, filter ? D3DTEXF_LINEAR : D3DTEXF_POINT);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_texture_stage_state call\n", (int)result);
- result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, D3DTSS_MAGFILTER, filter ? D3DTEXF_LINEAR : D3DTEXF_POINT);
+ result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, (D3DTEXTURESTAGESTATETYPE)D3DTSS_MAGFILTER, filter ? D3DTEXF_LINEAR : D3DTEXF_POINT);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_texture_stage_state call\n", (int)result);
}
}
@@ -316,9 +316,9 @@ INLINE void set_wrap(d3d_info *d3d, int wrap)
if (wrap != d3d->last_wrap)
{
d3d->last_wrap = wrap;
- result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, D3DTSS_ADDRESSU, wrap ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
+ result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, (D3DTEXTURESTAGESTATETYPE)D3DTSS_ADDRESSU, wrap ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_texture_stage_state call\n", (int)result);
- result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, D3DTSS_ADDRESSV, wrap ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
+ result = (*d3dintf->device.set_texture_stage_state)(d3d->device, 0, (D3DTEXTURESTAGESTATETYPE)D3DTSS_ADDRESSV, wrap ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_texture_stage_state call\n", (int)result);
}
}
@@ -500,7 +500,7 @@ static int drawd3d_window_init(win_window_info *window)
d3d_info *d3d;
// allocate memory for our structures
- d3d = malloc_or_die(sizeof(*d3d));
+ d3d = (d3d_info *)malloc_or_die(sizeof(*d3d));
memset(d3d, 0, sizeof(*d3d));
window->drawdata = d3d;
@@ -537,7 +537,7 @@ error:
static void drawd3d_window_destroy(win_window_info *window)
{
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
// skip if nothing
if (d3d == NULL)
@@ -563,7 +563,7 @@ static void drawd3d_window_destroy(win_window_info *window)
static const render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
{
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
RECT client;
GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen);
@@ -583,7 +583,7 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
{
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
const render_primitive *prim;
HRESULT result;
@@ -669,7 +669,7 @@ mtlog_add("drawd3d_window_draw: present end");
static int device_create(win_window_info *window)
{
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
HRESULT result;
int verify;
@@ -819,7 +819,7 @@ static int device_create_resources(d3d_info *d3d)
}
// set the vertex format
- result = (*d3dintf->device.set_vertex_shader)(d3d->device, VERTEX_FORMAT);
+ result = (*d3dintf->device.set_vertex_shader)(d3d->device, (D3DFORMAT)VERTEX_FORMAT);
if (result != D3D_OK)
{
mame_printf_error("Error setting vertex shader (%08X)", (UINT32)result);
@@ -1126,7 +1126,7 @@ static int device_test_cooperative(d3d_info *d3d)
static int config_adapter_mode(win_window_info *window)
{
d3d_adapter_identifier identifier;
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
HRESULT result;
// choose the monitor number
@@ -1244,7 +1244,7 @@ static void pick_best_mode(win_window_info *window)
const device_config *primary_screen = video_screen_first(window->machine->config);
double target_refresh = 60.0;
INT32 target_width, target_height;
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
INT32 minwidth, minheight;
float best_score = 0.0f;
int maxmodes;
@@ -1253,7 +1253,7 @@ static void pick_best_mode(win_window_info *window)
// determine the refresh rate of the primary screen
if (primary_screen != NULL)
{
- const screen_config *config = primary_screen->inline_config;
+ const screen_config *config = (const screen_config *)primary_screen->inline_config;
target_refresh = ATTOSECONDS_TO_HZ(config->refresh);
}
@@ -1288,7 +1288,7 @@ static void pick_best_mode(win_window_info *window)
continue;
// compute initial score based on difference between target and current
- size_score = 1.0f / (1.0f + fabs(mode.Width - target_width) + fabs(mode.Height - target_height));
+ size_score = 1.0f / (1.0f + fabs((float)(mode.Width - target_width)) + fabs((float)(mode.Height - target_height)));
// if the mode is too small, give a big penalty
if (mode.Width < minwidth || mode.Height < minheight)
@@ -1338,7 +1338,7 @@ static void pick_best_mode(win_window_info *window)
static int update_window_size(win_window_info *window)
{
- d3d_info *d3d = window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
RECT client;
// get the current window bounds
@@ -1658,7 +1658,7 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour
HRESULT result;
// allocate a new texture
- texture = malloc_or_die(sizeof(*texture));
+ texture = (texture_info *)malloc_or_die(sizeof(*texture));
memset(texture, 0, sizeof(*texture));
// fill in the core data
@@ -1687,7 +1687,7 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour
{
D3DFORMAT format;
DWORD usage = d3d->dynamic_supported ? D3DUSAGE_DYNAMIC : 0;
- DWORD pool = d3d->dynamic_supported ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
+ D3DPOOL pool = d3d->dynamic_supported ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
int maxdim = MAX(d3d->presentation.BackBufferWidth, d3d->presentation.BackBufferHeight);
int attempt;
@@ -1734,7 +1734,7 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour
else
{
int scwidth, scheight;
- int finalfmt;
+ D3DFORMAT finalfmt;
// use an offscreen plain surface for stretching if supported
// (won't work for YUY textures)
@@ -2306,32 +2306,32 @@ static void texture_set_data(d3d_info *d3d, texture_info *texture, const render_
switch (PRIMFLAG_GET_TEXFORMAT(flags))
{
case TEXFORMAT_PALETTE16:
- copyline_palette16(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
case TEXFORMAT_PALETTEA16:
- copyline_palettea16(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
case TEXFORMAT_RGB15:
- copyline_rgb15(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_rgb15((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
case TEXFORMAT_RGB32:
- copyline_rgb32(dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
case TEXFORMAT_ARGB32:
- copyline_argb32(dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
case TEXFORMAT_YUY16:
if (d3d->yuv_format == D3DFMT_YUY2)
- copyline_yuy16_to_yuy2(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_yuy16_to_yuy2((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
else if (d3d->yuv_format == D3DFMT_UYVY)
- copyline_yuy16_to_uyvy(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_yuy16_to_uyvy((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
else
- copyline_yuy16_to_argb(dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
+ copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, texture->xborderpix);
break;
default:
diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c
index e0a9557beaf..bff50c0a2af 100644
--- a/src/osd/windows/drawdd.c
+++ b/src/osd/windows/drawdd.c
@@ -249,7 +249,7 @@ static int drawdd_window_init(win_window_info *window)
dd_info *dd;
// allocate memory for our structures
- dd = malloc_or_die(sizeof(*dd));
+ dd = (dd_info *)malloc_or_die(sizeof(*dd));
memset(dd, 0, sizeof(*dd));
window->drawdata = dd;
@@ -277,7 +277,7 @@ error:
static void drawdd_window_destroy(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
// skip if nothing
if (dd == NULL)
@@ -299,7 +299,7 @@ static void drawdd_window_destroy(win_window_info *window)
static const render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
compute_blit_surface_size(window);
render_target_set_bounds(window->target, dd->blitwidth, dd->blitheight, 0);
@@ -316,7 +316,7 @@ static const render_primitive_list *drawdd_window_get_primitives(win_window_info
static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
const render_primitive *prim;
int usemembuffer = FALSE;
HRESULT result;
@@ -446,7 +446,7 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
static int ddraw_create(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
HRESULT result;
int verify;
@@ -455,7 +455,7 @@ static int ddraw_create(win_window_info *window)
ddraw_delete(window);
// create the DirectDraw object
- result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, &IID_IDirectDraw7, NULL);
+ result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
if (result != DD_OK)
{
mame_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
@@ -513,7 +513,7 @@ error:
static int ddraw_create_surfaces(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
HRESULT result;
// make a description of the primary surface
@@ -594,7 +594,7 @@ static int ddraw_create_surfaces(win_window_info *window)
if (brightness != 1.0f || contrast != 1.0f || gamma != 1.0f)
{
// see if we can get a GammaControl object
- result = IDirectDrawSurface_QueryInterface(dd->primary, &IID_IDirectDrawGammaControl, (void **)&dd->gamma);
+ result = IDirectDrawSurface_QueryInterface(dd->primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&dd->gamma);
if (result != DD_OK)
{
mame_printf_warning("DirectDraw: Warning - device does not support full screen gamma correction.\n");
@@ -636,7 +636,7 @@ error:
static void ddraw_delete(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
// free surfaces
ddraw_delete_surfaces(window);
@@ -663,7 +663,7 @@ static void ddraw_delete(win_window_info *window)
static void ddraw_delete_surfaces(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
// release the gamma control
if (dd->gamma != NULL)
@@ -736,7 +736,7 @@ static int ddraw_verify_caps(dd_info *dd)
static int ddraw_test_cooperative(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
HRESULT result;
// check our current status; if we lost the device, punt to GDI
@@ -806,7 +806,7 @@ static HRESULT create_surface(dd_info *dd, DDSURFACEDESC2 *desc, IDirectDrawSurf
static int create_clipper(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
HRESULT result;
// create a clipper for the primary surface
@@ -843,7 +843,7 @@ static int create_clipper(win_window_info *window)
static void compute_blit_surface_size(win_window_info *window)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
INT32 newwidth, newheight;
int xscale, yscale;
RECT client;
@@ -967,7 +967,7 @@ static void calc_fullscreen_margins(win_window_info *window, DWORD desc_width, D
static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight)
{
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
IDirectDrawSurface7 *target = (dd->back != NULL) ? dd->back : dd->primary;
win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
DDBLTFX blitfx = { sizeof(DDBLTFX) };
@@ -1103,14 +1103,14 @@ static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight
static int config_adapter_mode(win_window_info *window)
{
DDDEVICEIDENTIFIER2 identifier;
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
HRESULT result;
// choose the monitor number
get_adapter_for_monitor(dd, window->monitor);
// create a temporary DirectDraw object
- result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, &IID_IDirectDraw7, NULL);
+ result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
if (result != DD_OK)
{
mame_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
@@ -1231,15 +1231,15 @@ static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor)
static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context)
{
float size_score, refresh_score, final_score;
- mode_enum_info *einfo = context;
- dd_info *dd = einfo->window->drawdata;
+ mode_enum_info *einfo = (mode_enum_info *)context;
+ dd_info *dd = (dd_info *)einfo->window->drawdata;
// skip non-32 bit modes
if (desc->ddpfPixelFormat.dwRGBBitCount != 32)
return DDENUMRET_OK;
// compute initial score based on difference between target and current
- size_score = 1.0f / (1.0f + fabs((INT32)desc->dwWidth - einfo->target_width) + fabs((INT32)desc->dwHeight - einfo->target_height));
+ size_score = 1.0f / (1.0f + fabs((float)((INT32)desc->dwWidth - einfo->target_width)) + fabs((float)((INT32)desc->dwHeight - einfo->target_height)));
// if the mode is too small, give a big penalty
if (desc->dwWidth < einfo->minimum_width || desc->dwHeight < einfo->minimum_height)
@@ -1288,7 +1288,7 @@ static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context)
static void pick_best_mode(win_window_info *window)
{
const device_config *primary_screen = video_screen_first(window->machine->config);
- dd_info *dd = window->drawdata;
+ dd_info *dd = (dd_info *)window->drawdata;
mode_enum_info einfo;
HRESULT result;
@@ -1306,7 +1306,7 @@ static void pick_best_mode(win_window_info *window)
einfo.target_refresh = 60.0;
if (primary_screen != NULL)
{
- const screen_config *config = primary_screen->inline_config;
+ const screen_config *config = (const screen_config *)primary_screen->inline_config;
einfo.target_refresh = ATTOSECONDS_TO_HZ(config->refresh);
}
printf("Target refresh = %f\n", einfo.target_refresh);
diff --git a/src/osd/windows/drawgdi.c b/src/osd/windows/drawgdi.c
index 58f53944508..2c3cbb238b0 100644
--- a/src/osd/windows/drawgdi.c
+++ b/src/osd/windows/drawgdi.c
@@ -89,7 +89,7 @@ static int drawgdi_window_init(win_window_info *window)
int i;
// allocate memory for our structures
- gdi = malloc_or_die(sizeof(*gdi));
+ gdi = (gdi_info *)malloc_or_die(sizeof(*gdi));
memset(gdi, 0, sizeof(*gdi));
window->drawdata = gdi;
@@ -123,7 +123,7 @@ static int drawgdi_window_init(win_window_info *window)
static void drawgdi_window_destroy(win_window_info *window)
{
- gdi_info *gdi = window->drawdata;
+ gdi_info *gdi = (gdi_info *)window->drawdata;
// skip if nothing
if (gdi == NULL)
@@ -158,7 +158,7 @@ static const render_primitive_list *drawgdi_window_get_primitives(win_window_inf
static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
{
- gdi_info *gdi = window->drawdata;
+ gdi_info *gdi = (gdi_info *)window->drawdata;
int width, height, pitch;
RECT bounds;
@@ -178,7 +178,7 @@ static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
if (pitch * height * 4 > gdi->bmsize)
{
gdi->bmsize = pitch * height * 4 * 2;
- gdi->bmdata = realloc(gdi->bmdata, gdi->bmsize);
+ gdi->bmdata = (UINT8 *)realloc(gdi->bmdata, gdi->bmsize);
}
// draw the primitives to the bitmap
diff --git a/src/osd/windows/eivc.h b/src/osd/windows/eivc.h
index bb13b70cd9f..37c55df97a4 100644
--- a/src/osd/windows/eivc.h
+++ b/src/osd/windows/eivc.h
@@ -47,7 +47,7 @@ unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask);
INLINE UINT8 _count_leading_zeros(UINT32 value)
{
UINT32 index;
- return _BitScanReverse(&index, value) ? (index ^ 31) : 32;
+ return _BitScanReverse((unsigned long *)&index, value) ? (index ^ 31) : 32;
}
#endif
@@ -62,7 +62,7 @@ INLINE UINT8 _count_leading_zeros(UINT32 value)
INLINE UINT8 _count_leading_ones(UINT32 value)
{
UINT32 index;
- return _BitScanReverse(&index, ~value) ? (index ^ 31) : 32;
+ return _BitScanReverse((unsigned long *)&index, ~value) ? (index ^ 31) : 32;
}
#endif
@@ -83,7 +83,7 @@ INLINE UINT8 _count_leading_ones(UINT32 value)
#define compare_exchange32 _compare_exchange32
INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
{
- return _InterlockedCompareExchange(ptr, exchange, compare);
+ return _InterlockedCompareExchange((volatile long *)ptr, exchange, compare);
}
#endif
@@ -116,7 +116,7 @@ INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 excha
#define atomic_exchange32 _atomic_exchange32
INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
{
- return _InterlockedExchange(ptr, exchange);
+ return _InterlockedExchange((volatile long *)ptr, exchange);
}
#endif
@@ -131,7 +131,7 @@ INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
#define atomic_add32 _atomic_add32
INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta)
{
- return _InterlockedExchangeAdd(ptr, delta) + delta;
+ return _InterlockedExchangeAdd((volatile long *)ptr, delta) + delta;
}
#endif
@@ -146,7 +146,7 @@ INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta)
#define atomic_increment32 _atomic_increment32
INLINE INT32 _atomic_increment32(INT32 volatile *ptr)
{
- return _InterlockedIncrement(ptr);
+ return _InterlockedIncrement((volatile long *)ptr);
}
#endif
@@ -161,7 +161,7 @@ INLINE INT32 _atomic_increment32(INT32 volatile *ptr)
#define atomic_decrement32 _atomic_decrement32
INLINE INT32 _atomic_decrement32(INT32 volatile *ptr)
{
- return _InterlockedDecrement(ptr);
+ return _InterlockedDecrement((volatile long *)ptr);
}
#endif
diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c
index 7943730d18d..f77efec3a01 100644
--- a/src/osd/windows/input.c
+++ b/src/osd/windows/input.c
@@ -433,7 +433,7 @@ INLINE input_item_id keyboard_map_scancode_to_itemid(int scancode)
// scan the table for a match
for (tablenum = 0; tablenum < ARRAY_LENGTH(win_key_trans_table); tablenum++)
if (win_key_trans_table[tablenum][DI_KEY] == scancode)
- return win_key_trans_table[tablenum][MAME_KEY];
+ return (input_item_id)win_key_trans_table[tablenum][MAME_KEY];
// default to an "other" switch
return ITEM_ID_OTHER_SWITCH;
@@ -657,7 +657,7 @@ BOOL wininput_handle_raw(HANDLE device)
// if necessary, allocate a temporary buffer and fetch the data
if (size > sizeof(small_buffer))
{
- data = malloc(size);
+ data = (LPBYTE)malloc(size);
if (data == NULL)
return result;
}
@@ -795,7 +795,7 @@ static device_info *generic_device_alloc(running_machine *machine, device_info *
device_info *devinfo;
// allocate memory for the device object
- devinfo = malloc_or_die(sizeof(*devinfo));
+ devinfo = (device_info *)malloc_or_die(sizeof(*devinfo));
memset(devinfo, 0, sizeof(*devinfo));
devinfo->head = devlist_head_ptr;
devinfo->machine = machine;
@@ -890,8 +890,8 @@ static void generic_device_reset(device_info *devinfo)
static INT32 generic_button_get_state(void *device_internal, void *item_internal)
{
- device_info *devinfo = device_internal;
- BYTE *itemdata = item_internal;
+ device_info *devinfo = (device_info *)device_internal;
+ BYTE *itemdata = (BYTE *)item_internal;
// return the current state
poll_if_necessary(devinfo->machine);
@@ -905,8 +905,8 @@ static INT32 generic_button_get_state(void *device_internal, void *item_internal
static INT32 generic_axis_get_state(void *device_internal, void *item_internal)
{
- device_info *devinfo = device_internal;
- LONG *axisdata = item_internal;
+ device_info *devinfo = (device_info *)device_internal;
+ LONG *axisdata = (LONG *)item_internal;
// return the current state
poll_if_necessary(devinfo->machine);
@@ -948,7 +948,7 @@ static void win32_init(running_machine *machine)
for (axisnum = 0; axisnum < 2; axisnum++)
{
const char *name = utf8_from_tstring(default_axis_name[axisnum]);
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
free((void *)name);
}
@@ -956,7 +956,7 @@ static void win32_init(running_machine *machine)
for (butnum = 0; butnum < 2; butnum++)
{
const char *name = utf8_from_tstring(default_button_name(butnum));
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], ITEM_ID_BUTTON1 + butnum, generic_button_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
free((void *)name);
}
}
@@ -1176,12 +1176,12 @@ static device_info *dinput_device_create(running_machine *machine, device_info *
devinfo = generic_device_alloc(machine, devlist_head_ptr, instance->tszInstanceName);
// attempt to create a device
- result = IDirectInput_CreateDevice(dinput, &instance->guidInstance, &devinfo->dinput.device, NULL);
+ result = IDirectInput_CreateDevice(dinput, WRAP_REFIID(instance->guidInstance), &devinfo->dinput.device, NULL);
if (result != DI_OK)
goto error;
// try to get a version 2 device for it
- result = IDirectInputDevice_QueryInterface(devinfo->dinput.device, &IID_IDirectInputDevice2, (void **)&devinfo->dinput.device2);
+ result = IDirectInputDevice_QueryInterface(devinfo->dinput.device, WRAP_REFIID(IID_IDirectInputDevice2), (void **)&devinfo->dinput.device2);
if (result != DI_OK)
devinfo->dinput.device2 = NULL;
@@ -1268,7 +1268,7 @@ static const char *dinput_device_item_name(device_info *devinfo, int offset, con
return utf8_from_tstring(namestring);
// otherwise, allocate space to add the suffix
- combined = malloc_or_die(sizeof(TCHAR) * (_tcslen(namestring) + 1 + _tcslen(suffix) + 1));
+ combined = (TCHAR *)malloc_or_die(sizeof(TCHAR) * (_tcslen(namestring) + 1 + _tcslen(suffix) + 1));
_tcscpy(combined, namestring);
_tcscat(combined, TEXT(" "));
_tcscat(combined, suffix);
@@ -1311,7 +1311,7 @@ static HRESULT dinput_device_poll(device_info *devinfo)
static BOOL CALLBACK dinput_keyboard_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
{
- running_machine *machine = ref;
+ running_machine *machine = (running_machine *)ref;
device_info *devinfo;
int keynum;
@@ -1367,7 +1367,7 @@ static void dinput_keyboard_poll(device_info *devinfo)
static BOOL CALLBACK dinput_mouse_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
{
device_info *devinfo, *guninfo = NULL;
- running_machine *machine = ref;
+ running_machine *machine = (running_machine *)ref;
int axisnum, butnum;
HRESULT result;
@@ -1412,9 +1412,9 @@ static BOOL CALLBACK dinput_mouse_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
const char *name = dinput_device_item_name(devinfo, offsetof(DIMOUSESTATE, lX) + axisnum * sizeof(LONG), default_axis_name[axisnum], NULL);
// add to the mouse device and optionally to the gun device as well
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
if (guninfo != NULL && axisnum < 2)
- input_device_item_add(guninfo->device, name, &guninfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(guninfo->device, name, &guninfo->mouse.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
free((void *)name);
}
@@ -1422,13 +1422,14 @@ static BOOL CALLBACK dinput_mouse_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
// populate the buttons
for (butnum = 0; butnum < devinfo->dinput.caps.dwButtons; butnum++)
{
- const char *name = dinput_device_item_name(devinfo, offsetof(DIMOUSESTATE, rgbButtons[butnum]), default_button_name(butnum), NULL);
+ FPTR offset = (FPTR)(&((DIMOUSESTATE *)NULL)->rgbButtons[butnum]);
+ const char *name = dinput_device_item_name(devinfo, offset, default_button_name(butnum), NULL);
// add to the mouse device and optionally to the gun device as well
// note that the gun device points to the mouse buttons rather than its own
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], ITEM_ID_BUTTON1 + butnum, generic_button_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
if (guninfo != NULL)
- input_device_item_add(guninfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], ITEM_ID_BUTTON1 + butnum, generic_button_get_state);
+ input_device_item_add(guninfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
free((void *)name);
}
@@ -1469,7 +1470,7 @@ static BOOL CALLBACK dinput_joystick_enum(LPCDIDEVICEINSTANCE instance, LPVOID r
{
DWORD cooperative_level = (HAS_WINDOW_MENU ? DISCL_BACKGROUND : DISCL_FOREGROUND) | DISCL_EXCLUSIVE;
int axisnum, axiscount, povnum, butnum;
- running_machine *machine = ref;
+ running_machine *machine = (running_machine *)ref;
device_info *devinfo;
HRESULT result;
@@ -1521,7 +1522,7 @@ static BOOL CALLBACK dinput_joystick_enum(LPCDIDEVICEINSTANCE instance, LPVOID r
// populate the item description as well
name = dinput_device_item_name(devinfo, offsetof(DIJOYSTATE2, lX) + axisnum * sizeof(LONG), default_axis_name[axisnum], NULL);
- input_device_item_add(devinfo->device, name, &devinfo->joystick.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->joystick.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
free((void *)name);
axiscount++;
@@ -1556,8 +1557,9 @@ static BOOL CALLBACK dinput_joystick_enum(LPCDIDEVICEINSTANCE instance, LPVOID r
// populate the buttons
for (butnum = 0; butnum < devinfo->dinput.caps.dwButtons; butnum++)
{
- const char *name = dinput_device_item_name(devinfo, offsetof(DIJOYSTATE2, rgbButtons[butnum]), default_button_name(butnum), NULL);
- input_device_item_add(devinfo->device, name, &devinfo->joystick.state.rgbButtons[butnum], (butnum < 16) ? (ITEM_ID_BUTTON1 + butnum) : ITEM_ID_OTHER_SWITCH, generic_button_get_state);
+ FPTR offset = (FPTR)(&((DIJOYSTATE2 *)NULL)->rgbButtons[butnum]);
+ const char *name = dinput_device_item_name(devinfo, offset, default_button_name(butnum), NULL);
+ input_device_item_add(devinfo->device, name, &devinfo->joystick.state.rgbButtons[butnum], (butnum < 16) ? (input_item_id)(ITEM_ID_BUTTON1 + butnum) : ITEM_ID_OTHER_SWITCH, generic_button_get_state);
free((void *)name);
}
@@ -1592,7 +1594,7 @@ static void dinput_joystick_poll(device_info *devinfo)
static INT32 dinput_joystick_pov_get_state(void *device_internal, void *item_internal)
{
- device_info *devinfo = device_internal;
+ device_info *devinfo = (device_info *)device_internal;
int povnum = (FPTR)item_internal / 4;
int povdir = (FPTR)item_internal % 4;
INT32 result = 0;
@@ -1651,7 +1653,7 @@ static void rawinput_init(running_machine *machine)
goto error;
if (device_count == 0)
goto error;
- devlist = malloc_or_die(device_count * sizeof(*devlist));
+ devlist = (RAWINPUTDEVICELIST *)malloc_or_die(device_count * sizeof(*devlist));
if ((*get_rawinput_device_list)(devlist, &device_count, sizeof(*devlist)) == -1)
goto error;
@@ -1731,7 +1733,7 @@ static device_info *rawinput_device_create(running_machine *machine, device_info
// determine the length of the device name, allocate it, and fetch it
if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0)
goto error;
- tname = malloc_or_die(name_length * sizeof(*tname));
+ tname = (TCHAR *)malloc_or_die(name_length * sizeof(*tname));
if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1)
goto error;
@@ -1790,7 +1792,7 @@ static TCHAR *rawinput_device_improve_name(TCHAR *name)
return name;
// allocate a temporary string and concatenate the base path plus the name
- regpath = malloc_or_die(sizeof(*regpath) * (_tcslen(basepath) + 1 + _tcslen(name)));
+ regpath = (TCHAR *)malloc_or_die(sizeof(*regpath) * (_tcslen(basepath) + 1 + _tcslen(name)));
_tcscpy(regpath, basepath);
chdst = regpath + _tcslen(regpath);
@@ -1902,7 +1904,7 @@ convert:
chsrc++;
else
chsrc = regstring;
- name = malloc_or_die(sizeof(*name) * (_tcslen(chsrc) + 1));
+ name = (TCHAR *)malloc_or_die(sizeof(*name) * (_tcslen(chsrc) + 1));
_tcscpy(name, chsrc);
exit:
@@ -2019,9 +2021,9 @@ static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST de
const char *name = utf8_from_tstring(default_axis_name[axisnum]);
// add to the mouse device and optionally to the gun device as well
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
if (guninfo != NULL && axisnum < 2)
- input_device_item_add(guninfo->device, name, &guninfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
+ input_device_item_add(guninfo->device, name, &guninfo->mouse.state.lX + axisnum, (input_item_id)(ITEM_ID_XAXIS + axisnum), generic_axis_get_state);
free((void *)name);
}
@@ -2033,9 +2035,9 @@ static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST de
// add to the mouse device and optionally to the gun device as well
// note that the gun device points to the mouse buttons rather than its own
- input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], ITEM_ID_BUTTON1 + butnum, generic_button_get_state);
+ input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
if (guninfo != NULL)
- input_device_item_add(guninfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], ITEM_ID_BUTTON1 + butnum, generic_button_get_state);
+ input_device_item_add(guninfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
free((void *)name);
}
@@ -2130,7 +2132,7 @@ static TCHAR *reg_query_string(HKEY key, const TCHAR *path)
return NULL;
// allocate a buffer
- buffer = malloc_or_die(datalen + sizeof(*buffer));
+ buffer = (TCHAR *)malloc_or_die(datalen + sizeof(*buffer));
buffer[datalen / sizeof(*buffer)] = 0;
// now get the actual data
diff --git a/src/osd/windows/output.c b/src/osd/windows/output.c
index 96093969590..bdb821a4f3a 100644
--- a/src/osd/windows/output.c
+++ b/src/osd/windows/output.c
@@ -228,7 +228,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id)
}
// add us to the end
- *client = malloc_or_die(sizeof(**client));
+ *client = (registered_client *)malloc_or_die(sizeof(**client));
(*client)->next = NULL;
(*client)->id = id;
(*client)->hwnd = hwnd;
@@ -287,7 +287,7 @@ static LRESULT send_id_string(running_machine *machine, HWND hwnd, LPARAM id)
// allocate memory for the message
datalen = sizeof(*temp) + strlen(name);
- temp = malloc_or_die(datalen);
+ temp = (copydata_id_string *)malloc_or_die(datalen);
temp->id = id;
strcpy(temp->string, name);
diff --git a/src/osd/windows/vconv.c b/src/osd/windows/vconv.c
index 37d2fc1a7ed..e3a597955f7 100644
--- a/src/osd/windows/vconv.c
+++ b/src/osd/windows/vconv.c
@@ -49,80 +49,84 @@ struct _translation_info
static const translation_info gcc_translate[] =
{
- { 0, "-D*", "/D*" },
- { 0, "-U*", "/U*" },
- { 0, "-I*", "/I*" },
- { 0, "-o*", "~*" },
- { 0, "-include*", "/FI*" },
- { 0, "-c", "/c~/Fo" },
- { 0, "-E", "/c~/E >" },
- { 0, "-S", "/c~/Fa" },
- { VS7, "-O0", "/Od /GS /Oi" },
- { 0, "-O0", "/Od" },
- { 0, "-O1", "/O2" },
- { 0, "-O2", "/O2" },
- { 0, "-O3", "/O2" },
- { 0, "-Os", "/O1" },
- { 0, "-g", "/Zi" },
- { VS2005, "-fno-strict-aliasing", "" }, // deprecated in VS2005
- { 0, "-fno-strict-aliasing", "/Oa" },
+ { 0, "-D*", "/D*" },
+ { 0, "-U*", "/U*" },
+ { 0, "-I*", "/I*" },
+ { 0, "-o*", "~*" },
+ { 0, "-include*", "/FI*" },
+ { 0, "-c", "/c~/Fo" },
+ { 0, "-E", "/c~/E >" },
+ { 0, "-S", "/c~/Fa" },
+ { VS7, "-O0", "/Od /GS /Oi" },
+ { 0, "-O0", "/Od" },
+ { 0, "-O1", "/O2" },
+ { 0, "-O2", "/O2" },
+ { 0, "-O3", "/O2" },
+ { 0, "-Os", "/O1" },
+ { 0, "-g", "/Zi" },
+ { VS2005, "-fno-strict-aliasing", "" }, // deprecated in VS2005
+ { 0, "-fno-strict-aliasing", "/Oa" },
{ 0, "-fno-omit-frame-pointer", "" },
- { 0, "-Werror", "/WX" },
- { VS7, "-Wall", "/Wall /W3 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
- { 0, "-Wall", "/W0" },
- { VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102" },
- { 0, "-W*", "" },
- { VS2005, "-march=*", "" }, // deprecated in VS2005
- { 0, "-march=pentium", "/G5" },
- { 0, "-march=pentiumpro", "/G6" },
- { 0, "-march=pentium3", "/G6" },
- { 0, "-march=pentium-m", "/G6" },
- { 0, "-march=athlon", "/G7" },
- { 0, "-march=pentium4", "/G7" },
- { 0, "-march=athlon64", "/G7" },
- { VS71, "-msse2", "/arch:SSE2" },
- { 0, "-msse2", "" },
- { 0, "-msse3", "" },
- { 0, "-mwindows", "" },
- { 0, "-mno-cygwin", "" },
- { 0, "-std=gnu89", "" },
- { 0, "-pipe", "" },
+ { 0, "-Werror", "/WX" },
+ { VS7, "-Wall", "/Wall /W3 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
+ { 0, "-Wall", "/W0" },
+ { VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102" },
+ { 0, "-W*", "" },
+ { VS2005, "-march=*", "" }, // deprecated in VS2005
+ { 0, "-march=pentium", "/G5" },
+ { 0, "-march=pentiumpro", "/G6" },
+ { 0, "-march=pentium3", "/G6" },
+ { 0, "-march=pentium-m", "/G6" },
+ { 0, "-march=athlon", "/G7" },
+ { 0, "-march=pentium4", "/G7" },
+ { 0, "-march=athlon64", "/G7" },
+ { VS71, "-msse2", "/arch:SSE2" },
+ { 0, "-msse2", "" },
+ { 0, "-msse3", "" },
+ { 0, "-mwindows", "" },
+ { 0, "-mno-cygwin", "" },
+ { 0, "-std=gnu89", "" },
+ { 0, "-std=gnu++98", "/TP" },
+ { 0, "-pipe", "" },
+ { 0, "-x", "" },
+ { 0, "c++", "" },
{ 0 }
};
static const translation_info ld_translate[] =
{
- { VS2008, "-lbufferoverflowu","" },
- { 0, "-l*", "*.lib" },
- { 0, "-o*", "/out:*" },
- { 0, "-Wl,-Map,*", "/map:*" },
+ { VS2008, "-lbufferoverflowu", "" },
+ { 0, "-l*", "*.lib" },
+ { 0, "-o*", "/out:*" },
+ { 0, "-Wl,-Map,*", "/map:*" },
{ 0, "-Wl,--allow-multiple-definition", "/force:multiple" },
- { 0, "-Wl,--warn-common", "" },
- { 0, "-mno-cygwin", "" },
- { 0, "-s", "" },
- { 0, "-WO", "" },
- { 0, "-mconsole", "/subsystem:console" },
- { 0, "-mwindows", "/subsystem:windows" },
- { 0, "-shared", "/dll" },
+ { 0, "-Wl,--warn-common", "" },
+ { 0, "-mno-cygwin", "" },
+ { 0, "-s", "" },
+ { 0, "-WO", "" },
+ { 0, "-mconsole", "/subsystem:console" },
+ { 0, "-mwindows", "/subsystem:windows" },
+ { 0, "-shared", "/dll" },
{ 0 }
};
static const translation_info ar_translate[] =
{
- { 0, "-cr", "" },
+ { 0, "-cr", "" },
+ { 0, "/LTCG", "/LTCG" },
{ 0 }
};
static const translation_info windres_translate[] =
{
- { 0, "-D*", "/D*" },
- { 0, "-U*", "/U*" },
- { 0, "-I*", "/I*" },
- { 0, "--include-dir*", "/I*" },
- { 0, "-o*", "/fo*" },
- { 0, "-O*", "" },
- { 0, "-i*", "*" },
+ { 0, "-D*", "/D*" },
+ { 0, "-U*", "/U*" },
+ { 0, "-I*", "/I*" },
+ { 0, "--include-dir*", "/I*" },
+ { 0, "-o*", "/fo*" },
+ { 0, "-O*", "" },
+ { 0, "-i*", "*" },
{ 0 }
};
@@ -272,120 +276,123 @@ static void build_command_line(int argc, char *argv[])
for (param = 2; param < argc; param++)
{
const char *src = argv[param];
+ int firstchar = src[0];
int srclen = strlen(src);
+ int matched = FALSE;
int i;
// find a match
- if (src[0] == '-')
+ for (i = 0; !matched && transtable[i].gcc_option != NULL; i++)
{
- for (i = 0; transtable[i].gcc_option; i++)
- {
- const char *compare = transtable[i].gcc_option;
- const char *replace;
- int j;
+ const char *compare = transtable[i].gcc_option;
+ const char *replace;
+ int j;
- // check version number
- if (exe_version < transtable[i].vc_version)
- continue;
+ // check version number
+ if (exe_version < transtable[i].vc_version)
+ continue;
- // find a match
- for (j = 0; j < srclen; j++)
- if (src[j] != compare[j])
- break;
+ // find a match
+ for (j = 0; j < srclen; j++)
+ if (src[j] != compare[j])
+ break;
- // if we hit an asterisk, we're ok
- if (compare[j] == '*')
+ // if we hit an asterisk, we're ok
+ if (compare[j] == '*')
+ {
+ // if this is the end of the parameter, use the next one
+ if (src[j] == 0)
+ src = argv[++param];
+ else
+ src += j;
+
+ // copy the replacement up to the asterisk
+ replace = transtable[i].vc_option;
+ while (*replace && *replace != '*')
{
- // if this is the end of the parameter, use the next one
- if (src[j] == 0)
- src = argv[++param];
- else
- src += j;
-
- // copy the replacement up to the asterisk
- replace = transtable[i].vc_option;
- while (*replace && *replace != '*')
- {
- if (*replace == '~')
- {
- dst += sprintf(dst, "%s", outstring);
- replace++;
- }
- else
- *dst++ = *replace++;
- }
-
- // if we have an asterisk in the replacement, copy the rest of the source
- if (*replace == '*')
+ if (*replace == '~')
{
- int addquote = (strchr(src, ' ') != NULL);
-
- if (addquote)
- *dst++ = '"';
- while (*src)
- {
- *dst++ = (*src == '/') ? '\\' : *src;
- src++;
- }
- if (addquote)
- *dst++ = '"';
-
- // if there's stuff after the asterisk, copy that
+ dst += sprintf(dst, "%s", outstring);
replace++;
- while (*replace)
- *dst++ = *replace++;
}
-
- // append a final space
- *dst++ = ' ';
- break;
+ else
+ *dst++ = *replace++;
}
- // if we hit the end, we're also ok
- else if (compare[j] == 0 && j == srclen)
+ // if we have an asterisk in the replacement, copy the rest of the source
+ if (*replace == '*')
{
- // copy the replacement up to the tilde
- replace = transtable[i].vc_option;
- while (*replace && *replace != '~')
- *dst++ = *replace++;
+ int addquote = (strchr(src, ' ') != NULL);
- // if we hit a tilde, set the new output
- if (*replace == '~')
- outstring = replace + 1;
+ if (addquote)
+ *dst++ = '"';
+ while (*src)
+ {
+ *dst++ = (*src == '/') ? '\\' : *src;
+ src++;
+ }
+ if (addquote)
+ *dst++ = '"';
- // append a final space
- *dst++ = ' ';
- break;
+ // if there's stuff after the asterisk, copy that
+ replace++;
+ while (*replace)
+ *dst++ = *replace++;
}
- // else keep looking
+ // append a final space
+ *dst++ = ' ';
+ matched = TRUE;
}
- // warn if we didn't get a match
- if (!transtable[i].gcc_option)
- fprintf(stderr, "Unable to match parameter '%s'\n", src);
- }
+ // if we hit the end, we're also ok
+ else if (compare[j] == 0 && j == srclen)
+ {
+ // copy the replacement up to the tilde
+ replace = transtable[i].vc_option;
+ while (*replace && *replace != '~')
+ *dst++ = *replace++;
+
+ // if we hit a tilde, set the new output
+ if (*replace == '~')
+ outstring = replace + 1;
+
+ // append a final space
+ *dst++ = ' ';
+ matched = TRUE;
+ }
- // otherwise, assume it's a filename and copy translating slashes
- // it can also be a Windows-specific option which is passed through unscathed
- else
+ // else keep looking
+ }
+
+ // if we didn't match, process
+ if (!matched)
{
- int dotrans = (*src != '/');
+ // warn if we missed a parameter
+ if (transtable[i].gcc_option == NULL && firstchar == '-')
+ fprintf(stderr, "Unable to match parameter '%s'\n", src);
- // if the output filename is implicitly first, append the out parameter
- if (output_is_first)
+ // otherwise, assume it's a filename and copy translating slashes
+ // it can also be a Windows-specific option which is passed through unscathed
+ else if (firstchar != '-')
{
- dst += sprintf(dst, "%s", outstring);
- output_is_first = 0;
- }
+ int dotrans = (*src != '/');
- // now copy the rest of the string
- while (*src)
- {
- *dst++ = (dotrans && *src == '/') ? '\\' : *src;
- src++;
+ // if the output filename is implicitly first, append the out parameter
+ if (output_is_first)
+ {
+ dst += sprintf(dst, "%s", outstring);
+ output_is_first = 0;
+ }
+
+ // now copy the rest of the string
+ while (*src)
+ {
+ *dst++ = (dotrans && *src == '/') ? '\\' : *src;
+ src++;
+ }
+ *dst++ = ' ';
}
- *dst++ = ' ';
}
}
diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c
index d1274ce55bb..38c8b837a35 100644
--- a/src/osd/windows/video.c
+++ b/src/osd/windows/video.c
@@ -255,7 +255,7 @@ static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect,
assert(result);
// allocate a new monitor info
- monitor = malloc_or_die(sizeof(*monitor));
+ monitor = (win_monitor_info *)malloc_or_die(sizeof(*monitor));
memset(monitor, 0, sizeof(*monitor));
// copy in the data
@@ -439,7 +439,7 @@ static void extract_video_config(running_machine *machine)
static void load_effect_overlay(running_machine *machine, const char *filename)
{
const device_config *screen;
- char *tempstr = malloc_or_die(strlen(filename) + 5);
+ char *tempstr = (char *)malloc_or_die(strlen(filename) + 5);
char *dest;
// append a .PNG extension
diff --git a/src/osd/windows/windir.c b/src/osd/windows/windir.c
index 7a84cccd81a..6930bee81b8 100644
--- a/src/osd/windows/windir.c
+++ b/src/osd/windows/windir.c
@@ -51,7 +51,7 @@ osd_directory *osd_opendir(const char *dirname)
size_t dirfilter_size;
// allocate memory to hold the osd_tool_directory structure
- dir = malloc(sizeof(*dir));
+ dir = (osd_directory *)malloc(sizeof(*dir));
if (dir == NULL)
goto error;
memset(dir, 0, sizeof(*dir));
diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c
index 9df5e224c85..d93b34c4bd2 100644
--- a/src/osd/windows/window.c
+++ b/src/osd/windows/window.c
@@ -582,7 +582,7 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni
assert(GetCurrentThreadId() == main_threadid);
// allocate a new window object
- window = malloc_or_die(sizeof(*window));
+ window = (win_window_info *)malloc_or_die(sizeof(*window));
memset(window, 0, sizeof(*window));
window->maxwidth = config->width;
window->maxheight = config->height;
diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak
index 9ebb1adebeb..6270d54db5e 100644
--- a/src/osd/windows/windows.mak
+++ b/src/osd/windows/windows.mak
@@ -88,7 +88,7 @@ RCFLAGS = -O coff -I $(WINSRC) -I $(WINOBJ)
#-------------------------------------------------
ifdef CYGWIN_BUILD
-CFLAGS += -mno-cygwin
+CCOMFLAGS += -mno-cygwin
LDFLAGS += -mno-cygwin
endif
@@ -115,24 +115,28 @@ RC = @$(VCONV) windres
# make sure we use the multithreaded runtime
ifdef DEBUG
-CC += /MTd
+CCOMFLAGS += /MTd
else
-CC += /MT
+CCOMFLAGS += /MT
endif
# turn on link-time codegen if the MAXOPT flag is also set
ifdef MAXOPT
-CC += /GL
-LD += /LTCG
+CCOMFLAGS += /GL
+LDFLAGS += /LTCG
+AR += /LTCG
endif
ifdef PTR64
-CC += /wd4267
+CCOMFLAGS += /wd4267
endif
+# disable function pointer warnings in C++ which are evil to work around
+CPPONLYFLAGS += /wd4191
+
# explicitly set the entry point for UNICODE builds
ifdef UNICODE
-LD += /ENTRY:wmainCRTStartup
+LDFLAGS += /ENTRY:wmainCRTStartup
endif
# add some VC++-specific defines
@@ -194,10 +198,10 @@ endif
#-------------------------------------------------
# add our prefix files to the mix
-CFLAGS += -include $(WINSRC)/winprefix.h
+CCOMFLAGS += -include $(WINSRC)/winprefix.h
ifdef WIN95_MULTIMON
-CFLAGS += -DWIN95_MULTIMON
+CCOMFLAGS += -DWIN95_MULTIMON
endif
# add the windows libraries
@@ -205,10 +209,10 @@ LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32
ifeq ($(DIRECTINPUT),8)
LIBS += -ldinput8
-CFLAGS += -DDIRECTINPUT_VERSION=0x0800
+CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0800
else
LIBS += -ldinput
-CFLAGS += -DDIRECTINPUT_VERSION=0x0700
+CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0700
endif
ifdef PTR64
@@ -263,7 +267,7 @@ OSDOBJS = \
$(WINOBJ)/winmain.o
ifeq ($(DIRECT3D),9)
-CFLAGS += -DDIRECT3D_VERSION=0x0900
+CCOMFLAGS += -DDIRECT3D_VERSION=0x0900
else
OSDOBJS += $(WINOBJ)/d3d8intf.o
endif
diff --git a/src/osd/windows/winfile.c b/src/osd/windows/winfile.c
index e80e3858a2e..696484c8c1c 100644
--- a/src/osd/windows/winfile.c
+++ b/src/osd/windows/winfile.c
@@ -74,7 +74,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
}
// allocate a file object, plus space for the converted filename
- *file = malloc(sizeof(**file) + sizeof(TCHAR) * _tcslen(t_path));
+ *file = (osd_file *)malloc(sizeof(**file) + sizeof(TCHAR) * _tcslen(t_path));
if (*file == NULL)
{
filerr = FILERR_OUT_OF_MEMORY;
@@ -320,8 +320,8 @@ int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count)
DWORD create_path_recursive(const TCHAR *path)
{
- TCHAR *sep = _tcsrchr(path, '\\');
- file_error filerr;
+ TCHAR *sep = (TCHAR *)_tcsrchr(path, '\\');
+ DWORD filerr;
// if there's still a separator, and it's not the root, nuke it and recurse
if (sep != NULL && sep > path && sep[0] != ':' && sep[-1] != '\\')
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index 7a601c051ae..790f7d276e7 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -82,6 +82,18 @@
//============================================================
+// MACROS
+//============================================================
+
+#ifdef __cplusplus
+#define WRAP_REFIID(x) x
+#else
+#define WRAP_REFIID(x) &x
+#endif
+
+
+
+//============================================================
// GLOBAL VARIABLES
//============================================================
diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h
index dd2f60892a9..ef0f3f1e69b 100644
--- a/src/osd/windows/winprefix.h
+++ b/src/osd/windows/winprefix.h
@@ -30,7 +30,6 @@ void free_file_line(void *memory, const char *file, int line);
#endif
#ifdef _MSC_VER
-void *__cdecl _alloca(size_t);
#define alloca _alloca
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
diff --git a/src/osd/windows/winsync.c b/src/osd/windows/winsync.c
index bce3f7cd480..cf8b9987a4a 100644
--- a/src/osd/windows/winsync.c
+++ b/src/osd/windows/winsync.c
@@ -52,7 +52,7 @@ static int checked_for_try_enter = FALSE;
osd_lock *osd_lock_alloc(void)
{
- osd_lock *lock = malloc(sizeof(*lock));
+ osd_lock *lock = (osd_lock *)malloc(sizeof(*lock));
if (lock == NULL)
return NULL;
InitializeCriticalSection(&lock->critsect);
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 6f176466ec4..4b81ad802bf 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -254,7 +254,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
int threadnum;
// allocate a new queue
- queue = malloc(sizeof(*queue));
+ queue = (osd_work_queue *)malloc(sizeof(*queue));
if (queue == NULL)
goto error;
memset(queue, 0, sizeof(*queue));
@@ -284,7 +284,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
queue->threads = MIN(queue->threads, WORK_MAX_THREADS);
// allocate memory for thread array (+1 to count the calling thread)
- queue->thread = malloc((queue->threads + 1) * sizeof(queue->thread[0]));
+ queue->thread = (work_thread_info *)malloc((queue->threads + 1) * sizeof(queue->thread[0]));
if (queue->thread == NULL)
goto error;
memset(queue->thread, 0, (queue->threads + 1) * sizeof(queue->thread[0]));
@@ -512,7 +512,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
if (item == NULL)
{
// allocate the item
- item = malloc(sizeof(*item));
+ item = (osd_work_item *)malloc(sizeof(*item));
if (item == NULL)
return NULL;
item->event = NULL;
@@ -668,7 +668,7 @@ static int effective_num_processors(void)
static unsigned __stdcall worker_thread_entry(void *param)
{
- work_thread_info *thread = param;
+ work_thread_info *thread = (work_thread_info *)param;
osd_work_queue *queue = thread->queue;
// loop until we exit