2013-12-09 14:22:46 +01:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2019-08-29 16:36:09 -04:00
|
|
|
* Copyright (C) 2016-2019 - Brad Parker
|
2017-12-11 23:55:31 -08:00
|
|
|
*
|
2013-12-09 14:22:46 +01:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WIN32_COMMON_H__
|
|
|
|
#define WIN32_COMMON_H__
|
|
|
|
|
2015-04-09 05:19:29 +02:00
|
|
|
#include <string.h>
|
2015-11-11 17:41:20 +01:00
|
|
|
|
|
|
|
#ifndef _XBOX
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2017-09-03 23:39:25 -04:00
|
|
|
#if _WIN32_WINNT <= 0x0400
|
|
|
|
/* Windows versions below 98 do not support multiple monitors, so fake it */
|
|
|
|
#define COMPILE_MULTIMON_STUBS
|
|
|
|
#include <multimon.h>
|
|
|
|
#endif
|
|
|
|
|
2015-11-11 17:41:20 +01:00
|
|
|
#endif
|
|
|
|
|
2015-04-09 05:19:29 +02:00
|
|
|
#include <boolean.h>
|
2016-06-03 08:06:49 +02:00
|
|
|
#include <retro_common_api.h>
|
2017-12-30 13:35:47 +01:00
|
|
|
#include <retro_environment.h>
|
2015-04-09 05:19:29 +02:00
|
|
|
#include "../../driver.h"
|
2019-06-17 15:10:22 +02:00
|
|
|
#include "../../retroarch.h"
|
2015-04-09 05:19:29 +02:00
|
|
|
|
2018-05-14 03:57:27 +02:00
|
|
|
#ifndef _XBOX
|
2015-11-19 07:59:10 +01:00
|
|
|
#include "../../ui/drivers/ui_win32_resource.h"
|
2016-06-07 16:33:55 +02:00
|
|
|
#include "../../ui/drivers/ui_win32.h"
|
2017-08-09 13:39:14 +02:00
|
|
|
#endif
|
2013-12-09 14:22:46 +01:00
|
|
|
|
2017-12-30 13:35:47 +01:00
|
|
|
RETRO_BEGIN_DECLS
|
2017-08-09 13:39:14 +02:00
|
|
|
|
2018-05-12 19:03:39 +02:00
|
|
|
#if !defined(_XBOX)
|
|
|
|
extern unsigned g_win32_resize_width;
|
|
|
|
extern unsigned g_win32_resize_height;
|
2021-08-12 18:33:58 +03:00
|
|
|
extern float g_win32_refresh_rate;
|
2018-05-12 19:03:39 +02:00
|
|
|
extern bool g_win32_inited;
|
|
|
|
extern bool g_win32_restore_desktop;
|
2016-06-04 06:02:15 +02:00
|
|
|
extern ui_window_win32_t main_window;
|
2015-11-11 18:26:10 +01:00
|
|
|
|
2015-11-11 17:36:52 +01:00
|
|
|
void win32_monitor_get_info(void);
|
|
|
|
|
2015-11-11 17:47:56 +01:00
|
|
|
void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id);
|
2015-11-11 18:16:28 +01:00
|
|
|
|
2018-04-15 17:55:37 +02:00
|
|
|
int win32_change_display_settings(const char *str, void *devmode_data,
|
|
|
|
unsigned flags);
|
|
|
|
|
2020-08-28 01:29:23 +02:00
|
|
|
void create_wgl_context(HWND hwnd, bool *quit);
|
2017-01-12 15:03:27 -05:00
|
|
|
|
2020-07-17 02:31:12 +02:00
|
|
|
void create_vk_context(HWND hwnd, bool *quit);
|
|
|
|
|
2017-01-04 23:13:08 -05:00
|
|
|
void create_gdi_context(HWND hwnd, bool *quit);
|
2015-11-19 08:56:08 +01:00
|
|
|
|
2019-02-07 05:42:23 +01:00
|
|
|
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len);
|
|
|
|
|
2018-08-17 14:50:56 +02:00
|
|
|
#if !defined(__WINRT__)
|
2018-05-09 16:12:52 +02:00
|
|
|
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
|
|
|
|
|
|
|
|
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);
|
2013-12-09 14:22:46 +01:00
|
|
|
#endif
|
2018-08-17 14:50:56 +02:00
|
|
|
#endif
|
2013-12-09 14:22:46 +01:00
|
|
|
|
2016-06-04 05:54:33 +02:00
|
|
|
void win32_monitor_from_window(void);
|
2015-11-17 10:49:36 +01:00
|
|
|
|
2015-11-12 01:22:28 +01:00
|
|
|
void win32_monitor_init(void);
|
|
|
|
|
2015-11-12 05:16:06 +01:00
|
|
|
bool win32_set_video_mode(void *data,
|
|
|
|
unsigned width, unsigned height,
|
2015-11-12 05:17:21 +01:00
|
|
|
bool fullscreen);
|
2015-11-12 05:16:06 +01:00
|
|
|
|
2015-11-12 02:51:40 +01:00
|
|
|
bool win32_window_create(void *data, unsigned style,
|
|
|
|
RECT *mon_rect, unsigned width,
|
|
|
|
unsigned height, bool fullscreen);
|
|
|
|
|
2015-10-10 08:13:58 +02:00
|
|
|
bool win32_suppress_screensaver(void *data, bool enable);
|
|
|
|
|
2015-04-09 05:19:29 +02:00
|
|
|
bool win32_get_metrics(void *data,
|
2016-12-02 23:36:23 -05:00
|
|
|
enum display_metric_types type, float *value);
|
2015-04-09 05:19:29 +02:00
|
|
|
|
2020-01-04 15:40:02 +01:00
|
|
|
void win32_show_cursor(void *data, bool state);
|
2015-04-10 09:30:18 +02:00
|
|
|
|
2015-11-17 09:41:18 +01:00
|
|
|
HWND win32_get_window(void);
|
|
|
|
|
2021-09-04 20:13:24 +01:00
|
|
|
bool win32_get_client_rect(RECT* rect);
|
|
|
|
|
2021-08-20 23:16:01 +02:00
|
|
|
bool is_running_on_xbox(void);
|
|
|
|
|
2020-01-04 15:49:23 +01:00
|
|
|
bool win32_has_focus(void *data);
|
2015-11-17 08:58:49 +01:00
|
|
|
|
2021-02-02 00:52:03 +02:00
|
|
|
void win32_clip_window(bool grab);
|
|
|
|
|
2020-07-18 17:09:07 +02:00
|
|
|
void win32_check_window(void *data,
|
|
|
|
bool *quit,
|
2015-11-11 19:48:24 +01:00
|
|
|
bool *resize, unsigned *width, unsigned *height);
|
2015-04-10 09:36:03 +02:00
|
|
|
|
2016-01-09 04:59:12 +01:00
|
|
|
void win32_set_window(unsigned *width, unsigned *height,
|
2016-01-09 05:00:56 +01:00
|
|
|
bool fullscreen, bool windowed_full, void *rect_data);
|
2016-01-09 04:59:12 +01:00
|
|
|
|
2017-08-09 03:53:19 +02:00
|
|
|
void win32_get_video_output_size(
|
2021-09-07 20:25:22 +02:00
|
|
|
unsigned *width, unsigned *height, char *desc, size_t desc_len);
|
2017-08-09 03:53:19 +02:00
|
|
|
|
|
|
|
void win32_get_video_output_prev(
|
2017-08-09 03:44:03 +02:00
|
|
|
unsigned *width, unsigned *height);
|
|
|
|
|
2017-08-09 04:09:44 +02:00
|
|
|
void win32_get_video_output_next(
|
|
|
|
unsigned *width, unsigned *height);
|
|
|
|
|
2015-11-17 10:16:16 +01:00
|
|
|
void win32_window_reset(void);
|
|
|
|
|
2015-11-17 09:44:26 +01:00
|
|
|
void win32_destroy_window(void);
|
|
|
|
|
2018-01-01 02:08:09 -05:00
|
|
|
bool win32_taskbar_is_created(void);
|
|
|
|
|
2018-04-15 19:33:38 -05:00
|
|
|
float win32_get_refresh_rate(void *data);
|
|
|
|
|
2018-01-23 18:04:55 +01:00
|
|
|
#if defined(HAVE_D3D8) || defined(HAVE_D3D9) || defined (HAVE_D3D10) || defined (HAVE_D3D11) || defined (HAVE_D3D12)
|
2020-08-28 02:21:13 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_d3d_dinput(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2021-08-02 16:14:58 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_d3d_winraw(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2020-08-28 02:55:39 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_d3d_common(HWND hwnd, UINT message,
|
2015-11-28 21:50:28 +01:00
|
|
|
WPARAM wparam, LPARAM lparam);
|
2017-01-13 14:31:36 -05:00
|
|
|
#endif
|
2015-11-28 21:50:28 +01:00
|
|
|
|
2020-07-17 02:31:12 +02:00
|
|
|
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)
|
2020-08-28 02:21:13 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_wgl_dinput(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2021-08-02 16:14:58 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_wgl_winraw(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2020-08-28 02:55:39 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_wgl_common(HWND hwnd, UINT message,
|
2015-11-28 21:50:28 +01:00
|
|
|
WPARAM wparam, LPARAM lparam);
|
2017-01-13 14:31:36 -05:00
|
|
|
#endif
|
2015-11-28 21:50:28 +01:00
|
|
|
|
2020-07-17 02:31:12 +02:00
|
|
|
#if defined(HAVE_VULKAN)
|
2020-08-28 02:21:13 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_vk_dinput(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2021-08-02 16:14:58 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_vk_winraw(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2020-08-28 02:55:39 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_vk_common(HWND hwnd, UINT message,
|
2020-07-17 02:31:12 +02:00
|
|
|
WPARAM wparam, LPARAM lparam);
|
|
|
|
#endif
|
|
|
|
|
2020-08-28 02:21:13 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_gdi_dinput(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2021-08-02 16:14:58 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_gdi_winraw(HWND hwnd, UINT message,
|
|
|
|
WPARAM wparam, LPARAM lparam);
|
2020-08-28 02:55:39 +02:00
|
|
|
LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
|
2017-01-04 22:57:00 -05:00
|
|
|
WPARAM wparam, LPARAM lparam);
|
|
|
|
|
2015-11-17 10:49:36 +01:00
|
|
|
#ifdef _XBOX
|
|
|
|
BOOL IsIconic(HWND hwnd);
|
|
|
|
#endif
|
|
|
|
|
2018-05-09 20:17:04 -05:00
|
|
|
bool win32_load_content_from_gui(const char *szFilename);
|
|
|
|
|
2019-08-28 23:58:15 +02:00
|
|
|
void win32_setup_pixel_format(HDC hdc, bool supports_gl);
|
|
|
|
|
2020-08-29 03:41:33 +02:00
|
|
|
void win32_unset_input_userdata(void);
|
|
|
|
|
|
|
|
void win32_set_input_userdata(void *data);
|
|
|
|
|
2021-06-04 04:30:17 +03:00
|
|
|
void win32_update_title(void);
|
|
|
|
|
2017-12-30 13:35:47 +01:00
|
|
|
RETRO_END_DECLS
|
2017-08-09 13:39:14 +02:00
|
|
|
|
2013-12-09 14:22:46 +01:00
|
|
|
#endif
|