Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1fab14af
Commit
1fab14af
authored
Oct 15, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Just implement ddraw7_RestoreDisplayMode() on top of wined3d_set_adapter_display_mode().
parent
4a5ed44d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
91 deletions
+68
-91
ddraw.c
dlls/ddraw/ddraw.c
+67
-88
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-3
No files found.
dlls/ddraw/ddraw.c
View file @
1fab14af
...
@@ -1003,79 +1003,6 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window
...
@@ -1003,79 +1003,6 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window
}
}
/*****************************************************************************
/*****************************************************************************
*
* Helper function for SetDisplayMode and RestoreDisplayMode
*
* Implements DirectDraw's SetDisplayMode, but ignores the value of
* ForceRefreshRate, since it is already handled by
* ddraw7_SetDisplayMode. RestoreDisplayMode can use this function
* without worrying that ForceRefreshRate will override the refresh rate. For
* argument and return value documentation, see
* ddraw7_SetDisplayMode.
*
*****************************************************************************/
static
HRESULT
ddraw_set_display_mode
(
struct
ddraw
*
ddraw
,
DWORD
Width
,
DWORD
Height
,
DWORD
BPP
,
DWORD
RefreshRate
,
DWORD
Flags
)
{
struct
wined3d_display_mode
mode
;
enum
wined3d_format_id
format
;
HRESULT
hr
;
TRACE
(
"ddraw %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.
\n
"
,
ddraw
,
Width
,
Height
,
BPP
,
RefreshRate
,
Flags
);
wined3d_mutex_lock
();
if
(
!
Width
||
!
Height
)
{
ERR
(
"Width %u, Height %u, what to do?
\n
"
,
Width
,
Height
);
/* It looks like Need for Speed Porsche Unleashed expects DD_OK here */
wined3d_mutex_unlock
();
return
DD_OK
;
}
switch
(
BPP
)
{
case
8
:
format
=
WINED3DFMT_P8_UINT
;
break
;
case
15
:
format
=
WINED3DFMT_B5G5R5X1_UNORM
;
break
;
case
16
:
format
=
WINED3DFMT_B5G6R5_UNORM
;
break
;
case
24
:
format
=
WINED3DFMT_B8G8R8_UNORM
;
break
;
case
32
:
format
=
WINED3DFMT_B8G8R8X8_UNORM
;
break
;
default:
format
=
WINED3DFMT_UNKNOWN
;
break
;
}
/* Check the exclusive mode
if(!(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
return DDERR_NOEXCLUSIVEMODE;
* This is WRONG. Don't know if the SDK is completely
* wrong and if there are any conditions when DDERR_NOEXCLUSIVE
* is returned, but Half-Life 1.1.1.1 (Steam version)
* depends on this
*/
mode
.
width
=
Width
;
mode
.
height
=
Height
;
mode
.
refresh_rate
=
RefreshRate
;
mode
.
format_id
=
format
;
mode
.
scanline_ordering
=
WINED3D_SCANLINE_ORDERING_UNKNOWN
;
/* TODO: The possible return values from msdn suggest that
* the screen mode can't be changed if a surface is locked
* or some drawing is in progress
*/
/* TODO: Lose the primary surface */
hr
=
wined3d_set_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
mode
);
wined3d_mutex_unlock
();
switch
(
hr
)
{
case
WINED3DERR_NOTAVAILABLE
:
return
DDERR_UNSUPPORTED
;
default:
return
hr
;
}
}
/*****************************************************************************
* IDirectDraw7::SetDisplayMode
* IDirectDraw7::SetDisplayMode
*
*
* Sets the display screen resolution, color depth and refresh frequency
* Sets the display screen resolution, color depth and refresh frequency
...
@@ -1097,22 +1024,67 @@ static HRESULT ddraw_set_display_mode(struct ddraw *ddraw, DWORD Width, DWORD He
...
@@ -1097,22 +1024,67 @@ static HRESULT ddraw_set_display_mode(struct ddraw *ddraw, DWORD Width, DWORD He
* DD_OK on success
* DD_OK on success
*
*
*****************************************************************************/
*****************************************************************************/
static
HRESULT
WINAPI
ddraw7_SetDisplayMode
(
IDirectDraw7
*
iface
,
DWORD
Width
,
DWORD
H
eight
,
static
HRESULT
WINAPI
ddraw7_SetDisplayMode
(
IDirectDraw7
*
iface
,
DWORD
width
,
DWORD
h
eight
,
DWORD
BPP
,
DWORD
RefreshRate
,
DWORD
F
lags
)
DWORD
bpp
,
DWORD
refresh_rate
,
DWORD
f
lags
)
{
{
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
struct
wined3d_display_mode
mode
;
enum
wined3d_format_id
format
;
HRESULT
hr
;
TRACE
(
"iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.
\n
"
,
TRACE
(
"iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.
\n
"
,
iface
,
Width
,
Height
,
BPP
,
RefreshRate
,
F
lags
);
iface
,
width
,
height
,
bpp
,
refresh_rate
,
f
lags
);
if
(
force_refresh_rate
!=
0
)
if
(
force_refresh_rate
!=
0
)
{
{
TRACE
(
"ForceRefreshRate overriding passed-in refresh rate (%u Hz) to %u Hz
\n
"
,
TRACE
(
"ForceRefreshRate overriding passed-in refresh rate (%u Hz) to %u Hz
\n
"
,
RefreshR
ate
,
force_refresh_rate
);
refresh_r
ate
,
force_refresh_rate
);
RefreshR
ate
=
force_refresh_rate
;
refresh_r
ate
=
force_refresh_rate
;
}
}
return
ddraw_set_display_mode
(
ddraw
,
Width
,
Height
,
BPP
,
RefreshRate
,
Flags
);
wined3d_mutex_lock
();
if
(
!
width
||
!
height
)
{
/* It looks like Need for Speed Porsche Unleashed expects DD_OK here. */
wined3d_mutex_unlock
();
return
DD_OK
;
}
switch
(
bpp
)
{
case
8
:
format
=
WINED3DFMT_P8_UINT
;
break
;
case
15
:
format
=
WINED3DFMT_B5G5R5X1_UNORM
;
break
;
case
16
:
format
=
WINED3DFMT_B5G6R5_UNORM
;
break
;
case
24
:
format
=
WINED3DFMT_B8G8R8_UNORM
;
break
;
case
32
:
format
=
WINED3DFMT_B8G8R8X8_UNORM
;
break
;
default:
format
=
WINED3DFMT_UNKNOWN
;
break
;
}
/* Check the exclusive mode.
* if(!(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
* return DDERR_NOEXCLUSIVEMODE;
* This is WRONG. Don't know if the SDK is completely wrong and if there
* are any conditions when DDERR_NOEXCLUSIVE is returned, but Half-Life
* 1.1.1.1 (Steam version) depends on this. */
mode
.
width
=
width
;
mode
.
height
=
height
;
mode
.
refresh_rate
=
refresh_rate
;
mode
.
format_id
=
format
;
mode
.
scanline_ordering
=
WINED3D_SCANLINE_ORDERING_UNKNOWN
;
/* TODO: The possible return values from msdn suggest that the screen mode
* can't be changed if a surface is locked or some drawing is in progress. */
/* TODO: Lose the primary surface. */
hr
=
wined3d_set_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
mode
);
wined3d_mutex_unlock
();
switch
(
hr
)
{
case
WINED3DERR_NOTAVAILABLE
:
return
DDERR_UNSUPPORTED
;
default:
return
hr
;
}
}
}
static
HRESULT
WINAPI
ddraw4_SetDisplayMode
(
IDirectDraw4
*
iface
,
DWORD
width
,
DWORD
height
,
static
HRESULT
WINAPI
ddraw4_SetDisplayMode
(
IDirectDraw4
*
iface
,
DWORD
width
,
DWORD
height
,
...
@@ -1170,10 +1142,17 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO
...
@@ -1170,10 +1142,17 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO
static
HRESULT
WINAPI
ddraw7_RestoreDisplayMode
(
IDirectDraw7
*
iface
)
static
HRESULT
WINAPI
ddraw7_RestoreDisplayMode
(
IDirectDraw7
*
iface
)
{
{
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p.
\n
"
,
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
return
ddraw_set_display_mode
(
ddraw
,
ddraw
->
orig_width
,
ddraw
->
orig_height
,
ddraw
->
orig_bpp
,
0
,
0
);
wined3d_mutex_lock
();
hr
=
wined3d_set_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
ddraw
->
original_mode
);
wined3d_mutex_unlock
();
return
hr
;
}
}
static
HRESULT
WINAPI
ddraw4_RestoreDisplayMode
(
IDirectDraw4
*
iface
)
static
HRESULT
WINAPI
ddraw4_RestoreDisplayMode
(
IDirectDraw4
*
iface
)
...
@@ -5359,7 +5338,6 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
...
@@ -5359,7 +5338,6 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
HRESULT
ddraw_init
(
struct
ddraw
*
ddraw
,
enum
wined3d_device_type
device_type
)
HRESULT
ddraw_init
(
struct
ddraw
*
ddraw
,
enum
wined3d_device_type
device_type
)
{
{
HRESULT
hr
;
HRESULT
hr
;
HDC
hDC
;
ddraw
->
IDirectDraw7_iface
.
lpVtbl
=
&
ddraw7_vtbl
;
ddraw
->
IDirectDraw7_iface
.
lpVtbl
=
&
ddraw7_vtbl
;
ddraw
->
IDirectDraw_iface
.
lpVtbl
=
&
ddraw1_vtbl
;
ddraw
->
IDirectDraw_iface
.
lpVtbl
=
&
ddraw1_vtbl
;
...
@@ -5373,13 +5351,6 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
...
@@ -5373,13 +5351,6 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
ddraw
->
numIfaces
=
1
;
ddraw
->
numIfaces
=
1
;
ddraw
->
ref7
=
1
;
ddraw
->
ref7
=
1
;
/* Get the current screen settings. */
hDC
=
GetDC
(
0
);
ddraw
->
orig_bpp
=
GetDeviceCaps
(
hDC
,
BITSPIXEL
)
*
GetDeviceCaps
(
hDC
,
PLANES
);
ReleaseDC
(
0
,
hDC
);
ddraw
->
orig_width
=
GetSystemMetrics
(
SM_CXSCREEN
);
ddraw
->
orig_height
=
GetSystemMetrics
(
SM_CYSCREEN
);
ddraw
->
wined3d
=
wined3d_create
(
7
,
WINED3D_LEGACY_DEPTH_BIAS
);
ddraw
->
wined3d
=
wined3d_create
(
7
,
WINED3D_LEGACY_DEPTH_BIAS
);
if
(
!
ddraw
->
wined3d
)
if
(
!
ddraw
->
wined3d
)
{
{
...
@@ -5387,6 +5358,14 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
...
@@ -5387,6 +5358,14 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
if
(
FAILED
(
hr
=
wined3d_get_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
ddraw
->
original_mode
,
NULL
)))
{
ERR
(
"Failed to get display mode, hr %#x.
\n
"
,
hr
);
wined3d_decref
(
ddraw
->
wined3d
);
return
hr
;
}
hr
=
wined3d_device_create
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
device_type
,
hr
=
wined3d_device_create
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
device_type
,
NULL
,
0
,
8
,
&
ddraw
->
device_parent
,
&
ddraw
->
wined3d_device
);
NULL
,
0
,
8
,
&
ddraw
->
device_parent
,
&
ddraw
->
wined3d_device
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
...
...
dlls/ddraw/ddraw_private.h
View file @
1fab14af
...
@@ -78,9 +78,7 @@ struct ddraw
...
@@ -78,9 +78,7 @@ struct ddraw
/* DirectDraw things, which are not handled by WineD3D */
/* DirectDraw things, which are not handled by WineD3D */
DWORD
cooperative_level
;
DWORD
cooperative_level
;
struct
wined3d_display_mode
original_mode
;
DWORD
orig_width
,
orig_height
;
DWORD
orig_bpp
;
/* D3D things */
/* D3D things */
HWND
d3d_window
;
HWND
d3d_window
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment