diff options
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index e6a0512d7f..100cac5976 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -6,6 +6,9 @@ #include <cmath> #include <assert.h> #include <locale.h> +#ifdef __APPLE__ + #include <xlocale.h> +#endif #include "LightingShaderGen.h" #include "PixelShaderGen.h" @@ -513,7 +516,8 @@ const char *WriteLocation(API_TYPE ApiType) const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components) { - setlocale(LC_NUMERIC, "C"); // Reset locale for compilation + locale_t locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale_t old_locale = uselocale(locale); // Apply the locale for this thread text[sizeof(text) - 1] = 0x7C; // canary BuildSwapModeTable(); // Needed for WriteStage @@ -886,7 +890,8 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType if (text[sizeof(text) - 1] != 0x7C) PanicAlert("PixelShader generator - buffer too small, canary has been eaten!"); - setlocale(LC_NUMERIC, ""); // restore locale + uselocale(old_locale); // restore locale + freelocale(locale); return text; } |
