From f93fd61c26667c147f76ddfda87c6c2976f9f8c2 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 25 Jul 2018 21:34:39 +0200 Subject: [PATCH 1/4] Rename OFFICIAL_BUILD to OFFICIAL_COLOBOT_BUILD In order to avoid conflict with OFFICIAL_BUILD variable inside ntverp.h. It caused compilation error "invalid integer expression" https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/shared/ntverp.h#L134 --- CMakeLists.txt | 2 +- src/app/signal_handlers.cpp | 2 +- src/common/version.h.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44a63de6..8881e0e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,7 +204,7 @@ option(DEV_BUILD "Enable development build (enables some debugging tools, local # Official build - changes text on the crash screen # PLEASE DO NOT USE ON UNOFFICIAL BUILDS. Thanks. -option(OFFICIAL_BUILD "Official build (changes crash screen text)" OFF) +option(OFFICIAL_COLOBOT_BUILD "Official build (changes crash screen text)" OFF) # Portable build - load all data from current directory option(PORTABLE "Portable build" OFF) diff --git a/src/app/signal_handlers.cpp b/src/app/signal_handlers.cpp index 1974ba3f..03771dab 100644 --- a/src/app/signal_handlers.cpp +++ b/src/app/signal_handlers.cpp @@ -133,7 +133,7 @@ void CSignalHandlers::ReportError(const std::string& errorMessage) msg << "including information on what you were doing before this happened and all the information below." << std::endl; msg << "==============================" << std::endl; #if BUILD_NUMBER == 0 - #ifdef OFFICIAL_BUILD + #ifdef OFFICIAL_COLOBOT_BUILD msg << "You are running official " << COLOBOT_VERSION_DISPLAY << " build." << std::endl; #else // COLOBOT_VERSION_DISPLAY doesn't update if you don't run CMake after "git pull" diff --git a/src/common/version.h.cmake b/src/common/version.h.cmake index ad3714b3..ca377e4f 100644 --- a/src/common/version.h.cmake +++ b/src/common/version.h.cmake @@ -4,4 +4,4 @@ #define COLOBOT_VERSION_DISPLAY "@COLOBOT_VERSION_DISPLAY@" #define BUILD_NUMBER @BUILD_NUMBER@ -#cmakedefine OFFICIAL_BUILD +#cmakedefine OFFICIAL_COLOBOT_BUILD From 32d3d1eb924cc89b3cfdd1a729a04e0be96af296 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 25 Jul 2018 21:38:47 +0200 Subject: [PATCH 2/4] Change key for debug menu to F10 and for stats to F11 F12 is used by Visual Studio debugger to trigger a breakpoint and apparently it cannot be changed: "The F12 key is reserved for use by the debugger at all times, so it should not be registered as a hot key. Even when you are not debugging an application, F12 is reserved in case a kernel-mode debugger or a just-in-time debugger is resident." Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646309.aspx?f=255&MSPPError=-2147217396 --- src/graphics/engine/engine.cpp | 2 +- src/level/robotmain.cpp | 2 +- src/ui/debug_menu.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 4dfec9ca..8cb595eb 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -431,7 +431,7 @@ bool CEngine::ProcessEvent(const Event &event) { auto data = event.GetData(); - if (data->key == KEY(F12)) + if (data->key == KEY(F11)) { m_showStats = !m_showStats; return false; diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 2cabcccf..e2608007 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -779,7 +779,7 @@ bool CRobotMain::ProcessEvent(Event &event) if (IsPhaseWithWorld(m_phase)) { - if (data->key == KEY(F11)) + if (data->key == KEY(F10)) { m_debugMenu->ToggleInterface(); return false; diff --git a/src/ui/debug_menu.h b/src/ui/debug_menu.h index e3ee0933..ecc6f81e 100644 --- a/src/ui/debug_menu.h +++ b/src/ui/debug_menu.h @@ -39,7 +39,7 @@ class CInterface; /** * \class CDebugMenu - * \brief Handles debug menu (F11) + * \brief Handles debug menu (F10) * * There should always be only one instance of this class for each associated CRobotMain class. */ From cb701cacb8f1cf0f0d52c0e778474588e7e88703 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 25 Jul 2018 21:44:31 +0200 Subject: [PATCH 3/4] Add a workaround for failed assertion in VS debugger Assertion failed: ploc->_Mbcurmax == 1 || ploc->_Mbcurmax == 2 Apparently MS C/C++ library doesn't support UTF-8 locales, which causes the assertion to fail. My solution is to ignore the system locale and try to set the classic one. LibreOffice seems to have this problem fixed in less simple way: https://gerrit.libreoffice.org/#/c/54110/ --- src/app/app.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/app.cpp b/src/app/app.cpp index 3444481c..58a58da4 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1832,7 +1832,12 @@ void CApplication::SetLanguage(Language language) // Update C++ locale try { +#if defined(_MSC_VER) && defined(_DEBUG) + // Avoids failed assertion in VS debugger + throw -1; +#else std::locale::global(std::locale(systemLocale.c_str())); +#endif } catch (...) { From 7e19622b85dbad63bc5b0ceb53a2b22db65a574b Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 25 Jul 2018 23:45:15 +0200 Subject: [PATCH 4/4] Allow both F11 and F12 for stats --- src/graphics/engine/engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 8cb595eb..bc17087e 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -431,7 +431,7 @@ bool CEngine::ProcessEvent(const Event &event) { auto data = event.GetData(); - if (data->key == KEY(F11)) + if (data->key == KEY(F11) || data->key == KEY(F12)) { m_showStats = !m_showStats; return false;