From b29e8528863c3ab2f8b7781552e47cb46b9540b0 Mon Sep 17 00:00:00 2001 From: WerWolv98 Date: Thu, 26 Jul 2018 14:12:57 +0200 Subject: [PATCH] Added offline logging to /EdiZon/EdiZon.log instead of nxlink, if the file exists --- Makefile | 2 +- source/main.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8fc5686b..986bf6c4 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- VERSION_MAJOR := 1 VERSION_MINOR := 3 -VERSION_MICRO := 0 +VERSION_MICRO := 1 APP_TITLE := EdiZon APP_AUTHOR := WerWolv and thomasnet diff --git a/source/main.cpp b/source/main.cpp index 911d7bc7..ea813788 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -3,6 +3,10 @@ #include #include +#include +#include +#include + #include "gui.hpp" #include "gui_main.hpp" #include "gui_editor.hpp" @@ -55,6 +59,15 @@ int main(int argc, char** argv) { nxlinkStdio(); #endif + int file = open("/EdiZon/EdiZon.log", O_APPEND | O_WRONLY); + + if (file >= 0) { + fflush(stdout); + dup2(file, STDOUT_FILENO); + fflush(stderr); + dup2(file, STDERR_FILENO); + } + gfxInitDefault(); setsysInitialize(); ColorSetId colorSetId; @@ -144,6 +157,8 @@ int main(int argc, char** argv) { Title::g_titles.clear(); Account::g_accounts.clear(); + close(file); + socketExit(); gfxExit();