From 5b093e6ba9506f96c3d3f5d9460a406559bd73ce Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 24 Jul 2012 23:21:29 +0200 Subject: [PATCH] ddraw: Implement ddraw7_GetMonitorFrequency() on top of wined3d_get_adapter_display_mode(). --- dlls/ddraw/ddraw.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 3accf0338b0..6a63d8a540c 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1568,28 +1568,25 @@ static HRESULT WINAPI ddraw1_GetFourCCCodes(IDirectDraw *iface, DWORD *codes_cou return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes); } -/***************************************************************************** - * IDirectDraw7::GetMonitorFrequency - * - * Returns the monitor's frequency - * - * Exists in Version 1, 2, 4 and 7 - * - * Params: - * Freq: Pointer to a DWORD to write the frequency to - * - * Returns - * Always returns DD_OK - * - *****************************************************************************/ -static HRESULT WINAPI ddraw7_GetMonitorFrequency(IDirectDraw7 *iface, DWORD *Freq) +static HRESULT WINAPI ddraw7_GetMonitorFrequency(IDirectDraw7 *iface, DWORD *frequency) { - FIXME("iface %p, frequency %p stub!\n", iface, Freq); + struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + struct wined3d_display_mode mode; + HRESULT hr; + + TRACE("iface %p, frequency %p.\n", iface, frequency); + + wined3d_mutex_lock(); + hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL); + wined3d_mutex_unlock(); + if (FAILED(hr)) + { + WARN("Failed to get display mode, hr %#x.\n", hr); + return hr; + } + + *frequency = mode.refresh_rate; - /* Ideally this should be in WineD3D, as it concerns the screen setup, - * but for now this should make the games happy - */ - *Freq = 60; return DD_OK; }