(GDI) Merge gdi_ctx.c into gdi_gfx.c
This commit is contained in:
parent
ba5d735e2c
commit
f56b6a3a0f
|
@ -2040,7 +2040,6 @@ ifneq ($(findstring Win32,$(OS)),)
|
||||||
|
|
||||||
ifeq ($(HAVE_GDI), 1)
|
ifeq ($(HAVE_GDI), 1)
|
||||||
OBJ += gfx/drivers/gdi_gfx.o \
|
OBJ += gfx/drivers/gdi_gfx.o \
|
||||||
gfx/drivers_context/gdi_ctx.o \
|
|
||||||
gfx/drivers_font/gdi_font.o \
|
gfx/drivers_font/gdi_font.o \
|
||||||
gfx/drivers_display/gfx_display_gdi.o
|
gfx/drivers_display/gfx_display_gdi.o
|
||||||
LIBS += -lmsimg32
|
LIBS += -lmsimg32
|
||||||
|
|
|
@ -34,8 +34,6 @@ typedef struct gdi
|
||||||
unsigned video_height;
|
unsigned video_height;
|
||||||
unsigned screen_width;
|
unsigned screen_width;
|
||||||
unsigned screen_height;
|
unsigned screen_height;
|
||||||
void *ctx_data;
|
|
||||||
const gfx_ctx_driver_t *ctx_driver;
|
|
||||||
|
|
||||||
unsigned menu_width;
|
unsigned menu_width;
|
||||||
unsigned menu_height;
|
unsigned menu_height;
|
||||||
|
|
|
@ -39,6 +39,140 @@
|
||||||
#include "../common/win32_common.h"
|
#include "../common/win32_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static HDC win32_gdi_hdc;
|
||||||
|
static void *dinput_gdi;
|
||||||
|
|
||||||
|
static void gfx_ctx_gdi_update_title(void)
|
||||||
|
{
|
||||||
|
char title[128];
|
||||||
|
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||||
|
|
||||||
|
title[0] = '\0';
|
||||||
|
|
||||||
|
video_driver_get_window_title(title, sizeof(title));
|
||||||
|
|
||||||
|
if (window && title[0])
|
||||||
|
window->set_title(&main_window, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_gdi_get_video_size(
|
||||||
|
unsigned *width, unsigned *height)
|
||||||
|
{
|
||||||
|
HWND window = win32_get_window();
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
*width = g_win32_resize_width;
|
||||||
|
*height = g_win32_resize_height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RECT mon_rect;
|
||||||
|
MONITORINFOEX current_mon;
|
||||||
|
unsigned mon_id = 0;
|
||||||
|
HMONITOR hm_to_use = NULL;
|
||||||
|
|
||||||
|
win32_monitor_info(¤t_mon, &hm_to_use, &mon_id);
|
||||||
|
mon_rect = current_mon.rcMonitor;
|
||||||
|
*width = mon_rect.right - mon_rect.left;
|
||||||
|
*height = mon_rect.bottom - mon_rect.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_gdi_init(void)
|
||||||
|
{
|
||||||
|
WNDCLASSEX wndclass = {0};
|
||||||
|
|
||||||
|
if (g_win32_inited)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
win32_window_reset();
|
||||||
|
win32_monitor_init();
|
||||||
|
|
||||||
|
wndclass.lpfnWndProc = WndProcGDI;
|
||||||
|
if (!win32_window_init(&wndclass, true, NULL))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_gdi_destroy(void)
|
||||||
|
{
|
||||||
|
HWND window = win32_get_window();
|
||||||
|
|
||||||
|
if (window && win32_gdi_hdc)
|
||||||
|
{
|
||||||
|
ReleaseDC(window, win32_gdi_hdc);
|
||||||
|
win32_gdi_hdc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
win32_monitor_from_window();
|
||||||
|
win32_destroy_window();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_win32_restore_desktop)
|
||||||
|
{
|
||||||
|
win32_monitor_get_info();
|
||||||
|
g_win32_restore_desktop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_win32_inited = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_gdi_set_video_mode(
|
||||||
|
unsigned width, unsigned height,
|
||||||
|
bool fullscreen)
|
||||||
|
{
|
||||||
|
if (!win32_set_video_mode(NULL, width, height, fullscreen))
|
||||||
|
{
|
||||||
|
gfx_ctx_gdi_destroy();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_gdi_input_driver(
|
||||||
|
input_driver_t **input, void **input_data)
|
||||||
|
{
|
||||||
|
#if _WIN32_WINNT >= 0x0501
|
||||||
|
#ifdef HAVE_WINRAWINPUT
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
/* winraw only available since XP */
|
||||||
|
if (string_is_equal(settings->arrays.input_driver, "raw"))
|
||||||
|
{
|
||||||
|
*input_data = input_winraw.init(settings->arrays.input_driver);
|
||||||
|
if (*input_data)
|
||||||
|
{
|
||||||
|
*input = &input_winraw;
|
||||||
|
dinput_gdi = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DINPUT
|
||||||
|
dinput_gdi = input_dinput.init(settings->arrays.input_driver);
|
||||||
|
*input = dinput_gdi ? &input_dinput : NULL;
|
||||||
|
#else
|
||||||
|
dinput_gdi = NULL;
|
||||||
|
*input = NULL;
|
||||||
|
#endif
|
||||||
|
*input_data = dinput_gdi;
|
||||||
|
}
|
||||||
|
|
||||||
|
void create_gdi_context(HWND hwnd, bool *quit)
|
||||||
|
{
|
||||||
|
win32_gdi_hdc = GetDC(hwnd);
|
||||||
|
|
||||||
|
win32_setup_pixel_format(win32_gdi_hdc, false);
|
||||||
|
|
||||||
|
g_win32_inited = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void gdi_gfx_create(gdi_t *gdi)
|
static void gdi_gfx_create(gdi_t *gdi)
|
||||||
{
|
{
|
||||||
char os[64] = {0};
|
char os[64] = {0};
|
||||||
|
@ -65,11 +199,10 @@ static void *gdi_gfx_init(const video_info_t *video,
|
||||||
input_driver_t **input, void **input_data)
|
input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
unsigned full_x, full_y;
|
unsigned full_x, full_y;
|
||||||
gfx_ctx_input_t inp;
|
|
||||||
gfx_ctx_mode_t mode;
|
|
||||||
void *ctx_data = NULL;
|
void *ctx_data = NULL;
|
||||||
const gfx_ctx_driver_t *ctx_driver = NULL;
|
const gfx_ctx_driver_t *ctx_driver = NULL;
|
||||||
unsigned win_width = 0, win_height = 0;
|
unsigned mode_width = 0, mode_height = 0;
|
||||||
|
unsigned win_width = 0, win_height = 0;
|
||||||
unsigned temp_width = 0, temp_height = 0;
|
unsigned temp_width = 0, temp_height = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_font_enable = settings->bools.video_font_enable;
|
bool video_font_enable = settings->bools.video_font_enable;
|
||||||
|
@ -93,28 +226,15 @@ static void *gdi_gfx_init(const video_info_t *video,
|
||||||
gdi->video_pitch = video->width * 2;
|
gdi->video_pitch = video->width * 2;
|
||||||
|
|
||||||
gdi_gfx_create(gdi);
|
gdi_gfx_create(gdi);
|
||||||
|
if (!gfx_ctx_gdi_init())
|
||||||
ctx_driver = video_context_driver_init_first(gdi,
|
|
||||||
settings->arrays.video_context_driver,
|
|
||||||
GFX_CTX_GDI_API, 1, 0, false, &ctx_data);
|
|
||||||
if (!ctx_driver)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (ctx_data)
|
gfx_ctx_gdi_get_video_size(&mode_width, &mode_height);
|
||||||
gdi->ctx_data = ctx_data;
|
|
||||||
|
|
||||||
gdi->ctx_driver = ctx_driver;
|
full_x = mode_width;
|
||||||
|
full_y = mode_height;
|
||||||
video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver);
|
mode_width = 0;
|
||||||
|
mode_height = 0;
|
||||||
RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident);
|
|
||||||
|
|
||||||
video_context_driver_get_video_size(&mode);
|
|
||||||
|
|
||||||
full_x = mode.width;
|
|
||||||
full_y = mode.height;
|
|
||||||
mode.width = 0;
|
|
||||||
mode.height = 0;
|
|
||||||
|
|
||||||
RARCH_LOG("[GDI]: Detecting screen resolution %ux%u.\n", full_x, full_y);
|
RARCH_LOG("[GDI]: Detecting screen resolution %ux%u.\n", full_x, full_y);
|
||||||
|
|
||||||
|
@ -127,22 +247,22 @@ static void *gdi_gfx_init(const video_info_t *video,
|
||||||
win_height = full_y;
|
win_height = full_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode.width = win_width;
|
mode_width = win_width;
|
||||||
mode.height = win_height;
|
mode_height = win_height;
|
||||||
mode.fullscreen = video->fullscreen;
|
|
||||||
|
|
||||||
if (!video_context_driver_set_video_mode(&mode))
|
if (!gfx_ctx_gdi_set_video_mode(mode_width,
|
||||||
|
mode_height, video->fullscreen))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mode.width = 0;
|
mode_width = 0;
|
||||||
mode.height = 0;
|
mode_height = 0;
|
||||||
|
|
||||||
video_context_driver_get_video_size(&mode);
|
gfx_ctx_gdi_get_video_size(&mode_width, &mode_height);
|
||||||
|
|
||||||
temp_width = mode.width;
|
temp_width = mode_width;
|
||||||
temp_height = mode.height;
|
temp_height = mode_height;
|
||||||
mode.width = 0;
|
mode_width = 0;
|
||||||
mode.height = 0;
|
mode_height = 0;
|
||||||
|
|
||||||
/* Get real known video size, which might have been altered by context. */
|
/* Get real known video size, which might have been altered by context. */
|
||||||
|
|
||||||
|
@ -153,10 +273,7 @@ static void *gdi_gfx_init(const video_info_t *video,
|
||||||
|
|
||||||
RARCH_LOG("[GDI]: Using resolution %ux%u\n", temp_width, temp_height);
|
RARCH_LOG("[GDI]: Using resolution %ux%u\n", temp_width, temp_height);
|
||||||
|
|
||||||
inp.input = input;
|
gfx_ctx_gdi_input_driver(input, input_data);
|
||||||
inp.input_data = input_data;
|
|
||||||
|
|
||||||
video_context_driver_input_driver(&inp);
|
|
||||||
|
|
||||||
if (video_font_enable)
|
if (video_font_enable)
|
||||||
font_driver_init_osd(gdi,
|
font_driver_init_osd(gdi,
|
||||||
|
@ -170,7 +287,7 @@ static void *gdi_gfx_init(const video_info_t *video,
|
||||||
return gdi;
|
return gdi;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
video_context_driver_destroy();
|
gfx_ctx_gdi_destroy();
|
||||||
if (gdi)
|
if (gdi)
|
||||||
free(gdi);
|
free(gdi);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -181,7 +298,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
BITMAPINFO *info;
|
BITMAPINFO *info;
|
||||||
gfx_ctx_mode_t mode;
|
unsigned mode_width = 0;
|
||||||
|
unsigned mode_height = 0;
|
||||||
const void *frame_to_copy = frame;
|
const void *frame_to_copy = frame;
|
||||||
unsigned width = 0;
|
unsigned width = 0;
|
||||||
unsigned height = 0;
|
unsigned height = 0;
|
||||||
|
@ -276,10 +394,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
video_context_driver_get_video_size(&mode);
|
gfx_ctx_gdi_get_video_size(&mode_width, &mode_height);
|
||||||
|
|
||||||
gdi->screen_width = mode.width;
|
gdi->screen_width = mode_width;
|
||||||
gdi->screen_height = mode.height;
|
gdi->screen_height = mode_height;
|
||||||
|
|
||||||
info = (BITMAPINFO*)
|
info = (BITMAPINFO*)
|
||||||
calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
|
calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
|
||||||
|
@ -350,9 +468,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, false);
|
InvalidateRect(hwnd, NULL, false);
|
||||||
|
|
||||||
if (gdi->ctx_driver->update_window_title)
|
gfx_ctx_gdi_update_title();
|
||||||
gdi->ctx_driver->update_window_title(
|
|
||||||
gdi->ctx_data);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -368,12 +484,11 @@ static bool gdi_gfx_alive(void *data)
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
bool resize = false;
|
bool resize = false;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
gdi_t *gdi = (gdi_t*)data;
|
|
||||||
|
|
||||||
/* Needed because some context drivers don't track their sizes */
|
/* Needed because some context drivers don't track their sizes */
|
||||||
video_driver_get_size(&temp_width, &temp_height);
|
video_driver_get_size(&temp_width, &temp_height);
|
||||||
|
|
||||||
gdi->ctx_driver->check_window(gdi->ctx_data,
|
win32_check_window(
|
||||||
&quit, &resize, &temp_width, &temp_height);
|
&quit, &resize, &temp_width, &temp_height);
|
||||||
|
|
||||||
ret = !quit;
|
ret = !quit;
|
||||||
|
@ -440,7 +555,7 @@ static void gdi_gfx_free(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
font_driver_free_osd();
|
font_driver_free_osd();
|
||||||
video_context_driver_free();
|
gfx_ctx_gdi_destroy();
|
||||||
free(gdi);
|
free(gdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,13 +610,7 @@ static void gdi_set_texture_frame(void *data,
|
||||||
static void gdi_set_video_mode(void *data, unsigned width, unsigned height,
|
static void gdi_set_video_mode(void *data, unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
gfx_ctx_mode_t mode;
|
gfx_ctx_gdi_set_video_mode(width, height, fullscreen);
|
||||||
|
|
||||||
mode.width = width;
|
|
||||||
mode.height = height;
|
|
||||||
mode.fullscreen = fullscreen;
|
|
||||||
|
|
||||||
video_context_driver_set_video_mode(&mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uintptr_t gdi_load_texture(void *video_data, void *data,
|
static uintptr_t gdi_load_texture(void *video_data, void *data,
|
||||||
|
|
|
@ -1,263 +0,0 @@
|
||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
||||||
* Copyright (C) 2016-2019 - Brad Parker
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Win32/GDI context. */
|
|
||||||
|
|
||||||
/* necessary for mingw32 multimon defines: */
|
|
||||||
#ifndef _WIN32_WINNT
|
|
||||||
#define _WIN32_WINNT 0x0500 /*_WIN32_WINNT_WIN2K */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <commdlg.h>
|
|
||||||
|
|
||||||
#include <string/stdstring.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "../../config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../../dynamic.h"
|
|
||||||
#include "../../configuration.h"
|
|
||||||
#include "../../retroarch.h"
|
|
||||||
#include "../../verbosity.h"
|
|
||||||
#include "../../frontend/frontend_driver.h"
|
|
||||||
|
|
||||||
#include "../common/win32_common.h"
|
|
||||||
|
|
||||||
static HDC win32_gdi_hdc;
|
|
||||||
|
|
||||||
static unsigned win32_gdi_major = 0;
|
|
||||||
static unsigned win32_gdi_minor = 0;
|
|
||||||
static int win32_gdi_interval = 0;
|
|
||||||
static enum gfx_ctx_api win32_gdi_api = GFX_CTX_NONE;
|
|
||||||
|
|
||||||
typedef struct gfx_ctx_gdi_data
|
|
||||||
{
|
|
||||||
void *empty;
|
|
||||||
} gfx_ctx_gdi_data_t;
|
|
||||||
|
|
||||||
static void *dinput_gdi;
|
|
||||||
|
|
||||||
static void gfx_ctx_gdi_update_title(void *data)
|
|
||||||
{
|
|
||||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
|
||||||
char title[128];
|
|
||||||
|
|
||||||
title[0] = '\0';
|
|
||||||
|
|
||||||
video_driver_get_window_title(title, sizeof(title));
|
|
||||||
|
|
||||||
if (window && title[0])
|
|
||||||
window->set_title(&main_window, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_gdi_get_video_size(void *data,
|
|
||||||
unsigned *width, unsigned *height)
|
|
||||||
{
|
|
||||||
HWND window = win32_get_window();
|
|
||||||
|
|
||||||
(void)data;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
RECT mon_rect;
|
|
||||||
MONITORINFOEX current_mon;
|
|
||||||
unsigned mon_id = 0;
|
|
||||||
HMONITOR hm_to_use = NULL;
|
|
||||||
|
|
||||||
win32_monitor_info(¤t_mon, &hm_to_use, &mon_id);
|
|
||||||
mon_rect = current_mon.rcMonitor;
|
|
||||||
*width = mon_rect.right - mon_rect.left;
|
|
||||||
*height = mon_rect.bottom - mon_rect.top;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*width = g_win32_resize_width;
|
|
||||||
*height = g_win32_resize_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *gfx_ctx_gdi_init(void *video_driver)
|
|
||||||
{
|
|
||||||
WNDCLASSEX wndclass = {0};
|
|
||||||
gfx_ctx_gdi_data_t *gdi = (gfx_ctx_gdi_data_t*)calloc(1, sizeof(*gdi));
|
|
||||||
|
|
||||||
if (!gdi)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (g_win32_inited)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
win32_window_reset();
|
|
||||||
win32_monitor_init();
|
|
||||||
|
|
||||||
wndclass.lpfnWndProc = WndProcGDI;
|
|
||||||
if (!win32_window_init(&wndclass, true, NULL))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
return gdi;
|
|
||||||
|
|
||||||
error:
|
|
||||||
if (gdi)
|
|
||||||
free(gdi);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_gdi_destroy(void *data)
|
|
||||||
{
|
|
||||||
gfx_ctx_gdi_data_t *gdi = (gfx_ctx_gdi_data_t*)data;
|
|
||||||
HWND window = win32_get_window();
|
|
||||||
|
|
||||||
if (window && win32_gdi_hdc)
|
|
||||||
{
|
|
||||||
ReleaseDC(window, win32_gdi_hdc);
|
|
||||||
win32_gdi_hdc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window)
|
|
||||||
{
|
|
||||||
win32_monitor_from_window();
|
|
||||||
win32_destroy_window();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_win32_restore_desktop)
|
|
||||||
{
|
|
||||||
win32_monitor_get_info();
|
|
||||||
g_win32_restore_desktop = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gdi)
|
|
||||||
free(gdi);
|
|
||||||
|
|
||||||
g_win32_inited = false;
|
|
||||||
win32_gdi_major = 0;
|
|
||||||
win32_gdi_minor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool gfx_ctx_gdi_set_video_mode(void *data,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
bool fullscreen)
|
|
||||||
{
|
|
||||||
if (!win32_set_video_mode(NULL, width, height, fullscreen))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[GDI]: win32_set_video_mode failed.\n");
|
|
||||||
gfx_ctx_gdi_destroy(data);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_gdi_input_driver(void *data,
|
|
||||||
const char *joypad_name,
|
|
||||||
input_driver_t **input, void **input_data)
|
|
||||||
{
|
|
||||||
#if _WIN32_WINNT >= 0x0501
|
|
||||||
#ifdef HAVE_WINRAWINPUT
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
/* winraw only available since XP */
|
|
||||||
if (string_is_equal(settings->arrays.input_driver, "raw"))
|
|
||||||
{
|
|
||||||
*input_data = input_winraw.init(joypad_name);
|
|
||||||
if (*input_data)
|
|
||||||
{
|
|
||||||
*input = &input_winraw;
|
|
||||||
dinput_gdi = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_DINPUT
|
|
||||||
dinput_gdi = input_dinput.init(joypad_name);
|
|
||||||
*input = dinput_gdi ? &input_dinput : NULL;
|
|
||||||
#else
|
|
||||||
dinput_gdi = NULL;
|
|
||||||
*input = NULL;
|
|
||||||
#endif
|
|
||||||
*input_data = dinput_gdi;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool gfx_ctx_gdi_bind_api(void *data,
|
|
||||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
|
|
||||||
win32_gdi_major = major;
|
|
||||||
win32_gdi_minor = minor;
|
|
||||||
win32_gdi_api = api;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_gdi_check_window(void *data, bool *quit,
|
|
||||||
bool *resize, unsigned *width, unsigned *height) { win32_check_window(quit, resize, width, height); }
|
|
||||||
static bool gfx_ctx_gdi_set_resize(void *data, unsigned width, unsigned height) { return false; }
|
|
||||||
static enum gfx_ctx_api gfx_ctx_gdi_get_api(void *data) { return win32_gdi_api; }
|
|
||||||
static void gfx_ctx_gdi_swap_interval(void *data, int interval) { }
|
|
||||||
static void gfx_ctx_gdi_set_flags(void *data, uint32_t flags) { }
|
|
||||||
static uint32_t gfx_ctx_gdi_get_flags(void *data) { return 0; }
|
|
||||||
static void gfx_ctx_gdi_swap_buffers(void *data) { SwapBuffers(win32_gdi_hdc); }
|
|
||||||
|
|
||||||
void create_gdi_context(HWND hwnd, bool *quit)
|
|
||||||
{
|
|
||||||
win32_gdi_hdc = GetDC(hwnd);
|
|
||||||
|
|
||||||
win32_setup_pixel_format(win32_gdi_hdc, false);
|
|
||||||
|
|
||||||
g_win32_inited = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gfx_ctx_driver_t gfx_ctx_gdi = {
|
|
||||||
gfx_ctx_gdi_init,
|
|
||||||
gfx_ctx_gdi_destroy,
|
|
||||||
gfx_ctx_gdi_get_api,
|
|
||||||
gfx_ctx_gdi_bind_api,
|
|
||||||
gfx_ctx_gdi_swap_interval,
|
|
||||||
gfx_ctx_gdi_set_video_mode,
|
|
||||||
gfx_ctx_gdi_get_video_size,
|
|
||||||
NULL, /* get_refresh_rate */
|
|
||||||
NULL, /* get_video_output_size */
|
|
||||||
NULL, /* get_video_output_prev */
|
|
||||||
NULL, /* get_video_output_next */
|
|
||||||
win32_get_metrics,
|
|
||||||
NULL,
|
|
||||||
gfx_ctx_gdi_update_title,
|
|
||||||
gfx_ctx_gdi_check_window,
|
|
||||||
gfx_ctx_gdi_set_resize,
|
|
||||||
win32_has_focus,
|
|
||||||
win32_suppress_screensaver,
|
|
||||||
true, /* has_windowed */
|
|
||||||
gfx_ctx_gdi_swap_buffers,
|
|
||||||
gfx_ctx_gdi_input_driver,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
win32_show_cursor,
|
|
||||||
"gdi",
|
|
||||||
gfx_ctx_gdi_get_flags,
|
|
||||||
gfx_ctx_gdi_set_flags,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
|
@ -231,12 +231,6 @@ VIDEO CONTEXT
|
||||||
#include "../gfx/drivers_context/wgl_ctx.c"
|
#include "../gfx/drivers_context/wgl_ctx.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
|
||||||
#ifdef HAVE_GDI
|
|
||||||
#include "../gfx/drivers_context/gdi_ctx.c"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../gfx/display_servers/dispserv_win32.c"
|
#include "../gfx/display_servers/dispserv_win32.c"
|
||||||
|
|
||||||
#if defined(HAVE_FFMPEG)
|
#if defined(HAVE_FFMPEG)
|
||||||
|
|
|
@ -642,11 +642,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
||||||
#if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY)
|
#if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY)
|
||||||
&gfx_ctx_khr_display,
|
&gfx_ctx_khr_display,
|
||||||
#endif
|
#endif
|
||||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
|
||||||
#ifdef HAVE_GDI
|
|
||||||
&gfx_ctx_gdi,
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETWORK_VIDEO
|
#ifdef HAVE_NETWORK_VIDEO
|
||||||
&gfx_ctx_network,
|
&gfx_ctx_network,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue