summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-07 01:39:55 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-07 01:56:53 +0300
commit9ea6291b7259de2935d1a8fe3b45ef8eb2c67ede (patch)
treef30d5dfa2419260ada62144dc63e1dcb2ee92198
parentbfe9b1eeb587254d92c3ebb338b50ce1e7dfac79 (diff)
downloadplus-9ea6291b7259de2935d1a8fe3b45ef8eb2c67ede.tar.gz
plus-9ea6291b7259de2935d1a8fe3b45ef8eb2c67ede.tar.bz2
plus-9ea6291b7259de2935d1a8fe3b45ef8eb2c67ede.tar.xz
plus-9ea6291b7259de2935d1a8fe3b45ef8eb2c67ede.zip
Add SDL2 errors logging.
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/Makefile.am2
-rw-r--r--src/maingui.cpp2
-rw-r--r--src/progs/dyecmd/client.cpp3
-rw-r--r--src/progs/dyecmd/dyemain.cpp2
-rw-r--r--src/progs/manaplus/client.cpp3
-rw-r--r--src/utils/sdl2helper.cpp6
-rw-r--r--src/utils/sdl2helper.h2
-rw-r--r--src/utils/sdlhelper.cpp4
-rw-r--r--src/utils/sdlhelper.h2
10 files changed, 29 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 37389a0c2..d0971b0c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -946,6 +946,8 @@ SET(SRCS
utils/process.h
utils/sdl2helper.cpp
utils/sdl2helper.h
+ utils/sdl2logger.cpp
+ utils/sdl2logger.h
utils/sdlcheckutils.cpp
utils/sdlcheckutils.h
utils/sdlhelper.cpp
@@ -1869,6 +1871,8 @@ SET(DYE_CMD_SRCS
fs/virtfs/ziplocalheader.h
utils/sdl2helper.cpp
utils/sdl2helper.h
+ utils/sdl2logger.cpp
+ utils/sdl2logger.h
utils/sdlcheckutils.cpp
utils/sdlcheckutils.h
utils/sdlhelper.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 57b3ce58a..bd920e164 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -632,6 +632,8 @@ BASE_SRC += client.h \
utils/process.h \
utils/sdl2helper.cpp \
utils/sdl2helper.h \
+ utils/sdl2logger.cpp \
+ utils/sdl2logger.h \
utils/sdlcheckutils.cpp \
utils/sdlcheckutils.h \
utils/sdlhelper.cpp \
diff --git a/src/maingui.cpp b/src/maingui.cpp
index 205d8c6d1..4279472bd 100644
--- a/src/maingui.cpp
+++ b/src/maingui.cpp
@@ -64,6 +64,7 @@ PRAGMA48(GCC diagnostic pop)
#endif // UNITTESTS_DOCTEST
#else // UNITTESTS
#include "utils/xml.h"
+#include "utils/sdlhelper.h"
#endif // UNITTESTS
#define SDL_IMAGE_COMPILEDVERSION \
@@ -150,6 +151,7 @@ int mainGui(int argc, char *argv[])
int main(int argc, char *argv[])
{
+ SDL::initLogger();
VirtFs::init(argv[0]);
Cpu::detect();
DyePalette::initFunctions();
diff --git a/src/progs/dyecmd/client.cpp b/src/progs/dyecmd/client.cpp
index 7f75f4cd5..8685cc024 100644
--- a/src/progs/dyecmd/client.cpp
+++ b/src/progs/dyecmd/client.cpp
@@ -67,8 +67,8 @@
#ifdef ANDROID
#include "fs/paths.h"
#endif // ANDROID
-
#include "utils/sdlcheckutils.h"
+#include "utils/sdlhelper.h"
#include "utils/timer.h"
#include "utils/translation/translationmanager.h"
@@ -157,6 +157,7 @@ void Client::testsClear()
void Client::gameInit()
{
logger = new Logger;
+ SDL::initLogger();
initRand();
diff --git a/src/progs/dyecmd/dyemain.cpp b/src/progs/dyecmd/dyemain.cpp
index 2217508cc..234e4a600 100644
--- a/src/progs/dyecmd/dyemain.cpp
+++ b/src/progs/dyecmd/dyemain.cpp
@@ -37,6 +37,7 @@
#include "resources/loaders/imageloader.h"
#include "utils/gettext.h"
+#include "utils/sdlhelper.h"
#include <iostream>
@@ -75,6 +76,7 @@ int main(int argc, char **argv)
logger = new Logger;
logger->setLogToStandardOut(false);
+ SDL::initLogger();
VirtFs::init(argv[0]);
SDL_Init(SDL_INIT_VIDEO);
diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp
index 6e245029d..a3e30b86a 100644
--- a/src/progs/manaplus/client.cpp
+++ b/src/progs/manaplus/client.cpp
@@ -125,6 +125,7 @@
#include "fs/paths.h"
#endif // ANDROID
#include "utils/sdlcheckutils.h"
+#include "utils/sdlhelper.h"
#include "utils/timer.h"
#include "utils/translation/translationmanager.h"
@@ -262,6 +263,7 @@ void Client::testsInit()
{
initRand();
logger = new Logger;
+ SDL::initLogger();
Dirs::initLocalDataDir();
Dirs::initTempDir();
Dirs::initConfigDir();
@@ -272,6 +274,7 @@ void Client::testsInit()
void Client::gameInit()
{
logger = new Logger;
+ SDL::initLogger();
initRand();
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp
index d7df14af1..4f99dc512 100644
--- a/src/utils/sdl2helper.cpp
+++ b/src/utils/sdl2helper.cpp
@@ -25,6 +25,7 @@
#include "logger.h"
#include "utils/foreach.h"
+#include "utils/sdl2logger.h"
#include "utils/stringutils.h"
PRAGMA48(GCC diagnostic push)
@@ -182,4 +183,9 @@ void SDL::makeCurrentContext(void *const context A_UNUSED)
{
}
+void SDL::initLogger()
+{
+ SDL2Logger::init();
+}
+
#endif // USE_SDL2
diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h
index 70d3ffa90..04a258014 100644
--- a/src/utils/sdl2helper.h
+++ b/src/utils/sdl2helper.h
@@ -61,6 +61,8 @@ namespace SDL
const int profile);
void makeCurrentContext(void *const context);
+
+ void initLogger();
} // namespace SDL
#endif // USE_SDL2
diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp
index dca31ab5e..821eb40a5 100644
--- a/src/utils/sdlhelper.cpp
+++ b/src/utils/sdlhelper.cpp
@@ -182,4 +182,8 @@ void SDL::makeCurrentContext(void *const context A_UNUSED)
}
#endif // defined(USE_X11) && defined(USE_OPENGL)
+void SDL::initLogger()
+{
+}
+
#endif // USE_SDL2
diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h
index 0ba99df10..5e8c31e15 100644
--- a/src/utils/sdlhelper.h
+++ b/src/utils/sdlhelper.h
@@ -67,6 +67,8 @@ namespace SDL
const int profile);
void makeCurrentContext(void *const context);
+
+ void initLogger();
} // namespace SDL
#endif // USE_SDL2