static win_monitor_info *pick_monitor(core_options &options, int index) { const char *scrname, *scrname2; win_monitor_info *monitor; int moncount = 0; char option[20]; float aspect; // get the screen option scrname = options_get_string(&options, WINOPTION_SCREEN); sprintf(option, "screen%d", index); scrname2 = options_get_string(&options, option); // decide which one we want to use if (strcmp(scrname2, "auto") != 0) scrname = scrname2; // get the aspect ratio sprintf(option, "aspect%d", index); aspect = get_aspect(options, option, TRUE); // look for a match in the name first if (scrname[0] != 0) for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next) { char *utf8_device; int rc = 1; moncount++; utf8_device = utf8_from_tstring(monitor->info.szDevice); if (utf8_device != NULL) { rc = strcmp(scrname, utf8_device); osd_free(utf8_device); } if (rc == 0) goto finishit; } // didn't find it; alternate monitors until we hit the jackpot index %= moncount; for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next) if (index-- == 0) goto finishit; // return the primary just in case all else fails monitor = primary_monitor; finishit: if (aspect != 0) monitor->aspect = aspect; return monitor; }
osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &osdopts, int index) { windows_options &options = reinterpret_cast<windows_options &>(osdopts); osd_monitor_info *monitor; const char *scrname, *scrname2; int moncount = 0; float aspect; // get the screen option scrname = options.screen(); scrname2 = options.screen(index); // decide which one we want to use if (strcmp(scrname2, "auto") != 0) scrname = scrname2; // get the aspect ratio aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); // look for a match in the name first if (scrname != NULL && (scrname[0] != 0)) { for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) { moncount++; if (strcmp(scrname, monitor->devicename()) == 0) goto finishit; } } // didn't find it; alternate monitors until we hit the jackpot index %= moncount; for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) if (index-- == 0) goto finishit; // return the primary just in case all else fails for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) if (monitor->is_primary()) goto finishit; // FIXME: FatalError? finishit: if (aspect != 0) { monitor->set_aspect(aspect); } return monitor; }
static sdl_monitor_info *pick_monitor(sdl_options &options, int index) { sdl_monitor_info *monitor; float aspect; // get the aspect ratio aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); // return the primary just in case all else fails monitor = primary_monitor; if (aspect != 0) { monitor->aspect = aspect; } return monitor; }
static sdl_monitor_info *pick_monitor(sdl_options &options, int index) { sdl_monitor_info *monitor; const char *scrname; int moncount = 0; float aspect; // get the screen option scrname = options.screen(index); // get the aspect ratio aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); // look for a match in the name first if (scrname != NULL) for (monitor = sdl_monitor_list; monitor != NULL; monitor = monitor->next) { moncount++; if (strcmp(scrname, monitor->monitor_device) == 0) goto finishit; } // didn't find it; alternate monitors until we hit the jackpot index %= moncount; for (monitor = sdl_monitor_list; monitor != NULL; monitor = monitor->next) if (index-- == 0) goto finishit; // return the primary just in case all else fails monitor = primary_monitor; finishit: if (aspect != 0) { monitor->aspect = aspect; } return monitor; }