From 04c56a98d5569f2d322a3543862669ee8cab3e4f Mon Sep 17 00:00:00 2001 From: tobid7 Date: Wed, 28 Feb 2024 21:01:04 +0100 Subject: [PATCH] Save Errors Tag Debug Func of ui7 --- source/Error.cpp | 13 +++++++++++++ source/UI7.cpp | 1 + source/renderd7.cpp | 1 + 3 files changed, 15 insertions(+) diff --git a/source/Error.cpp b/source/Error.cpp index c80d131..d41cadd 100644 --- a/source/Error.cpp +++ b/source/Error.cpp @@ -5,8 +5,20 @@ #include #include +void rd7i_save_report(const std::string& msg) { + auto ts = RenderD7::GetTimeStr(); + std::ofstream f("sdmc:/RenderD7/Reports/report_" + ts + ".txt"); + f << "RenderD7 Error [" << rd7i_app_name << ", " << ts << "]" << std::endl; + f << "Error Message: " << std::endl; + f << msg << std::endl; + f << "SysInfo: " << std::endl; + f << "- Citra -> " << (rd7i_is_citra ? "true" : "false") << std::endl; + f.close(); +} + namespace RenderD7 { void Error(const std::string& msg) { + rd7i_save_report(msg); /*if (rd7i_graphics_on) { C3D_FrameEnd(0); while (aptMainLoop()) { @@ -31,6 +43,7 @@ void Error(const std::string& msg) { gfxInitDefault(); consoleInit(GFX_TOP, NULL); printf("RENDERD7 - ERROR MANAGER\n\n%s\n", msg.c_str()); + printf("Report Saved in\nsdmc:/RenderD7/Reports\n"); printf("Press Start to Exit\n"); while (aptMainLoop()) { hidScanInput(); diff --git a/source/UI7.cpp b/source/UI7.cpp index 136a9b1..815bc59 100644 --- a/source/UI7.cpp +++ b/source/UI7.cpp @@ -85,6 +85,7 @@ struct UI7OBJ { type = i1; s = rd7i_current_screen; } + // Killer Function void Debug() { RenderD7::OnScreen(s ? Top : Bottom); auto clr = UI7CtxDebugCol(type); diff --git a/source/renderd7.cpp b/source/renderd7.cpp index f9f5caa..db5a613 100644 --- a/source/renderd7.cpp +++ b/source/renderd7.cpp @@ -124,6 +124,7 @@ void rd7i_init_config() { rd7i_config_path = "sdmc:/RenderD7/Apps/"; rd7i_config_path += rd7i_app_name; std::filesystem::create_directories(rd7i_config_path.c_str()); + std::filesystem::create_directories("sdmc:/RenderD7/Reports"); bool renew = false; if (RenderD7::FS::FileExist(rd7i_config_path + "/config.rc7")) {