mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 12:40:07 +00:00
revert rest of unicode changes
This commit is contained in:
parent
f725b48555
commit
e39031cbd0
@ -219,10 +219,7 @@ void fill_pathname_application_path(char *s, size_t len)
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
MultiByteToWideChar(CP_UTF8, 0, s, -1, ws, sizeof(ws) / sizeof(ws[0]));
|
||||
|
||||
|
||||
ret = GetModuleFileNameW(GetModuleHandleW(NULL), ws, sizeof(ws) / sizeof(ws[0]));
|
||||
ret = GetModuleFileName(GetModuleHandle(NULL), s, len - 1);
|
||||
s[ret] = '\0';
|
||||
#elif defined(__APPLE__)
|
||||
if (bundle)
|
||||
|
@ -177,7 +177,7 @@ static void frontend_win32_init(void *data)
|
||||
{
|
||||
typedef BOOL (WINAPI *isProcessDPIAwareProc)();
|
||||
typedef BOOL (WINAPI *setProcessDPIAwareProc)();
|
||||
HMODULE handle = GetModuleHandleW(L"User32.dll");
|
||||
HMODULE handle = GetModuleHandle("User32.dll");
|
||||
isProcessDPIAwareProc isDPIAwareProc = (isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware");
|
||||
setProcessDPIAwareProc setDPIAwareProc = (setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware");
|
||||
|
||||
@ -338,7 +338,7 @@ static void frontend_win32_detach_console(void)
|
||||
{
|
||||
HWND wnd = GetConsoleWindow();
|
||||
FreeConsole();
|
||||
PostMessageW(wnd, WM_CLOSE, 0, 0);
|
||||
PostMessage(wnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -212,20 +212,20 @@ void win32_monitor_from_window(void)
|
||||
|
||||
void win32_monitor_get_info(void)
|
||||
{
|
||||
MONITORINFOEXW current_mon;
|
||||
MONITORINFOEX current_mon;
|
||||
|
||||
memset(¤t_mon, 0, sizeof(current_mon));
|
||||
current_mon.cbSize = sizeof(MONITORINFOEXW);
|
||||
current_mon.cbSize = sizeof(MONITORINFOEX);
|
||||
|
||||
GetMonitorInfoW(win32_monitor_last, (MONITORINFOEXW*)¤t_mon);
|
||||
ChangeDisplaySettingsExW(current_mon.szDevice, NULL, NULL, 0, NULL);
|
||||
GetMonitorInfo(win32_monitor_last, (MONITORINFOEX*)¤t_mon);
|
||||
ChangeDisplaySettingsEx(current_mon.szDevice, NULL, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
|
||||
{
|
||||
unsigned i, fs_monitor;
|
||||
settings_t *settings = config_get_ptr();
|
||||
MONITORINFOEXW *mon = (MONITORINFOEXW*)data;
|
||||
MONITORINFOEX *mon = (MONITORINFOEX*)data;
|
||||
HMONITOR *hm_to_use = (HMONITOR*)hm_data;
|
||||
|
||||
if (!win32_monitor_last)
|
||||
@ -254,17 +254,16 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
|
||||
}
|
||||
|
||||
memset(mon, 0, sizeof(*mon));
|
||||
mon->cbSize = sizeof(MONITORINFOEXW);
|
||||
GetMonitorInfoW(*hm_to_use, (MONITORINFOEXW*)mon);
|
||||
mon->cbSize = sizeof(MONITORINFOEX);
|
||||
GetMonitorInfo(*hm_to_use, (MONITORINFOEX*)mon);
|
||||
}
|
||||
|
||||
/* Get the count of the files dropped */
|
||||
static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
|
||||
{
|
||||
char szFilename[1024] = {0};
|
||||
wchar_t wszFilename[1024] = {0};
|
||||
|
||||
if (DragQueryFileW((HDROP)wparam, 0xFFFFFFFF, NULL, 0))
|
||||
if (DragQueryFile((HDROP)wparam, 0xFFFFFFFF, NULL, 0))
|
||||
{
|
||||
/*poll list of current cores */
|
||||
size_t list_size;
|
||||
@ -272,9 +271,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
const core_info_t *core_info = NULL;
|
||||
|
||||
DragQueryFileW((HDROP)wparam, 0, wszFilename, sizeof(wszFilename) / sizeof(wszFilename[0]));
|
||||
|
||||
utf16_to_char_string((const uint16_t*)wszFilename, szFilename, sizeof(szFilename));
|
||||
DragQueryFile((HDROP)wparam, 0, szFilename, sizeof(szFilename));
|
||||
|
||||
core_info_get_list(&core_info_list);
|
||||
|
||||
@ -335,7 +332,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
|
||||
else
|
||||
{
|
||||
/* Pick one core that could be compatible, ew */
|
||||
if(DialogBoxParamW(GetModuleHandleW(NULL),MAKEINTRESOURCE(IDD_PICKCORE),
|
||||
if(DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_PICKCORE),
|
||||
hwnd,PickCoreProc,(LPARAM)NULL)==IDOK)
|
||||
{
|
||||
task_push_content_load_default(
|
||||
@ -507,7 +504,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
|
||||
|
||||
if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam))
|
||||
return 0;
|
||||
return DefWindowProcW(hwnd, message, wparam, lparam);
|
||||
return DefWindowProc(hwnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
bool win32_window_create(void *data, unsigned style,
|
||||
@ -515,7 +512,7 @@ bool win32_window_create(void *data, unsigned style,
|
||||
unsigned height, bool fullscreen)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
main_window.hwnd = CreateWindowExW(0, L"RetroArch", L"RetroArch",
|
||||
main_window.hwnd = CreateWindowEx(0, "RetroArch", "RetroArch",
|
||||
style,
|
||||
fullscreen ? mon_rect->left : g_pos_x,
|
||||
fullscreen ? mon_rect->top : g_pos_y,
|
||||
@ -583,7 +580,6 @@ static bool win32_monitor_set_fullscreen(unsigned width, unsigned height,
|
||||
{
|
||||
#ifndef _XBOX
|
||||
DEVMODE devmode;
|
||||
wchar_t dev_name_wide[1024] = {0};
|
||||
|
||||
memset(&devmode, 0, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
@ -595,9 +591,7 @@ static bool win32_monitor_set_fullscreen(unsigned width, unsigned height,
|
||||
RARCH_LOG("Setting fullscreen to %ux%u @ %uHz on device %s.\n",
|
||||
width, height, refresh, dev_name);
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, dev_name, -1, dev_name_wide, sizeof(dev_name_wide) / sizeof(dev_name_wide[0]));
|
||||
|
||||
return ChangeDisplaySettingsExW(dev_name_wide, &devmode,
|
||||
return ChangeDisplaySettingsEx(dev_name, &devmode,
|
||||
NULL, CDS_FULLSCREEN, NULL) == DISP_CHANGE_SUCCESSFUL;
|
||||
#endif
|
||||
}
|
||||
@ -655,7 +649,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
|
||||
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
|
||||
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
|
||||
POWER_REQUEST_TYPE RequestType);
|
||||
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
HMODULE kernel32 = GetModuleHandle("kernel32.dll");
|
||||
PowerCreateRequestPtr powerCreateRequest =
|
||||
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
|
||||
PowerSetRequestPtr powerSetRequest =
|
||||
@ -689,7 +683,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
|
||||
}
|
||||
|
||||
/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */
|
||||
void win32_set_style(MONITORINFOEXW *current_mon, HMONITOR *hm_to_use,
|
||||
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)
|
||||
{
|
||||
@ -714,17 +708,14 @@ void win32_set_style(MONITORINFOEXW *current_mon, HMONITOR *hm_to_use,
|
||||
}
|
||||
else
|
||||
{
|
||||
char dev_name[CCHDEVICENAME] = {0};
|
||||
*style = WS_POPUP | WS_VISIBLE;
|
||||
|
||||
utf16_to_char_string((const uint16_t*)current_mon->szDevice, dev_name, sizeof(dev_name));
|
||||
|
||||
if (!win32_monitor_set_fullscreen(*width, *height,
|
||||
refresh, dev_name))
|
||||
refresh, current_mon->szDevice))
|
||||
{}
|
||||
|
||||
/* Display settings might have changed, get new coordinates. */
|
||||
GetMonitorInfoW(*hm_to_use, (MONITORINFOEXW*)current_mon);
|
||||
GetMonitorInfo(*hm_to_use, (MONITORINFOEX*)current_mon);
|
||||
*mon_rect = current_mon->rcMonitor;
|
||||
}
|
||||
}
|
||||
@ -755,8 +746,8 @@ void win32_set_window(unsigned *width, unsigned *height,
|
||||
{
|
||||
RECT rc_temp = {0, 0, (LONG)*height, 0x7FFF};
|
||||
SetMenu(main_window.hwnd,
|
||||
LoadMenuW(GetModuleHandleW(NULL),MAKEINTRESOURCE(IDR_MENU)));
|
||||
SendMessageW(main_window.hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp);
|
||||
LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));
|
||||
SendMessage(main_window.hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp);
|
||||
g_resize_height = *height += rc_temp.top + rect->top;
|
||||
SetWindowPos(main_window.hwnd, NULL, 0, 0, *width, *height, SWP_NOMOVE);
|
||||
}
|
||||
@ -782,7 +773,7 @@ bool win32_set_video_mode(void *data,
|
||||
MSG msg;
|
||||
RECT mon_rect;
|
||||
unsigned mon_id;
|
||||
MONITORINFOEXW current_mon;
|
||||
MONITORINFOEX current_mon;
|
||||
bool windowed_full;
|
||||
RECT rect = {0};
|
||||
HMONITOR hm_to_use = NULL;
|
||||
@ -805,10 +796,10 @@ bool win32_set_video_mode(void *data,
|
||||
win32_set_window(&width, &height, fullscreen, windowed_full, &rect);
|
||||
|
||||
/* Wait until context is created (or failed to do so ...) */
|
||||
while (!g_inited && !g_quit && GetMessageW(&msg, main_window.hwnd, 0, 0))
|
||||
while (!g_inited && !g_quit && GetMessage(&msg, main_window.hwnd, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (g_quit)
|
||||
@ -866,7 +857,7 @@ void win32_window_reset(void)
|
||||
void win32_destroy_window(void)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
UnregisterClassW(L"RetroArch", GetModuleHandleW(NULL));
|
||||
UnregisterClass("RetroArch", GetModuleHandle(NULL));
|
||||
#endif
|
||||
main_window.hwnd = NULL;
|
||||
}
|
||||
|
@ -21,9 +21,6 @@
|
||||
|
||||
#ifndef _XBOX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define UNICODE
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@ -99,7 +96,7 @@ void win32_set_window(unsigned *width, unsigned *height,
|
||||
|
||||
#ifndef _XBOX
|
||||
/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */
|
||||
void win32_set_style(MONITORINFOEXW *current_mon, HMONITOR *hm_to_use,
|
||||
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
|
||||
|
@ -18,10 +18,6 @@
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#include <xgraphics.h>
|
||||
#else
|
||||
#define UNICODE
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#include <formats/image.h>
|
||||
|
@ -46,7 +46,7 @@ static void *d3dfonts_w32_init_font(void *video_data,
|
||||
OUT_TT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_PITCH,
|
||||
L"Verdana" /* Hardcode FTL */
|
||||
"Verdana" /* Hardcode FTL */
|
||||
};
|
||||
|
||||
d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));
|
||||
|
@ -29,10 +29,6 @@
|
||||
#define WM_MOUSEWHEEL 0x020A
|
||||
#endif
|
||||
|
||||
#define UNICODE
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -48,7 +44,7 @@
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../input_config.h"
|
||||
#include "../input_joypad_driver.h"
|
||||
#include "../input_keymaps.h"
|
||||
|
@ -34,7 +34,6 @@ struct RDIR *retro_opendir(const char *name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
char path_buf[1024] = {0};
|
||||
wchar_t pathW[1024] = {0};
|
||||
#endif
|
||||
struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir));
|
||||
|
||||
@ -43,8 +42,7 @@ struct RDIR *retro_opendir(const char *name)
|
||||
|
||||
#if defined(_WIN32)
|
||||
snprintf(path_buf, sizeof(path_buf), "%s\\*", name);
|
||||
MultiByteToWideChar(CP_UTF8, 0, path_buf, -1, pathW, sizeof(pathW) / sizeof(pathW[0]));
|
||||
rdir->directory = FindFirstFileW(pathW, &rdir->entry);
|
||||
rdir->directory = FindFirstFile(path_buf, &rdir->entry);
|
||||
#elif defined(VITA) || defined(PSP)
|
||||
rdir->directory = sceIoDopen(name);
|
||||
#elif defined(_3DS)
|
||||
@ -77,7 +75,7 @@ int retro_readdir(struct RDIR *rdir)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if(rdir->next)
|
||||
return (FindNextFileW(rdir->directory, &rdir->entry) != 0);
|
||||
return (FindNextFile(rdir->directory, &rdir->entry) != 0);
|
||||
else {
|
||||
rdir->next = true;
|
||||
return (rdir->directory != INVALID_HANDLE_VALUE);
|
||||
@ -96,9 +94,7 @@ int retro_readdir(struct RDIR *rdir)
|
||||
const char *retro_dirent_get_name(struct RDIR *rdir)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
memset(rdir->path, 0, sizeof(rdir->path));
|
||||
utf16_to_char_string(rdir->entry.cFileName, rdir->path, sizeof(rdir->path));
|
||||
return rdir->path;
|
||||
return rdir->entry.cFileName;
|
||||
#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__)
|
||||
return rdir->entry.d_name;
|
||||
#else
|
||||
@ -120,7 +116,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
|
||||
bool retro_dirent_is_dir(struct RDIR *rdir, const char *path)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
const WIN32_FIND_DATAW *entry = (const WIN32_FIND_DATAW*)&rdir->entry;
|
||||
const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry;
|
||||
return entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
const SceIoDirent *entry = (const SceIoDirent*)&rdir->entry;
|
||||
|
@ -103,11 +103,9 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
|
||||
#elif defined(_WIN32)
|
||||
WIN32_FILE_ATTRIBUTE_DATA file_info;
|
||||
GET_FILEEX_INFO_LEVELS fInfoLevelId = GetFileExInfoStandard;
|
||||
wchar_t path_wide[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, path_wide, sizeof(path_wide) / sizeof(path_wide[0]));
|
||||
DWORD ret = GetFileAttributesEx(path, fInfoLevelId, &file_info);
|
||||
|
||||
DWORD ret = GetFileAttributesExW(path_wide, fInfoLevelId, &file_info);
|
||||
if (ret == 0)
|
||||
return false;
|
||||
#else
|
||||
|
@ -47,9 +47,6 @@
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define UNICODE
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <windows.h>
|
||||
#elif defined(_WIN32) && defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
|
@ -26,9 +26,6 @@
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define UNICODE
|
||||
# include <tchar.h>
|
||||
# include <wchar.h>
|
||||
# ifdef _MSC_VER
|
||||
# define setmode _setmode
|
||||
# endif
|
||||
@ -77,17 +74,10 @@ struct RFILE
|
||||
|
||||
#define HAVE_BUFFERED_IO 1
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MODE_STR_READ L"r"
|
||||
#define MODE_STR_READ_UNBUF L"rb"
|
||||
#define MODE_STR_WRITE_UNBUF L"wb"
|
||||
#define MODE_STR_WRITE_PLUS L"w+"
|
||||
#else
|
||||
#define MODE_STR_READ "r"
|
||||
#define MODE_STR_READ_UNBUF "rb"
|
||||
#define MODE_STR_WRITE_UNBUF "wb"
|
||||
#define MODE_STR_WRITE_PLUS "w+"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_BUFFERED_IO)
|
||||
FILE *fp;
|
||||
@ -117,12 +107,7 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
|
||||
int flags = 0;
|
||||
int mode_int = 0;
|
||||
#if defined(HAVE_BUFFERED_IO)
|
||||
#ifdef _WIN32
|
||||
const wchar_t *mode_str = NULL;
|
||||
wchar_t path_wide[PATH_MAX_LENGTH] = {0};
|
||||
#else
|
||||
const char *mode_str = NULL;
|
||||
#endif
|
||||
#endif
|
||||
RFILE *stream = (RFILE*)calloc(1, sizeof(*stream));
|
||||
|
||||
@ -213,12 +198,7 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
|
||||
#if defined(HAVE_BUFFERED_IO)
|
||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, path_wide, sizeof(path_wide) / sizeof(path_wide[0]));
|
||||
stream->fp = _wfopen(path_wide, mode_str);
|
||||
#else
|
||||
stream->fp = fopen(path, mode_str);
|
||||
#endif
|
||||
if (!stream->fp)
|
||||
goto error;
|
||||
}
|
||||
|
@ -155,20 +155,20 @@ static void shader_dlg_params_refresh(void)
|
||||
bool checked =
|
||||
(shader_info.data->parameters[i].current ==
|
||||
shader_info.data->parameters[i].maximum);
|
||||
SendMessageW(control->checkbox.hwnd, BM_SETCHECK, checked, 0);
|
||||
SendMessage(control->checkbox.hwnd, BM_SETCHECK, checked, 0);
|
||||
}
|
||||
break;
|
||||
case SHADER_PARAM_CTRL_TRACKBAR:
|
||||
shader_dlg_refresh_trackbar_label(i);
|
||||
|
||||
SendMessageW(control->trackbar.hwnd,
|
||||
SendMessage(control->trackbar.hwnd,
|
||||
TBM_SETRANGEMIN, (WPARAM)TRUE, (LPARAM)0);
|
||||
SendMessageW(control->trackbar.hwnd,
|
||||
SendMessage(control->trackbar.hwnd,
|
||||
TBM_SETRANGEMAX, (WPARAM)TRUE,
|
||||
(LPARAM)((shader_info.data->parameters[i].maximum -
|
||||
shader_info.data->parameters[i].minimum)
|
||||
/ shader_info.data->parameters[i].step));
|
||||
SendMessageW(control->trackbar.hwnd, TBM_SETPOS, (WPARAM)TRUE,
|
||||
SendMessage(control->trackbar.hwnd, TBM_SETPOS, (WPARAM)TRUE,
|
||||
(LPARAM)((shader_info.data->parameters[i].current -
|
||||
shader_info.data->parameters[i].minimum) /
|
||||
shader_info.data->parameters[i].step));
|
||||
@ -234,12 +234,6 @@ void shader_dlg_params_reload(void)
|
||||
for (i = 0; i < (int)shader_info.data->num_parameters; i++)
|
||||
{
|
||||
shader_param_ctrl_t*control = &g_shader_dlg.controls[i];
|
||||
size_t param_desc_wide_size = sizeof(shader_info.data->parameters[i].desc) * 2;
|
||||
wchar_t param_desc_wide[param_desc_wide_size];
|
||||
|
||||
memset(param_desc_wide, 0, sizeof(param_desc_wide));
|
||||
MultiByteToWideChar(CP_UTF8, 0, shader_info.data->parameters[i].desc, -1, param_desc_wide, sizeof(param_desc_wide) / sizeof(param_desc_wide[0]));
|
||||
|
||||
|
||||
if ((shader_info.data->parameters[i].minimum == 0.0)
|
||||
&& (shader_info.data->parameters[i].maximum
|
||||
@ -255,12 +249,12 @@ void shader_dlg_params_reload(void)
|
||||
}
|
||||
|
||||
control->type = SHADER_PARAM_CTRL_CHECKBOX;
|
||||
control->checkbox.hwnd = CreateWindowExW(0, L"BUTTON",
|
||||
param_desc_wide,
|
||||
control->checkbox.hwnd = CreateWindowEx(0, "BUTTON",
|
||||
shader_info.data->parameters[i].desc,
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, pos_x, pos_y,
|
||||
SHADER_DLG_CTRL_WIDTH, SHADER_DLG_CHECKBOX_HEIGHT,
|
||||
g_shader_dlg.window.hwnd, (HMENU)(size_t)i, NULL, NULL);
|
||||
SendMessageW(control->checkbox.hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
SendMessage(control->checkbox.hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
pos_y += SHADER_DLG_CHECKBOX_HEIGHT + SHADER_DLG_CTRL_MARGIN;
|
||||
}
|
||||
else
|
||||
@ -273,27 +267,27 @@ void shader_dlg_params_reload(void)
|
||||
}
|
||||
|
||||
control->type = SHADER_PARAM_CTRL_TRACKBAR;
|
||||
control->trackbar.label_title = CreateWindowExW(0, L"STATIC",
|
||||
param_desc_wide,
|
||||
control->trackbar.label_title = CreateWindowEx(0, "STATIC",
|
||||
shader_info.data->parameters[i].desc,
|
||||
WS_CHILD | WS_VISIBLE | SS_LEFT, pos_x, pos_y,
|
||||
SHADER_DLG_CTRL_WIDTH, SHADER_DLG_LABEL_HEIGHT, g_shader_dlg.window.hwnd,
|
||||
(HMENU)(size_t)i, NULL, NULL);
|
||||
SendMessageW(control->trackbar.label_title, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
SendMessage(control->trackbar.label_title, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
|
||||
pos_y += SHADER_DLG_LABEL_HEIGHT;
|
||||
control->trackbar.hwnd = CreateWindowExW(0, TRACKBAR_CLASS, L"",
|
||||
control->trackbar.hwnd = CreateWindowEx(0, TRACKBAR_CLASS, "",
|
||||
WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_NOTICKS,
|
||||
pos_x + SHADER_DLG_TRACKBAR_LABEL_WIDTH, pos_y,
|
||||
SHADER_DLG_TRACKBAR_WIDTH, SHADER_DLG_TRACKBAR_HEIGHT,
|
||||
g_shader_dlg.window.hwnd, (HMENU)(size_t)i, NULL, NULL);
|
||||
|
||||
control->trackbar.label_val = CreateWindowExW(0, L"STATIC", L"",
|
||||
control->trackbar.label_val = CreateWindowEx(0, "STATIC", "",
|
||||
WS_CHILD | WS_VISIBLE | SS_LEFT, pos_x,
|
||||
pos_y, SHADER_DLG_TRACKBAR_LABEL_WIDTH, SHADER_DLG_LABEL_HEIGHT,
|
||||
g_shader_dlg.window.hwnd, (HMENU)(size_t)i, NULL, NULL);
|
||||
SendMessageW(control->trackbar.label_val, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
SendMessage(control->trackbar.label_val, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
|
||||
SendMessageW(control->trackbar.hwnd, TBM_SETBUDDY, (WPARAM)TRUE,
|
||||
SendMessage(control->trackbar.hwnd, TBM_SETBUDDY, (WPARAM)TRUE,
|
||||
(LPARAM)control->trackbar.label_val);
|
||||
|
||||
pos_y += SHADER_DLG_TRACKBAR_HEIGHT + SHADER_DLG_CTRL_MARGIN;
|
||||
@ -305,7 +299,7 @@ void shader_dlg_params_reload(void)
|
||||
if (window && g_shader_dlg.separator.hwnd)
|
||||
window->destroy(&g_shader_dlg.separator);
|
||||
|
||||
g_shader_dlg.separator.hwnd = CreateWindowExW(0, L"STATIC", L"",
|
||||
g_shader_dlg.separator.hwnd = CreateWindowEx(0, "STATIC", "",
|
||||
SS_ETCHEDHORZ | WS_VISIBLE | WS_CHILD, SHADER_DLG_CTRL_X,
|
||||
g_shader_dlg.parameters_start_y - SHADER_DLG_CTRL_MARGIN - SHADER_DLG_SEPARATOR_HEIGHT / 2,
|
||||
(pos_x - SHADER_DLG_CTRL_X) + SHADER_DLG_CTRL_WIDTH,
|
||||
@ -395,7 +389,7 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_CHECKBOX)
|
||||
break;
|
||||
|
||||
if (SendMessageW(g_shader_dlg.controls[i].checkbox.hwnd,
|
||||
if (SendMessage(g_shader_dlg.controls[i].checkbox.hwnd,
|
||||
BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
shader_info.data->parameters[i].current =
|
||||
shader_info.data->parameters[i].maximum;
|
||||
@ -406,7 +400,7 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
i = GetWindowLongW((HWND)lparam, GWL_ID);
|
||||
i = GetWindowLong((HWND)lparam, GWL_ID);
|
||||
|
||||
if (i >= GFX_MAX_PARAMETERS)
|
||||
break;
|
||||
@ -414,7 +408,7 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_TRACKBAR)
|
||||
break;
|
||||
|
||||
pos = (int)SendMessageW(g_shader_dlg.controls[i].trackbar.hwnd, TBM_GETPOS, 0, 0);
|
||||
pos = (int)SendMessage(g_shader_dlg.controls[i].trackbar.hwnd, TBM_GETPOS, 0, 0);
|
||||
shader_info.data->parameters[i].current =
|
||||
shader_info.data->parameters[i].minimum + pos * shader_info.data->parameters[i].step;
|
||||
|
||||
@ -423,24 +417,19 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, message, wparam, lparam);
|
||||
return DefWindowProc(hwnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
bool win32_window_init(WNDCLASSEX *wndclass,
|
||||
bool fullscreen, const char *class_name)
|
||||
{
|
||||
wchar_t class_name_wide[1024] = {0};
|
||||
|
||||
if (class_name)
|
||||
MultiByteToWideChar(CP_UTF8, 0, class_name, -1, class_name_wide, sizeof(class_name_wide) / sizeof(class_name_wide[0]));
|
||||
|
||||
wndclass->cbSize = sizeof(WNDCLASSEX);
|
||||
wndclass->style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
wndclass->hInstance = GetModuleHandleW(NULL);
|
||||
wndclass->hCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||
wndclass->lpszClassName = (class_name != NULL) ? class_name_wide : L"RetroArch";
|
||||
wndclass->hIcon = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCE(IDI_ICON));
|
||||
wndclass->hIconSm = (HICON)LoadImageW(GetModuleHandleW(NULL),
|
||||
wndclass->hInstance = GetModuleHandle(NULL);
|
||||
wndclass->hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass->lpszClassName = (class_name != NULL) ? class_name : "RetroArch";
|
||||
wndclass->hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
|
||||
wndclass->hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
|
||||
MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
|
||||
if (!fullscreen)
|
||||
wndclass->hbrBackground = (HBRUSH)COLOR_WINDOW;
|
||||
@ -448,7 +437,7 @@ bool win32_window_init(WNDCLASSEX *wndclass,
|
||||
if (class_name != NULL)
|
||||
wndclass->style |= CS_CLASSDC;
|
||||
|
||||
if (!RegisterClassExW(wndclass))
|
||||
if (!RegisterClassEx(wndclass))
|
||||
return false;
|
||||
|
||||
/* This is non-NULL when we want a window for shader dialogs,
|
||||
@ -473,7 +462,7 @@ bool win32_shader_dlg_init(void)
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
WNDCLASSEXW wc_shader_dlg = {0};
|
||||
WNDCLASSEX wc_shader_dlg = {0};
|
||||
INITCOMMONCONTROLSEX comm_ctrl_init = {0};
|
||||
|
||||
comm_ctrl_init.dwSize = sizeof(comm_ctrl_init);
|
||||
@ -493,19 +482,19 @@ bool win32_shader_dlg_init(void)
|
||||
|
||||
hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
|
||||
|
||||
g_shader_dlg.window.hwnd = CreateWindowExW(0, L"Shader Dialog", L"Shader Parameters",
|
||||
g_shader_dlg.window.hwnd = CreateWindowEx(0, "Shader Dialog", "Shader Parameters",
|
||||
WS_POPUPWINDOW | WS_CAPTION, 100, 100,
|
||||
SHADER_DLG_WIDTH, SHADER_DLG_MIN_HEIGHT, NULL, NULL, NULL, NULL);
|
||||
|
||||
pos_y = SHADER_DLG_CTRL_MARGIN;
|
||||
g_shader_dlg.on_top_checkbox.hwnd = CreateWindowExW(0, L"BUTTON", L"Always on Top",
|
||||
g_shader_dlg.on_top_checkbox.hwnd = CreateWindowEx(0, "BUTTON", "Always on Top",
|
||||
BS_AUTOCHECKBOX | WS_VISIBLE | WS_CHILD,
|
||||
SHADER_DLG_CTRL_X, pos_y, SHADER_DLG_CTRL_WIDTH,
|
||||
SHADER_DLG_CHECKBOX_HEIGHT, g_shader_dlg.window.hwnd,
|
||||
(HMENU)SHADER_DLG_CHECKBOX_ONTOP_ID, NULL, NULL);
|
||||
pos_y += SHADER_DLG_CHECKBOX_HEIGHT + SHADER_DLG_CTRL_MARGIN;
|
||||
|
||||
SendMessageW(g_shader_dlg.on_top_checkbox.hwnd,
|
||||
SendMessage(g_shader_dlg.on_top_checkbox.hwnd,
|
||||
WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
|
||||
pos_y += SHADER_DLG_SEPARATOR_HEIGHT + SHADER_DLG_CTRL_MARGIN;
|
||||
@ -676,7 +665,7 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam)
|
||||
command_event(cmd, NULL);
|
||||
|
||||
if (do_wm_close)
|
||||
PostMessageW(owner, WM_CLOSE, 0, 0);
|
||||
PostMessage(owner, WM_CLOSE, 0, 0);
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user