remove explicit unicode def/undefs

This commit is contained in:
Brad Parker 2016-12-02 12:46:32 -05:00
parent 44b95a1602
commit d891f1c90b
8 changed files with 71 additions and 70 deletions

View File

@ -1,6 +1,6 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2011-2016 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * 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- * 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. * ation, either version 3 of the License, or (at your option) any later version.
@ -76,7 +76,7 @@ ui_window_win32_t main_window;
/* Power Request APIs */ /* Power Request APIs */
#if !defined(_XBOX) && (_MSC_VER == 1310) #if !defined(_XBOX) && (_MSC_VER == 1310)
typedef struct _REASON_CONTEXT typedef struct _REASON_CONTEXT
{ {
ULONG Version; ULONG Version;
DWORD Flags; DWORD Flags;
@ -129,7 +129,7 @@ extern "C"
} }
}; };
INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message, INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
size_t list_size; size_t list_size;
@ -148,16 +148,16 @@ INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
core_info_list_get_supported_cores(core_info_list, core_info_list_get_supported_cores(core_info_list,
path_get(RARCH_PATH_CONTENT), &core_info, &list_size); path_get(RARCH_PATH_CONTENT), &core_info, &list_size);
hwndList = GetDlgItem(hDlg, ID_CORELISTBOX); hwndList = GetDlgItem(hDlg, ID_CORELISTBOX);
for (i = 0; i < list_size; i++) for (i = 0; i < list_size; i++)
{ {
const core_info_t *info = (const core_info_t*)&core_info[i]; const core_info_t *info = (const core_info_t*)&core_info[i];
SendMessage(hwndList, LB_ADDSTRING, 0, SendMessage(hwndList, LB_ADDSTRING, 0,
(LPARAM)info->display_name); (LPARAM)info->display_name);
} }
SetFocus(hwndList); SetFocus(hwndList);
return TRUE; return TRUE;
} }
case WM_COMMAND: case WM_COMMAND:
@ -168,20 +168,20 @@ INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
EndDialog(hDlg, LOWORD(wParam)); EndDialog(hDlg, LOWORD(wParam));
break; break;
case ID_CORELISTBOX: case ID_CORELISTBOX:
switch (HIWORD(wParam)) switch (HIWORD(wParam))
{ {
case LBN_SELCHANGE: case LBN_SELCHANGE:
{ {
int lbItem; int lbItem;
const core_info_t *info = NULL; const core_info_t *info = NULL;
HWND hwndList = GetDlgItem(hDlg, ID_CORELISTBOX); HWND hwndList = GetDlgItem(hDlg, ID_CORELISTBOX);
lbItem = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0); lbItem = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0);
core_info_get_list(&core_info_list); core_info_get_list(&core_info_list);
core_info_list_get_supported_cores(core_info_list, core_info_list_get_supported_cores(core_info_list,
path_get(RARCH_PATH_CONTENT), &core_info, &list_size); path_get(RARCH_PATH_CONTENT), &core_info, &list_size);
info = (const core_info_t*)&core_info[lbItem]; info = (const core_info_t*)&core_info[lbItem];
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH,info->path); runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH,info->path);
} }
break; break;
} }
return TRUE; return TRUE;
@ -336,7 +336,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
{ {
/* Pick one core that could be compatible, ew */ /* Pick one core that could be compatible, ew */
if(DialogBoxParamW(GetModuleHandleW(NULL),MAKEINTRESOURCE(IDD_PICKCORE), if(DialogBoxParamW(GetModuleHandleW(NULL),MAKEINTRESOURCE(IDD_PICKCORE),
hwnd,PickCoreProc,(LPARAM)NULL)==IDOK) hwnd,PickCoreProc,(LPARAM)NULL)==IDOK)
{ {
task_push_content_load_default( task_push_content_load_default(
NULL, NULL, NULL, NULL,
@ -408,7 +408,7 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
} }
*quit = true; *quit = true;
break; break;
case WM_COMMAND: case WM_COMMAND:
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (settings->ui.menubar_enable) if (settings->ui.menubar_enable)
@ -453,7 +453,7 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam; LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam;
curD3D = p_cs->lpCreateParams; curD3D = p_cs->lpCreateParams;
g_inited = true; g_inited = true;
win32_window.hwnd = hwnd; win32_window.hwnd = hwnd;
ui_window_win32_set_droppable(&win32_window, true); ui_window_win32_set_droppable(&win32_window, true);
@ -533,7 +533,7 @@ bool win32_window_create(void *data, unsigned style,
#endif #endif
bool win32_get_metrics(void *data, bool win32_get_metrics(void *data,
enum display_metric_types type, float *value) enum display_metric_types type, float *value)
{ {
#ifdef _XBOX #ifdef _XBOX
return false; return false;
@ -616,7 +616,7 @@ void win32_check_window(bool *quit, bool *resize,
unsigned *width, unsigned *height) unsigned *width, unsigned *height)
{ {
#ifndef _XBOX #ifndef _XBOX
const ui_application_t *application = const ui_application_t *application =
ui_companion_driver_get_application_ptr(); ui_companion_driver_get_application_ptr();
if (application) if (application)
application->process_events(); application->process_events();
@ -696,12 +696,12 @@ void win32_set_style(MONITORINFOEXW *current_mon, HMONITOR *hm_to_use,
#ifndef _XBOX #ifndef _XBOX
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
/* Windows only reports the refresh rates for modelines as /* Windows only reports the refresh rates for modelines as
* an integer, so video.refresh_rate needs to be rounded. Also, account * an integer, so video.refresh_rate needs to be rounded. Also, account
* for black frame insertion using video.refresh_rate set to half * for black frame insertion using video.refresh_rate set to half
* of the display refresh rate, as well as higher vsync swap intervals. */ * of the display refresh rate, as well as higher vsync swap intervals. */
float refresh_mod = settings->video.black_frame_insertion ? 2.0f : 1.0f; float refresh_mod = settings->video.black_frame_insertion ? 2.0f : 1.0f;
unsigned refresh = roundf(settings->video.refresh_rate unsigned refresh = roundf(settings->video.refresh_rate
* refresh_mod * settings->video.swap_interval); * refresh_mod * settings->video.swap_interval);
if (fullscreen) if (fullscreen)
@ -714,14 +714,14 @@ void win32_set_style(MONITORINFOEXW *current_mon, HMONITOR *hm_to_use,
} }
else else
{ {
char dev_name[CCHDEVICENAME] = {0}; char dev_name[CCHDEVICENAME] = {0};
*style = WS_POPUP | WS_VISIBLE; *style = WS_POPUP | WS_VISIBLE;
utf16_to_char_string((const uint16_t*)current_mon->szDevice, dev_name, sizeof(dev_name)); utf16_to_char_string((const uint16_t*)current_mon->szDevice, dev_name, sizeof(dev_name));
if (!win32_monitor_set_fullscreen(*width, *height, if (!win32_monitor_set_fullscreen(*width, *height,
refresh, dev_name)) refresh, dev_name))
{} {}
/* Display settings might have changed, get new coordinates. */ /* Display settings might have changed, get new coordinates. */
GetMonitorInfoW(*hm_to_use, (MONITORINFOEXW*)current_mon); GetMonitorInfoW(*hm_to_use, (MONITORINFOEXW*)current_mon);
@ -801,7 +801,7 @@ bool win32_set_video_mode(void *data,
if (!win32_window_create(data, style, &mon_rect, width, height, fullscreen)) if (!win32_window_create(data, style, &mon_rect, width, height, fullscreen))
return false; return false;
win32_set_window(&width, &height, fullscreen, windowed_full, &rect); win32_set_window(&width, &height, fullscreen, windowed_full, &rect);
/* Wait until context is created (or failed to do so ...) */ /* Wait until context is created (or failed to do so ...) */

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2011-2016 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * 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- * 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. * ation, either version 3 of the License, or (at your option) any later version.
@ -18,12 +18,10 @@
#define WIN32_COMMON_H__ #define WIN32_COMMON_H__
#include <string.h> #include <string.h>
#include <encodings/win32.h>
#ifndef _XBOX #ifndef _XBOX
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define UNICODE
#include <tchar.h>
#include <wchar.h>
#include <windows.h> #include <windows.h>
#endif #endif
@ -83,7 +81,7 @@ bool win32_window_create(void *data, unsigned style,
bool win32_suppress_screensaver(void *data, bool enable); bool win32_suppress_screensaver(void *data, bool enable);
bool win32_get_metrics(void *data, bool win32_get_metrics(void *data,
enum display_metric_types type, float *value); enum display_metric_types type, float *value);
void win32_show_cursor(bool state); void win32_show_cursor(bool state);

View File

@ -15,13 +15,11 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <encodings/win32.h>
#ifdef _XBOX #ifdef _XBOX
#include <xtl.h> #include <xtl.h>
#include <xgraphics.h> #include <xgraphics.h>
#else
#define UNICODE
#include <tchar.h>
#include <wchar.h>
#endif #endif
#include <formats/image.h> #include <formats/image.h>
@ -155,14 +153,14 @@ static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
video_info->input_scale * RARCH_SCALE_BASE; video_info->input_scale * RARCH_SCALE_BASE;
if (!renderchain_init_first(&d3d->renderchain_driver, if (!renderchain_init_first(&d3d->renderchain_driver,
&d3d->renderchain_data)) &d3d->renderchain_data))
{ {
RARCH_ERR("Renderchain could not be initialized.\n"); RARCH_ERR("Renderchain could not be initialized.\n");
return false; return false;
} }
if (!d3d->renderchain_driver || !d3d->renderchain_data) if (!d3d->renderchain_driver || !d3d->renderchain_data)
return false; return false;
if ( if (
!d3d->renderchain_driver->init( !d3d->renderchain_driver->init(
@ -187,7 +185,7 @@ static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
for (i = 1; i < d3d->shader.passes; i++) for (i = 1; i < d3d->shader.passes; i++)
{ {
d3d->renderchain_driver->convert_geometry(d3d->renderchain_data, d3d->renderchain_driver->convert_geometry(d3d->renderchain_data,
&link_info, &link_info,
&out_width, &out_height, &out_width, &out_height,
current_width, current_height, &d3d->final_viewport); current_width, current_height, &d3d->final_viewport);
@ -327,8 +325,8 @@ static void d3d_viewport_info(void *data, struct video_viewport *vp)
{ {
d3d_video_t *d3d = (d3d_video_t*)data; d3d_video_t *d3d = (d3d_video_t*)data;
if ( !d3d || if ( !d3d ||
!d3d->renderchain_driver || !d3d->renderchain_driver ||
!d3d->renderchain_driver->viewport_info) !d3d->renderchain_driver->viewport_info)
return; return;
@ -364,7 +362,7 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
vert[i][7] = 1.0f; vert[i][7] = 1.0f;
vert[i][8] = overlay->alpha_mod; vert[i][8] = overlay->alpha_mod;
} }
d3d_viewport_info(d3d, &vp); d3d_viewport_info(d3d, &vp);
overlay_width = vp.width; overlay_width = vp.width;
@ -502,7 +500,7 @@ void d3d_make_d3dpp(void *data,
#ifdef _XBOX #ifdef _XBOX
d3dpp->Windowed = false; d3dpp->Windowed = false;
#else #else
d3dpp->Windowed = settings->video.windowed_fullscreen d3dpp->Windowed = settings->video.windowed_fullscreen
|| !info->fullscreen; || !info->fullscreen;
#endif #endif
d3dpp->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; d3dpp->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
@ -533,13 +531,13 @@ void d3d_make_d3dpp(void *data,
d3dpp->BackBufferFormat = d3dpp->BackBufferFormat =
#ifdef _XBOX360 #ifdef _XBOX360
global->console.screen.gamma_correction ? global->console.screen.gamma_correction ?
(D3DFORMAT)MAKESRGBFMT(info->rgb32 ? (D3DFORMAT)MAKESRGBFMT(info->rgb32 ?
D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5) : D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5) :
#endif #endif
info->rgb32 ? D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5; info->rgb32 ? D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5;
#else #else
d3dpp->hDeviceWindow = win32_get_window(); d3dpp->hDeviceWindow = win32_get_window();
d3dpp->BackBufferFormat = !d3dpp->Windowed ? d3dpp->BackBufferFormat = !d3dpp->Windowed ?
D3DFMT_X8R8G8B8 : D3DFMT_UNKNOWN; D3DFMT_X8R8G8B8 : D3DFMT_UNKNOWN;
#endif #endif
@ -713,8 +711,8 @@ static void d3d_calculate_rect(void *data,
if (fabsf(device_aspect - desired_aspect) < 0.0001f) if (fabsf(device_aspect - desired_aspect) < 0.0001f)
{ {
/* If the aspect ratios of screen and desired aspect /* If the aspect ratios of screen and desired aspect
* ratio are sufficiently equal (floating point stuff), * ratio are sufficiently equal (floating point stuff),
* assume they are actually equal. * assume they are actually equal.
*/ */
} }
@ -806,7 +804,7 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
video_driver_get_size(&width, &height); video_driver_get_size(&width, &height);
d3d_set_viewport(d3d, d3d_set_viewport(d3d,
width, height, false, true); width, height, false, true);
#if defined(_XBOX360) #if defined(_XBOX360)
strlcpy(settings->path.font, "game:\\media\\Arial_12.xpr", strlcpy(settings->path.font, "game:\\media\\Arial_12.xpr",
@ -1047,7 +1045,7 @@ static bool d3d_construct(d3d_video_t *d3d,
win_height, info->fullscreen); win_height, info->fullscreen);
win32_set_window(&win_width, &win_height, info->fullscreen, win32_set_window(&win_width, &win_height, info->fullscreen,
windowed_full, &rect); windowed_full, &rect);
#endif #endif
#ifdef HAVE_SHADERS #ifdef HAVE_SHADERS
@ -1337,7 +1335,7 @@ static bool d3d_overlay_load(void *data,
image_data; image_data;
if (!d3d) if (!d3d)
return false; return false;
d3d_free_overlays(d3d); d3d_free_overlays(d3d);
d3d->overlays.resize(num_images); d3d->overlays.resize(num_images);
@ -1542,8 +1540,8 @@ static bool d3d_read_viewport(void *data, uint8_t *buffer)
{ {
d3d_video_t *d3d = (d3d_video_t*)data; d3d_video_t *d3d = (d3d_video_t*)data;
if ( !d3d || if ( !d3d ||
!d3d->renderchain_driver || !d3d->renderchain_driver ||
!d3d->renderchain_driver->read_viewport) !d3d->renderchain_driver->read_viewport)
return false; return false;
@ -1603,7 +1601,7 @@ static void d3d_set_menu_texture_frame(void *data,
|| d3d->menu->tex_h != height) || d3d->menu->tex_h != height)
{ {
if (d3d->menu) if (d3d->menu)
d3d_texture_free(d3d->menu->tex); d3d_texture_free(d3d->menu->tex);
d3d->menu->tex = d3d_texture_new(d3d->dev, NULL, d3d->menu->tex = d3d_texture_new(d3d->dev, NULL,
width, height, 1, width, height, 1,
@ -1686,7 +1684,7 @@ static void video_texture_load_d3d(d3d_video_t *d3d,
uintptr_t *id) uintptr_t *id)
{ {
*id = (uintptr_t)d3d_texture_new(d3d->dev, NULL, *id = (uintptr_t)d3d_texture_new(d3d->dev, NULL,
ti->width, ti->height, 1, ti->width, ti->height, 1,
0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, 0, 0, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, 0, 0, 0,
NULL, NULL); NULL, NULL);
} }
@ -1739,7 +1737,7 @@ static void d3d_unload_texture(void *data, uintptr_t id)
{ {
LPDIRECT3DTEXTURE texid; LPDIRECT3DTEXTURE texid;
if (!id) if (!id)
return; return;
texid = (LPDIRECT3DTEXTURE)id; texid = (LPDIRECT3DTEXTURE)id;
d3d_texture_free(texid); d3d_texture_free(texid);

View File

@ -29,10 +29,7 @@
#define WM_MOUSEWHEEL 0x020A #define WM_MOUSEWHEEL 0x020A
#endif #endif
#define UNICODE #include <encodings/win32.h>
#include <tchar.h>
#include <wchar.h>
#include <dinput.h> #include <dinput.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -35,12 +35,12 @@ extern "C" {
#ifndef snprintf #ifndef snprintf
#define snprintf c99_snprintf_retro__ #define snprintf c99_snprintf_retro__
#endif #endif
int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...); int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...);
#endif #endif
/* Pre-MSVC 2010 compilers don't implement vsnprintf in a cross-platform manner? Not sure about this one. */ /* Pre-MSVC 2010 compilers don't implement vsnprintf in a cross-platform manner? Not sure about this one. */
#if _MSC_VER < 1600 #if _MSC_VER < 1600
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef vsnprintf #ifndef vsnprintf
@ -53,7 +53,6 @@ extern "C" {
} }
#endif #endif
#undef UNICODE /* Do not bother with UNICODE at this time. */
#include <direct.h> #include <direct.h>
#include <stddef.h> #include <stddef.h>
#include <math.h> #include <math.h>

View File

@ -28,7 +28,17 @@
#define UNICODE #define UNICODE
#include <tchar.h> #include <tchar.h>
#include <wchar.h> #include <wchar.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <encodings/utf.h> #include <encodings/utf.h>
#ifdef __cplusplus
}
#endif
#endif #endif
#endif #endif

View File

@ -45,11 +45,12 @@
#include <time.h> #include <time.h>
#endif #endif
#ifdef _WIN32
#include <encodings/win32.h>
#endif
#if defined(_WIN32) && !defined(_XBOX) #if defined(_WIN32) && !defined(_XBOX)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define UNICODE
#include <tchar.h>
#include <wchar.h>
#include <windows.h> #include <windows.h>
#elif defined(_WIN32) && defined(_XBOX) #elif defined(_WIN32) && defined(_XBOX)
#include <Xtl.h> #include <Xtl.h>

View File

@ -26,9 +26,7 @@
#include <errno.h> #include <errno.h>
#if defined(_WIN32) #if defined(_WIN32)
# define UNICODE #include <encodings/win32.h>
# include <tchar.h>
# include <wchar.h>
# ifdef _MSC_VER # ifdef _MSC_VER
# define setmode _setmode # define setmode _setmode
# endif # endif
@ -295,7 +293,7 @@ char *filestream_getline(RFILE *stream)
} }
newline[idx] = '\0'; newline[idx] = '\0';
return newline; return newline;
} }
char *filestream_gets(RFILE *stream, char *s, size_t len) char *filestream_gets(RFILE *stream, char *s, size_t len)
@ -346,7 +344,7 @@ ssize_t filestream_seek(RFILE *stream, ssize_t offset, int whence)
#endif #endif
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
/* Need to check stream->mapped because this function is /* Need to check stream->mapped because this function is
* called in filestream_open() */ * called in filestream_open() */
if (stream->mapped && stream->hints & RFILE_HINT_MMAP) if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
{ {
@ -416,7 +414,7 @@ ssize_t filestream_tell(RFILE *stream)
return ftell(stream->fp); return ftell(stream->fp);
#endif #endif
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
/* Need to check stream->mapped because this function /* Need to check stream->mapped because this function
* is called in filestream_open() */ * is called in filestream_open() */
if (stream->mapped && stream->hints & RFILE_HINT_MMAP) if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
return stream->mappos; return stream->mappos;