diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index b45d1daee26..6d0e37e572c 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -125,7 +125,7 @@ project ("osd_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/debugger/qt/breakpointswindow.c", MAME_DIR .. "src/osd/modules/debugger/qt/deviceswindow.c", MAME_DIR .. "src/osd/modules/debugger/qt/deviceinformationwindow.c", - + GEN_DIR .. "osd/modules/debugger/qt/debuggerview.moc.c", GEN_DIR .. "osd/modules/debugger/qt/windowqt.moc.c", GEN_DIR .. "osd/modules/debugger/qt/logwindow.moc.c", @@ -212,7 +212,7 @@ project ("ocore_" .. _OPTIONS["osd"]) end files { - MAME_DIR .. "src/osd/sdl/strconv.c", + MAME_DIR .. "src/osd/strconv.c", MAME_DIR .. "src/osd/sdl/sdldir.c", MAME_DIR .. "src/osd/sdl/sdlfile.c", MAME_DIR .. "src/osd/sdl/sdlptty_" .. BASE_TARGETOS ..".c", diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 24a80ff7bbc..e63fe3387a5 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -6,7 +6,6 @@ if _OPTIONS["targetos"]=="windows" then defines { "OSD_SDL", "SDLMAME_WIN32", - "X64_WINDOWS_ABI", "UNICODE", "_UNICODE", "SDLMAME_SDL2=1", diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index 0b935635aab..6e1ce7a7e2c 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -128,9 +128,9 @@ project ("ocore_" .. _OPTIONS["osd"]) } files { + MAME_DIR .. "src/osd/strconv.c", MAME_DIR .. "src/osd/modules/osdmodule.c", MAME_DIR .. "src/osd/windows/main.c", - MAME_DIR .. "src/osd/windows/strconv.c", MAME_DIR .. "src/osd/windows/windir.c", MAME_DIR .. "src/osd/windows/winfile.c", MAME_DIR .. "src/osd/modules/sync/sync_windows.c", diff --git a/src/osd/sdl/strconv.c b/src/osd/strconv.c similarity index 100% rename from src/osd/sdl/strconv.c rename to src/osd/strconv.c diff --git a/src/osd/sdl/strconv.h b/src/osd/strconv.h similarity index 100% rename from src/osd/sdl/strconv.h rename to src/osd/strconv.h diff --git a/src/osd/windows/strconv.c b/src/osd/windows/strconv.c deleted file mode 100644 index 3eedf040127..00000000000 --- a/src/osd/windows/strconv.c +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// strconv.c - Win32 string conversion -// -//============================================================ - -#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) -#define WIN32_LEAN_AND_MEAN -#include -#endif - -// MAMEOS headers -#include "strconv.h" -#include "unicode.h" - -#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) -//============================================================ -// astring_from_utf8 -//============================================================ - -CHAR *astring_from_utf8(const char *utf8string) -{ - WCHAR *wstring; - int char_count; - CHAR *result; - - // convert MAME string (UTF-8) to UTF-16 - char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0); - wstring = (WCHAR *)alloca(char_count * sizeof(*wstring)); - MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, wstring, char_count); - - // convert UTF-16 to "ANSI code page" string - char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, NULL, 0, NULL, NULL); - result = (CHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, NULL, NULL); - - return result; -} - - -//============================================================ -// utf8_from_astring -//============================================================ - -char *utf8_from_astring(const CHAR *astring) -{ - WCHAR *wstring; - int char_count; - CHAR *result; - - // convert "ANSI code page" string to UTF-16 - char_count = MultiByteToWideChar(CP_ACP, 0, astring, -1, NULL, 0); - wstring = (WCHAR *)alloca(char_count * sizeof(*wstring)); - MultiByteToWideChar(CP_ACP, 0, astring, -1, wstring, char_count); - - // convert UTF-16 to MAME string (UTF-8) - char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL); - result = (CHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, NULL, NULL); - - return result; -} - - -//============================================================ -// wstring_from_utf8 -//============================================================ - -WCHAR *wstring_from_utf8(const char *utf8string) -{ - int char_count; - WCHAR *result; - - // convert MAME string (UTF-8) to UTF-16 - char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0); - result = (WCHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count); - - return result; -} - - -//============================================================ -// utf8_from_wstring -//============================================================ - -char *utf8_from_wstring(const WCHAR *wstring) -{ - int char_count; - char *result; - - // convert UTF-16 to MAME string (UTF-8) - char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL); - result = (char *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, NULL, NULL); - - return result; -} - -//============================================================ -// osd_uchar_from_osdchar -//============================================================ - -int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count) -{ - WCHAR wch; - - count = MIN(count, IsDBCSLeadByte(*osdchar) ? 2 : 1); - if (MultiByteToWideChar(CP_ACP, 0, osdchar, (DWORD)count, &wch, 1) != 0) - *uchar = wch; - else - *uchar = 0; - return (int) count; -} - -#else - -//============================================================ -// osd_uchar_from_osdchar -//============================================================ - -int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count) -{ - wchar_t wch; - - count = mbstowcs(&wch, (char *)osdchar, 1); - if (count != -1) - *uchar = wch; - else - *uchar = 0; - - return count; -} - -#endif diff --git a/src/osd/windows/strconv.h b/src/osd/windows/strconv.h deleted file mode 100644 index 4ad7e1e2e48..00000000000 --- a/src/osd/windows/strconv.h +++ /dev/null @@ -1,52 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// strconv.h - String conversion -// -// Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. -// Visit http://mamedev.org for licensing and usage restrictions. -// -//============================================================ - -#ifndef __OSD_STRCONV__ -#define __OSD_STRCONV__ - -#include "osdcore.h" - - - -//============================================================ -// FUNCTION PROTOTYPES -//============================================================ - -#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) - -#if defined(SDLMAME_WIN32) -#define WIN32_LEAN_AND_MEAN -#include -#endif -// the result of these functions has to be released with osd_free() - -CHAR *astring_from_utf8(const char *s); -char *utf8_from_astring(const CHAR *s); - -WCHAR *wstring_from_utf8(const char *s); -char *utf8_from_wstring(const WCHAR *s); - -#ifdef UNICODE -#define tstring_from_utf8 wstring_from_utf8 -#define utf8_from_tstring utf8_from_wstring -#else // !UNICODE -#define tstring_from_utf8 astring_from_utf8 -#define utf8_from_tstring utf8_from_astring -#endif // UNICODE - -#if defined(SDLMAME_WIN32) -#define _tcsncpy wcsncpy -#endif - -#endif //SDLMAME_WIN32 - - -#endif // __OSD_STRCONV__