Dummy implementation of MultiByteToWideChar & WideCharToMultiByte.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-10-06 20:57:18 +01:00
parent 14fdc2520b
commit ffddc18fe6
5 changed files with 41 additions and 0 deletions

View file

@ -48,6 +48,7 @@ add_library(appleii SHARED
linux/windows/dsound.cpp linux/windows/dsound.cpp
linux/windows/guiddef.cpp linux/windows/guiddef.cpp
linux/windows/dmusicc.cpp linux/windows/dmusicc.cpp
linux/windows/winnls.cpp
linux/data.cpp linux/data.cpp
linux/benchmark.cpp linux/benchmark.cpp

View file

@ -20,3 +20,4 @@
#include "linux/windows/mmreg.h" #include "linux/windows/mmreg.h"
#include "linux/windows/mmsystem.h" #include "linux/windows/mmsystem.h"
#include "linux/windows/dmusicc.h" #include "linux/windows/dmusicc.h"
#include "linux/windows/winnls.h"

View file

@ -139,6 +139,7 @@ typedef short SHORT;
typedef /*long*/int LONG; typedef /*long*/int LONG;
typedef SHORT *PSHORT; typedef SHORT *PSHORT;
typedef LONG *PLONG; typedef LONG *PLONG;
typedef wchar_t WCHAR;
#endif #endif
typedef LONG HRESULT; typedef LONG HRESULT;
@ -166,6 +167,8 @@ typedef LPSTR PTSTR, LPTSTR;
typedef LPCSTR LPCTSTR; typedef LPCSTR LPCTSTR;
typedef LPSTR LP; typedef LPSTR LP;
typedef WCHAR *LPWSTR;
typedef CONST WCHAR *LPCWSTR;
#ifndef _TCHAR_DEFINED #ifndef _TCHAR_DEFINED
// TCHAR a typedef or a define? // TCHAR a typedef or a define?

View file

@ -0,0 +1,26 @@
#include "linux/windows/winnls.h"
#include <cstdlib>
#include <cstring>
// massive hack until I understand how it works!
INT WINAPI MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, INT cbMultiByte, LPWSTR lpWideCharStr, INT cchWideChar)
{
// int res = mbstowcs(lpWideCharStr, lpMultiByteStr, strlen(lpMultiByteStr));
if (lpWideCharStr)
{
strcpy(reinterpret_cast<char *>(lpWideCharStr), lpMultiByteStr);
}
return strlen(lpMultiByteStr) + 1; // add NULL char at end
}
INT WINAPI WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, INT cchWideChar, LPSTR lpMultiByteStr, INT cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar)
{
if (lpMultiByteStr)
{
strcpy(lpMultiByteStr, reinterpret_cast<const char *>(lpWideCharStr));
}
// size_t res = wcstombs(lpMultiByteStr, lpWideCharStr, cbMultiByte);
return strlen((const char *)lpWideCharStr) + 1;
}

View file

@ -0,0 +1,10 @@
#pragma once
#include "linux/windows/wincompat.h"
#define CP_ACP 0
#define CP_UTF8 65001
#define MB_ERR_INVALID_CHARS 0x08
INT WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT);
INT WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,LPBOOL);