RetroArch
win32_common.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef WIN32_COMMON_H__
18 #define WIN32_COMMON_H__
19 
20 #include <string.h>
21 
22 #ifndef _XBOX
23 #define WIN32_LEAN_AND_MEAN
24 #include <windows.h>
25 #if _WIN32_WINNT <= 0x0400
26 /* Windows versions below 98 do not support multiple monitors, so fake it */
27 #define COMPILE_MULTIMON_STUBS
28 #include <multimon.h>
29 #endif
30 
31 #endif
32 
33 #include <boolean.h>
34 #include <retro_common_api.h>
35 #include <retro_environment.h>
36 #include "../../driver.h"
37 #include "../video_driver.h"
38 
39 #ifndef _XBOX
40 #include "../../ui/drivers/ui_win32_resource.h"
41 #include "../../ui/drivers/ui_win32.h"
42 #endif
43 
45 
46 #if !defined(_XBOX)
47 extern unsigned g_win32_resize_width;
48 extern unsigned g_win32_resize_height;
49 extern bool g_win32_inited;
50 extern bool g_win32_restore_desktop;
52 
53 void win32_monitor_get_info(void);
54 
55 void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id);
56 
57 int win32_change_display_settings(const char *str, void *devmode_data,
58  unsigned flags);
59 
60 void create_graphics_context(HWND hwnd, bool *quit);
61 
62 void create_gdi_context(HWND hwnd, bool *quit);
63 
64 bool gdi_has_menu_frame(void);
65 
66 #if !defined(__WINRT__)
67 bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
68 
69 void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
70  unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
71  RECT *rect, RECT *mon_rect, DWORD *style);
72 #endif
73 #endif
74 
75 void win32_monitor_from_window(void);
76 
77 void win32_monitor_init(void);
78 
79 bool win32_set_video_mode(void *data,
80  unsigned width, unsigned height,
81  bool fullscreen);
82 
83 bool win32_window_create(void *data, unsigned style,
84  RECT *mon_rect, unsigned width,
85  unsigned height, bool fullscreen);
86 
87 bool win32_suppress_screensaver(void *data, bool enable);
88 
89 bool win32_get_metrics(void *data,
90  enum display_metric_types type, float *value);
91 
92 void win32_show_cursor(bool state);
93 
94 HWND win32_get_window(void);
95 
96 bool win32_has_focus(void);
97 
98 void win32_check_window(bool *quit,
99  bool *resize, unsigned *width, unsigned *height);
100 
101 void win32_set_window(unsigned *width, unsigned *height,
102  bool fullscreen, bool windowed_full, void *rect_data);
103 
104 bool win32_get_video_output(DEVMODE *dm, int mode, size_t len);
105 
107  unsigned *width, unsigned *height);
108 
110  unsigned *width, unsigned *height);
111 
113  unsigned *width, unsigned *height);
114 
115 void win32_window_reset(void);
116 
117 void win32_destroy_window(void);
118 
119 bool win32_taskbar_is_created(void);
120 
121 void win32_set_taskbar_created(bool created);
122 
123 float win32_get_refresh_rate(void *data);
124 
125 #if defined(HAVE_D3D8) || defined(HAVE_D3D9) || defined (HAVE_D3D10) || defined (HAVE_D3D11) || defined (HAVE_D3D12)
126 LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
127  WPARAM wparam, LPARAM lparam);
128 #endif
129 
130 #if defined(HAVE_OPENGL) || defined(HAVE_VULKAN)
131 LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
132  WPARAM wparam, LPARAM lparam);
133 #endif
134 
135 LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
136  WPARAM wparam, LPARAM lparam);
137 
138 #ifdef _XBOX
139 BOOL IsIconic(HWND hwnd);
140 #endif
141 
142 LRESULT win32_menu_loop(HWND owner, WPARAM wparam);
143 
144 bool win32_load_content_from_gui(const char *szFilename);
145 
147 
148 #endif
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
Definition: win32_common.c:1560
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name)
Definition: ui_win32.c:61
RETRO_BEGIN_DECLS unsigned g_win32_resize_width
Definition: win32_common.c:206
GLenum mode
Definition: glext.h:6857
LRESULT win32_menu_loop(HWND owner, WPARAM wparam)
Definition: ui_win32.c:136
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, RECT *rect, RECT *mon_rect, DWORD *style)
Definition: win32_common.c:1200
bool win32_taskbar_is_created(void)
Definition: win32_common.c:265
void win32_monitor_from_window(void)
Definition: win32_common.c:357
void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height)
Definition: win32_common.c:1108
bool win32_load_content_from_gui(const char *szFilename)
Definition: win32_common.c:434
GLenum GLsizei len
Definition: glext.h:7389
void win32_monitor_get_info(void)
Definition: win32_common.c:385
GLboolean enable
Definition: glext.h:12027
int win32_change_display_settings(const char *str, void *devmode_data, unsigned flags)
Definition: win32_common.c:372
void win32_get_video_output_next(unsigned *width, unsigned *height)
Definition: win32_common.c:1530
static const bool fullscreen
Definition: config.def.h:108
HWND win32_get_window(void)
Definition: win32_common.c:1399
display_metric_types
Definition: video_driver.h:105
Definition: ibxm.h:9
void create_gdi_context(HWND hwnd, bool *quit)
Definition: gdi_ctx.c:337
bool win32_has_focus(void)
Definition: win32_common.c:1381
bool win32_suppress_screensaver(void *data, bool enable)
Definition: win32_common.c:1131
bool win32_get_metrics(void *data, enum display_metric_types type, float *value)
Definition: win32_common.c:1031
void win32_set_window(unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, void *rect_data)
Definition: win32_common.c:1264
ui_window_win32_t main_window
Definition: win32_common.c:213
Definition: ui_win32.h:40
void win32_destroy_window(void)
Definition: win32_common.c:1414
GLenum type
Definition: glext.h:6233
bool win32_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
Definition: win32_common.c:1302
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:6233
void win32_get_video_output_size(unsigned *width, unsigned *height)
Definition: win32_common.c:1572
bool g_win32_restore_desktop
Definition: win32_common.c:195
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
unsigned int BOOL
Definition: gctypes.h:51
void win32_monitor_init(void)
Definition: win32_common.c:1065
void win32_show_cursor(bool state)
Definition: win32_common.c:1098
GLint GLint GLsizei width
Definition: glext.h:6293
LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: win32_common.c:867
Definition: glslang_tab.cpp:136
void win32_window_reset(void)
Definition: win32_common.c:1408
void create_graphics_context(HWND hwnd, bool *quit)
Definition: wgl_ctx.c:320
GLsizei const GLfloat * value
Definition: glext.h:6709
bool gdi_has_menu_frame(void)
Definition: gdi_gfx.c:638
unsigned g_win32_resize_height
Definition: win32_common.c:207
float win32_get_refresh_rate(void *data)
Definition: win32_common.c:1466
void win32_get_video_output_prev(unsigned *width, unsigned *height)
Definition: win32_common.c:1425
void win32_set_taskbar_created(bool created)
Definition: win32_common.c:270
GLbitfield flags
Definition: glext.h:7828
void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
Definition: win32_common.c:397
bool win32_window_create(void *data, unsigned style, RECT *mon_rect, unsigned width, unsigned height, bool fullscreen)
Definition: win32_common.c:965
const char *const str
Definition: portlistingparse.c:18
GLint GLint GLsizei GLsizei height
Definition: glext.h:6293
bool g_win32_inited
Definition: win32_common.c:198