mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Fixed engine not starting from non-Latin paths
This commit is contained in:
parent
505f666545
commit
9b9699c134
3 changed files with 31 additions and 21 deletions
|
@ -7,7 +7,8 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
|
|||
|
||||
### Bug fixes
|
||||
* Fixed static meshes with dynamic light mode not accepting room lights.
|
||||
* Fixed rare case of not being able to start a new game or exit game from main menu.
|
||||
* Fixed issues with launching the engine from directories with non-Latin characters in the path.
|
||||
* Fixed rare case of not being able to start a new game or exit game from the main menu.
|
||||
* Fixed antialiasing quality not changing after changing it in display settings.
|
||||
* Fixed endless explosion effect for Puna.
|
||||
|
||||
|
|
|
@ -205,44 +205,46 @@ namespace TEN::Utils
|
|||
((1.0f - ndc.y) * DISPLAY_SPACE_RES.y) / 2);
|
||||
}
|
||||
|
||||
std::vector<unsigned short> GetProductOrFileVersion(bool productVersion)
|
||||
{
|
||||
char fileName[UCHAR_MAX] = {};
|
||||
std::vector<unsigned short> GetProductOrFileVersion(bool productVersion)
|
||||
{
|
||||
wchar_t fileName[UCHAR_MAX] = {};
|
||||
|
||||
if (!GetModuleFileNameA(nullptr, fileName, UCHAR_MAX))
|
||||
if (!GetModuleFileNameW(nullptr, fileName, UCHAR_MAX))
|
||||
{
|
||||
TENLog("Can't get current assembly filename", LogLevel::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
int size = GetFileVersionInfoSizeA(fileName, NULL);
|
||||
DWORD dummy;
|
||||
DWORD size = GetFileVersionInfoSizeW(fileName, &dummy);
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
TENLog("GetFileVersionInfoSizeA failed", LogLevel::Error);
|
||||
TENLog("GetFileVersionInfoSizeW failed", LogLevel::Error);
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<unsigned char> buffer(new unsigned char[size]);
|
||||
|
||||
std::unique_ptr<unsigned char[]> buffer(new unsigned char[size]);
|
||||
|
||||
// Load version info.
|
||||
if (!GetFileVersionInfoA(fileName, 0, size, buffer.get()))
|
||||
if (!GetFileVersionInfoW(fileName, 0, size, buffer.get()))
|
||||
{
|
||||
TENLog("GetFileVersionInfoA failed", LogLevel::Error);
|
||||
TENLog("GetFileVersionInfoW failed", LogLevel::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
VS_FIXEDFILEINFO* info;
|
||||
unsigned int infoSize;
|
||||
|
||||
if (!VerQueryValueA(buffer.get(), "\\", (void**)&info, &infoSize))
|
||||
if (!VerQueryValueW(buffer.get(), L"\\", (void**)&info, &infoSize))
|
||||
{
|
||||
TENLog("VerQueryValueA failed", LogLevel::Error);
|
||||
TENLog("VerQueryValueW failed", LogLevel::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
if (infoSize != sizeof(VS_FIXEDFILEINFO))
|
||||
{
|
||||
TENLog("VerQueryValueA returned wrong size for VS_FIXEDFILEINFO", LogLevel::Error);
|
||||
TENLog("VerQueryValueW returned wrong size for VS_FIXEDFILEINFO", LogLevel::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -347,19 +347,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
// Initialize logging.
|
||||
InitTENLog(gameDir);
|
||||
|
||||
auto windowName = std::string("Starting TombEngine");
|
||||
|
||||
// Indicate version.
|
||||
auto ver = GetProductOrFileVersion(false);
|
||||
auto windowName = (std::string("Starting TombEngine version ") +
|
||||
std::to_string(ver[0]) + "." +
|
||||
std::to_string(ver[1]) + "." +
|
||||
std::to_string(ver[2]) + "." +
|
||||
std::to_string(ver[3]) + " " +
|
||||
|
||||
if (ver.size() == 4)
|
||||
{
|
||||
windowName = windowName + " version " +
|
||||
std::to_string(ver[0]) + "." +
|
||||
std::to_string(ver[1]) + "." +
|
||||
std::to_string(ver[2]) + "." +
|
||||
std::to_string(ver[3]);
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
"(64-bit)"
|
||||
windowName = windowName + " (64-bit)";
|
||||
#else
|
||||
"(32-bit)"
|
||||
windowName = windowName + " (32-bit)";
|
||||
#endif
|
||||
);
|
||||
|
||||
TENLog(windowName, LogLevel::Info);
|
||||
|
||||
// Initialize savegame and scripting systems.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue