static void extract_video_config(running_machine &machine) { const char *stemp; sdl_options &options = downcast<sdl_options &>(machine.options()); video_config.perftest = options.video_fps(); // global options: extract the data video_config.windowed = options.window(); video_config.keepaspect = options.keep_aspect(); video_config.numscreens = options.numscreens(); video_config.fullstretch = options.uneven_stretch(); #ifdef SDLMAME_X11 video_config.restrictonemonitor = !options.use_all_heads(); #endif if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED) video_config.windowed = TRUE; // default to working video please video_config.novideo = 0; // d3d options: extract the data stemp = options.video(); if (strcmp(stemp, SDLOPTVAL_SOFT) == 0) video_config.mode = VIDEO_MODE_SOFT; else if (strcmp(stemp, SDLOPTVAL_NONE) == 0) { video_config.mode = VIDEO_MODE_SOFT; video_config.novideo = 1; if (options.seconds_to_run() == 0) mame_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); } else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) video_config.mode = VIDEO_MODE_OPENGL; else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL16) == 0)) { video_config.mode = VIDEO_MODE_OPENGL; video_config.prefer16bpp_tex = 1; } else if (SDLMAME_SDL2 && (strcmp(stemp, SDLOPTVAL_SDL13) == 0)) { video_config.mode = VIDEO_MODE_SDL13; video_config.prefer16bpp_tex = 1; } else { mame_printf_warning("Invalid video value %s; reverting to software\n", stemp); video_config.mode = VIDEO_MODE_SOFT; } video_config.switchres = options.switch_res(); video_config.centerh = options.centerh(); video_config.centerv = options.centerv(); video_config.waitvsync = options.wait_vsync(); video_config.syncrefresh = options.sync_refresh(); if (!video_config.waitvsync && video_config.syncrefresh) { mame_printf_warning("-syncrefresh specified without -waitsync. Reverting to -nosyncrefresh\n"); video_config.syncrefresh = 0; } if (USE_OPENGL || SDLMAME_SDL2) { video_config.filter = options.filter(); } if (USE_OPENGL) { video_config.prescale = options.prescale(); if (video_config.prescale < 1 || video_config.prescale > 3) { mame_printf_warning("Invalid prescale option, reverting to '1'\n"); video_config.prescale = 1; } // default to working video please video_config.prefer16bpp_tex = 0; video_config.forcepow2texture = options.gl_force_pow2_texture(); video_config.allowtexturerect = !(options.gl_no_texture_rect()); video_config.vbo = options.gl_vbo(); video_config.pbo = options.gl_pbo(); video_config.glsl = options.gl_glsl(); if ( video_config.glsl ) { int i; video_config.glsl_filter = options.glsl_filter(); video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { stemp = options.shader_mame(i); if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0) { video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); strcpy(video_config.glsl_shader_mamebm[i], stemp); video_config.glsl_shader_mamebm_num++; } else { video_config.glsl_shader_mamebm[i] = NULL; } } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { stemp = options.shader_screen(i); if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0) { video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); strcpy(video_config.glsl_shader_scrn[i], stemp); video_config.glsl_shader_scrn_num++; } else { video_config.glsl_shader_scrn[i] = NULL; } } video_config.glsl_vid_attributes = options.glsl_vid_attr(); { // Disable feature: glsl_vid_attributes, as long we have the gamma calculation // disabled within the direct shaders .. -> too slow. // IMHO the gamma setting should be done global anyways, and for the whole system, // not just MAME .. float gamma = options.gamma(); if (gamma != 1.0 && video_config.glsl_vid_attributes && video_config.glsl) { video_config.glsl_vid_attributes = FALSE; mame_printf_warning("OpenGL: GLSL - disable handling of brightness and contrast, gamma is set to %f\n", gamma); } } } else { int i; video_config.glsl_filter = 0; video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { video_config.glsl_shader_mamebm[i] = NULL; } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { video_config.glsl_shader_scrn[i] = NULL; } video_config.glsl_vid_attributes = 0; } } // misc options: sanity check values // global options: sanity check values #if (!SDLMAME_SDL2) if (video_config.numscreens < 1 || video_config.numscreens > 1) //MAX_VIDEO_WINDOWS) { mame_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); video_config.numscreens = 1; } #else if (video_config.numscreens < 1 || video_config.numscreens > MAX_VIDEO_WINDOWS) { mame_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); video_config.numscreens = 1; } #endif // yuv settings ... stemp = options.scale_mode(); video_config.scale_mode = drawsdl_scale_mode(stemp); if (video_config.scale_mode < 0) { mame_printf_warning("Invalid yuvmode value %s; reverting to none\n", stemp); video_config.scale_mode = VIDEO_SCALE_MODE_NONE; } if ( (video_config.mode != VIDEO_MODE_SOFT) && (video_config.scale_mode != VIDEO_SCALE_MODE_NONE) ) { mame_printf_warning("scalemode is only for -video soft, overriding\n"); video_config.scale_mode = VIDEO_SCALE_MODE_NONE; } }
void sdl_osd_interface::extract_video_config() { const char *stemp; video_config.perftest = options().video_fps(); // global options: extract the data video_config.windowed = options().window(); video_config.prescale = options().prescale(); video_config.filter = options().filter(); video_config.keepaspect = options().keep_aspect(); video_config.numscreens = options().numscreens(); video_config.fullstretch = options().uneven_stretch(); #ifdef SDLMAME_X11 video_config.restrictonemonitor = !options().use_all_heads(); #endif // if we are in debug mode, never go full screen if (machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) video_config.windowed = TRUE; // default to working video please video_config.novideo = 0; // d3d options: extract the data stemp = options().video(); if (strcmp(stemp, "auto") == 0) { #if (defined SDLMAME_MACOSX || defined SDLMAME_WIN32) stemp = "opengl"; #else stemp = "soft"; #endif } if (strcmp(stemp, SDLOPTVAL_SOFT) == 0) video_config.mode = VIDEO_MODE_SOFT; else if (strcmp(stemp, OSDOPTVAL_NONE) == 0) { video_config.mode = VIDEO_MODE_SOFT; video_config.novideo = 1; if (options().seconds_to_run() == 0) osd_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); } else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) video_config.mode = VIDEO_MODE_OPENGL; else if (SDLMAME_SDL2 && (strcmp(stemp, SDLOPTVAL_SDL2ACCEL) == 0)) { video_config.mode = VIDEO_MODE_SDL2ACCEL; } #ifdef USE_BGFX else if (strcmp(stemp, SDLOPTVAL_BGFX) == 0) { video_config.mode = VIDEO_MODE_BGFX; } #endif else { osd_printf_warning("Invalid video value %s; reverting to software\n", stemp); video_config.mode = VIDEO_MODE_SOFT; } video_config.switchres = options().switch_res(); video_config.centerh = options().centerh(); video_config.centerv = options().centerv(); video_config.waitvsync = options().wait_vsync(); video_config.syncrefresh = machine().options().sync_refresh(); if (video_config.prescale < 1 || video_config.prescale > 3) { osd_printf_warning("Invalid prescale option, reverting to '1'\n"); video_config.prescale = 1; } #if (USE_OPENGL) // default to working video please video_config.forcepow2texture = options().gl_force_pow2_texture(); video_config.allowtexturerect = !(options().gl_no_texture_rect()); video_config.vbo = options().gl_vbo(); video_config.pbo = options().gl_pbo(); video_config.glsl = options().gl_glsl(); if ( video_config.glsl ) { int i; video_config.glsl_filter = options().glsl_filter(); video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { stemp = options().shader_mame(i); if (stemp && strcmp(stemp, OSDOPTVAL_NONE) != 0 && strlen(stemp)>0) { video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); strcpy(video_config.glsl_shader_mamebm[i], stemp); video_config.glsl_shader_mamebm_num++; } else { video_config.glsl_shader_mamebm[i] = NULL; } } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { stemp = options().shader_screen(i); if (stemp && strcmp(stemp, OSDOPTVAL_NONE) != 0 && strlen(stemp)>0) { video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); strcpy(video_config.glsl_shader_scrn[i], stemp); video_config.glsl_shader_scrn_num++; } else { video_config.glsl_shader_scrn[i] = NULL; } } } else { int i; video_config.glsl_filter = 0; video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { video_config.glsl_shader_mamebm[i] = NULL; } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { video_config.glsl_shader_scrn[i] = NULL; } } #endif /* USE_OPENGL */ // misc options: sanity check values // global options: sanity check values #if (!SDLMAME_SDL2) if (video_config.numscreens < 1 || video_config.numscreens > 1) //MAX_VIDEO_WINDOWS) { osd_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); video_config.numscreens = 1; } #else if (video_config.numscreens < 1 || video_config.numscreens > MAX_VIDEO_WINDOWS) { osd_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); video_config.numscreens = 1; } #endif // yuv settings ... stemp = options().scale_mode(); video_config.scale_mode = drawsdl_scale_mode(stemp); if (video_config.scale_mode < 0) { osd_printf_warning("Invalid yuvmode value %s; reverting to none\n", stemp); video_config.scale_mode = VIDEO_SCALE_MODE_NONE; } if ( (video_config.mode != VIDEO_MODE_SOFT) && (video_config.scale_mode != VIDEO_SCALE_MODE_NONE) ) { osd_printf_warning("scalemode is only for -video soft, overriding\n"); video_config.scale_mode = VIDEO_SCALE_MODE_NONE; } }