Fixed non-unicode builds (nw)

This commit is contained in:
Miodrag Milanovic 2015-04-06 11:52:35 +02:00
parent 1de80e729e
commit 1c61e69daf
3 changed files with 16 additions and 5 deletions

View File

@ -1,7 +1,13 @@
#if defined(OSD_NET_USE_PCAP)
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
#ifdef UNICODE
#define LIB_NAME L"wpcap.dll"
#define LoadDynamicLibrary LoadLibraryW
#else
#define LIB_NAME "wpcap.dll"
#define LoadDynamicLibrary LoadLibraryA
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
@ -15,7 +21,6 @@
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
#define LIB_NAME L"wpcap.dll"
#define LIB_ERROR_STR "Unable to load winpcap: %lx\n"
typedef DWORD except_type;
@ -39,7 +44,7 @@ typedef const char *except_type;
#define FreeLibrary(x) dlclose(x)
#define GetLastError() dlerror()
#define GetProcAddress(x, y) dlsym(x, y)
#define LoadLibrary(x) dlopen(x, RTLD_LAZY)
#define LoadDynamicLibrary(x) dlopen(x, RTLD_LAZY)
#endif
@ -239,7 +244,7 @@ bool pcap_module::probe()
{
if (handle == NULL)
{
handle = LoadLibrary(LIB_NAME);
handle = LoadDynamicLibrary(LIB_NAME);
return (handle != NULL);
}
return true;

View File

@ -101,9 +101,15 @@ base *drawd3d9_init(void)
HINSTANCE fxhandle = NULL;
for (int idx = 99; idx >= 0; idx--) // a shameful moogle
{
#ifdef UNICODE
wchar_t dllbuf[13];
wsprintf(dllbuf, TEXT("d3dx9_%d.dll"), idx);
fxhandle = LoadLibrary(dllbuf);
#else
char dllbuf[13];
sprintf(dllbuf, "d3dx9_%d.dll", idx);
fxhandle = LoadLibraryA(dllbuf);
#endif
if (fxhandle != NULL)
{
break;

View File

@ -228,7 +228,7 @@ BOOL CALLBACK win_monitor_info::monitor_enum_callback(HMONITOR handle, HDC dc, L
float aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top);
// allocate a new monitor info
char *temp = utf8_from_wstring(info.szDevice);
char *temp = utf8_from_tstring(info.szDevice);
// copy in the data
monitor = global_alloc(win_monitor_info(handle, temp, aspect));
osd_free(temp);