2024-05-18 20:05:03 +02:00
|
|
|
/**
|
|
|
|
* This file is part of RenderD7
|
|
|
|
* Copyright (C) 2021-2024 NPI-D7, tobid7
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-02-19 19:20:37 +01:00
|
|
|
#include <3ds.h>
|
|
|
|
|
|
|
|
#include <renderd7/Error.hpp>
|
|
|
|
#include <renderd7/UI7.hpp>
|
|
|
|
#include <renderd7/internal_db.hpp>
|
|
|
|
#include <renderd7/renderd7.hpp>
|
|
|
|
|
2024-02-28 21:01:04 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2024-02-19 19:20:37 +01:00
|
|
|
namespace RenderD7 {
|
|
|
|
void Error(const std::string& msg) {
|
2024-02-28 21:01:04 +01:00
|
|
|
rd7i_save_report(msg);
|
2024-06-15 15:12:06 +02:00
|
|
|
if (rd7i_graphics_on) {
|
2024-02-19 19:20:37 +01:00
|
|
|
while (aptMainLoop()) {
|
|
|
|
hidScanInput();
|
|
|
|
if (hidKeysDown() & KEY_START) break;
|
|
|
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
|
|
|
RenderD7::ClearTextBufs();
|
2024-06-15 15:12:06 +02:00
|
|
|
C2D_TargetClear(rd7_top, 0x00000000);
|
|
|
|
C2D_TargetClear(rd7_bottom, 0x00000000);
|
|
|
|
RenderD7::R2()->OnScreen(R2Screen_Top);
|
2024-02-19 19:20:37 +01:00
|
|
|
if (UI7::BeginMenu("RenderD7 - Error Manager", R7Vec2(),
|
|
|
|
UI7MenuFlags_TitleMid)) {
|
|
|
|
UI7::Label(msg, RD7TextFlags_Wrap);
|
|
|
|
UI7::Label("Press Start to Exit!");
|
|
|
|
UI7::EndMenu();
|
|
|
|
}
|
2024-06-15 15:12:06 +02:00
|
|
|
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
|
|
|
UI7::Update();
|
|
|
|
RenderD7::R2()->Process();
|
2024-02-19 19:20:37 +01:00
|
|
|
C3D_FrameEnd(0);
|
|
|
|
}
|
|
|
|
exit(0);
|
2024-06-15 15:12:06 +02:00
|
|
|
} else {
|
|
|
|
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();
|
|
|
|
if (hidKeysDown() & KEY_START) break;
|
|
|
|
gfxSwapBuffers();
|
|
|
|
}
|
|
|
|
gfxExit();
|
|
|
|
exit(0);
|
2024-02-19 19:20:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace RenderD7
|