From be95e42b4dd5f30a4ba4fde645c62dc0c2c576fb Mon Sep 17 00:00:00 2001 From: EXL Date: Tue, 12 Nov 2013 16:34:44 +0700 Subject: [PATCH] Fix build on linux-g++-64, fix russian letters in app logs. --- common/stat.cpp | 26 ++++++++++++++++++-------- graphics/font.h | 2 +- nx.pro | 10 +++++----- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/common/stat.cpp b/common/stat.cpp index 80034f1..102c436 100644 --- a/common/stat.cpp +++ b/common/stat.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include "graphics/font.h" + #include "basics.h" #include "misc.fdh" @@ -38,18 +41,25 @@ void c------------------------------() {} void stat(const char *fmt, ...) { -va_list ar; -char buffer[MAXBUFSIZE]; - + va_list ar; + char buffer[MAXBUFSIZE]; va_start(ar, fmt); vsnprintf(buffer, sizeof(buffer), fmt, ar); va_end(ar); - puts(buffer); - fflush(stdout); - - if (logfilename[0]) - writelog(buffer, true); +#ifdef _L10N_CP1251 + char buffer_w_u[MAXBUFSIZE]; + NXFont::win1251_to_utf8(buffer, buffer_w_u); + puts(buffer_w_u); + fflush(stdout); + if (logfilename[0]) + writelog(buffer_w_u, true); +#else + puts(buffer); + fflush(stdout); + if (logfilename[0]) + writelog(buffer, true); +#endif } void staterr(const char *fmt, ...) diff --git a/graphics/font.h b/graphics/font.h index 18da83b..9888832 100644 --- a/graphics/font.h +++ b/graphics/font.h @@ -28,7 +28,7 @@ class NXFont bool InitChars(TTF_Font *font, uint32_t color); bool InitCharsShadowed(TTF_Font *top, uint32_t color, uint32_t shadowcolor); - int win1251_to_utf8(const char* text, char* utext); + static int win1251_to_utf8(const char* text, char* utext); bool InitBitmapChars(SDL_Surface *sheet, uint32_t fgcolor, uint32_t color); bool InitBitmapCharsShadowed(SDL_Surface *sheet, uint32_t fgcolor, uint32_t color, uint32_t shadowcolor); diff --git a/nx.pro b/nx.pro index 0a06184..bf584ef 100644 --- a/nx.pro +++ b/nx.pro @@ -29,7 +29,7 @@ CONFIG -= l10n_rus linux-mips-g++: CONFIG += platform-rzx50 # Targets -win32-g++|linux-g++ { +win32-g++ | linux-g++ | linux-g++-64 { TARGET = nx } linux-mips-g++ { TARGET = nx.dge @@ -39,13 +39,13 @@ win32-g++|linux-g++ { # Strip release binary CONFIG(release, debug|release) { - linux-g++ | linux-mips-g++ | linux-arm-gnueabi-g++ { + linux-g++ | linux-g++-64 | linux-mips-g++ | linux-arm-gnueabi-g++ { QMAKE_POST_LINK += $(STRIP) $(TARGET) } } # Defines -win32-g++|linux-g++ { +win32-g++ | linux-g++ | linux-g++-64 { DEFINES += } linux-mips-g++ { CONFIG(platform-rzx50, platform-rzx50|platform-a320) { @@ -84,7 +84,7 @@ INCLUDEPATH += . win32-g++: { INCLUDEPATH += C:/MinGW/include INCLUDEPATH += C:/MinGW/include/SDL -} linux-g++ { +} linux-g++ | linux-g++-64 { INCLUDEPATH += /usr/include INCLUDEPATH += /usr/include/SDL } linux-mips-g++ { @@ -99,7 +99,7 @@ win32-g++: { win32-g++ { QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ LIBS += -lmingw32 -lSDL_ttf -lfreetype -lpng -lz -lSDLmain -lSDL -lgdi32 -lwinmm -} linux-g++ { +} linux-g++ | linux-g++-64 { LIBS += -lSDLmain -lSDL -lSDL_ttf } linux-mips-g++ { LIBS += -lSDLmain -lSDL -lSDL_ttf -lSDL_mixer