diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-02-21 20:48:21 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-02-23 11:25:39 +0100 |
commit | b427ddce887617f17aefdbe1f22ca1e00d013c3d (patch) | |
tree | 06fd938bd05dd716ba2d573978789f2c8e068505 /src/music | |
parent | beeb9e0a1b1c6ceb61499edeb8cd6cf7999d12ea (diff) | |
download | openttd-b427ddce887617f17aefdbe1f22ca1e00d013c3d.tar.xz |
Codechange: Switch to explicit wide strings
Diffstat (limited to 'src/music')
-rw-r--r-- | src/music/dmusic.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index c35765337..b0e34070c 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -81,7 +81,7 @@ struct DLSFile { std::vector<DLSWave> waves; /** Try loading a DLS file into memory. */ - bool LoadFile(const TCHAR *file); + bool LoadFile(const wchar_t *file); private: /** Load an articulation structure from a DLS file. */ @@ -428,11 +428,11 @@ bool DLSFile::ReadDLSWaveList(FILE *f, DWORD list_length) return true; } -bool DLSFile::LoadFile(const TCHAR *file) +bool DLSFile::LoadFile(const wchar_t *file) { DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file)); - FILE *f = _tfopen(file, _T("rb")); + FILE *f = _wfopen(file, L"rb"); if (f == nullptr) return false; FileCloser f_scope(f); @@ -861,11 +861,11 @@ static const char *LoadDefaultDLSFile(const char *user_dls) if (user_dls == nullptr) { /* Try loading the default GM DLS file stored in the registry. */ HKEY hkDM; - if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\DirectMusic"), 0, KEY_READ, &hkDM))) { - TCHAR dls_path[MAX_PATH]; + if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\DirectMusic", 0, KEY_READ, &hkDM))) { + wchar_t dls_path[MAX_PATH]; DWORD buf_size = sizeof(dls_path); // Buffer size as to be given in bytes! - if (SUCCEEDED(RegQueryValueEx(hkDM, _T("GMFilePath"), nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) { - TCHAR expand_path[MAX_PATH * 2]; + if (SUCCEEDED(RegQueryValueEx(hkDM, L"GMFilePath", nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) { + wchar_t expand_path[MAX_PATH * 2]; ExpandEnvironmentStrings(dls_path, expand_path, lengthof(expand_path)); if (!dls_file.LoadFile(expand_path)) DEBUG(driver, 1, "Failed to load default GM DLS file from registry"); } @@ -874,8 +874,8 @@ static const char *LoadDefaultDLSFile(const char *user_dls) /* If we couldn't load the file from the registry, try again at the default install path of the GM DLS file. */ if (dls_file.instruments.size() == 0) { - static const TCHAR *DLS_GM_FILE = _T("%windir%\\System32\\drivers\\gm.dls"); - TCHAR path[MAX_PATH]; + static const wchar_t *DLS_GM_FILE = L"%windir%\\System32\\drivers\\gm.dls"; + wchar_t path[MAX_PATH]; ExpandEnvironmentStrings(DLS_GM_FILE, path, lengthof(path)); if (!dls_file.LoadFile(path)) return "Can't load GM DLS collection"; |