Some early WinRT commits

This commit is contained in:
twinaphex 2018-05-09 16:12:52 +02:00
parent 53140172ab
commit 46f7742afc
7 changed files with 54 additions and 28 deletions

View File

@ -18,9 +18,13 @@
#ifndef __GDI_COMMON_H
#define __GDI_COMMON_H
#include <retro_environment.h>
typedef struct gdi
{
#ifndef __WINRT__
WNDCLASSEX wndclass;
#endif
HDC winDC;
HDC memDC;
HBITMAP bmp;

View File

@ -47,7 +47,7 @@
#include "../../tasks/tasks_internal.h"
#include "../../core_info.h"
#if !defined(_XBOX)
#if !defined(_XBOX) && !defined(__WINRT__)
#include <commdlg.h>
#include <dbt.h>
@ -1020,7 +1020,7 @@ bool win32_window_create(void *data, unsigned style,
bool win32_get_metrics(void *data,
enum display_metric_types type, float *value)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
HDC monitor = GetDC(NULL);
int pixels_x = GetDeviceCaps(monitor, HORZRES);
int pixels_y = GetDeviceCaps(monitor, VERTRES);
@ -1053,7 +1053,7 @@ bool win32_get_metrics(void *data,
void win32_monitor_init(void)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
win32_monitor_count = 0;
EnumDisplayMonitors(NULL, NULL,
win32_monitor_enum_proc, 0);
@ -1066,7 +1066,7 @@ static bool win32_monitor_set_fullscreen(
unsigned width, unsigned height,
unsigned refresh, char *dev_name)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
DEVMODE devmode;
memset(&devmode, 0, sizeof(devmode));
@ -1087,7 +1087,7 @@ static bool win32_monitor_set_fullscreen(
void win32_show_cursor(bool state)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
if (state)
while (ShowCursor(TRUE) < 0);
else
@ -1098,7 +1098,7 @@ void win32_show_cursor(bool state)
void win32_check_window(bool *quit, bool *resize,
unsigned *width, unsigned *height)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
const ui_application_t *application =
ui_companion_driver_get_application_ptr();
if (application)
@ -1117,7 +1117,7 @@ void win32_check_window(bool *quit, bool *resize,
bool win32_suppress_screensaver(void *data, bool enable)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
if (enable)
{
char tmp[PATH_MAX_LENGTH];
@ -1188,7 +1188,7 @@ 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)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
if (fullscreen)
{
settings_t *settings = config_get_ptr();
@ -1235,7 +1235,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
RECT *rect = (RECT*)rect_data;
if (!fullscreen || windowed_full)
@ -1274,7 +1274,7 @@ bool win32_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
DWORD style;
MSG msg;
RECT mon_rect;

View File

@ -45,7 +45,7 @@
RETRO_BEGIN_DECLS
#ifndef _XBOX
#if !defined(_XBOX) && !defined(__WINRT__)
extern unsigned g_resize_width;
extern unsigned g_resize_height;
extern bool g_inited;
@ -66,6 +66,12 @@ void create_gdi_context(HWND hwnd, bool *quit);
bool gdi_has_menu_frame(void);
void shader_dlg_params_reload(void);
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);
#endif
void win32_monitor_from_window(void);
@ -76,14 +82,6 @@ bool win32_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen);
#ifndef _XBOX
RETRO_BEGIN_DECLS
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
RETRO_END_DECLS
#endif
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,
unsigned height, bool fullscreen);
@ -105,12 +103,6 @@ void win32_check_window(bool *quit,
void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data);
#ifndef _XBOX
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);
#endif
void win32_get_video_output_size(
unsigned *width, unsigned *height);

View File

@ -470,7 +470,7 @@ static void cpulist_read_from(CpuList* list, const char* filename)
**/
unsigned cpu_features_get_core_amount(void)
{
#if defined(_WIN32) && !defined(_XBOX)
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
/* Win32 */
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);

View File

@ -73,6 +73,34 @@ printf("This is C++, version %d.\n", __cplusplus);
/* This is not standard C. __STDC__ is not defined. */
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
#if defined(_MSC_VER) && defined(__has_include)
#if __has_include(<winapifamily.h>)
#define HAVE_WINAPIFAMILY_H 1
#else
#define HAVE_WINAPIFAMILY_H 0
#endif
/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
#define HAVE_WINAPIFAMILY_H 1
#else
#define HAVE_WINAPIFAMILY_H 0
#endif
#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
#else
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */
#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
#endif
#endif
#endif

View File

@ -91,6 +91,8 @@ static INLINE void retro_sleep(unsigned msec)
sceKernelDelayThread(1000 * msec);
#elif defined(_3DS)
svcSleepThread(1000000 * (s64)msec);
#elif defined(__WINRT__)
/* TODO/FIXME */
#elif defined(_WIN32)
Sleep(msec);
#elif defined(XENON)

View File

@ -35,10 +35,10 @@
#endif
#include <boolean.h>
#include <retro_environment.h>
#include <streams/stdin_stream.h>
#if (defined(_WIN32) && defined(_XBOX)) || defined(__CELLOS_LV2__)
#if (defined(_WIN32) && defined(_XBOX)) || defined(__CELLOS_LV2__) || defined(__WINRT__)
size_t read_stdin(char *buf, size_t size)
{
/* Not implemented. */