Commit 46b26be5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

DirectDraw: port to UNICODE friendly APIs

This would need more testing and close look
parent 59f746f6
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include "common.h" #include "common.h"
#ifdef UNICODE #ifdef UNICODE
# error "Unicode mode not supported" # warning "Unicode mode not tested"
#endif #endif
/***************************************************************************** /*****************************************************************************
...@@ -446,12 +446,14 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc, ...@@ -446,12 +446,14 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
if (!hmon) if (!hmon)
return TRUE; return TRUE;
msg_Dbg(vd, "DirectXEnumCallback: %s, %s", desc, drivername); char *psz_drivername = FromT(drivername);
msg_Dbg(vd, "DirectXEnumCallback: %s, %s", FromT(desc), psz_drivername);
char *device = var_GetString(vd, "directx-device"); char *device = var_GetString(vd, "directx-device");
/* Check for forced device */ /* Check for forced device */
if (device && *device && !strcmp(drivername, device)) { if (device && *device && !strcmp(psz_drivername, device)) {
MONITORINFO monitor_info; MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO); monitor_info.cbSize = sizeof(MONITORINFO);
...@@ -475,7 +477,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc, ...@@ -475,7 +477,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
free(device); free(device);
if (hmon == sys->hmonitor) { if (hmon == sys->hmonitor) {
msg_Dbg(vd, "selecting %s, %s", desc, drivername); msg_Dbg(vd, "selecting %s, %s", FromT(desc), psz_drivername);
free(sys->display_driver); free(sys->display_driver);
sys->display_driver = malloc(sizeof(*guid)); sys->display_driver = malloc(sizeof(*guid));
...@@ -564,16 +566,16 @@ static int DirectXOpenDDraw(vout_display_t *vd) ...@@ -564,16 +566,16 @@ static int DirectXOpenDDraw(vout_display_t *vd)
/* */ /* */
HRESULT (WINAPI *OurDirectDrawCreate)(GUID *,LPDIRECTDRAW *,IUnknown *); HRESULT (WINAPI *OurDirectDrawCreate)(GUID *,LPDIRECTDRAW *,IUnknown *);
OurDirectDrawCreate = OurDirectDrawCreate =
(void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawCreate")); (void *)GetProcAddress(sys->hddraw_dll, "DirectDrawCreate");
if (!OurDirectDrawCreate) { if (!OurDirectDrawCreate) {
msg_Err(vd, "DirectXInitDDraw failed GetProcAddress"); msg_Err(vd, "DirectXInitDDraw failed GetProcAddress");
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* */ /* */
HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD); HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX, LPVOID, DWORD);
OurDirectDrawEnumerateEx = OurDirectDrawEnumerateEx =
(void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA")); (void *)GetProcAddress(sys->hddraw_dll, "DirectDrawEnumerateEx");
if (OurDirectDrawEnumerateEx) { if (OurDirectDrawEnumerateEx) {
char *device = var_GetString(vd, "directx-device"); char *device = var_GetString(vd, "directx-device");
...@@ -1425,8 +1427,8 @@ static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc, ...@@ -1425,8 +1427,8 @@ static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc,
ctx->descs = xrealloc(ctx->descs, (ctx->count + 1) * sizeof(char *)); ctx->descs = xrealloc(ctx->descs, (ctx->count + 1) * sizeof(char *));
/* TODO? Unicode APIs */ /* TODO? Unicode APIs */
ctx->values[ctx->count] = FromANSI(drivername); ctx->values[ctx->count] = FromT(drivername);
ctx->descs[ctx->count] = FromANSI(drivername); ctx->descs[ctx->count] = FromT(drivername);
ctx->count++; ctx->count++;
return TRUE; /* Keep enumerating */ return TRUE; /* Keep enumerating */
...@@ -1448,9 +1450,9 @@ static int FindDevicesCallback(vlc_object_t *object, const char *name, ...@@ -1448,9 +1450,9 @@ static int FindDevicesCallback(vlc_object_t *object, const char *name,
if (hddraw_dll != NULL) if (hddraw_dll != NULL)
{ {
/* Enumerate displays */ /* Enumerate displays */
HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX,
LPVOID, DWORD) = LPVOID, DWORD) =
(void *)GetProcAddress(hddraw_dll, _T("DirectDrawEnumerateExA")); (void *)GetProcAddress(hddraw_dll, "DirectDrawEnumerateEx");
if (OurDirectDrawEnumerateEx != NULL) if (OurDirectDrawEnumerateEx != NULL)
OurDirectDrawEnumerateEx(DirectXEnumCallback2, &ctx, OurDirectDrawEnumerateEx(DirectXEnumCallback2, &ctx,
DDENUM_ATTACHEDSECONDARYDEVICES); DDENUM_ATTACHEDSECONDARYDEVICES);
......
...@@ -499,7 +499,7 @@ static int DirectXCreateWindow( event_thread_t *p_event ) ...@@ -499,7 +499,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
HMENU hMenu; HMENU hMenu;
RECT rect_window; RECT rect_window;
WNDCLASS wc; /* window class components */ WNDCLASS wc; /* window class components */
char vlc_path[MAX_PATH+1]; TCHAR vlc_path[MAX_PATH+1];
int i_style, i_stylex; int i_style, i_stylex;
msg_Dbg( vd, "DirectXCreateWindow" ); msg_Dbg( vd, "DirectXCreateWindow" );
...@@ -1043,9 +1043,9 @@ event_thread_t *EventThreadCreate( vout_display_t *vd) ...@@ -1043,9 +1043,9 @@ event_thread_t *EventThreadCreate( vout_display_t *vd)
p_event->source = vd->source; p_event->source = vd->source;
vout_display_PlacePicture(&p_event->place, &vd->source, vd->cfg, false); vout_display_PlacePicture(&p_event->place, &vd->source, vd->cfg, false);
_snprintf( p_event->class_main, sizeof(p_event->class_main)/sizeof(*p_event->class_main), _sntprintf( p_event->class_main, sizeof(p_event->class_main)/sizeof(*p_event->class_main),
_T("VLC MSW %p"), p_event ); _T("VLC MSW %p"), p_event );
_snprintf( p_event->class_video, sizeof(p_event->class_video)/sizeof(*p_event->class_video), _sntprintf( p_event->class_video, sizeof(p_event->class_video)/sizeof(*p_event->class_video),
_T("VLC MSW video %p"), p_event ); _T("VLC MSW video %p"), p_event );
return p_event; return p_event;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment