TTS: Add TTS support when compiling with msvc.

This commit is contained in:
Jaromir Wysoglad 2019-07-27 01:06:35 +02:00 committed by Filippos Karapetis
parent 990ab61793
commit e965df1e88
4 changed files with 17 additions and 9 deletions

View file

@ -81,7 +81,7 @@ bool confirmWindowsVersion(int majorVersion, int minorVersion) {
return VerifyVersionInfoFunc(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask); return VerifyVersionInfoFunc(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask);
} }
wchar_t *ansiToUnicode(const char *s, uint codePage) { wchar_t *ansiToUnicode(const char *s, unsigned int codePage) {
DWORD size = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0); DWORD size = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
if (size > 0) { if (size > 0) {
@ -93,7 +93,7 @@ wchar_t *ansiToUnicode(const char *s, uint codePage) {
return NULL; return NULL;
} }
char *unicodeToAnsi(const wchar_t *s, uint codePage) { char *unicodeToAnsi(const wchar_t *s, unsigned int codePage) {
DWORD size = WideCharToMultiByte(codePage, 0, s, -1, NULL, 0, 0, 0); DWORD size = WideCharToMultiByte(codePage, 0, s, -1, NULL, 0, 0, 0);
if (size > 0) { if (size > 0) {
@ -105,7 +105,7 @@ char *unicodeToAnsi(const wchar_t *s, uint codePage) {
return NULL; return NULL;
} }
uint getCurrentCharset() { unsigned int getCurrentCharset() {
#ifdef USE_TRANSLATION #ifdef USE_TRANSLATION
Common::String charset = TransMan.getCurrentCharset(); Common::String charset = TransMan.getCurrentCharset();
if (charset == "iso-8859-2") if (charset == "iso-8859-2")

View file

@ -45,7 +45,7 @@ bool confirmWindowsVersion(int majorVersion, int minorVersion);
* *
* @note Return value must be freed by the caller. * @note Return value must be freed by the caller.
*/ */
wchar_t *ansiToUnicode(const char *s, uint codePage = CP_ACP); wchar_t *ansiToUnicode(const char *s, unsigned int codePage = CP_ACP);
/** /**
* Converts a Windows wide-character string into a C string. * Converts a Windows wide-character string into a C string.
* Used to interact with Win32 Unicode APIs with no ANSI fallback. * Used to interact with Win32 Unicode APIs with no ANSI fallback.
@ -55,9 +55,9 @@ wchar_t *ansiToUnicode(const char *s, uint codePage = CP_ACP);
* *
* @note Return value must be freed by the caller. * @note Return value must be freed by the caller.
*/ */
char *unicodeToAnsi(const wchar_t *s, uint codePage = CP_ACP); char *unicodeToAnsi(const wchar_t *s, unsigned int codePage = CP_ACP);
uint getCurrentCharset(); unsigned int getCurrentCharset();
} }

View file

@ -1371,7 +1371,7 @@ public:
WAVEFORMATEX * m_pCoMemWaveFormatEx; WAVEFORMATEX * m_pCoMemWaveFormatEx;
static CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) static HRESULT CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)
{ {
ULONG cb = sizeof(WAVEFORMATEX) + pSrc->cbSize; ULONG cb = sizeof(WAVEFORMATEX) + pSrc->cbSize;
*ppCoMemWFEX = (WAVEFORMATEX *)::CoTaskMemAlloc(cb); *ppCoMemWFEX = (WAVEFORMATEX *)::CoTaskMemAlloc(cb);

View file

@ -390,7 +390,7 @@ int main(int argc, char *argv[]) {
#endif #endif
} }
bool updatesEnabled = false, curlEnabled = false, sdlnetEnabled = false; bool updatesEnabled = false, curlEnabled = false, sdlnetEnabled = false, ttsEnabled = false;
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) { for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
if (i->enable) { if (i->enable) {
if (!strcmp(i->name, "updates")) if (!strcmp(i->name, "updates"))
@ -399,6 +399,8 @@ int main(int argc, char *argv[]) {
curlEnabled = true; curlEnabled = true;
else if (!strcmp(i->name, "sdlnet")) else if (!strcmp(i->name, "sdlnet"))
sdlnetEnabled = true; sdlnetEnabled = true;
else if (!strcmp(i->name, "tts"))
ttsEnabled = true;
} }
} }
@ -424,6 +426,11 @@ int main(int argc, char *argv[]) {
setup.libraries.push_back("winmm"); setup.libraries.push_back("winmm");
} }
if (ttsEnabled) {
setup.libraries.push_back("sapi");
setup.defines.push_back("USE_WINDOWS_TTS");
}
setup.defines.push_back("SDL_BACKEND"); setup.defines.push_back("SDL_BACKEND");
if (!setup.useSDL2) { if (!setup.useSDL2) {
cout << "\nBuilding against SDL 1.2\n\n"; cout << "\nBuilding against SDL 1.2\n\n";
@ -1088,7 +1095,8 @@ const Feature s_features[] = {
{ "dialogs", "USE_SYSDIALOGS", "", true, "System dialogs support"}, { "dialogs", "USE_SYSDIALOGS", "", true, "System dialogs support"},
{ "langdetect", "USE_DETECTLANG", "", true, "System language detection support" }, // This feature actually depends on "translation", there { "langdetect", "USE_DETECTLANG", "", true, "System language detection support" }, // This feature actually depends on "translation", there
// is just no current way of properly detecting this... // is just no current way of properly detecting this...
{ "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", "", false, "Text console debugger" } // This feature is always applied in xcode projects { "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", "", false, "Text console debugger" }, // This feature is always applied in xcode projects
{ "tts", "USE_TTS", "", false, "Text to speech support"}
}; };
const Tool s_tools[] = { const Tool s_tools[] = {