mirror of
https://github.com/holub/mame
synced 2025-05-19 20:29:09 +03:00
Some fixes to keep sdlmame aligned to SDL1.3 development. No whatsnew.
This commit is contained in:
parent
e2686259a0
commit
fe632b74c2
@ -119,9 +119,11 @@ INLINE void texcopy_##_name (texture_info *texture, const render_texinfo *texsou
|
|||||||
for (y = 0; y < texsource->height; y++) { \
|
for (y = 0; y < texsource->height; y++) { \
|
||||||
_src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div); \
|
_src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div); \
|
||||||
_dest_type *dst = (_dest_type *)((UINT8 *)texture->pixels + y * texture->pitch); \
|
_dest_type *dst = (_dest_type *)((UINT8 *)texture->pixels + y * texture->pitch); \
|
||||||
for (x = 0; x < texsource->width / (_len_div); x++) { \
|
x = texsource->width / (_len_div); \
|
||||||
|
while (x > 0) { \
|
||||||
*dst++ = _op(*src); \
|
*dst++ = _op(*src); \
|
||||||
src++; \
|
src++; \
|
||||||
|
x--; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -140,11 +142,13 @@ INLINE void texcopy_rot_##_name (texture_info *texture, const render_texinfo *te
|
|||||||
INT32 curu = setup->startu + y * setup->dudy; \
|
INT32 curu = setup->startu + y * setup->dudy; \
|
||||||
INT32 curv = setup->startv + y * setup->dvdy; \
|
INT32 curv = setup->startv + y * setup->dvdy; \
|
||||||
_dest_type *dst = (_dest_type *)((UINT8 *)texture->pixels + y * texture->pitch); \
|
_dest_type *dst = (_dest_type *)((UINT8 *)texture->pixels + y * texture->pitch); \
|
||||||
for (x = 0; x < setup->rotwidth; x++) { \
|
x = setup->rotwidth; \
|
||||||
|
while (x>0) { \
|
||||||
_src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16); \
|
_src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16); \
|
||||||
*dst++ = _op(*src); \
|
*dst++ = _op(*src); \
|
||||||
curu += dudx; \
|
curu += dudx; \
|
||||||
curv += dvdx; \
|
curv += dvdx; \
|
||||||
|
x--; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,6 @@
|
|||||||
//
|
//
|
||||||
// SDLMAME by Olivier Galibert and R. Belmont
|
// SDLMAME by Olivier Galibert and R. Belmont
|
||||||
//
|
//
|
||||||
// Note: D3D9 goes to a lot of trouble to fiddle with MODULATE
|
|
||||||
// mode on textures. That is the default in OpenGL so we
|
|
||||||
// don't have to touch it.
|
|
||||||
//
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
// standard C headers
|
// standard C headers
|
||||||
@ -134,6 +130,12 @@ struct _sdl_info
|
|||||||
float last_hofs;
|
float last_hofs;
|
||||||
float last_vofs;
|
float last_vofs;
|
||||||
|
|
||||||
|
// resize information
|
||||||
|
|
||||||
|
UINT8 resize_pending;
|
||||||
|
UINT32 resize_width;
|
||||||
|
UINT32 resize_height;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
INT64 last_blit_time;
|
INT64 last_blit_time;
|
||||||
INT64 last_blit_pixels;
|
INT64 last_blit_pixels;
|
||||||
@ -151,7 +153,7 @@ static int draw13_window_create(sdl_window_info *window, int width, int height);
|
|||||||
static void draw13_window_resize(sdl_window_info *window, int width, int height);
|
static void draw13_window_resize(sdl_window_info *window, int width, int height);
|
||||||
static void draw13_window_destroy(sdl_window_info *window);
|
static void draw13_window_destroy(sdl_window_info *window);
|
||||||
static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||||
static const render_primitive_list *draw13_window_get_primitives(sdl_window_info *window);
|
static render_primitive_list &draw13_window_get_primitives(sdl_window_info *window);
|
||||||
static void draw13_destroy_all_textures(sdl_window_info *window);
|
static void draw13_destroy_all_textures(sdl_window_info *window);
|
||||||
static void draw13_window_clear(sdl_window_info *window);
|
static void draw13_window_clear(sdl_window_info *window);
|
||||||
static int draw13_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
static int draw13_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||||
@ -379,7 +381,7 @@ INLINE void render_quad(sdl_info *sdl, texture_info *texture, render_primitive *
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_SetTextureScaleMode(texture->texture_id, SDL_TEXTURESCALEMODE_FAST);
|
SDL_SetTextureScaleMode(texture->texture_id, SDL_TEXTURESCALEMODE_NONE);
|
||||||
}
|
}
|
||||||
SDL_SetTextureBlendMode(texture_id, texture->sdl_blendmode);
|
SDL_SetTextureBlendMode(texture_id, texture->sdl_blendmode);
|
||||||
set_coloralphamode(texture_id, &prim->color);
|
set_coloralphamode(texture_id, &prim->color);
|
||||||
@ -611,11 +613,6 @@ static int draw13_window_create(sdl_window_info *window, int width, int height)
|
|||||||
window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||||
width, height, sdl->extra_flags);
|
width, height, sdl->extra_flags);
|
||||||
|
|
||||||
SDL_ShowWindow(window->sdl_window);
|
|
||||||
//SDL_SetWindowFullscreen(window->window_id, window->fullscreen);
|
|
||||||
SDL_RaiseWindow(window->sdl_window);
|
|
||||||
SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
|
|
||||||
|
|
||||||
// create renderer
|
// create renderer
|
||||||
|
|
||||||
if (video_config.waitvsync)
|
if (video_config.waitvsync)
|
||||||
@ -630,6 +627,12 @@ static int draw13_window_create(sdl_window_info *window, int width, int height)
|
|||||||
|
|
||||||
SDL_SelectRenderer(window->sdl_window);
|
SDL_SelectRenderer(window->sdl_window);
|
||||||
|
|
||||||
|
SDL_ShowWindow(window->sdl_window);
|
||||||
|
//SDL_SetWindowFullscreen(window->window_id, window->fullscreen);
|
||||||
|
SDL_RaiseWindow(window->sdl_window);
|
||||||
|
SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
|
||||||
|
|
||||||
|
|
||||||
sdl->blittimer = 3;
|
sdl->blittimer = 3;
|
||||||
|
|
||||||
// in case any textures try to come up before these are validated,
|
// in case any textures try to come up before these are validated,
|
||||||
@ -637,6 +640,7 @@ static int draw13_window_create(sdl_window_info *window, int width, int height)
|
|||||||
sdl->texture_max_width = 64;
|
sdl->texture_max_width = 64;
|
||||||
sdl->texture_max_height = 64;
|
sdl->texture_max_height = 64;
|
||||||
|
|
||||||
|
SDL_RenderPresent();
|
||||||
mame_printf_verbose("Leave draw13_window_create\n");
|
mame_printf_verbose("Leave draw13_window_create\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -649,8 +653,13 @@ static void draw13_window_resize(sdl_window_info *window, int width, int height)
|
|||||||
{
|
{
|
||||||
sdl_info *sdl = (sdl_info *) window->dxdata;
|
sdl_info *sdl = (sdl_info *) window->dxdata;
|
||||||
|
|
||||||
SDL_SetWindowSize(window->sdl_window, width, height);
|
sdl->resize_pending = 1;
|
||||||
SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
|
sdl->resize_height = height;
|
||||||
|
sdl->resize_width = width;
|
||||||
|
|
||||||
|
window->width = width;
|
||||||
|
window->height = height;
|
||||||
|
|
||||||
sdl->blittimer = 3;
|
sdl->blittimer = 3;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -676,7 +685,7 @@ static int draw13_xy_to_render_target(sdl_window_info *window, int x, int y, int
|
|||||||
// draw13_window_get_primitives
|
// draw13_window_get_primitives
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static const render_primitive_list *draw13_window_get_primitives(sdl_window_info *window)
|
static render_primitive_list &draw13_window_get_primitives(sdl_window_info *window)
|
||||||
{
|
{
|
||||||
if ((!window->fullscreen) || (video_config.switchres))
|
if ((!window->fullscreen) || (video_config.switchres))
|
||||||
{
|
{
|
||||||
@ -707,13 +716,21 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SelectRenderer(window->sdl_window);
|
if (sdl->resize_pending)
|
||||||
|
{
|
||||||
|
SDL_SetWindowSize(window->sdl_window, sdl->resize_width, sdl->resize_height);
|
||||||
|
SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
|
||||||
|
sdl->resize_pending = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SelectRenderer(window->sdl_window);
|
||||||
|
|
||||||
if (sdl->blittimer > 0)
|
if (sdl->blittimer > 0)
|
||||||
{
|
{
|
||||||
/* SDL Underlays need alpha = 0 ! */
|
/* SDL Underlays need alpha = 0 ! */
|
||||||
SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
|
SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
|
||||||
SDL_SetRenderDrawColor(0,0,0,0 /*255*/);
|
//SDL_SetRenderDrawColor(0,0,0,255);
|
||||||
|
SDL_SetRenderDrawColor(0,0,0,0);
|
||||||
SDL_RenderFillRect(NULL);
|
SDL_RenderFillRect(NULL);
|
||||||
sdl->blittimer--;
|
sdl->blittimer--;
|
||||||
}
|
}
|
||||||
@ -749,10 +766,10 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
|||||||
sdl->last_hofs = hofs;
|
sdl->last_hofs = hofs;
|
||||||
sdl->last_vofs = vofs;
|
sdl->last_vofs = vofs;
|
||||||
|
|
||||||
osd_lock_acquire(window->primlist->lock);
|
window->primlist->acquire_lock();
|
||||||
|
|
||||||
// now draw
|
// now draw
|
||||||
for (prim = window->primlist->head; prim != NULL; prim = prim->next)
|
for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
|
||||||
{
|
{
|
||||||
Uint8 sr, sg, sb, sa;
|
Uint8 sr, sg, sb, sa;
|
||||||
|
|
||||||
@ -777,10 +794,12 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
|||||||
round_nearest(hofs + prim->bounds.x0),
|
round_nearest(hofs + prim->bounds.x0),
|
||||||
round_nearest(vofs + prim->bounds.y0));
|
round_nearest(vofs + prim->bounds.y0));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw emu_fatalerror("Unexpected render_primitive type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osd_lock_release(window->primlist->lock);
|
window->primlist->release_lock();
|
||||||
|
|
||||||
sdl->last_blit_pixels = blit_pixels;
|
sdl->last_blit_pixels = blit_pixels;
|
||||||
sdl->last_blit_time = -osd_ticks();
|
sdl->last_blit_time = -osd_ticks();
|
||||||
@ -1164,10 +1183,10 @@ static void draw13_destroy_all_textures(sdl_window_info *window)
|
|||||||
if (sdl == NULL)
|
if (sdl == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(window->primlist && window->primlist->lock)
|
if(window->primlist)
|
||||||
{
|
{
|
||||||
lock=TRUE;
|
lock=TRUE;
|
||||||
osd_lock_acquire(window->primlist->lock);
|
window->primlist->acquire_lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = sdl->texlist;
|
texture = sdl->texlist;
|
||||||
@ -1180,5 +1199,5 @@ static void draw13_destroy_all_textures(sdl_window_info *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
osd_lock_release(window->primlist->lock);
|
window->primlist->release_lock();
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ static void sdlinput_deregister_joysticks(running_machine *machine)
|
|||||||
// sdlinput_register_mice
|
// sdlinput_register_mice
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#if (SDL_VERSION_ATLEAST(1,3,0))
|
#if (!SDL13_POST_HG4464 && SDL_VERSION_ATLEAST(1,3,0))
|
||||||
static void sdlinput_register_mice(running_machine *machine)
|
static void sdlinput_register_mice(running_machine *machine)
|
||||||
{
|
{
|
||||||
int index, physical_mouse;
|
int index, physical_mouse;
|
||||||
@ -1002,7 +1002,7 @@ static kt_table * sdlinput_read_keymap(running_machine *machine)
|
|||||||
// sdlinput_register_keyboards
|
// sdlinput_register_keyboards
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#if (SDL_VERSION_ATLEAST(1,3,0))
|
#if (!SDL13_POST_HG4464 && SDL_VERSION_ATLEAST(1,3,0))
|
||||||
static void sdlinput_register_keyboards(running_machine *machine)
|
static void sdlinput_register_keyboards(running_machine *machine)
|
||||||
{
|
{
|
||||||
int physical_keyboard;
|
int physical_keyboard;
|
||||||
|
@ -3,6 +3,15 @@
|
|||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// Temporary SDL 1.3 defines
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
// set this to 0 if compiling against a "hg update 4464"
|
||||||
|
// checkout of SDL 1.3
|
||||||
|
|
||||||
|
#define SDL13_POST_HG4464 (1)
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// System dependent defines
|
// System dependent defines
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -153,11 +153,17 @@ char *osd_get_clipboard_text(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if ( info.subsystem != SDL_SYSWM_X11 )
|
if ( info.subsystem != SDL_SYSWM_X11 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#if (SDL_VERSION_ATLEAST(1,3,0))
|
||||||
|
if ( (display = info.x11.display) == NULL )
|
||||||
|
return NULL;
|
||||||
|
if ( (our_win = info.x11.window) == None )
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
if ( (display = info.info.x11.display) == NULL )
|
if ( (display = info.info.x11.display) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
if ( (our_win = info.info.x11.window) == None )
|
if ( (our_win = info.info.x11.window) == None )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#endif
|
||||||
/* request data to owner */
|
/* request data to owner */
|
||||||
selection_win = XGetSelectionOwner( display, XA_PRIMARY );
|
selection_win = XGetSelectionOwner( display, XA_PRIMARY );
|
||||||
if ( selection_win == None )
|
if ( selection_win == None )
|
||||||
|
Loading…
Reference in New Issue
Block a user