Final fixups, get sliders working again, nw

This commit is contained in:
therealmogminer@gmail.com 2016-02-21 03:03:05 +01:00
parent eca47070a5
commit bf033cfe00
24 changed files with 424 additions and 194 deletions

View File

@ -1954,6 +1954,8 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
state->incval = incval;
state->update = update;
state->arg = arg;
state->hidden = false;
state->id = -1;
strcpy(state->description, title);
return state;

View File

@ -104,6 +104,7 @@ struct slider_state
INT32 maxval; /* maximum value */
INT32 incval; /* increment value */
bool hidden; /* hidden or not */
INT32 id; /* unique identifier */
char description[1]; /* textual description */
};

View File

@ -492,6 +492,7 @@ bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_ar
slider_state* osd_common_t::get_slider_list()
{
printf("Core get_slider_list\n");
return nullptr;
}

View File

@ -16,8 +16,10 @@
#include "render/drawnone.h"
#include "render/drawbgfx.h"
#if (USE_OPENGL)
#include "render/drawogl.h"
#if OSD_WINDOWS
#endif
#ifdef OSD_WINDOWS
#include "render/drawgdi.h"
#include "render/drawd3d.h"
#else
@ -29,15 +31,17 @@ osd_renderer* osd_renderer::make_for_type(int mode, osd_window* window, int extr
{
switch(mode)
{
#ifdef OSD_WINDOWS
case VIDEO_MODE_NONE:
return new renderer_none(window);
#endif
case VIDEO_MODE_BGFX:
return new renderer_bgfx(window);
#if (USE_OPENGL)
case VIDEO_MODE_OPENGL:
return new renderer_ogl(window);
#endif
#if OSD_WINDOWS
#ifdef OSD_WINDOWS
case VIDEO_MODE_GDI:
return new renderer_gdi(window);
case VIDEO_MODE_D3D:

View File

@ -12,6 +12,11 @@
#include "emu.h"
#include "ui/ui.h"
#ifdef OSD_SDL
// standard SDL headers
#include "sdlinc.h"
#endif
//============================================================
// TYPE DEFINITIONS
//============================================================
@ -21,7 +26,7 @@ class render_primitive_list;
enum
{
VIDEO_MODE_NONE,
VIDEO_MODE_NONE = 0,
VIDEO_MODE_GDI,
VIDEO_MODE_BGFX,
#if (USE_OPENGL)
@ -29,7 +34,9 @@ enum
#endif
VIDEO_MODE_SDL2ACCEL,
VIDEO_MODE_D3D,
VIDEO_MODE_SOFT
VIDEO_MODE_SOFT,
VIDEO_MODE_COUNT
};
class osd_dim
@ -205,7 +212,7 @@ public:
static const int FLAG_NEEDS_ASYNCBLIT = 0x0200;
osd_renderer(osd_window *window, const int flags)
: m_window(window), m_flags(flags) { }
: m_sliders_dirty(false), m_window(window), m_flags(flags) { }
virtual ~osd_renderer() { }
@ -219,7 +226,6 @@ public:
/* Interface to be implemented by render code */
virtual int create() = 0;
virtual int init(running_machine &machine) = 0;
virtual render_primitive_list *get_primitives() = 0;
virtual slider_state* get_slider_list() { return nullptr; }
@ -228,12 +234,14 @@ public:
virtual void save() { };
virtual void record() { };
virtual void toggle_fsfx() { };
virtual bool sliders_dirty() { return m_sliders_dirty; }
static osd_renderer* make_for_type(int mode, osd_window *window, int extra_flags = FLAG_NONE);
protected:
/* Internal flags */
static const int FI_CHANGED = 0x010000;
bool m_sliders_dirty;
private:
osd_window *m_window;

View File

@ -2206,7 +2206,7 @@ static void get_vector(const char *data, int count, float *out, bool report_erro
// be done in a more ideal way.
//============================================================
static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg)
static slider_state *slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg)
{
int size = sizeof(slider_state) + strlen(title);
slider_state *state = (slider_state *)auto_alloc_array_clear(machine, UINT8, size);
@ -2218,6 +2218,7 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
state->update = update;
state->arg = arg;
state->hidden = false;
state->id = id;
strcpy(state->description, title);
return state;
@ -2845,99 +2846,191 @@ static INT32 slider_ntsc_scan_time(running_machine &machine, void *arg, std::str
hlsl_options shaders::last_options = { false };
enum slider_option
{
SLIDER_VECTOR_ATTENUATION = 0,
SLIDER_VECTOR_LENGTH_MAX,
SLIDER_SHADOW_MASK_TILE_MODE,
SLIDER_SHADOW_MASK_ALPHA,
SLIDER_SHADOW_MASK_X_COUNT,
SLIDER_SHADOW_MASK_Y_COUNT,
SLIDER_SHADOW_MASK_U_SIZE,
SLIDER_SHADOW_MASK_V_SIZE,
SLIDER_SHADOW_MASK_U_OFFSET,
SLIDER_SHADOW_MASK_V_OFFSET,
SLIDER_CURVATURE,
SLIDER_ROUND_CORNER,
SLIDER_SMOOTH_BORDER,
SLIDER_REFLECTION,
SLIDER_VIGNETTING,
SLIDER_SCANLINE_ALPHA,
SLIDER_SCANLINE_SCALE,
SLIDER_SCANLINE_HEIGHT,
SLIDER_SCANLINE_BRIGHT_SCALE,
SLIDER_SCANLINE_BRIGHT_OFFSET,
SLIDER_SCANLINE_JITTER,
SLIDER_HUM_BAR_ALPHA,
SLIDER_DEFOCUS_X,
SLIDER_DEFOCUS_Y,
SLIDER_RED_CONVERGE_X,
SLIDER_RED_CONVERGE_Y,
SLIDER_GREEN_CONVERGE_X,
SLIDER_GREEN_CONVERGE_Y,
SLIDER_BLUE_CONVERGE_X,
SLIDER_BLUE_CONVERGE_Y,
SLIDER_RED_RADIAL_CONVERGE_X,
SLIDER_RED_RADIAL_CONVERGE_Y,
SLIDER_GREEN_RADIAL_CONVERGE_X,
SLIDER_GREEN_RADIAL_CONVERGE_Y,
SLIDER_BLUE_RADIAL_CONVERGE_X,
SLIDER_BLUE_RADIAL_CONVERGE_Y,
SLIDER_RED_FROM_R,
SLIDER_RED_FROM_G,
SLIDER_RED_FROM_B,
SLIDER_GREEN_FROM_R,
SLIDER_GREEN_FROM_G,
SLIDER_GREEN_FROM_B,
SLIDER_BLUE_FROM_R,
SLIDER_BLUE_FROM_G,
SLIDER_BLUE_FROM_B,
SLIDER_SATURATION,
SLIDER_RED_OFFSET,
SLIDER_GREEN_OFFSET,
SLIDER_BLUE_OFFSET,
SLIDER_RED_SCALE,
SLIDER_GREEN_SCALE,
SLIDER_BLUE_SCALE,
SLIDER_RED_POWER,
SLIDER_GREEN_POWER,
SLIDER_BLUE_POWER,
SLIDER_RED_FLOOR,
SLIDER_GREEN_FLOOR,
SLIDER_BLUE_FLOOR,
SLIDER_RED_PHOSPHOR,
SLIDER_GREEN_PHOSPHOR,
SLIDER_BLUE_PHOSPHOR,
SLIDER_BLOOM_BLEND_MODE,
SLIDER_BLOOM_SCALE,
SLIDER_BLOOM_RED_OVERDRIVE,
SLIDER_BLOOM_GREEN_OVERDRIVE,
SLIDER_BLOOM_BLUE_OVERDRIVE,
SLIDER_BLOOM_LVL0_SCALE,
SLIDER_BLOOM_LVL1_SCALE,
SLIDER_BLOOM_LVL2_SCALE,
SLIDER_BLOOM_LVL3_SCALE,
SLIDER_BLOOM_LVL4_SCALE,
SLIDER_BLOOM_LVL5_SCALE,
SLIDER_BLOOM_LVL6_SCALE,
SLIDER_BLOOM_LVL7_SCALE,
SLIDER_BLOOM_LVL8_SCALE,
SLIDER_BLOOM_LVL9_SCALE,
SLIDER_BLOOM_LVL10_SCALE,
SLIDER_NTSC_ENABLE,
SLIDER_NTSC_JITTER,
SLIDER_NTSC_A_VALUE,
SLIDER_NTSC_B_VALUE,
SLIDER_NTSC_P_VALUE,
SLIDER_NTSC_O_VALUE,
SLIDER_NTSC_CC_VALUE,
SLIDER_NTSC_N_VALUE,
SLIDER_NTSC_Y_VALUE,
SLIDER_NTSC_I_VALUE,
SLIDER_NTSC_Q_VALUE,
SLIDER_NTSC_SCAN_TIME
};
shaders::slider_desc shaders::s_sliders[] =
{
{ "Vector Length Attenuation", 0, 50, 100, 1, 2, slider_vector_attenuation },
{ "Vector Attenuation Length Limit", 1, 500, 1000, 1, 2, slider_vector_length_max },
{ "Shadow Mask Tile Mode", 0, 0, 1, 1, 7, slider_shadow_mask_tile_mode },
{ "Shadow Mask Darkness", 0, 0, 100, 1, 7, slider_shadow_mask_alpha },
{ "Shadow Mask X Count", 1, 1, 1024, 1, 7, slider_shadow_mask_x_count },
{ "Shadow Mask Y Count", 1, 1, 1024, 1, 7, slider_shadow_mask_y_count },
{ "Shadow Mask Pixel Count X", 1, 1, 64, 1, 7, slider_shadow_mask_usize },
{ "Shadow Mask Pixel Count Y", 1, 1, 64, 1, 7, slider_shadow_mask_vsize },
{ "Shadow Mask Offset X", -100, 0, 100, 1, 7, slider_shadow_mask_uoffset },
{ "Shadow Mask Offset Y", -100, 0, 100, 1, 7, slider_shadow_mask_voffset },
{ "Screen Curvature", 0, 0, 100, 1, 7, slider_curvature },
{ "Screen Round Corner", 0, 0, 100, 1, 7, slider_round_corner },
{ "Screen Smooth Border", 0, 0, 100, 1, 7, slider_smooth_border },
{ "Screen Reflection", 0, 0, 100, 1, 7, slider_reflection },
{ "Image Vignetting", 0, 0, 100, 1, 7, slider_vignetting },
{ "Scanline Darkness", 0, 0, 100, 1, 5, slider_scanline_alpha },
{ "Scanline Screen Height", 1, 20, 80, 1, 5, slider_scanline_scale },
{ "Scanline Indiv. Height", 1, 20, 80, 1, 5, slider_scanline_height },
{ "Scanline Brightness", 0, 20, 40, 1, 5, slider_scanline_bright_scale },
{ "Scanline Brightness Overdrive", 0, 0, 20, 1, 5, slider_scanline_bright_offset },
{ "Scanline Jitter", 0, 0, 100, 1, 5, slider_scanline_jitter },
{ "Hum Bar Darkness", 0, 0, 100, 1, 5, slider_hum_bar_alpha },
{ "Defocus X", 0, 0, 100, 1, 7, slider_defocus_x },
{ "Defocus Y", 0, 0, 100, 1, 7, slider_defocus_y },
{ "Red Position Offset X", -100, 0, 100, 1, 7, slider_red_converge_x },
{ "Red Position Offset Y", -100, 0, 100, 1, 7, slider_red_converge_y },
{ "Green Position Offset X", -100, 0, 100, 1, 7, slider_green_converge_x },
{ "Green Position Offset Y", -100, 0, 100, 1, 7, slider_green_converge_y },
{ "Blue Position Offset X", -100, 0, 100, 1, 7, slider_blue_converge_x },
{ "Blue Position Offset Y", -100, 0, 100, 1, 7, slider_blue_converge_y },
{ "Red Convergence X", -100, 0, 100, 1, 7, slider_red_radial_converge_x },
{ "Red Convergence Y", -100, 0, 100, 1, 7, slider_red_radial_converge_y },
{ "Green Convergence X", -100, 0, 100, 1, 7, slider_green_radial_converge_x },
{ "Green Convergence Y", -100, 0, 100, 1, 7, slider_green_radial_converge_y },
{ "Blue Convergence X", -100, 0, 100, 1, 7, slider_blue_radial_converge_x },
{ "Blue Convergence Y", -100, 0, 100, 1, 7, slider_blue_radial_converge_y },
{ "Red Output from Red Input", -400, 0, 400, 5, 7, slider_red_from_r },
{ "Red Output from Green Input", -400, 0, 400, 5, 7, slider_red_from_g },
{ "Red Output from Blue Input", -400, 0, 400, 5, 7, slider_red_from_b },
{ "Green Output from Red Input", -400, 0, 400, 5, 7, slider_green_from_r },
{ "Green Output from Green Input", -400, 0, 400, 5, 7, slider_green_from_g },
{ "Green Output from Blue Input", -400, 0, 400, 5, 7, slider_green_from_b },
{ "Blue Output from Red Input", -400, 0, 400, 5, 7, slider_blue_from_r },
{ "Blue Output from Green Input", -400, 0, 400, 5, 7, slider_blue_from_g },
{ "Blue Output from Blue Input", -400, 0, 400, 5, 7, slider_blue_from_b },
{ "Saturation", 0, 100, 400, 1, 7, slider_saturation },
{ "Red DC Offset", -100, 0, 100, 1, 7, slider_red_offset },
{ "Green DC Offset", -100, 0, 100, 1, 7, slider_green_offset },
{ "Blue DC Offset", -100, 0, 100, 1, 7, slider_blue_offset },
{ "Red Scale", -200, 100, 200, 1, 7, slider_red_scale },
{ "Green Scale", -200, 100, 200, 1, 7, slider_green_scale },
{ "Blue Scale", -200, 100, 200, 1, 7, slider_blue_scale },
{ "Red Gamma", -80, 0, 80, 1, 7, slider_red_power },
{ "Green Gamma", -80, 0, 80, 1, 7, slider_green_power },
{ "Blue Gamma", -80, 0, 80, 1, 7, slider_blue_power },
{ "Red Floor", 0, 0, 100, 1, 7, slider_red_floor },
{ "Green Floor", 0, 0, 100, 1, 7, slider_green_floor },
{ "Blue Floor", 0, 0, 100, 1, 7, slider_blue_floor },
{ "Red Phosphor Life", 0, 0, 100, 1, 7, slider_red_phosphor_life },
{ "Green Phosphor Life", 0, 0, 100, 1, 7, slider_green_phosphor_life },
{ "Blue Phosphor Life", 0, 0, 100, 1, 7, slider_blue_phosphor_life },
{ "Bloom Blend Mode", 0, 0, 1, 1, 7, slider_bloom_blend_mode },
{ "Bloom Scale", 0, 0, 2000, 5, 7, slider_bloom_scale },
{ "Bloom Red Overdrive", 0, 0, 2000, 5, 7, slider_bloom_red_overdrive },
{ "Bloom Green Overdrive", 0, 0, 2000, 5, 7, slider_bloom_green_overdrive },
{ "Bloom Blue Overdrive", 0, 0, 2000, 5, 7, slider_bloom_blue_overdrive },
{ "Bloom Level 0 Scale", 0, 100, 100, 1, 7, slider_bloom_lvl0_scale },
{ "Bloom Level 1 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl1_scale },
{ "Bloom Level 2 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl2_scale },
{ "Bloom Level 3 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl3_scale },
{ "Bloom Level 4 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl4_scale },
{ "Bloom Level 5 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl5_scale },
{ "Bloom Level 6 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl6_scale },
{ "Bloom Level 7 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl7_scale },
{ "Bloom Level 8 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl8_scale },
{ "Bloom Level 9 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl9_scale },
{ "Bloom Level 10 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl10_scale },
{ "NTSC processing", 0, 0, 1, 1, 5, slider_ntsc_enable },
{ "Signal Jitter", 0, 0, 100, 1, 5, slider_ntsc_jitter },
{ "A Value", -100, 50, 100, 1, 5, slider_ntsc_a_value },
{ "B Value", -100, 50, 100, 1, 5, slider_ntsc_b_value },
{ "Incoming Pixel Clock Scaling", -300, 100, 300, 1, 5, slider_ntsc_p_value },
{ "Outgoing Color Carrier Phase", -300, 0, 300, 1, 5, slider_ntsc_o_value },
{ "Color Carrier Frequency", 0, 35795, 60000, 5, 5, slider_ntsc_cc_value },
{ "Y Notch", 0, 100, 600, 5, 5, slider_ntsc_n_value },
{ "Y Frequency", 0, 600, 600, 5, 5, slider_ntsc_y_value },
{ "I Frequency", 0, 120, 600, 5, 5, slider_ntsc_i_value },
{ "Q Frequency", 0, 60, 600, 5, 5, slider_ntsc_q_value },
{ "Scanline Duration", 0, 5260, 10000, 1, 5, slider_ntsc_scan_time },
// { "Phase Count", 1, 2, 3, 1, 5, slider_ntsc_phase_count },
{ NULL, 0, 0, 0, 0, 0, NULL },
{ "Vector Length Attenuation", 0, 50, 100, 1, SLIDER_SCREEN_TYPE_VECTOR, slider_vector_attenuation, SLIDER_VECTOR_ATTENUATION },
{ "Vector Attenuation Length Limit", 1, 500, 1000, 1, SLIDER_SCREEN_TYPE_VECTOR, slider_vector_length_max, SLIDER_VECTOR_LENGTH_MAX },
{ "Shadow Mask Tile Mode", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_tile_mode, SLIDER_SHADOW_MASK_TILE_MODE },
{ "Shadow Mask Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_alpha, SLIDER_SHADOW_MASK_ALPHA },
{ "Shadow Mask X Count", 1, 1, 1024, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_x_count, SLIDER_SHADOW_MASK_X_COUNT },
{ "Shadow Mask Y Count", 1, 1, 1024, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_y_count, SLIDER_SHADOW_MASK_Y_COUNT },
{ "Shadow Mask Pixel Count X", 1, 1, 64, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_usize, SLIDER_SHADOW_MASK_U_SIZE },
{ "Shadow Mask Pixel Count Y", 1, 1, 64, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_vsize, SLIDER_SHADOW_MASK_V_SIZE },
{ "Shadow Mask Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_uoffset, SLIDER_SHADOW_MASK_U_OFFSET },
{ "Shadow Mask Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_voffset, SLIDER_SHADOW_MASK_V_OFFSET },
{ "Screen Curvature", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_curvature, SLIDER_CURVATURE },
{ "Screen Round Corner", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_round_corner, SLIDER_ROUND_CORNER },
{ "Screen Smooth Border", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_smooth_border, SLIDER_SMOOTH_BORDER },
{ "Screen Reflection", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_reflection, SLIDER_REFLECTION },
{ "Image Vignetting", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_vignetting, SLIDER_VIGNETTING },
{ "Scanline Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_alpha, SLIDER_SCANLINE_ALPHA },
{ "Scanline Screen Height", 1, 20, 80, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_scale, SLIDER_SCANLINE_SCALE },
{ "Scanline Indiv. Height", 1, 20, 80, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_height, SLIDER_SCANLINE_HEIGHT },
{ "Scanline Brightness", 0, 20, 40, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_scale, SLIDER_SCANLINE_BRIGHT_SCALE },
{ "Scanline Brightness Overdrive", 0, 0, 20, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_offset, SLIDER_SCANLINE_BRIGHT_OFFSET },
{ "Scanline Jitter", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_jitter, SLIDER_SCANLINE_JITTER },
{ "Hum Bar Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_hum_bar_alpha, SLIDER_HUM_BAR_ALPHA },
{ "Defocus X", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_defocus_x, SLIDER_DEFOCUS_X },
{ "Defocus Y", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_defocus_y, SLIDER_DEFOCUS_Y },
{ "Red Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_converge_x, SLIDER_RED_CONVERGE_X },
{ "Red Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_converge_y, SLIDER_RED_CONVERGE_Y },
{ "Green Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_converge_x, SLIDER_GREEN_CONVERGE_X },
{ "Green Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_converge_y, SLIDER_GREEN_CONVERGE_Y },
{ "Blue Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_converge_x, SLIDER_BLUE_CONVERGE_X },
{ "Blue Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_converge_y, SLIDER_BLUE_CONVERGE_Y },
{ "Red Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_radial_converge_x, SLIDER_RED_RADIAL_CONVERGE_X },
{ "Red Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_radial_converge_y, SLIDER_RED_RADIAL_CONVERGE_Y },
{ "Green Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_radial_converge_x, SLIDER_GREEN_RADIAL_CONVERGE_X },
{ "Green Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_radial_converge_y, SLIDER_GREEN_RADIAL_CONVERGE_Y },
{ "Blue Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_radial_converge_x, SLIDER_BLUE_RADIAL_CONVERGE_X },
{ "Blue Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_radial_converge_y, SLIDER_BLUE_RADIAL_CONVERGE_Y },
{ "Red Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_r, SLIDER_RED_FROM_R },
{ "Red Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_g, SLIDER_RED_FROM_G },
{ "Red Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_b, SLIDER_RED_FROM_B },
{ "Green Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_r, SLIDER_GREEN_FROM_R },
{ "Green Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_g, SLIDER_GREEN_FROM_G },
{ "Green Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_b, SLIDER_GREEN_FROM_B },
{ "Blue Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_r, SLIDER_BLUE_FROM_R },
{ "Blue Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_g, SLIDER_BLUE_FROM_G },
{ "Blue Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_b, SLIDER_BLUE_FROM_B },
{ "Saturation", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_ANY, slider_saturation, SLIDER_SATURATION },
{ "Red DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_offset, SLIDER_RED_OFFSET },
{ "Green DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_offset, SLIDER_GREEN_OFFSET },
{ "Blue DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_offset, SLIDER_BLUE_OFFSET },
{ "Red Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_scale, SLIDER_RED_SCALE },
{ "Green Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_scale, SLIDER_GREEN_SCALE },
{ "Blue Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_scale, SLIDER_BLUE_SCALE },
{ "Red Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_power, SLIDER_RED_POWER },
{ "Green Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_power, SLIDER_GREEN_POWER },
{ "Blue Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_power, SLIDER_BLUE_POWER },
{ "Red Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_floor, SLIDER_RED_FLOOR },
{ "Green Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_floor, SLIDER_GREEN_FLOOR },
{ "Blue Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_floor, SLIDER_BLUE_FLOOR },
{ "Red Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_phosphor_life, SLIDER_RED_PHOSPHOR },
{ "Green Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_phosphor_life, SLIDER_GREEN_PHOSPHOR },
{ "Blue Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_phosphor_life, SLIDER_BLUE_PHOSPHOR },
{ "Bloom Blend Mode", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_blend_mode, SLIDER_BLOOM_BLEND_MODE },
{ "Bloom Scale", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_scale, SLIDER_BLOOM_SCALE },
{ "Bloom Red Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_red_overdrive, SLIDER_BLOOM_RED_OVERDRIVE },
{ "Bloom Green Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_green_overdrive, SLIDER_BLOOM_GREEN_OVERDRIVE },
{ "Bloom Blue Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_blue_overdrive, SLIDER_BLOOM_BLUE_OVERDRIVE },
{ "Bloom Level 0 Scale", 0, 100, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl0_scale, SLIDER_BLOOM_LVL0_SCALE },
{ "Bloom Level 1 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl1_scale, SLIDER_BLOOM_LVL1_SCALE },
{ "Bloom Level 2 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl2_scale, SLIDER_BLOOM_LVL2_SCALE },
{ "Bloom Level 3 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl3_scale, SLIDER_BLOOM_LVL3_SCALE },
{ "Bloom Level 4 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl4_scale, SLIDER_BLOOM_LVL4_SCALE },
{ "Bloom Level 5 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl5_scale, SLIDER_BLOOM_LVL5_SCALE },
{ "Bloom Level 6 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl6_scale, SLIDER_BLOOM_LVL6_SCALE },
{ "Bloom Level 7 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl7_scale, SLIDER_BLOOM_LVL7_SCALE },
{ "Bloom Level 8 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl8_scale, SLIDER_BLOOM_LVL8_SCALE },
{ "Bloom Level 9 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl9_scale, SLIDER_BLOOM_LVL9_SCALE },
{ "Bloom Level 10 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl10_scale, SLIDER_BLOOM_LVL10_SCALE },
{ "NTSC processing", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_enable, SLIDER_NTSC_ENABLE },
{ "Signal Jitter", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_jitter, SLIDER_NTSC_JITTER },
{ "A Value", -100, 50, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_a_value, SLIDER_NTSC_A_VALUE },
{ "B Value", -100, 50, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_b_value, SLIDER_NTSC_B_VALUE },
{ "Incoming Pixel Clock Scaling", -300, 100, 300, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_p_value, SLIDER_NTSC_P_VALUE },
{ "Outgoing Color Carrier Phase", -300, 0, 300, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_o_value, SLIDER_NTSC_O_VALUE },
{ "Color Carrier Frequency", 0, 35795, 60000, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_cc_value, SLIDER_NTSC_CC_VALUE },
{ "Y Notch", 0, 100, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_n_value, SLIDER_NTSC_N_VALUE },
{ "Y Frequency", 0, 600, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_y_value, SLIDER_NTSC_Y_VALUE },
{ "I Frequency", 0, 120, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_i_value, SLIDER_NTSC_I_VALUE },
{ "Q Frequency", 0, 60, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_q_value, SLIDER_NTSC_Q_VALUE },
{ "Scanline Duration", 0, 5260, 10000, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_scan_time, SLIDER_NTSC_SCAN_TIME },
{ NULL, 0, 0, 0, 0, 0, NULL, -1 },
};
@ -2965,7 +3058,7 @@ slider_state *shaders::init_slider_list()
(screen_type == SCREEN_TYPE_RASTER && (slider->screen_type & SLIDER_SCREEN_TYPE_RASTER) == SLIDER_SCREEN_TYPE_RASTER) ||
(screen_type == SCREEN_TYPE_LCD && (slider->screen_type & SLIDER_SCREEN_TYPE_LCD) == SLIDER_SCREEN_TYPE_LCD))
{
*tailptr = slider_alloc(*machine, slider->name, slider->minval, slider->defval, slider->maxval, slider->step, slider->adjustor, (void*)options);
*tailptr = slider_alloc(*machine, slider->id, slider->name, slider->minval, slider->defval, slider->maxval, slider->step, slider->adjustor, (void*)options);
tailptr = &(*tailptr)->next;
}
}

View File

@ -320,7 +320,9 @@ public:
SLIDER_SCREEN_TYPE_NONE = 0,
SLIDER_SCREEN_TYPE_RASTER = 1,
SLIDER_SCREEN_TYPE_VECTOR = 2,
SLIDER_SCREEN_TYPE_LCD = 4
SLIDER_SCREEN_TYPE_LCD = 4,
SLIDER_SCREEN_TYPE_LCD_OR_RASTER = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_LCD,
SLIDER_SCREEN_TYPE_ANY = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_VECTOR | SLIDER_SCREEN_TYPE_LCD
};
struct slider_desc
@ -332,6 +334,7 @@ public:
int step;
int screen_type;
INT32(*adjustor)(running_machine &, void *, std::string *, INT32);
int id;
};
private:

View File

@ -84,7 +84,7 @@ renderer_sdl1::renderer_sdl1(osd_window *window, int extra_flags)
* prohibit fullscreen toggling. It is than not possible
* to toggle from fullscreen to window mode.
*/
expand_copy_info(blit_info_default);
expand_copy_info(s_blit_info_default);
s_blit_info_initialized = true;
}
}
@ -180,7 +180,7 @@ const copy_info_t renderer_sdl1::s_blit_info_default[] =
{ -1 },
};
copy_info_t* renderer_sdl::s_blit_info[SDL_TEXFORMAT_LAST+1] = { NULL };
copy_info_t* renderer_sdl1::s_blit_info[SDL_TEXFORMAT_LAST+1] = { NULL };
bool renderer_sdl1::s_blit_info_initialized = false;
//============================================================
@ -216,7 +216,7 @@ static inline SDL_BlendMode map_blendmode(const int blendmode)
return SDL_BLENDMODE_NONE;
}
void renderer_sdl1::set_coloralphamode(SDL_Texture *texture_id, const render_color *color)
void texture_info::set_coloralphamode(SDL_Texture *texture_id, const render_color *color)
{
UINT32 sr = (UINT32)(255.0f * color->r);
UINT32 sg = (UINT32)(255.0f * color->g);
@ -333,7 +333,7 @@ int renderer_sdl1::RendererSupportsFormat(Uint32 format, Uint32 access, const ch
// drawsdl_init
//============================================================
static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm)
void renderer_sdl1::add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm)
{
copy_info_t *newci = global_alloc(copy_info_t);
*newci = *element;
@ -343,11 +343,9 @@ static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm)
*head = newci;
}
static void expand_copy_info(copy_info_t *list)
void renderer_sdl1::expand_copy_info(const copy_info_t *list)
{
copy_info_t *bi;
for (bi = list; bi->src_fmt != -1; bi++)
for (const copy_info_t *bi = list; bi->src_fmt != -1; bi++)
{
if (bi->bm_mask == BM_ALL)
{
@ -357,17 +355,14 @@ static void expand_copy_info(copy_info_t *list)
add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_BLEND);
}
else
{
add_list(&s_blit_info[bi->src_fmt], bi, bi->bm_mask);
}
}
}
static osd_renderer *drawsdl2_create(osd_window *window)
{
return global_alloc(renderer_sdl1(window, osd_renderer::FLAG_NONE));
}
// FIXME: machine only used to access options.
int renderer_sdl1::init(running_machine &machine)
bool renderer_sdl1::init(running_machine &machine)
{
osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n");
@ -386,7 +381,7 @@ int renderer_sdl1::init(running_machine &machine)
else
osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
return 0;
return false;
}
@ -615,11 +610,10 @@ int renderer_sdl1::draw(int update)
copy_info_t *texture_info::compute_size_type()
{
copy_info_t *bi;
copy_info_t *result = NULL;
int maxperf = 0;
for (bi = blit_info[m_format]; bi != NULL; bi = bi->next)
for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != NULL; bi = bi->next)
{
if ((m_is_rotated == bi->blitter->m_is_rot)
&& (m_sdl_blendmode == bi->bm_mask))
@ -637,10 +631,12 @@ copy_info_t *texture_info::compute_size_type()
}
}
}
if (result)
return result;
/* try last resort handlers */
for (bi = blit_info[m_format]; bi != NULL; bi = bi->next)
for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != NULL; bi = bi->next)
{
if ((m_is_rotated == bi->blitter->m_is_rot)
&& (m_sdl_blendmode == bi->bm_mask))
@ -906,7 +902,7 @@ texture_info *renderer_sdl1::texture_find(const render_primitive &prim, const qu
// texture_update
//============================================================
texture_info * renderer_sdl3::texture_update(const render_primitive &prim)
texture_info * renderer_sdl1::texture_update(const render_primitive &prim)
{
quad_setup_data setup;
texture_info *texture;
@ -936,7 +932,7 @@ texture_info * renderer_sdl3::texture_update(const render_primitive &prim)
return texture;
}
render_primitive_list *renderer_sdl13::get_primitives()
render_primitive_list *renderer_sdl1::get_primitives()
{
osd_dim nd = window().blit_surface_size();
if (nd != m_blit_dim)

View File

@ -88,6 +88,8 @@ public:
bool is_pixels_owned() const;
private:
void set_coloralphamode(SDL_Texture *texture_id, const render_color *color);
Uint32 m_sdl_access;
renderer_sdl1 * m_renderer;
render_texinfo m_texinfo; // copy of the texture info
@ -176,7 +178,7 @@ public:
}
virtual int create() override;
virtual int init(running_machine &machine) override;
static bool init(running_machine &machine);
virtual int draw(const int update) override;
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override;
virtual render_primitive_list *get_primitives() override;
@ -184,9 +186,13 @@ public:
SDL_Renderer * m_sdl_renderer;
static copy_info_t* s_blit_info[SDL_TEXFORMAT_LAST+1];
private:
void expand_copy_info(const copy_info_t *list);
void add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm);
void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
void set_coloralphamode(SDL_Texture *texture_id, const render_color *color);
texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
texture_info *texture_update(const render_primitive &prim);
@ -216,7 +222,6 @@ private:
INT64 m_last_blit_time;
INT64 m_last_blit_pixels;
static copy_info_t* s_blit_info[SDL_TEXFORMAT_LAST+1];
static bool s_blit_info_initialized;
static const copy_info_t s_blit_info_default[];
};

View File

@ -31,7 +31,7 @@ public:
virtual int create() override;
virtual slider_state* get_slider_list() override;
virtual int init(running_machine &machine) override { return 0; }
static bool init(running_machine &machine) { return false; }
virtual int draw(const int update) override;
#ifdef OSD_SDL
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override;

View File

@ -219,7 +219,7 @@ render_primitive_list *renderer_d3d9::get_primitives()
// drawnone_create
//============================================================
int renderer_d3d9::init(running_machine &machine)
bool renderer_d3d9::init(running_machine &machine)
{
// Use Direct3D9
d3dintf = drawd3d9_init();
@ -228,10 +228,10 @@ int renderer_d3d9::init(running_machine &machine)
if (d3dintf == nullptr)
{
osd_printf_error("Unable to initialize Direct3D.\n");
return 1;
return true;
}
return 0;
return false;
}
@ -576,11 +576,15 @@ int renderer_d3d9::initialize()
{
// configure the adapter for the mode we want
if (config_adapter_mode())
{
return false;
}
// create the device immediately for the full screen case (defer for window mode)
if (window().fullscreen() && device_create(window().m_focus_hwnd))
{
return false;
}
return true;
}
@ -870,6 +874,7 @@ try_again:
m_shaders = (shaders*)global_alloc_clear<shaders>();
m_shaders->init(d3dintf, &window().machine(), this);
m_sliders_dirty = true;
int failed = m_shaders->create_resources(false);
if (failed)

View File

@ -43,7 +43,7 @@ public:
virtual int create() override;
virtual slider_state* get_slider_list() override;
virtual int init(running_machine &machine) override;
static bool init(running_machine &machine);
virtual render_primitive_list *get_primitives() override;
virtual int draw(const int update) override;
virtual void save() override;

View File

@ -38,7 +38,7 @@ public:
virtual ~renderer_gdi();
virtual int create() override;
virtual int init(running_machine &machine) override { return 0; }
static bool init(running_machine &machine) { return false; }
virtual render_primitive_list *get_primitives() override;
virtual int draw(const int update) override;
virtual void save() override {};

View File

@ -23,7 +23,7 @@ public:
virtual ~renderer_none() { }
virtual int create() override { return 0; }
virtual int init(running_machine &machine) override { return 0; }
static bool init(running_machine &machine) { return false; }
virtual render_primitive_list *get_primitives() override;
virtual int draw(const int update) override { return 0; }
virtual void save() override { }

View File

@ -277,7 +277,7 @@ static void texture_set_data(ogl_texture_info *texture, const render_texinfo *te
bool renderer_ogl::s_shown_video_info = false;
bool renderer_ogl::s_dll_loaded = false;
int renderer_ogl::init(running_machine &machine)
bool renderer_ogl::init(running_machine &machine)
{
s_dll_loaded = false;
@ -288,7 +288,7 @@ int renderer_ogl::init(running_machine &machine)
osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n");
#endif
return 0;
return false;
}
//============================================================

View File

@ -131,7 +131,7 @@ public:
virtual ~renderer_ogl();
virtual int create() override;
virtual int init(running_machine &machine) override;
static bool init(running_machine &machine);
virtual int draw(const int update) override;
#ifndef OSD_WINDOWS
@ -165,7 +165,7 @@ private:
void destroy_all_textures();
void load_gl_lib(running_machine &machine);
static void load_gl_lib(running_machine &machine);
void loadGLExtensions();
void initialize_gl();
void set_blendmode(int blendmode);

View File

@ -44,9 +44,6 @@
// PROTOTYPES
//============================================================
// core functions
static void drawsdl_exit(void);
// YUV overlays
static void yuv_RGB_to_YV12(const UINT16 *bitmap, UINT8 *ptr, const int pitch, \
@ -93,10 +90,10 @@ int drawsdl_scale_mode(const char *s)
// drawsdl_init
//============================================================
int renderer_sdl2::init(running_machine &machine)
bool renderer_sdl2::init(running_machine &machine)
{
osd_printf_verbose("Using SDL multi-window soft driver (SDL 2.0+)\n");
return 0;
return false;
}
//============================================================
@ -154,7 +151,7 @@ void renderer_sdl2::setup_texture(const osd_dim &size)
// drawsdl_show_info
//============================================================
void renderer_sdl::show_info(struct SDL_RendererInfo *render_info)
void renderer_sdl2::show_info(struct SDL_RendererInfo *render_info)
{
#define RF_ENTRY(x) {x, #x }
static struct

View File

@ -36,12 +36,13 @@ public:
}
virtual ~renderer_sdl2();
/* virtual */ int create() override;
/* virtual */ int init(running_machine &machine) override;
/* virtual */ int draw(const int update) override;
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt) override;
virtual int create() override;
virtual int draw(const int update) override;
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override;
virtual render_primitive_list *get_primitives() override;
static bool init(running_machine &machine);
private:
void show_info(struct SDL_RendererInfo *render_info);

View File

@ -83,7 +83,7 @@ bool sdl_osd_interface::video_init()
get_resolution(options().resolution(), options().resolution(index), &conf, TRUE);
// create window ...
sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf));
sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, osd_monitor_info::pick_monitor(reinterpret_cast<osd_options &>(options()), index), &conf));
if (win->window_init())
return false;
@ -229,8 +229,9 @@ void sdl_monitor_info::exit()
// pick_monitor
//============================================================
osd_monitor_info *osd_monitor_info::pick_monitor(sdl_options &options, int index)
osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &generic_options, int index)
{
sdl_options &options = reinterpret_cast<sdl_options &>(generic_options);
osd_monitor_info *monitor;
const char *scrname, *scrname2;
int moncount = 0;

View File

@ -12,6 +12,7 @@
#define __SDLVIDEO__
#include "osdsdl.h"
#include "modules/osdwindow.h"
//============================================================
// CONSTANTS

View File

@ -36,6 +36,12 @@
#include "window.h"
#include "input.h"
#include "osdsdl.h"
#include "modules/render/drawbgfx.h"
#include "modules/render/drawsdl.h"
#include "modules/render/draw13.h"
#if (USE_OPENGL)
#include "modules/render/drawogl.h"
#endif
//============================================================
// PARAMETERS
@ -221,13 +227,37 @@ bool sdl_osd_interface::window_init()
}
// initialize the drawers
if (m_renderer->init(machine()))
video_config.mode = VIDEO_MODE_SOFT;
if (video_config.mode == VIDEO_MODE_BGFX)
{
if (renderer_bgfx::init(machine()))
{
#if (USE_OPENGL)
video_config.mode = VIDEO_MODE_OPENGL;
}
}
if (video_config.mode == VIDEO_MODE_OPENGL)
{
if (renderer_ogl::init(machine()))
{
video_config.mode = VIDEO_MODE_SOFT;
#else
video_config.mode = VIDEO_MODE_SOFT;
#endif
}
}
if (video_config.mode == VIDEO_MODE_SDL2ACCEL)
{
if (renderer_sdl2::init(machine()))
{
video_config.mode = VIDEO_MODE_SOFT;
}
}
if (video_config.mode == VIDEO_MODE_SOFT)
{
if (m_renderer->init(machine()))
if (renderer_sdl1::init(machine()))
{
return false;
}
}
/* We may want to set a number of the hints SDL2 provides.
@ -327,9 +357,6 @@ void sdl_osd_interface::window_exit()
sdlwindow_sync();
}
// kill the drawers
delete render_module;
execute_async_wait(&sdlwindow_exit_wt, wp_dummy);
if (multithreading_enabled)
@ -514,7 +541,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
window->m_windowed_dim = window->get_size();
}
global_free(window->m_renderer);
delete window->m_renderer;
window->m_renderer = nullptr;
bool is_osx = false;
@ -531,9 +558,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
SDL_DestroyWindow(window->sdl_window());
sdlinput_release_keys();
osd_renderer *renderer = osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this));
renderer->init(window->machine());
window->set_renderer(renderer);
window->set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(window)));
// toggle the window mode
window->set_fullscreen(!window->fullscreen());
@ -659,8 +684,7 @@ int sdl_window_info::window_init()
*last_window_ptr = this;
last_window_ptr = &this->m_next;
osd_renderer* renderer =
set_renderer(draw.create(this));
set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this)));
// create an event that we can use to skip blitting
m_rendered_event = osd_event_alloc(FALSE, TRUE);

View File

@ -83,28 +83,6 @@ bool windows_osd_interface::video_init()
win_window_info::create(machine(), index, osd_monitor_info::pick_monitor(options, index), &windows[index]);
}
m_sliders = nullptr;
slider_state *curr = m_sliders;
for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next)
{
slider_state *window_sliders = info->m_renderer->get_slider_list();
if (window_sliders != nullptr)
{
if (m_sliders == nullptr)
{
m_sliders = curr = window_sliders;
}
else
{
while (curr->next != nullptr)
{
curr = curr->next;
}
curr->next = window_sliders;
}
}
}
if (video_config.mode != VIDEO_MODE_NONE)
SetForegroundWindow(win_window_list->m_hwnd);
@ -215,6 +193,8 @@ void windows_osd_interface::update(bool skip_redraw)
// ping the watchdog on each update
winmain_watchdog_ping();
update_slider_list();
// if we're not skipping this redraw, update all windows
if (!skip_redraw)
{

View File

@ -28,6 +28,14 @@
#include "winutil.h"
#include "modules/render/drawbgfx.h"
#include "modules/render/drawnone.h"
#include "modules/render/drawd3d.h"
#include "modules/render/drawgdi.h"
#if (USE_OPENGL)
#include "modules/render/drawogl.h"
#endif
//============================================================
// PARAMETERS
//============================================================
@ -196,13 +204,108 @@ bool windows_osd_interface::window_init()
window_threadid = main_threadid;
}
const int fallbacks[VIDEO_MODE_COUNT] = {
-1, // NONE -> no fallback
VIDEO_MODE_NONE, // GDI -> NONE
VIDEO_MODE_D3D, // BGFX -> D3D
#if (USE_OPENGL)
VIDEO_MODE_GDI, // OPENGL -> GDI
#endif
-1, // No SDL2ACCEL on Windows OSD
#if (USE_OPENGL)
VIDEO_MODE_OPENGL, // D3D -> OPENGL
#else
VIDEO_MODE_GDI, // D3D -> GDI
#endif
-1 // No SOFT on Windows OSD
};
int current_mode = video_config.mode;
while (current_mode != VIDEO_MODE_NONE)
{
bool error = false;
switch(current_mode)
{
case VIDEO_MODE_NONE:
error = renderer_none::init(machine());
break;
case VIDEO_MODE_GDI:
error = renderer_gdi::init(machine());
break;
case VIDEO_MODE_BGFX:
error = renderer_bgfx::init(machine());
break;
#if (USE_OPENGL)
case VIDEO_MODE_OPENGL:
error = renderer_ogl::init(machine());
break;
#endif
case VIDEO_MODE_SDL2ACCEL:
fatalerror("SDL2-Accel renderer unavailable on Windows OSD.");
break;
case VIDEO_MODE_D3D:
error = renderer_d3d9::init(machine());
break;
case VIDEO_MODE_SOFT:
fatalerror("SDL1 renderer unavailable on Windows OSD.");
break;
default:
fatalerror("Unknown video mode.");
break;
}
if (error)
{
current_mode = fallbacks[current_mode];
}
else
{
break;
}
}
video_config.mode = current_mode;
// set up the window list
last_window_ptr = &win_window_list;
return true;
}
void windows_osd_interface::update_slider_list()
{
for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next)
{
if (window->m_renderer->sliders_dirty())
{
build_slider_list();
return;
}
}
}
void windows_osd_interface::build_slider_list()
{
m_sliders = nullptr;
slider_state *curr = m_sliders;
for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next)
{
slider_state *window_sliders = info->m_renderer->get_slider_list();
if (window_sliders != nullptr)
{
if (m_sliders == nullptr)
{
m_sliders = curr = window_sliders;
}
else
{
while (curr->next != nullptr)
{
curr = curr->next;
}
curr->next = window_sliders;
}
}
}
}
//============================================================
// winwindow_exit
@ -300,9 +403,7 @@ void winwindow_process_events_periodic(running_machine &machine)
static BOOL is_mame_window(HWND hwnd)
{
win_window_info *window;
for (window = win_window_list; window != nullptr; window = window->m_next)
for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next)
if (window->m_hwnd == hwnd)
return TRUE;
@ -609,13 +710,10 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
// allocate a new window object
win_window_info *window = global_alloc(win_window_info(machine));
//printf("%d, %d\n", config->width, config->height);
window->m_win_config = *config;
window->m_monitor = monitor;
window->m_fullscreen = !video_config.windowed;
window->m_index = index;
window->m_renderer = reinterpret_cast<osd_renderer *>(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(window)));
window->m_renderer->init(machine);
// set main window
if (index > 0)
@ -1019,8 +1117,6 @@ int win_window_info::wnd_extra_height()
return rect_height(&temprect) - 100;
}
//============================================================
// thread_entry
// (window thread)
@ -1185,8 +1281,14 @@ int win_window_info::complete_create()
if (!m_fullscreen || m_fullscreen_safe)
{
// finish off by trying to initialize DirectX; if we fail, ignore it
if (m_renderer != nullptr)
{
global_free(m_renderer);
}
m_renderer = osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this));
if (m_renderer->create())
return 1;
ShowWindow(m_hwnd, SW_SHOW);
}
@ -1892,9 +1994,12 @@ void win_window_info::set_fullscreen(int fullscreen)
{
if (video_config.mode != VIDEO_MODE_NONE)
ShowWindow(m_hwnd, SW_SHOW);
osd_renderer *renderer = reinterpret_cast<osd_renderer *>(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this)));
renderer->init(machine());
m_renderer = renderer;
if (m_renderer != nullptr)
{
delete m_renderer;
}
m_renderer = reinterpret_cast<osd_renderer *>(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this)));
if (m_renderer->create())
exit(1);
}

View File

@ -275,8 +275,11 @@ public:
private:
virtual void osd_exit() override;
windows_options &m_options;
slider_state *m_sliders;
void build_slider_list();
void update_slider_list();
windows_options & m_options;
slider_state * m_sliders;
static const int DEFAULT_FONT_HEIGHT = 200;
};