xref: /reactos/dll/appcompat/shims/layer/dispmode.c (revision 8a978a17)
1 /*
2  * PROJECT:     ReactOS 'Layers' Shim library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Display settings related shims
5  * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #define WIN32_NO_STATUS
9 #include <windef.h>
10 #include <winbase.h>
11 #include <wingdi.h>
12 #include <winuser.h>
13 #include <shimlib.h>
14 
15 
16 #define SHIM_NS         Force8BitColor
17 #include <setup_shim.inl>
18 
19 #define SHIM_NUM_HOOKS  0
20 #define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
21 
22 BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
23 {
24     if (fdwReason == SHIM_REASON_INIT)
25     {
26         DEVMODEA dm = { { 0 } };
27         dm.dmSize = sizeof(dm);
28         if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
29             dm.dmBitsPerPel != 8)
30         {
31             dm.dmBitsPerPel = 8;
32             dm.dmFields |= DM_BITSPERPEL;
33             ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
34         }
35     }
36     return TRUE;
37 }
38 
39 #include <implement_shim.inl>
40 
41 
42 
43 #define SHIM_NS         Force640x480
44 #include <setup_shim.inl>
45 
46 #define SHIM_NUM_HOOKS  0
47 #define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
48 
49 BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
50 {
51     if (fdwReason == SHIM_REASON_INIT)
52     {
53         DEVMODEA dm = { { 0 } };
54         dm.dmSize = sizeof(dm);
55         if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
56             (dm.dmPelsWidth != 640 || dm.dmPelsHeight != 480))
57         {
58             dm.dmPelsWidth = 640;
59             dm.dmPelsHeight = 480;
60             dm.dmFields |= (DM_PELSWIDTH | DM_PELSHEIGHT);
61             ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
62         }
63     }
64     return TRUE;
65 }
66 
67 #include <implement_shim.inl>
68 
69 
70