From e4880faef72e7f0da7e7b91a7bf8f08da804ce19 Mon Sep 17 00:00:00 2001 From: Dmitry Grigoryev Date: Tue, 16 Feb 2021 11:20:35 +0100 Subject: [PATCH] Nintendo switch logging / path fixes --- src/Makefile.switch | 12 ++++-------- src/engine/logging.cpp | 6 +++--- src/engine/logging.h | 9 ++++++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Makefile.switch b/src/Makefile.switch index 304ec83f840..71756a1303f 100644 --- a/src/Makefile.switch +++ b/src/Makefile.switch @@ -1,13 +1,9 @@ -PREFIX = $(DEVKITPRO)/devkitA64/bin/aarch64-none-elf- - -CC = $(PREFIX)gcc -CXX = $(PREFIX)g++ -AR = $(PREFIX)ar +include $(DEVKITPRO)/libnx/switch_rules ARCH = -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -CFLAGS := $(CFLAGS) $(ARCH) -D__SWITCH__ -CXXFLAGS := $(CXXFLAGS) $(ARCH) -D__SWITCH__ +CFLAGS := $(CFLAGS) $(ARCH) -D__SWITCH__ -DCONFIGURE_FHEROES2_DATA=\"//switch/fheroes2\" +CXXFLAGS := $(CXXFLAGS) $(ARCH) -D__SWITCH__ -DCONFIGURE_FHEROES2_DATA=\"//switch/fheroes2\" CFLAGS_TP := $(CFLAGS_TP) $(ARCH) CXXFLAGS_TP := $(CXXFLAGS_TP) $(ARCH) -LIBS := $(LIBS) -lSDL2 -lfreetype -lbz2 -lvorbisidec -lmodplug -lmpg123 -lm -lopusfile -logg -lopus -ljpeg -lwebp -specs=$(DEVKITPRO)/libnx/switch.specs +LIBS := $(LIBS) -lSDL2 -lfreetype -lpng16 -lbz2 -lvorbisidec -lmodplug -lmpg123 -lm -lopusfile -logg -lopus -ljpeg -lwebp -specs=$(DEVKITPRO)/libnx/switch.specs diff --git a/src/engine/logging.cpp b/src/engine/logging.cpp index a52aca819e8..fad4fc1403f 100644 --- a/src/engine/logging.cpp +++ b/src/engine/logging.cpp @@ -24,14 +24,14 @@ namespace { int g_debug = DBG_ALL_WARN + DBG_ALL_INFO; +} +namespace Logging +{ #if defined( __SWITCH__ ) // Platforms which log to file std::ofstream logFile; #endif -} -namespace Logging -{ const char * GetDebugOptionName( const int name ) { if ( name & DBG_ENGINE ) diff --git a/src/engine/logging.h b/src/engine/logging.h index 46211394af7..409e9195a3b 100644 --- a/src/engine/logging.h +++ b/src/engine/logging.h @@ -94,11 +94,14 @@ namespace std #elif defined( __SWITCH__ ) // Platforms which log to file #include -extern std::ofstream log_file; +namespace Logging +{ + extern std::ofstream logFile; +} #define COUT( x ) \ { \ - log_file << x << std::endl; \ - log_file.flush(); \ + Logging::logFile << x << std::endl; \ + Logging::logFile.flush(); \ } #else // Default: log to STDERR #define COUT( x ) \