Buildfixes for MSVC 2015

This commit is contained in:
twinaphex 2018-05-03 15:20:06 +02:00
parent 268baca939
commit 7bc66ae710
4 changed files with 70 additions and 56 deletions

View File

@ -1255,7 +1255,7 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
}
if (set_state)
audio_mixer_streams[i].state = type;
audio_mixer_streams[i].state = (enum audio_mixer_state)type;
}
void audio_driver_mixer_play_stream(unsigned i)

View File

@ -408,7 +408,7 @@ static void d3d9_set_mvp(void *data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_set_vertex_shader_constantf(d3d->dev, 0, (const float*)mat_data, 4);
d3d9_set_vertex_shader_constantf((LPDIRECT3DDEVICE9)d3d->dev, 0, (const float*)mat_data, 4);
}
static void d3d9_overlay_render(d3d_video_t *d3d,
@ -417,6 +417,7 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
{
D3DTEXTUREFILTERTYPE filter_type;
LPDIRECT3DVERTEXDECLARATION9 vertex_decl;
LPDIRECT3DDEVICE9 dev;
struct video_viewport vp;
void *verts;
unsigned i;
@ -436,10 +437,12 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
if (!d3d || !overlay || !overlay->tex)
return;
dev = (LPDIRECT3DDEVICE9)d3d->dev;
if (!overlay->vert_buf)
{
overlay->vert_buf = d3d9_vertex_buffer_new(
d3d->dev, sizeof(vert), D3DUSAGE_WRITEONLY,
dev, sizeof(vert), D3DUSAGE_WRITEONLY,
#ifdef _XBOX
0,
#else
@ -477,18 +480,18 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
vert[2].v = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3].v = overlay->tex_coords[1] + overlay->tex_coords[3];
verts = d3d9_vertex_buffer_lock(overlay->vert_buf);
verts = d3d9_vertex_buffer_lock((LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf);
memcpy(verts, vert, sizeof(vert));
d3d9_vertex_buffer_unlock(overlay->vert_buf);
d3d9_vertex_buffer_unlock((LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf);
d3d9_enable_blend_func(d3d->dev);
d3d9_enable_blend_func((LPDIRECT3DDEVICE9)d3d->dev);
/* set vertex declaration for overlay. */
d3d9_vertex_declaration_new(d3d->dev, &vElems, (void**)&vertex_decl);
d3d9_set_vertex_declaration(d3d->dev, vertex_decl);
d3d9_vertex_declaration_new(dev, &vElems, (void**)&vertex_decl);
d3d9_set_vertex_declaration(dev, vertex_decl);
d3d9_vertex_declaration_free(vertex_decl);
d3d9_set_stream_source(d3d->dev, 0, overlay->vert_buf,
d3d9_set_stream_source(dev, 0, (LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf,
0, sizeof(*vert));
if (overlay->fullscreen)
@ -501,7 +504,7 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
vp_full.Height = height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3d9_set_viewports(d3d->dev, &vp_full);
d3d9_set_viewports(dev, &vp_full);
}
filter_type = D3DTEXF_LINEAR;
@ -514,16 +517,16 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
}
/* Render overlay. */
d3d9_set_texture(d3d->dev, 0, overlay->tex);
d3d9_set_sampler_address_u(d3d->dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_address_v(d3d->dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_minfilter(d3d->dev, 0, filter_type);
d3d9_set_sampler_magfilter(d3d->dev, 0, filter_type);
d3d9_draw_primitive(d3d->dev, D3DPT_TRIANGLESTRIP, 0, 2);
d3d9_set_texture(dev, 0, (LPDIRECT3DTEXTURE9)overlay->tex);
d3d9_set_sampler_address_u(dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_address_v(dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_minfilter(dev, 0, filter_type);
d3d9_set_sampler_magfilter(dev, 0, filter_type);
d3d9_draw_primitive(dev, D3DPT_TRIANGLESTRIP, 0, 2);
/* Restore previous state. */
d3d9_disable_blend_func(d3d->dev);
d3d9_set_viewports(d3d->dev, &d3d->final_viewport);
d3d9_disable_blend_func(dev);
d3d9_set_viewports(dev, &d3d->final_viewport);
}
static void d3d9_free_overlay(d3d_video_t *d3d, overlay_t *overlay)
@ -531,7 +534,7 @@ static void d3d9_free_overlay(d3d_video_t *d3d, overlay_t *overlay)
if (!d3d)
return;
d3d9_texture_free(overlay->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)overlay->tex);
d3d9_vertex_buffer_free(overlay->vert_buf, NULL);
}
@ -916,7 +919,7 @@ static bool d3d9_initialize(d3d_video_t *d3d, const video_info_t *info)
D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
if (!d3d9_vertex_declaration_new(d3d->dev,
if (!d3d9_vertex_declaration_new((LPDIRECT3DDEVICE9)d3d->dev,
(void*)VertexElements, (void**)&d3d->menu_display.decl))
return false;
}
@ -940,7 +943,7 @@ static bool d3d9_initialize(d3d_video_t *d3d, const video_info_t *info)
d3d_matrix_ortho_off_center_lh(&d3d->mvp_transposed, 0, 1, 0, 1, 0, 1);
d3d_matrix_transpose(&d3d->mvp, &d3d->mvp_transposed);
d3d9_set_render_state(d3d->dev, D3DRS_CULLMODE, D3DCULL_NONE);
d3d9_set_render_state((LPDIRECT3DDEVICE9)d3d->dev, D3DRS_CULLMODE, D3DCULL_NONE);
return true;
}
@ -1077,13 +1080,14 @@ static void d3d9_set_osd_msg(void *data,
const void *params, void *font)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)d3d->dev;
if (d3d->renderchain_driver->set_font_rect && params)
d3d->renderchain_driver->set_font_rect(d3d, params);
d3d9_begin_scene(d3d->dev);
d3d9_begin_scene(dev);
font_driver_render_msg(video_info, font, msg, (const struct font_params *)params);
d3d9_end_scene(d3d->dev);
d3d9_end_scene(dev);
}
static void d3d9_input_driver(
@ -1421,7 +1425,7 @@ static bool d3d9_overlay_load(void *data,
return false;
}
if (d3d9_lock_rectangle(overlay->tex, 0, &d3dlr,
if (d3d9_lock_rectangle((LPDIRECT3DTEXTURE9)overlay->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
uint32_t *dst = (uint32_t*)(d3dlr.pBits);
@ -1430,7 +1434,7 @@ static bool d3d9_overlay_load(void *data,
for (y = 0; y < height; y++, dst += pitch, src += width)
memcpy(dst, src, width << 2);
d3d9_unlock_rectangle(overlay->tex);
d3d9_unlock_rectangle((LPDIRECT3DTEXTURE9)overlay->tex);
}
overlay->tex_w = width;
@ -1576,16 +1580,16 @@ static bool d3d9_frame(void *data, const void *frame,
screen_vp.MaxZ = 1;
screen_vp.Width = width;
screen_vp.Height = height;
d3d9_set_viewports(d3d->dev, &screen_vp);
d3d9_clear(d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
d3d9_set_viewports((LPDIRECT3DDEVICE9)d3d->dev, &screen_vp);
d3d9_clear((LPDIRECT3DDEVICE9)d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
/* Insert black frame first, so we
* can screenshot, etc. */
if (video_info->black_frame_insertion)
{
if (!d3d9_swap(d3d, d3d->dev) || d3d->needs_restore)
if (!d3d9_swap(d3d, (LPDIRECT3DDEVICE9)d3d->dev) || d3d->needs_restore)
return true;
d3d9_clear(d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
d3d9_clear((LPDIRECT3DDEVICE9)d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
}
if (!d3d->renderchain_driver->render(
@ -1605,10 +1609,10 @@ static bool d3d9_frame(void *data, const void *frame,
d3d9_overlay_render(d3d, video_info, d3d->menu, false);
d3d->menu_display.offset = 0;
d3d9_set_vertex_declaration(d3d->dev, d3d->menu_display.decl);
d3d9_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, sizeof(Vertex));
d3d9_set_vertex_declaration((LPDIRECT3DDEVICE9)d3d->dev, (LPDIRECT3DVERTEXDECLARATION9)d3d->menu_display.decl);
d3d9_set_stream_source((LPDIRECT3DDEVICE9)d3d->dev, 0, (LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer, 0, sizeof(Vertex));
d3d9_set_viewports(d3d->dev, &screen_vp);
d3d9_set_viewports((LPDIRECT3DDEVICE9)d3d->dev, &screen_vp);
menu_driver_frame(video_info);
}
else if (video_info->statistics_show)
@ -1618,11 +1622,11 @@ static bool d3d9_frame(void *data, const void *frame,
if (osd_params)
{
d3d9_set_viewports(d3d->dev, &screen_vp);
d3d9_begin_scene(d3d->dev);
d3d9_set_viewports((LPDIRECT3DDEVICE9)d3d->dev, &screen_vp);
d3d9_begin_scene((LPDIRECT3DDEVICE9)d3d->dev);
font_driver_render_msg(video_info, NULL, video_info->stat_text,
(const struct font_params*)&video_info->osd_stat_params);
d3d9_end_scene(d3d->dev);
d3d9_end_scene((LPDIRECT3DDEVICE9)d3d->dev);
}
}
#endif
@ -1638,14 +1642,14 @@ static bool d3d9_frame(void *data, const void *frame,
if (msg && *msg)
{
d3d9_set_viewports(d3d->dev, &screen_vp);
d3d9_begin_scene(d3d->dev);
d3d9_set_viewports((LPDIRECT3DDEVICE9)d3d->dev, &screen_vp);
d3d9_begin_scene((LPDIRECT3DDEVICE9)d3d->dev);
font_driver_render_msg(video_info, NULL, msg, NULL);
d3d9_end_scene(d3d->dev);
d3d9_end_scene((LPDIRECT3DDEVICE9)d3d->dev);
}
d3d9_update_title(video_info);
d3d9_swap(d3d, d3d->dev);
d3d9_swap(d3d, (LPDIRECT3DDEVICE9)d3d->dev);
return true;
}
@ -1718,7 +1722,7 @@ static void d3d9_set_menu_texture_frame(void *data,
d3d->menu->tex_h != height)
{
if (d3d->menu)
d3d9_texture_free(d3d->menu->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d->menu->tex = d3d9_texture_new(d3d->dev, NULL,
width, height, 1,
@ -1737,7 +1741,7 @@ static void d3d9_set_menu_texture_frame(void *data,
d3d->menu->alpha_mod = alpha;
if (d3d9_lock_rectangle(d3d->menu->tex, 0, &d3dlr,
if (d3d9_lock_rectangle((LPDIRECT3DTEXTURE9)d3d->menu->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
unsigned h, w;
@ -1778,7 +1782,7 @@ static void d3d9_set_menu_texture_frame(void *data,
if (d3d->menu)
d3d9_unlock_rectangle(d3d->menu->tex);
d3d9_unlock_rectangle((LPDIRECT3DTEXTURE9)d3d->menu->tex);
}
}

View File

@ -240,7 +240,7 @@ static int zip_file_read(
const char *needle, void **buf,
const char *optional_outfile)
{
file_archive_transfer_t zlib = {0};
file_archive_transfer_t zlib = {ARCHIVE_TRANSFER_NONE, 0, NULL, NULL, NULL, NULL, NULL, NULL };
struct archive_extract_userdata userdata = {{0}};
bool returnerr = true;
int ret = 0;

View File

@ -87,7 +87,7 @@ static void menu_display_d3d9_blend_begin(video_frame_info_t *video_info)
if (!d3d)
return;
d3d9_enable_blend_func(d3d->dev);
d3d9_enable_blend_func((LPDIRECT3DDEVICE9)d3d->dev);
}
static void menu_display_d3d9_blend_end(video_frame_info_t *video_info)
@ -98,7 +98,7 @@ static void menu_display_d3d9_blend_end(video_frame_info_t *video_info)
if (!d3d)
return;
d3d9_disable_blend_func(d3d->dev);
d3d9_disable_blend_func((LPDIRECT3DDEVICE9)d3d->dev);
}
static void menu_display_d3d9_viewport(void *data, video_frame_info_t *video_info)
@ -108,16 +108,19 @@ static void menu_display_d3d9_viewport(void *data, video_frame_info_t *video_inf
static void menu_display_d3d9_bind_texture(void *data, d3d_video_t *d3d)
{
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
LPDIRECT3DDEVICE9 dev;
if (!d3d || !draw || !draw->texture)
return;
d3d9_set_texture(d3d->dev, 0, (void*)draw->texture);
d3d9_set_sampler_address_u(d3d->dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d9_set_sampler_address_v(d3d->dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d9_set_sampler_minfilter(d3d->dev, 0, D3DTEXF_COMM_LINEAR);
d3d9_set_sampler_magfilter(d3d->dev, 0, D3DTEXF_COMM_LINEAR);
d3d9_set_sampler_mipfilter(d3d->dev, 0, D3DTEXF_COMM_LINEAR);
dev = (LPDIRECT3DDEVICE9)d3d->dev;
d3d9_set_texture(dev, 0, (LPDIRECT3DTEXTURE9)draw->texture);
d3d9_set_sampler_address_u(dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d9_set_sampler_address_v(dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d9_set_sampler_minfilter(dev, 0, D3DTEXF_COMM_LINEAR);
d3d9_set_sampler_magfilter(dev, 0, D3DTEXF_COMM_LINEAR);
d3d9_set_sampler_mipfilter(dev, 0, D3DTEXF_COMM_LINEAR);
}
static void menu_display_d3d9_draw(void *data, video_frame_info_t *video_info)
@ -126,6 +129,7 @@ static void menu_display_d3d9_draw(void *data, video_frame_info_t *video_info)
video_shader_ctx_mvp_t mvp;
math_matrix_4x4 mop, m1, m2;
unsigned width, height;
LPDIRECT3DDEVICE9 dev;
d3d_video_t *d3d = video_info ? (d3d_video_t*)video_info->userdata : NULL;
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
Vertex * pv = NULL;
@ -135,12 +139,15 @@ static void menu_display_d3d9_draw(void *data, video_frame_info_t *video_info)
if (!d3d || !draw || draw->pipeline.id)
return;
dev = (LPDIRECT3DDEVICE9)d3d->dev;
if((d3d->menu_display.offset + draw->coords->vertices )
> (unsigned)d3d->menu_display.size)
return;
pv = (Vertex*)
d3d9_vertex_buffer_lock(d3d->menu_display.buffer);
d3d9_vertex_buffer_lock((LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer);
if (!pv)
return;
@ -178,7 +185,7 @@ static void menu_display_d3d9_draw(void *data, video_frame_info_t *video_info)
colors[2] /* B */
);
}
d3d9_vertex_buffer_unlock(d3d->menu_display.buffer);
d3d9_vertex_buffer_unlock((LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer);
if(!draw->matrix_data)
draw->matrix_data = menu_display_d3d9_get_default_mvp(video_info);
@ -206,8 +213,8 @@ static void menu_display_d3d9_draw(void *data, video_frame_info_t *video_info)
mvp.matrix = &m1;
video_driver_set_mvp(&mvp);
menu_display_d3d9_bind_texture(draw, (d3d_video_t*)video_info->userdata);
d3d9_draw_primitive(d3d->dev,
menu_display_prim_to_d3d9_enum(draw->prim_type),
d3d9_draw_primitive(dev,
(D3DPRIMITIVETYPE)menu_display_prim_to_d3d9_enum(draw->prim_type),
d3d->menu_display.offset,
draw->coords->vertices -
((draw->prim_type == MENU_DISPLAY_PRIM_TRIANGLESTRIP)
@ -270,6 +277,7 @@ static void menu_display_d3d9_restore_clear_color(void)
static void menu_display_d3d9_clear_color(
menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info)
{
LPDIRECT3DDEVICE9 dev;
DWORD clear_color = 0;
d3d_video_t *d3d = video_info ?
(d3d_video_t*)video_info->userdata : NULL;
@ -277,6 +285,8 @@ static void menu_display_d3d9_clear_color(
if (!d3d || !clearcolor)
return;
dev = (LPDIRECT3DDEVICE9)d3d->dev;
clear_color = D3DCOLOR_ARGB(
BYTE_CLAMP(clearcolor->a * 255.0f), /* A */
BYTE_CLAMP(clearcolor->r * 255.0f), /* R */
@ -284,7 +294,7 @@ static void menu_display_d3d9_clear_color(
BYTE_CLAMP(clearcolor->b * 255.0f) /* B */
);
d3d9_clear(d3d->dev, 0, NULL, D3D_COMM_CLEAR_TARGET, clear_color, 0, 0);
d3d9_clear(dev, 0, NULL, D3D_COMM_CLEAR_TARGET, clear_color, 0, 0);
}
static bool menu_display_d3d9_font_init_first(