mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Switch to explicit wide strings
parent
beeb9e0a1b
commit
b427ddce88
|
@ -134,7 +134,7 @@ static void debug_print(const char *dbg, const char *buf)
|
|||
char buffer[512];
|
||||
seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
|
||||
#if defined(_WIN32)
|
||||
TCHAR system_buf[512];
|
||||
wchar_t system_buf[512];
|
||||
convert_to_fs(buffer, system_buf, lengthof(system_buf), true);
|
||||
_fputts(system_buf, stderr);
|
||||
#else
|
||||
|
|
|
@ -107,14 +107,14 @@ DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode)
|
|||
struct DIR;
|
||||
|
||||
struct dirent { // XXX - only d_name implemented
|
||||
TCHAR *d_name; // name of found file
|
||||
wchar_t *d_name; // name of found file
|
||||
/* little hack which will point to parent DIR struct which will
|
||||
* save us a call to GetFileAttributes if we want information
|
||||
* about the file (for example in function fio_bla) */
|
||||
DIR *dir;
|
||||
};
|
||||
|
||||
DIR *opendir(const TCHAR *path);
|
||||
DIR *opendir(const wchar_t *path);
|
||||
struct dirent *readdir(DIR *d);
|
||||
int closedir(DIR *d);
|
||||
#else
|
||||
|
|
12
src/ini.cpp
12
src/ini.cpp
|
@ -92,17 +92,15 @@ bool IniFile::SaveToDisk(const std::string &filename)
|
|||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* _tcsncpy = strcpy is TCHAR is char, but isn't when TCHAR is wchar. */
|
||||
# undef strncpy
|
||||
/* Allocate space for one more \0 character. */
|
||||
TCHAR tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1];
|
||||
_tcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH);
|
||||
_tcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH);
|
||||
wchar_t tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1];
|
||||
wcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH);
|
||||
wcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH);
|
||||
/* SHFileOperation wants a double '\0' terminated string. */
|
||||
tfilename[MAX_PATH - 1] = '\0';
|
||||
tfile_new[MAX_PATH - 1] = '\0';
|
||||
tfilename[_tcslen(tfilename) + 1] = '\0';
|
||||
tfile_new[_tcslen(tfile_new) + 1] = '\0';
|
||||
tfilename[wcslen(tfilename) + 1] = '\0';
|
||||
tfile_new[wcslen(tfile_new) + 1] = '\0';
|
||||
|
||||
/* Rename file without any user confirmation. */
|
||||
SHFILEOPSTRUCT shfopt;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -150,7 +150,7 @@ static uint32 CalcCRC(byte *data, uint size, uint32 crc)
|
|||
return crc;
|
||||
}
|
||||
|
||||
static void GetFileInfo(DebugFileInfo *dfi, const TCHAR *filename)
|
||||
static void GetFileInfo(DebugFileInfo *dfi, const wchar_t *filename)
|
||||
{
|
||||
HANDLE file;
|
||||
memset(dfi, 0, sizeof(*dfi));
|
||||
|
@ -183,7 +183,7 @@ static void GetFileInfo(DebugFileInfo *dfi, const TCHAR *filename)
|
|||
|
||||
static char *PrintModuleInfo(char *output, const char *last, HMODULE mod)
|
||||
{
|
||||
TCHAR buffer[MAX_PATH];
|
||||
wchar_t buffer[MAX_PATH];
|
||||
DebugFileInfo dfi;
|
||||
|
||||
GetModuleFileName(mod, buffer, MAX_PATH);
|
||||
|
@ -491,7 +491,7 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c
|
|||
/* virtual */ int CrashLogWindows::WriteCrashDump(char *filename, const char *filename_last) const
|
||||
{
|
||||
int ret = 0;
|
||||
HMODULE dbghelp = LoadLibrary(_T("dbghelp.dll"));
|
||||
HMODULE dbghelp = LoadLibrary(L"dbghelp.dll");
|
||||
if (dbghelp != nullptr) {
|
||||
typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,
|
||||
MINIDUMP_TYPE,
|
||||
|
@ -553,19 +553,19 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
|||
}
|
||||
|
||||
if (GamelogTestEmergency()) {
|
||||
static const TCHAR _emergency_crash[] =
|
||||
_T("A serious fault condition occurred in the game. The game will shut down.\n")
|
||||
_T("As you loaded an emergency savegame no crash information will be generated.\n");
|
||||
MessageBox(nullptr, _emergency_crash, _T("Fatal Application Failure"), MB_ICONERROR);
|
||||
static const wchar_t _emergency_crash[] =
|
||||
L"A serious fault condition occurred in the game. The game will shut down.\n"
|
||||
L"As you loaded an emergency savegame no crash information will be generated.\n";
|
||||
MessageBox(nullptr, _emergency_crash, L"Fatal Application Failure", MB_ICONERROR);
|
||||
ExitProcess(3);
|
||||
}
|
||||
|
||||
if (SaveloadCrashWithMissingNewGRFs()) {
|
||||
static const TCHAR _saveload_crash[] =
|
||||
_T("A serious fault condition occurred in the game. The game will shut down.\n")
|
||||
_T("As you loaded an savegame for which you do not have the required NewGRFs\n")
|
||||
_T("no crash information will be generated.\n");
|
||||
MessageBox(nullptr, _saveload_crash, _T("Fatal Application Failure"), MB_ICONERROR);
|
||||
static const wchar_t _saveload_crash[] =
|
||||
L"A serious fault condition occurred in the game. The game will shut down.\n"
|
||||
L"As you loaded an savegame for which you do not have the required NewGRFs\n"
|
||||
L"no crash information will be generated.\n";
|
||||
MessageBox(nullptr, _saveload_crash, L"Fatal Application Failure", MB_ICONERROR);
|
||||
ExitProcess(3);
|
||||
}
|
||||
|
||||
|
@ -641,20 +641,20 @@ static void CDECL CustomAbort(int signal)
|
|||
|
||||
static bool _expanded;
|
||||
|
||||
static const TCHAR _crash_desc[] =
|
||||
_T("A serious fault condition occurred in the game. The game will shut down.\n")
|
||||
_T("Please send the crash information and the crash.dmp file (if any) to the developers.\n")
|
||||
_T("This will greatly help debugging. The correct place to do this is https://github.com/OpenTTD/OpenTTD/issues. ")
|
||||
_T("The information contained in the report is displayed below.\n")
|
||||
_T("Press \"Emergency save\" to attempt saving the game. Generated file(s):\n")
|
||||
_T("%s");
|
||||
static const wchar_t _crash_desc[] =
|
||||
L"A serious fault condition occurred in the game. The game will shut down.\n"
|
||||
L"Please send the crash information and the crash.dmp file (if any) to the developers.\n"
|
||||
L"This will greatly help debugging. The correct place to do this is https://github.com/OpenTTD/OpenTTD/issues. "
|
||||
L"The information contained in the report is displayed below.\n"
|
||||
L"Press \"Emergency save\" to attempt saving the game. Generated file(s):\n"
|
||||
L"%s";
|
||||
|
||||
static const TCHAR _save_succeeded[] =
|
||||
_T("Emergency save succeeded.\nIts location is '%s'.\n")
|
||||
_T("Be aware that critical parts of the internal game state may have become ")
|
||||
_T("corrupted. The saved game is not guaranteed to work.");
|
||||
static const wchar_t _save_succeeded[] =
|
||||
L"Emergency save succeeded.\nIts location is '%s'.\n"
|
||||
L"Be aware that critical parts of the internal game state may have become "
|
||||
L"corrupted. The saved game is not guaranteed to work.";
|
||||
|
||||
static const TCHAR * const _expand_texts[] = {_T("S&how report >>"), _T("&Hide report <<") };
|
||||
static const wchar_t * const _expand_texts[] = {L"S&how report >>", L"&Hide report <<" };
|
||||
|
||||
static void SetWndSize(HWND wnd, int mode)
|
||||
{
|
||||
|
@ -677,17 +677,13 @@ static void SetWndSize(HWND wnd, int mode)
|
|||
}
|
||||
}
|
||||
|
||||
/* When TCHAR is char, then _sntprintf becomes snprintf. When TCHAR is wchar it doesn't. Likewise for strcat. */
|
||||
#undef snprintf
|
||||
#undef strcat
|
||||
|
||||
static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG: {
|
||||
/* We need to put the crash-log in a separate buffer because the default
|
||||
* buffer in MB_TO_WIDE is not large enough (512 chars) */
|
||||
TCHAR crash_msgW[lengthof(CrashLogWindows::current->crashlog)];
|
||||
* buffer in OTTD2FS is not large enough (512 chars) */
|
||||
wchar_t crash_msgW[lengthof(CrashLogWindows::current->crashlog)];
|
||||
/* Convert unix -> dos newlines because the edit box only supports that properly :( */
|
||||
const char *unix_nl = CrashLogWindows::current->crashlog;
|
||||
char dos_nl[lengthof(CrashLogWindows::current->crashlog)];
|
||||
|
@ -700,20 +696,20 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA
|
|||
*p = '\0';
|
||||
|
||||
/* Add path to crash.log and crash.dmp (if any) to the crash window text */
|
||||
size_t len = _tcslen(_crash_desc) + 2;
|
||||
len += _tcslen(OTTD2FS(CrashLogWindows::current->crashlog_filename)) + 2;
|
||||
len += _tcslen(OTTD2FS(CrashLogWindows::current->crashdump_filename)) + 2;
|
||||
len += _tcslen(OTTD2FS(CrashLogWindows::current->screenshot_filename)) + 1;
|
||||
size_t len = wcslen(_crash_desc) + 2;
|
||||
len += wcslen(OTTD2FS(CrashLogWindows::current->crashlog_filename)) + 2;
|
||||
len += wcslen(OTTD2FS(CrashLogWindows::current->crashdump_filename)) + 2;
|
||||
len += wcslen(OTTD2FS(CrashLogWindows::current->screenshot_filename)) + 1;
|
||||
|
||||
TCHAR *text = AllocaM(TCHAR, len);
|
||||
_sntprintf(text, len, _crash_desc, OTTD2FS(CrashLogWindows::current->crashlog_filename));
|
||||
if (OTTD2FS(CrashLogWindows::current->crashdump_filename)[0] != _T('\0')) {
|
||||
_tcscat(text, _T("\n"));
|
||||
_tcscat(text, OTTD2FS(CrashLogWindows::current->crashdump_filename));
|
||||
wchar_t *text = AllocaM(wchar_t, len);
|
||||
_snwprintf(text, len, _crash_desc, OTTD2FS(CrashLogWindows::current->crashlog_filename));
|
||||
if (OTTD2FS(CrashLogWindows::current->crashdump_filename)[0] != L'\0') {
|
||||
wcscat(text, L"\n");
|
||||
wcscat(text, OTTD2FS(CrashLogWindows::current->crashdump_filename));
|
||||
}
|
||||
if (OTTD2FS(CrashLogWindows::current->screenshot_filename)[0] != _T('\0')) {
|
||||
_tcscat(text, _T("\n"));
|
||||
_tcscat(text, OTTD2FS(CrashLogWindows::current->screenshot_filename));
|
||||
if (OTTD2FS(CrashLogWindows::current->screenshot_filename)[0] != L'\0') {
|
||||
wcscat(text, L"\n");
|
||||
wcscat(text, OTTD2FS(CrashLogWindows::current->screenshot_filename));
|
||||
}
|
||||
|
||||
SetDlgItemText(wnd, 10, text);
|
||||
|
@ -729,12 +725,12 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA
|
|||
case 13: // Emergency save
|
||||
char filename[MAX_PATH];
|
||||
if (CrashLogWindows::current->WriteSavegame(filename, lastof(filename))) {
|
||||
size_t len = _tcslen(_save_succeeded) + _tcslen(OTTD2FS(filename)) + 1;
|
||||
TCHAR *text = AllocaM(TCHAR, len);
|
||||
_sntprintf(text, len, _save_succeeded, OTTD2FS(filename));
|
||||
MessageBox(wnd, text, _T("Save successful"), MB_ICONINFORMATION);
|
||||
size_t len = wcslen(_save_succeeded) + wcslen(OTTD2FS(filename)) + 1;
|
||||
wchar_t *text = AllocaM(wchar_t, len);
|
||||
_snwprintf(text, len, _save_succeeded, OTTD2FS(filename));
|
||||
MessageBox(wnd, text, L"Save successful", MB_ICONINFORMATION);
|
||||
} else {
|
||||
MessageBox(wnd, _T("Save failed"), _T("Save failed"), MB_ICONINFORMATION);
|
||||
MessageBox(wnd, L"Save failed", L"Save failed", MB_ICONINFORMATION);
|
||||
}
|
||||
break;
|
||||
case 15: // Expand window to show crash-message
|
||||
|
|
|
@ -46,10 +46,10 @@ extern FT_Library _library;
|
|||
* @param long_path the path in system encoding.
|
||||
* @return the short path in ANSI (ASCII).
|
||||
*/
|
||||
static const char *GetShortPath(const TCHAR *long_path)
|
||||
static const char *GetShortPath(const wchar_t *long_path)
|
||||
{
|
||||
static char short_path[MAX_PATH];
|
||||
WCHAR short_path_w[MAX_PATH];
|
||||
wchar_t short_path_w[MAX_PATH];
|
||||
GetShortPathName(long_path, short_path_w, lengthof(short_path_w));
|
||||
WideCharToMultiByte(CP_ACP, 0, short_path_w, -1, short_path, lengthof(short_path), nullptr, nullptr);
|
||||
return short_path;
|
||||
|
@ -69,8 +69,8 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
|||
FT_Error err = FT_Err_Cannot_Open_Resource;
|
||||
HKEY hKey;
|
||||
LONG ret;
|
||||
TCHAR vbuffer[MAX_PATH], dbuffer[256];
|
||||
TCHAR *pathbuf;
|
||||
wchar_t vbuffer[MAX_PATH], dbuffer[256];
|
||||
wchar_t *pathbuf;
|
||||
const char *font_path;
|
||||
uint index;
|
||||
size_t path_len;
|
||||
|
@ -83,10 +83,10 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
|||
}
|
||||
|
||||
/* Convert font name to file system encoding. */
|
||||
TCHAR *font_namep = _tcsdup(OTTD2FS(font_name));
|
||||
wchar_t *font_namep = wcsdup(OTTD2FS(font_name));
|
||||
|
||||
for (index = 0;; index++) {
|
||||
TCHAR *s;
|
||||
wchar_t *s;
|
||||
DWORD vbuflen = lengthof(vbuffer);
|
||||
DWORD dbuflen = lengthof(dbuffer);
|
||||
|
||||
|
@ -102,13 +102,13 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
|||
* TTC files, font files which contain more than one font are separated
|
||||
* by '&'. Our best bet will be to do substr match for the fontname
|
||||
* and then let FreeType figure out which index to load */
|
||||
s = _tcschr(vbuffer, _T('('));
|
||||
s = wcschr(vbuffer, L'(');
|
||||
if (s != nullptr) s[-1] = '\0';
|
||||
|
||||
if (_tcschr(vbuffer, _T('&')) == nullptr) {
|
||||
if (_tcsicmp(vbuffer, font_namep) == 0) break;
|
||||
if (wcschr(vbuffer, L'&') == nullptr) {
|
||||
if (wcsicmp(vbuffer, font_namep) == 0) break;
|
||||
} else {
|
||||
if (_tcsstr(vbuffer, font_namep) != nullptr) break;
|
||||
if (wcsstr(vbuffer, font_namep) != nullptr) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,9 +121,9 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
|||
* contain multiple fonts inside this single file. GetFontData however
|
||||
* returns the whole file, so we need to check each font inside to get the
|
||||
* proper font. */
|
||||
path_len = _tcslen(vbuffer) + _tcslen(dbuffer) + 2; // '\' and terminating nul.
|
||||
pathbuf = AllocaM(TCHAR, path_len);
|
||||
_sntprintf(pathbuf, path_len, _T("%s\\%s"), vbuffer, dbuffer);
|
||||
path_len = wcslen(vbuffer) + wcslen(dbuffer) + 2; // '\' and terminating nul.
|
||||
pathbuf = AllocaM(wchar_t, path_len);
|
||||
_snwprintf(pathbuf, path_len, L"%s\\%s", vbuffer, dbuffer);
|
||||
|
||||
/* Convert the path into something that FreeType understands. */
|
||||
font_path = GetShortPath(pathbuf);
|
||||
|
@ -228,13 +228,13 @@ err2:
|
|||
ReleaseDC(nullptr, dc);
|
||||
DeleteObject(font);
|
||||
err1:
|
||||
return ret_font_name == nullptr ? WIDE_TO_MB((const TCHAR *)logfont->elfFullName) : ret_font_name;
|
||||
return ret_font_name == nullptr ? FS2OTTD((const wchar_t *)logfont->elfFullName) : ret_font_name;
|
||||
}
|
||||
#endif /* WITH_FREETYPE */
|
||||
|
||||
class FontList {
|
||||
protected:
|
||||
TCHAR **fonts;
|
||||
wchar_t **fonts;
|
||||
uint items;
|
||||
uint capacity;
|
||||
|
||||
|
@ -251,9 +251,9 @@ public:
|
|||
free(this->fonts);
|
||||
}
|
||||
|
||||
bool Add(const TCHAR *font) {
|
||||
bool Add(const wchar_t *font) {
|
||||
for (uint i = 0; i < this->items; i++) {
|
||||
if (_tcscmp(this->fonts[i], font) == 0) return false;
|
||||
if (wcscmp(this->fonts[i], font) == 0) return false;
|
||||
}
|
||||
|
||||
if (this->items == this->capacity) {
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
this->fonts = ReallocT(this->fonts, this->capacity);
|
||||
}
|
||||
|
||||
this->fonts[this->items++] = _tcsdup(font);
|
||||
this->fonts[this->items++] = wcsdup(font);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
|
|||
EFCParam *info = (EFCParam *)lParam;
|
||||
|
||||
/* Skip duplicates */
|
||||
if (!info->fonts.Add((const TCHAR *)logfont->elfFullName)) return 1;
|
||||
if (!info->fonts.Add((const wchar_t *)logfont->elfFullName)) return 1;
|
||||
/* Only use TrueType fonts */
|
||||
if (!(type & TRUETYPE_FONTTYPE)) return 1;
|
||||
/* Don't use SYMBOL fonts */
|
||||
|
@ -305,7 +305,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
|
|||
}
|
||||
|
||||
char font_name[MAX_PATH];
|
||||
convert_from_fs((const TCHAR *)logfont->elfFullName, font_name, lengthof(font_name));
|
||||
convert_from_fs((const wchar_t *)logfont->elfFullName, font_name, lengthof(font_name));
|
||||
|
||||
#ifdef WITH_FREETYPE
|
||||
/* Add english name after font name */
|
||||
|
@ -342,7 +342,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
|||
{
|
||||
DEBUG(freetype, 1, "Trying fallback fonts");
|
||||
EFCParam langInfo;
|
||||
if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(TCHAR)) == 0) {
|
||||
if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(wchar_t)) == 0) {
|
||||
/* Invalid langid or some other mysterious error, can't determine fallback font. */
|
||||
DEBUG(freetype, 1, "Can't get locale info for fallback font (langid=0x%x)", winlangid);
|
||||
return false;
|
||||
|
@ -601,7 +601,7 @@ void LoadWin32Font(FontSize fs)
|
|||
} else if (strchr(settings->font, '.') != nullptr) {
|
||||
/* Might be a font file name, try load it. */
|
||||
|
||||
TCHAR fontPath[MAX_PATH] = {};
|
||||
wchar_t fontPath[MAX_PATH] = {};
|
||||
|
||||
/* See if this is an absolute path. */
|
||||
if (FileExists(settings->font)) {
|
||||
|
@ -619,7 +619,7 @@ void LoadWin32Font(FontSize fs)
|
|||
/* Try a nice little undocumented function first for getting the internal font name.
|
||||
* Some documentation is found at: http://www.undocprint.org/winspool/getfontresourceinfo */
|
||||
typedef BOOL(WINAPI *PFNGETFONTRESOURCEINFO)(LPCTSTR, LPDWORD, LPVOID, DWORD);
|
||||
static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(_T("Gdi32")), "GetFontResourceInfoW");
|
||||
static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(L"Gdi32"), "GetFontResourceInfoW");
|
||||
|
||||
if (GetFontResourceInfo != nullptr) {
|
||||
/* Try to query an array of LOGFONTs that describe the file. */
|
||||
|
@ -634,10 +634,10 @@ void LoadWin32Font(FontSize fs)
|
|||
|
||||
/* No dice yet. Use the file name as the font face name, hoping it matches. */
|
||||
if (logfont.lfFaceName[0] == 0) {
|
||||
TCHAR fname[_MAX_FNAME];
|
||||
_tsplitpath(fontPath, nullptr, nullptr, fname, nullptr);
|
||||
wchar_t fname[_MAX_FNAME];
|
||||
_wsplitpath(fontPath, nullptr, nullptr, fname, nullptr);
|
||||
|
||||
_tcsncpy_s(logfont.lfFaceName, lengthof(logfont.lfFaceName), fname, _TRUNCATE);
|
||||
wcsncpy_s(logfont.lfFaceName, lengthof(logfont.lfFaceName), fname, _TRUNCATE);
|
||||
logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr || strcasestr(settings->font, "-bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts.
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
~Win32FontCache();
|
||||
void ClearFontCache() override;
|
||||
GlyphID MapCharToGlyph(WChar key) override;
|
||||
const char *GetFontName() override { return WIDE_TO_MB(this->logfont.lfFaceName); }
|
||||
const char *GetFontName() override { return FS2OTTD(this->logfont.lfFaceName); }
|
||||
const void *GetOSHandle() override { return &this->logfont; }
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ bool LoadLibraryList(Function proc[], const char *dll)
|
|||
{
|
||||
while (*dll != '\0') {
|
||||
HMODULE lib;
|
||||
lib = LoadLibrary(MB_TO_WIDE(dll));
|
||||
lib = LoadLibrary(OTTD2FS(dll));
|
||||
|
||||
if (lib == nullptr) return false;
|
||||
for (;;) {
|
||||
|
@ -77,12 +77,12 @@ bool LoadLibraryList(Function proc[], const char *dll)
|
|||
void ShowOSErrorBox(const char *buf, bool system)
|
||||
{
|
||||
MyShowCursor(true);
|
||||
MessageBox(GetActiveWindow(), OTTD2FS(buf), _T("Error!"), MB_ICONSTOP | MB_TASKMODAL);
|
||||
MessageBox(GetActiveWindow(), OTTD2FS(buf), L"Error!", MB_ICONSTOP | MB_TASKMODAL);
|
||||
}
|
||||
|
||||
void OSOpenBrowser(const char *url)
|
||||
{
|
||||
ShellExecute(GetActiveWindow(), _T("open"), OTTD2FS(url), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
ShellExecute(GetActiveWindow(), L"open", OTTD2FS(url), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
/* Code below for windows version of opendir/readdir/closedir copied and
|
||||
|
@ -132,7 +132,7 @@ static inline void dir_free(DIR *d)
|
|||
}
|
||||
}
|
||||
|
||||
DIR *opendir(const TCHAR *path)
|
||||
DIR *opendir(const wchar_t *path)
|
||||
{
|
||||
DIR *d;
|
||||
UINT sem = SetErrorMode(SEM_FAILCRITICALERRORS); // disable 'no-disk' message box
|
||||
|
@ -141,12 +141,12 @@ DIR *opendir(const TCHAR *path)
|
|||
if ((fa != INVALID_FILE_ATTRIBUTES) && (fa & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
d = dir_calloc();
|
||||
if (d != nullptr) {
|
||||
TCHAR search_path[MAX_PATH];
|
||||
bool slash = path[_tcslen(path) - 1] == '\\';
|
||||
wchar_t search_path[MAX_PATH];
|
||||
bool slash = path[wcslen(path) - 1] == '\\';
|
||||
|
||||
/* build search path for FindFirstFile, try not to append additional slashes
|
||||
* as it throws Win9x off its groove for root directories */
|
||||
_sntprintf(search_path, lengthof(search_path), _T("%s%s*"), path, slash ? _T("") : _T("\\"));
|
||||
_snwprintf(search_path, lengthof(search_path), L"%s%s*", path, slash ? L"" : L"\\");
|
||||
*lastof(search_path) = '\0';
|
||||
d->hFind = FindFirstFile(search_path, &d->fd);
|
||||
|
||||
|
@ -204,8 +204,8 @@ bool FiosIsRoot(const char *file)
|
|||
|
||||
void FiosGetDrives(FileList &file_list)
|
||||
{
|
||||
TCHAR drives[256];
|
||||
const TCHAR *s;
|
||||
wchar_t drives[256];
|
||||
const wchar_t *s;
|
||||
|
||||
GetLogicalDriveStrings(lengthof(drives), drives);
|
||||
for (s = drives; *s != '\0';) {
|
||||
|
@ -245,10 +245,10 @@ bool FiosGetDiskFreeSpace(const char *path, uint64 *tot)
|
|||
{
|
||||
UINT sem = SetErrorMode(SEM_FAILCRITICALERRORS); // disable 'no-disk' message box
|
||||
bool retval = false;
|
||||
TCHAR root[4];
|
||||
wchar_t root[4];
|
||||
DWORD spc, bps, nfc, tnc;
|
||||
|
||||
_sntprintf(root, lengthof(root), _T("%c:") _T(PATHSEP), path[0]);
|
||||
_snwprintf(root, lengthof(root), L"%c:" PATHSEP, path[0]);
|
||||
if (tot != nullptr && GetDiskFreeSpace(root, &spc, &bps, &nfc, &tnc)) {
|
||||
*tot = ((spc * bps) * (uint64)nfc);
|
||||
retval = true;
|
||||
|
@ -366,7 +366,7 @@ static INT_PTR CALLBACK HelpDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM
|
|||
*q = '\0';
|
||||
/* We need to put the text in a separate buffer because the default
|
||||
* buffer in OTTD2FS might not be large enough (512 chars). */
|
||||
TCHAR help_msg_buf[8192];
|
||||
wchar_t help_msg_buf[8192];
|
||||
SetDlgItemText(wnd, 11, convert_to_fs(help_msg, help_msg_buf, lengthof(help_msg_buf)));
|
||||
SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
|
||||
} return TRUE;
|
||||
|
@ -400,8 +400,8 @@ void ShowInfo(const char *str)
|
|||
} else {
|
||||
/* We need to put the text in a separate buffer because the default
|
||||
* buffer in OTTD2FS might not be large enough (512 chars). */
|
||||
TCHAR help_msg_buf[8192];
|
||||
MessageBox(GetActiveWindow(), convert_to_fs(str, help_msg_buf, lengthof(help_msg_buf)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OK);
|
||||
wchar_t help_msg_buf[8192];
|
||||
MessageBox(GetActiveWindow(), convert_to_fs(str, help_msg_buf, lengthof(help_msg_buf)), L"OpenTTD", MB_ICONINFORMATION | MB_OK);
|
||||
}
|
||||
MyShowCursor(old);
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
|
||||
char *getcwd(char *buf, size_t size)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
wchar_t path[MAX_PATH];
|
||||
GetCurrentDirectory(MAX_PATH - 1, path);
|
||||
convert_from_fs(path, buf, size);
|
||||
return buf;
|
||||
|
@ -459,7 +459,7 @@ void DetermineBasePaths(const char *exe)
|
|||
{
|
||||
extern std::array<std::string, NUM_SEARCHPATHS> _searchpaths;
|
||||
|
||||
TCHAR path[MAX_PATH];
|
||||
wchar_t path[MAX_PATH];
|
||||
#ifdef WITH_PERSONAL_DIR
|
||||
if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PERSONAL, nullptr, SHGFP_TYPE_CURRENT, path))) {
|
||||
std::string tmp(FS2OTTD(path));
|
||||
|
@ -497,8 +497,8 @@ void DetermineBasePaths(const char *exe)
|
|||
_searchpaths[SP_WORKING_DIR] = cwd_s;
|
||||
} else {
|
||||
/* Use the folder of the config file as working directory. */
|
||||
TCHAR config_dir[MAX_PATH];
|
||||
_tcsncpy(path, convert_to_fs(_config_file.c_str(), path, lengthof(path)), lengthof(path));
|
||||
wchar_t config_dir[MAX_PATH];
|
||||
wcsncpy(path, convert_to_fs(_config_file.c_str(), path, lengthof(path)), lengthof(path));
|
||||
if (!GetFullPathName(path, lengthof(config_dir), config_dir, nullptr)) {
|
||||
DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
|
||||
_searchpaths[SP_WORKING_DIR].clear();
|
||||
|
@ -515,8 +515,8 @@ void DetermineBasePaths(const char *exe)
|
|||
DEBUG(misc, 0, "GetModuleFileName failed (%lu)\n", GetLastError());
|
||||
_searchpaths[SP_BINARY_DIR].clear();
|
||||
} else {
|
||||
TCHAR exec_dir[MAX_PATH];
|
||||
_tcsncpy(path, convert_to_fs(exe, path, lengthof(path)), lengthof(path));
|
||||
wchar_t exec_dir[MAX_PATH];
|
||||
wcsncpy(path, convert_to_fs(exe, path, lengthof(path)), lengthof(path));
|
||||
if (!GetFullPathName(path, lengthof(exec_dir), exec_dir, nullptr)) {
|
||||
DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
|
||||
_searchpaths[SP_BINARY_DIR].clear();
|
||||
|
@ -567,7 +567,7 @@ bool GetClipboardContents(char *buffer, const char *last)
|
|||
* @see the current code-page comes from video\win32_v.cpp, event-notification
|
||||
* WM_INPUTLANGCHANGE
|
||||
*/
|
||||
const char *FS2OTTD(const TCHAR *name)
|
||||
const char *FS2OTTD(const wchar_t *name)
|
||||
{
|
||||
static char utf8_buf[512];
|
||||
return convert_from_fs(name, utf8_buf, lengthof(utf8_buf));
|
||||
|
@ -582,9 +582,9 @@ const char *FS2OTTD(const TCHAR *name)
|
|||
* @param console_cp convert to the console encoding instead of the normal system encoding.
|
||||
* @return pointer to the converted string; if failed string is of zero-length
|
||||
*/
|
||||
const TCHAR *OTTD2FS(const char *name, bool console_cp)
|
||||
const wchar_t *OTTD2FS(const char *name, bool console_cp)
|
||||
{
|
||||
static TCHAR system_buf[512];
|
||||
static wchar_t system_buf[512];
|
||||
return convert_to_fs(name, system_buf, lengthof(system_buf), console_cp);
|
||||
}
|
||||
|
||||
|
@ -597,9 +597,9 @@ const TCHAR *OTTD2FS(const char *name, bool console_cp)
|
|||
* @param buflen length in characters of the receiving buffer
|
||||
* @return pointer to utf8_buf. If conversion fails the string is of zero-length
|
||||
*/
|
||||
char *convert_from_fs(const TCHAR *name, char *utf8_buf, size_t buflen)
|
||||
char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen)
|
||||
{
|
||||
const WCHAR *wide_buf = name;
|
||||
const wchar_t *wide_buf = name;
|
||||
|
||||
/* Convert UTF-16 string to UTF-8. */
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, wide_buf, -1, utf8_buf, (int)buflen, nullptr, nullptr);
|
||||
|
@ -619,7 +619,7 @@ char *convert_from_fs(const TCHAR *name, char *utf8_buf, size_t buflen)
|
|||
* @param console_cp convert to the console encoding instead of the normal system encoding.
|
||||
* @return pointer to system_buf. If conversion fails the string is of zero-length
|
||||
*/
|
||||
TCHAR *convert_to_fs(const char *name, TCHAR *system_buf, size_t buflen, bool console_cp)
|
||||
wchar_t *convert_to_fs(const char *name, wchar_t *system_buf, size_t buflen, bool console_cp)
|
||||
{
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, system_buf, (int)buflen);
|
||||
if (len == 0) system_buf[0] = '\0';
|
||||
|
@ -677,7 +677,7 @@ int OTTDStringCompare(const char *s1, const char *s2)
|
|||
#endif
|
||||
|
||||
if (first_time) {
|
||||
_CompareStringEx = (PFNCOMPARESTRINGEX)GetProcAddress(GetModuleHandle(_T("Kernel32")), "CompareStringEx");
|
||||
_CompareStringEx = (PFNCOMPARESTRINGEX)GetProcAddress(GetModuleHandle(L"Kernel32"), "CompareStringEx");
|
||||
first_time = false;
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ int OTTDStringCompare(const char *s1, const char *s2)
|
|||
}
|
||||
}
|
||||
|
||||
TCHAR s1_buf[512], s2_buf[512];
|
||||
wchar_t s1_buf[512], s2_buf[512];
|
||||
convert_to_fs(s1, s1_buf, lengthof(s1_buf));
|
||||
convert_to_fs(s2, s2_buf, lengthof(s2_buf));
|
||||
|
||||
|
|
|
@ -16,13 +16,8 @@ bool MyShowCursor(bool show, bool toggle = false);
|
|||
typedef void (*Function)(int);
|
||||
bool LoadLibraryList(Function proc[], const char *dll);
|
||||
|
||||
char *convert_from_fs(const TCHAR *name, char *utf8_buf, size_t buflen);
|
||||
TCHAR *convert_to_fs(const char *name, TCHAR *utf16_buf, size_t buflen, bool console_cp = false);
|
||||
|
||||
/* Function shortcuts for UTF-8 <> UNICODE conversion. These functions use an
|
||||
* internal buffer of max 512 characters. */
|
||||
# define MB_TO_WIDE(str) OTTD2FS(str)
|
||||
# define WIDE_TO_MB(str) FS2OTTD(str)
|
||||
char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
|
||||
wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen, bool console_cp = false);
|
||||
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
#define SHGFP_TYPE_CURRENT 0
|
||||
|
|
|
@ -48,7 +48,7 @@ static DWORD WINAPI SoundThread(LPVOID arg)
|
|||
if ((hdr->dwFlags & WHDR_INQUEUE) != 0) continue;
|
||||
MxMixSamples(hdr->lpData, hdr->dwBufferLength / 4);
|
||||
if (waveOutWrite(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) {
|
||||
MessageBox(nullptr, _T("Sounds are disabled until restart."), _T("waveOutWrite failed"), MB_ICONINFORMATION);
|
||||
MessageBox(nullptr, L"Sounds are disabled until restart.", L"waveOutWrite failed", MB_ICONINFORMATION);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
10
src/stdafx.h
10
src/stdafx.h
|
@ -260,12 +260,12 @@
|
|||
# include <tchar.h>
|
||||
# include <io.h>
|
||||
|
||||
namespace std { using ::_tfopen; }
|
||||
# define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
|
||||
# define unlink(file) _tunlink(OTTD2FS(file))
|
||||
namespace std { using ::_wfopen; }
|
||||
# define fopen(file, mode) _wfopen(OTTD2FS(file), _T(mode))
|
||||
# define unlink(file) _wunlink(OTTD2FS(file))
|
||||
|
||||
const char *FS2OTTD(const TCHAR *name);
|
||||
const TCHAR *OTTD2FS(const char *name, bool console_cp = false);
|
||||
const char *FS2OTTD(const wchar_t *name);
|
||||
const wchar_t *OTTD2FS(const char *name, bool console_cp = false);
|
||||
# else
|
||||
# define fopen(file, mode) fopen(OTTD2FS(file), mode)
|
||||
const char *FS2OTTD(const char *name);
|
||||
|
|
|
@ -151,7 +151,7 @@ const char *VideoDriver_Dedicated::Start(const StringList &parm)
|
|||
/* For win32 we need to allocate a console (debug mode does the same) */
|
||||
CreateConsole();
|
||||
CreateWindowsConsoleThread();
|
||||
SetConsoleTitle(_T("OpenTTD Dedicated Server"));
|
||||
SetConsoleTitle(L"OpenTTD Dedicated Server");
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -214,7 +214,7 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen)
|
|||
char window_title[64];
|
||||
seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision);
|
||||
|
||||
this->main_wnd = CreateWindow(_T("OTTD"), MB_TO_WIDE(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this);
|
||||
this->main_wnd = CreateWindow(L"OTTD", OTTD2FS(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this);
|
||||
if (this->main_wnd == nullptr) usererror("CreateWindow failed");
|
||||
ShowWindow(this->main_wnd, showstyle);
|
||||
}
|
||||
|
@ -329,9 +329,9 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
if (lParam & GCS_RESULTSTR) {
|
||||
/* Read result string from the IME. */
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, nullptr, 0); // Length is always in bytes, even in UNICODE build.
|
||||
TCHAR *str = (TCHAR *)_alloca(len + sizeof(TCHAR));
|
||||
wchar_t *str = (wchar_t *)_alloca(len + sizeof(wchar_t));
|
||||
len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, str, len);
|
||||
str[len / sizeof(TCHAR)] = '\0';
|
||||
str[len / sizeof(wchar_t)] = '\0';
|
||||
|
||||
/* Transmit text to windowing system. */
|
||||
if (len > 0) {
|
||||
|
@ -347,9 +347,9 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
if ((lParam & GCS_COMPSTR) && DrawIMECompositionString()) {
|
||||
/* Read composition string from the IME. */
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_COMPSTR, nullptr, 0); // Length is always in bytes, even in UNICODE build.
|
||||
TCHAR *str = (TCHAR *)_alloca(len + sizeof(TCHAR));
|
||||
wchar_t *str = (wchar_t *)_alloca(len + sizeof(wchar_t));
|
||||
len = ImmGetCompositionString(hIMC, GCS_COMPSTR, str, len);
|
||||
str[len / sizeof(TCHAR)] = '\0';
|
||||
str[len / sizeof(wchar_t)] = '\0';
|
||||
|
||||
if (len > 0) {
|
||||
static char utf8_buf[1024];
|
||||
|
@ -358,7 +358,7 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
/* Convert caret position from bytes in the input string to a position in the UTF-8 encoded string. */
|
||||
LONG caret_bytes = ImmGetCompositionString(hIMC, GCS_CURSORPOS, nullptr, 0);
|
||||
const char *caret = utf8_buf;
|
||||
for (const TCHAR *c = str; *c != '\0' && *caret != '\0' && caret_bytes > 0; c++, caret_bytes--) {
|
||||
for (const wchar_t *c = str; *c != '\0' && *caret != '\0' && caret_bytes > 0; c++, caret_bytes--) {
|
||||
/* Skip DBCS lead bytes or leading surrogates. */
|
||||
if (Utf16IsLeadSurrogate(*c)) {
|
||||
c++;
|
||||
|
@ -748,7 +748,7 @@ static void RegisterWndClass()
|
|||
LoadCursor(nullptr, IDC_ARROW),
|
||||
0,
|
||||
0,
|
||||
_T("OTTD")
|
||||
L"OTTD"
|
||||
};
|
||||
|
||||
registered = true;
|
||||
|
@ -1009,9 +1009,9 @@ float VideoDriver_Win32Base::GetDPIScale()
|
|||
if (!init_done) {
|
||||
init_done = true;
|
||||
|
||||
_GetDpiForWindow = (PFNGETDPIFORWINDOW)GetProcAddress(GetModuleHandle(_T("User32")), "GetDpiForWindow");
|
||||
_GetDpiForSystem = (PFNGETDPIFORSYSTEM)GetProcAddress(GetModuleHandle(_T("User32")), "GetDpiForSystem");
|
||||
_GetDpiForMonitor = (PFNGETDPIFORMONITOR)GetProcAddress(LoadLibrary(_T("Shcore.dll")), "GetDpiForMonitor");
|
||||
_GetDpiForWindow = (PFNGETDPIFORWINDOW)GetProcAddress(GetModuleHandle(L"User32"), "GetDpiForWindow");
|
||||
_GetDpiForSystem = (PFNGETDPIFORSYSTEM)GetProcAddress(GetModuleHandle(L"User32"), "GetDpiForSystem");
|
||||
_GetDpiForMonitor = (PFNGETDPIFORMONITOR)GetProcAddress(LoadLibrary(L"Shcore.dll"), "GetDpiForMonitor");
|
||||
}
|
||||
|
||||
UINT cur_dpi = 0;
|
||||
|
|
Loading…
Reference in New Issue