Fix UWP build in non-UNICODE mode

This commit is contained in:
Anonymous Maarten 2024-07-18 20:23:47 +02:00 committed by Anonymous Maarten
parent 5ab1151508
commit 11c0dfbdfe
6 changed files with 13 additions and 13 deletions

View File

@ -145,7 +145,7 @@ SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler()
void SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher ^ sender, DeviceInformation ^ info)
{
SDL_assert(sender == this->watcher);
char *utf8dev = WIN_StringToUTF8(info->Name->Data());
char *utf8dev = WIN_StringToUTF8W(info->Name->Data());
if (utf8dev) {
WAVEFORMATEXTENSIBLE fmt;
Platform::Object ^ obj = info->Properties->Lookup(SDL_PKEY_AudioEngine_DeviceFormat);

View File

@ -250,7 +250,7 @@ WASAPI doesn't need this. This is just for DirectSound/WinMM.
char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
return WIN_StringToUTF8W(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
#else
static const GUID nullguid = { 0 };
const unsigned char *ptr;

View File

@ -115,7 +115,7 @@ SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
return NULL;
}
char *utf8Path = WIN_StringToUTF8(ucs2Path);
char *utf8Path = WIN_StringToUTF8W(ucs2Path);
utf8Paths[pathType] = utf8Path;
SDL_free(utf8Path);
return utf8Paths[pathType].c_str();
@ -181,13 +181,13 @@ SDL_GetPrefPath(const char *org, const char *app)
}
SDL_wcslcpy(path, srcPath, SDL_arraysize(path));
worg = WIN_UTF8ToString(org);
worg = WIN_UTF8ToStringW(org);
if (!worg) {
SDL_OutOfMemory();
return NULL;
}
wapp = WIN_UTF8ToString(app);
wapp = WIN_UTF8ToStringW(app);
if (!wapp) {
SDL_free(worg);
SDL_OutOfMemory();
@ -232,7 +232,7 @@ SDL_GetPrefPath(const char *org, const char *app)
SDL_wcslcat(path, L"\\", new_wpath_len + 1);
retval = WIN_StringToUTF8(path);
retval = WIN_StringToUTF8W(path);
return retval;
}

View File

@ -32,23 +32,23 @@
void *SDL_LoadObject(const char *sofile)
{
void *handle;
LPTSTR tstr;
LPWSTR wstr;
if (!sofile) {
SDL_InvalidParamError("sofile");
return NULL;
}
tstr = WIN_UTF8ToString(sofile);
wstr = WIN_UTF8ToStringW(sofile);
#ifdef __WINRT__
/* WinRT only publicly supports LoadPackagedLibrary() for loading .dll
files. LoadLibrary() is a private API, and not available for apps
(that can be published to MS' Windows Store.)
*/
handle = (void *)LoadPackagedLibrary(tstr, 0);
handle = (void *)LoadPackagedLibrary(wstr, 0);
#else
handle = (void *)LoadLibrary(tstr);
handle = (void *)LoadLibraryW(wstr);
#endif
SDL_free(tstr);
SDL_free(wstr);
/* Generate an error message if all loads failed */
if (!handle) {

View File

@ -35,7 +35,7 @@ using namespace Windows::Foundation;
using namespace Windows::UI::Popups;
static String ^ WINRT_UTF8ToPlatformString(const char *str) {
wchar_t *wstr = WIN_UTF8ToString(str);
wchar_t *wstr = WIN_UTF8ToStringW(str);
String ^ rtstr = ref new String(wstr);
SDL_free(wstr);
return rtstr;

View File

@ -321,7 +321,7 @@ static int WINRT_AddDisplaysForOutput(_THIS, IDXGIAdapter1 *dxgiAdapter1, int ou
WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::FindClosestMatchingMode failed", hr);
goto done;
} else {
displayName = WIN_StringToUTF8(dxgiOutputDesc.DeviceName);
displayName = WIN_StringToUTF8W(dxgiOutputDesc.DeviceName);
display.name = displayName;
WINRT_DXGIModeToSDLDisplayMode(&closestMatch, &display.desktop_mode);
display.current_mode = display.desktop_mode;