diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-10 15:30:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-10 15:31:00 +0300 |
commit | 923925780650de4736d580f984a6b6001b786a15 (patch) | |
tree | 718b8988d660187115ecc7e89abb5b2f10291451 /source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | |
parent | fcc2175710fa273ef2b72a39bb7de8880f6e7875 (diff) |
Fix T48393: Blender player doesn't start on files saved with with cyrillic letters in path
Diffstat (limited to 'source/gameengine/GamePlayer/ghost/GPG_ghost.cpp')
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a69a8eae55d..4d2c5bb0c14 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -116,10 +116,14 @@ extern char datatoc_bmonofont_ttf[]; #include "RNA_define.h" #ifdef WIN32 -#include <windows.h> -#if !defined(DEBUG) -#include <wincon.h> -#endif // !defined(DEBUG) +# include <windows.h> +# if !defined(DEBUG) +# include <wincon.h> +# endif // !defined(DEBUG) +# if defined(_MSC_VER) && defined(_M_X64) +# include <math.h> /* needed for _set_FMA3_enable */ +# endif +# include "utfconv.h" #endif // WIN32 #ifdef WITH_SDL_DYNLOAD @@ -399,7 +403,14 @@ static int GPG_PyNextFrame(void *state0) } } -int main(int argc, char** argv) +int main( + int argc, +#ifdef WIN32 + const char **UNUSED(argv_c) +#else + const char **argv +#endif + ) { int i; int argc_py_clamped= argc; /* use this so python args can be added after ' - ' */ @@ -434,6 +445,34 @@ int main(int argc, char** argv) bool samplesParFound = false; GHOST_TUns16 aasamples = 0; +#ifdef WIN32 + char **argv; + int argv_num; + + /* We delay loading of openmp so we can set the policy here. */ +# if defined(_MSC_VER) + _putenv_s("OMP_WAIT_POLICY", "PASSIVE"); +# endif + + /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */ +# if defined(_MSC_VER) && defined(_M_X64) + _set_FMA3_enable(0); +# endif + + /* Win32 Unicode Args */ + /* NOTE: cannot use guardedalloc malloc here, as it's not yet initialized + * (it depends on the args passed in, which is what we're getting here!) + */ + { + wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc); + argv = (char**)malloc(argc * sizeof(char *)); + for (argv_num = 0; argv_num < argc; argv_num++) { + argv[argv_num] = alloc_utf_8_from_16(argv_16[argv_num], 0); + } + LocalFree(argv_16); + } +#endif /* WIN32 */ + #ifdef __linux__ #ifdef __alpha__ signal (SIGFPE, SIG_IGN); @@ -1165,5 +1204,13 @@ int main(int argc, char** argv) BKE_tempdir_session_purge(); +#ifdef WIN32 + while (argv_num) { + free(argv[--argv_num]); + } + free(argv); + argv = NULL; +#endif + return error ? -1 : 0; } |