summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-03-17 15:50:12 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-03-17 15:50:12 +0000
commitec550fa07b074134947dc76f9dc469431edb1787 (patch)
tree2e8bf8dd6b96d9515abaac6c3d3502231b642629 /src/osd
parent75056eb1b52a5e7e4bf5cd78d63cc3583ae80cd1 (diff)
Fixed pick_best_mode in both d3d and ddraw cases to manually extract
refresh information from the device's inline_config, since this is done before the screen devices are start. Fixes 01491: switchres causes Exception at EIP=009413BF: ACCESS VIOLATION. Also, fixed render_target_get_minimum_size() to return nominal values if no screens are found.
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/windows/drawd3d.c10
-rw-r--r--src/osd/windows/drawdd.c11
2 files changed, 19 insertions, 2 deletions
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index c1805de19dc..9784632d7e4 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -1238,7 +1238,8 @@ static int get_adapter_for_monitor(d3d_info *d3d, win_monitor_info *monitor)
static void pick_best_mode(win_window_info *window)
{
- double target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds);
+ const device_config *primary_screen = video_screen_first(Machine->config);
+ double target_refresh = 60.0;
INT32 target_width, target_height;
d3d_info *d3d = window->drawdata;
INT32 minwidth, minheight;
@@ -1246,6 +1247,13 @@ static void pick_best_mode(win_window_info *window)
int maxmodes;
int modenum;
+ // determine the refresh rate of the primary screen
+ if (primary_screen != NULL)
+ {
+ const screen_config *config = primary_screen->inline_config;
+ target_refresh = ATTOSECONDS_TO_HZ(config->refresh);
+ }
+
// determine the minimum width/height for the selected target
// note: technically we should not be calling this from an alternate window
// thread; however, it is only done during init time, and the init code on
diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c
index 2492e2dce79..6cf429af5d7 100644
--- a/src/osd/windows/drawdd.c
+++ b/src/osd/windows/drawdd.c
@@ -1291,6 +1291,7 @@ static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context)
static void pick_best_mode(win_window_info *window)
{
+ const device_config *primary_screen = video_screen_first(Machine->config);
dd_info *dd = window->drawdata;
mode_enum_info einfo;
HRESULT result;
@@ -1304,7 +1305,15 @@ static void pick_best_mode(win_window_info *window)
// use those as the target for now
einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);
einfo.target_height = einfo.minimum_height * MAX(1, video_config.prescale);
- einfo.target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds);
+
+ // determine the refresh rate of the primary screen
+ einfo.target_refresh = 60.0;
+ if (primary_screen != NULL)
+ {
+ const screen_config *config = primary_screen->inline_config;
+ einfo.target_refresh = ATTOSECONDS_TO_HZ(config->refresh);
+ }
+ printf("Target refresh = %f\n", einfo.target_refresh);
// if we're not stretching, allow some slop on the minimum since we can handle it
if (!video_config.hwstretch)