From 1271b9fa9a933383b8dbcef64909734da3a7e409 Mon Sep 17 00:00:00 2001 From: tobid7 Date: Wed, 12 Jun 2024 19:03:41 +0200 Subject: [PATCH] Changes: New Logger Add NTCtrl Base to UI7 --- include/rd7.hpp | 1 - include/renderd7/{Log2.hpp => Logger.hpp} | 8 ++- include/renderd7/SpriteAnimation.hpp | 4 +- include/renderd7/StealConsole.hpp | 39 ----------- include/renderd7/internal_db.hpp | 5 +- include/renderd7/renderd7.hpp | 3 +- source/{Log2.cpp => Logger.cpp} | 8 ++- source/Sheet.cpp | 5 ++ source/Sound.cpp | 8 +-- source/SpriteSheetAnimation.cpp | 7 -- source/StealConsole.cpp | 42 ----------- source/UI7.cpp | 85 +++++++++++++++++------ source/internal_db.cpp | 11 +++ source/renderd7.cpp | 53 ++++++++++---- 14 files changed, 141 insertions(+), 138 deletions(-) rename include/renderd7/{Log2.hpp => Logger.hpp} (83%) delete mode 100644 include/renderd7/StealConsole.hpp rename source/{Log2.cpp => Logger.cpp} (89%) delete mode 100644 source/StealConsole.cpp diff --git a/include/rd7.hpp b/include/rd7.hpp index 117d445..1f2ae30 100644 --- a/include/rd7.hpp +++ b/include/rd7.hpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/include/renderd7/Log2.hpp b/include/renderd7/Logger.hpp similarity index 83% rename from include/renderd7/Log2.hpp rename to include/renderd7/Logger.hpp index 2068f70..cbaa92e 100644 --- a/include/renderd7/Log2.hpp +++ b/include/renderd7/Logger.hpp @@ -35,15 +35,19 @@ class LoggerBase { /// @brief Init the Logger /// @param filename name[_date_time.txt] void Init(const std::string& name, bool fileless = false); - /// @brief Write a String to the File + /// @brief Write a String /// @param debug_text string - void Write(const std::string& debug_text); + /// @param lvl Logger LVL 0 = ERR, 1 =WARNING, >=2= Default + void Write(const std::string& debug_text, int lvl = 2); + void SetLvl(int lvl) { writelvl = lvl; } + const std::vector& Lines(); private: /// \param filename the name of the logfile std::string filename; std::string log_path; std::ofstream _log; + int writelvl = 1; // Only log errors/Warnings std::vector lines; }; } // namespace RenderD7 \ No newline at end of file diff --git a/include/renderd7/SpriteAnimation.hpp b/include/renderd7/SpriteAnimation.hpp index 6c3bd46..87ee9b8 100644 --- a/include/renderd7/SpriteAnimation.hpp +++ b/include/renderd7/SpriteAnimation.hpp @@ -30,9 +30,9 @@ namespace RenderD7 { class SpriteSheetAnimation : public RenderD7::Sprite { public: /// @brief Constructor - SpriteSheetAnimation(); + SpriteSheetAnimation() = default; /// @brief Deconstructor - ~SpriteSheetAnimation(); + ~SpriteSheetAnimation() = default; RD7_SMART_CTOR(SpriteSheetAnimation); /// @brief Setup an Animation /// @param sheet Input Spritesheet diff --git a/include/renderd7/StealConsole.hpp b/include/renderd7/StealConsole.hpp deleted file mode 100644 index 7926979..0000000 --- a/include/renderd7/StealConsole.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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 . - */ - -#pragma once -#include -#include - -namespace RenderD7 { -/// @brief StealConsole Class -class StealConsole { - public: - /// @brief Constructor - StealConsole(); - /// @brief Deconstructor - ~StealConsole(); - /// @brief The Stolen Stdout - /// @return Stdout as string - std::string GetStdout(); - - private: - /// @param stolen_stdout Stolen Stdout - std::stringstream stolen_stdout; -}; -} // namespace RenderD7 \ No newline at end of file diff --git a/include/renderd7/internal_db.hpp b/include/renderd7/internal_db.hpp index 6ca3ac8..f171765 100644 --- a/include/renderd7/internal_db.hpp +++ b/include/renderd7/internal_db.hpp @@ -22,7 +22,7 @@ #include #include -#define CFGVER "0" +#define CFGVER "1" #define THEMEVER "0" #ifndef V_RD7BTIME @@ -76,6 +76,9 @@ extern bool rd7i_amdt; extern void* rd7i_soc_buf; extern bool rd7i_is_am_init; extern RenderD7::Theme::Ref rd7i_active_theme; +extern bool rd7i_lggrf; +// Use function for protection +RenderD7::LoggerBase::Ref _rd7i_logger(); RenderD7::Net::Error rd7i_soc_init(); void rd7i_soc_deinit(); \ No newline at end of file diff --git a/include/renderd7/renderd7.hpp b/include/renderd7/renderd7.hpp index 56900b8..598ba2d 100644 --- a/include/renderd7/renderd7.hpp +++ b/include/renderd7/renderd7.hpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -107,6 +107,7 @@ class RSettings : public RenderD7::Scene { ROVERLAYS, // Overlay Settings RFTRACE, // FTRace Menu RUI7, // UI7 Menu + RLOGS, // Logs }; /// @param shared_request Defines requests from Draw to Logic diff --git a/source/Log2.cpp b/source/Logger.cpp similarity index 89% rename from source/Log2.cpp rename to source/Logger.cpp index bb49b01..ba20051 100644 --- a/source/Log2.cpp +++ b/source/Logger.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -46,9 +46,9 @@ void LoggerBase::Init(const std::string& name, bool fileless) { this->Write("RenderD7 Log\n\n"); } -void LoggerBase::Write(const std::string& debug_text) { +void LoggerBase::Write(const std::string& debug_text, int lvl) { std::string msg = "[" + RenderD7::GetTimeStr() + "]: " + debug_text; - if (this->_log.is_open()) { + if (this->_log.is_open() && lvl <= writelvl) { this->_log << msg << std::endl; } while (msg.find_first_of('\n') != 0) { @@ -57,4 +57,6 @@ void LoggerBase::Write(const std::string& debug_text) { } lines.push_back(msg); } + +const std::vector& LoggerBase::Lines() { return this->lines; } } // namespace RenderD7 \ No newline at end of file diff --git a/source/Sheet.cpp b/source/Sheet.cpp index 8224baf..9f23c6a 100644 --- a/source/Sheet.cpp +++ b/source/Sheet.cpp @@ -17,13 +17,18 @@ */ #include +#include Result RenderD7::Sheet::Load(const std::string& path) { this->spritesheet = C2D_SpriteSheetLoad(path.c_str()); + if (!this->spritesheet) { + _rd7i_logger()->Write("Failed to Load Spritesheet from: " + path, 0); + } return 0; } void RenderD7::Sheet::Free() { + if (!this->spritesheet) return; C2D_SpriteSheetFree(this->spritesheet); this->spritesheet = nullptr; } diff --git a/source/Sound.cpp b/source/Sound.cpp index d805c7f..552e947 100644 --- a/source/Sound.cpp +++ b/source/Sound.cpp @@ -50,7 +50,7 @@ Sound::Sound(const string &path, int channel, bool toloop) { std::fstream fp(path, std::ios::in | std::ios::binary); if (!fp.is_open()) { - printf("Could not open the WAV file: %s\n", path.c_str()); + _rd7i_logger()->Write("Could not open WAV: " + path, 0); return; } @@ -59,7 +59,7 @@ Sound::Sound(const string &path, int channel, bool toloop) { size_t read = fp.tellg(); if (read != sizeof(wavHeader)) { // Short read. - printf("WAV file header is too short: %s\n", path.c_str()); + _rd7i_logger()->Write("WAV Header is too short", 0); fp.close(); return; } @@ -68,7 +68,7 @@ Sound::Sound(const string &path, int channel, bool toloop) { static const char RIFF_magic[4] = {'R', 'I', 'F', 'F'}; if (memcmp(wavHeader.magic, RIFF_magic, sizeof(wavHeader.magic)) != 0) { // Incorrect magic number. - printf("Wrong file format.\n"); + _rd7i_logger()->Write("Wrong Fileformat", 0); fp.close(); return; } @@ -77,7 +77,7 @@ Sound::Sound(const string &path, int channel, bool toloop) { (wavHeader.channels != 1 && wavHeader.channels != 2) || (wavHeader.bits_per_sample != 8 && wavHeader.bits_per_sample != 16)) { // Unsupported WAV file. - printf("Corrupted wav file.\n"); + _rd7i_logger()->Write("File is invalid", 0); fp.close(); return; } diff --git a/source/SpriteSheetAnimation.cpp b/source/SpriteSheetAnimation.cpp index 2ed62cf..f362436 100644 --- a/source/SpriteSheetAnimation.cpp +++ b/source/SpriteSheetAnimation.cpp @@ -18,13 +18,6 @@ #include -RenderD7::SpriteSheetAnimation::SpriteSheetAnimation() { - // -} -RenderD7::SpriteSheetAnimation::~SpriteSheetAnimation() { - // -} - void RenderD7::SpriteSheetAnimation::Setup(RenderD7::Sheet::Ref sheet, size_t imagecount, size_t startimage, float frame_begin, diff --git a/source/StealConsole.cpp b/source/StealConsole.cpp deleted file mode 100644 index 11ac645..0000000 --- a/source/StealConsole.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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 . - */ - -#include -#include - -namespace RenderD7 { -StealConsole::StealConsole() { - std::streambuf *old = std::cout.rdbuf(this->stolen_stdout.rdbuf()); - if (old) { - // To prevent from unused error - } -} - -StealConsole::~StealConsole() { - // Do Nothing Here -} - -std::string StealConsole::GetStdout() { - if (this->stolen_stdout.str().length() < 400) { - return this->stolen_stdout.str(); - } else { - return this->stolen_stdout.str().substr(stolen_stdout.str().length() - 400); - } - return ""; -} -} // namespace RenderD7 \ No newline at end of file diff --git a/source/UI7.cpp b/source/UI7.cpp index a8f9e7d..cacb574 100644 --- a/source/UI7.cpp +++ b/source/UI7.cpp @@ -83,6 +83,33 @@ struct UI7ID { bool has_title; }; +// Non Touch Control +struct NTCtrl { + // 0x0 = Obj + // 0x1 = Selector + // 0x2 = fill obj + std::vector grid; + std::vector cgrid; + int hz = 0; // Horizontal maximum obj + int vt = 0; // Vertical maximum Obj + int chz = 0; // current hz + int selection = 0; + void AddObj() { + chz++; + if (chz > hz) hz = chz; + grid.push_back(0x0); + } + void NewRow() { + chz = 0; + vt++; + } + void Clear() { + cgrid = grid; + grid.clear(); + } + RD7_SMART_CTOR(NTCtrl) +}; + using DrawCmdType = int; enum DrawCmdType_ { DrawCmdType_Skip, @@ -314,6 +341,7 @@ struct UI7Menu { float tbh; // TabBar Height bool show_scroolbar = true; // Show Scrollbar bool has_touch = false; // To Disable touch on Top Screen + NTCtrl::Ref ctrl; // NonTouchControl // SubMenu std::string submenu; @@ -378,6 +406,7 @@ bool UI7CtxBeginMenu(const std::string &lb) { if (ui7_ctx->menus.find(id.ID()) == ui7_ctx->menus.end()) ui7_ctx->menus.insert(std::make_pair(id.ID(), UI7Menu::New())); ui7_ctx->cm = ui7_ctx->menus[id.ID()]; + if (!ui7_ctx->cm->ctrl) ui7_ctx->cm->ctrl = NTCtrl::New(); ui7_ctx->cm->menuid = id; ui7_ctx->cm->cursor = R7Vec2(0, 0); ui7_ctx->cm->has_touch = !RenderD7::R2()->GetCurrentScreen(); @@ -394,27 +423,31 @@ void UI7CtxEndMenu() { RenderD7::Ftrace::ScopedTrace tr("ui7", "EndMenu"); // Draw Scrollbar if (ui7_ctx->cm->enable_scrolling) { - int sw = (RenderD7::R2()->GetCurrentScreen() ? 400 : 320); - int tsp = 5 + ui7_ctx->cm->tbh; - int szs = 240 - tsp - 5; - int lszs = 20; // Lowest Slider size - float slider_h = (szs - 4) * (static_cast(szs - 4) / - static_cast(ui7_ctx->cm->msr.y)); - int slider_rh = d7min(d7max(slider_h, (float)lszs), (float)(szs - 4)); - int slider_pos = d7min( - static_cast(tsp + szs - slider_rh - 4), - d7max( - static_cast(tsp), - static_cast(tsp) + - static_cast( - (szs) * (static_cast(ui7_ctx->cm->scrolling_offset) / - static_cast(ui7_ctx->cm->msr.y))))); - int slider_w = 4; - ui7_ctx->cm->front->AddRectangle(R7Vec2(sw - 12, tsp), - R7Vec2(slider_w * 2, szs), RD7Color_List0); - ui7_ctx->cm->front->AddRectangle(R7Vec2(sw - 10, slider_pos + 2), - R7Vec2(slider_w, slider_h), - RD7Color_Selector); + ui7_ctx->cm->show_scroolbar = (ui7_ctx->cm->ms.y < 235 ? false : true); + + if (ui7_ctx->cm->show_scroolbar) { + int sw = (RenderD7::R2()->GetCurrentScreen() ? 400 : 320); + int tsp = 5 + ui7_ctx->cm->tbh; + int szs = 240 - tsp - 5; + int lszs = 20; // Lowest Slider size + float slider_h = (szs - 4) * (static_cast(szs - 4) / + static_cast(ui7_ctx->cm->msr.y)); + int slider_rh = d7min(d7max(slider_h, (float)lszs), (float)(szs - 4)); + int slider_pos = d7min( + static_cast(tsp + szs - slider_rh - 4), + d7max(static_cast(tsp), + static_cast(tsp) + + static_cast( + (szs) * + (static_cast(ui7_ctx->cm->scrolling_offset) / + static_cast(ui7_ctx->cm->msr.y))))); + int slider_w = 4; + ui7_ctx->cm->front->AddRectangle( + R7Vec2(sw - 12, tsp), R7Vec2(slider_w * 2, szs), RD7Color_List0); + ui7_ctx->cm->front->AddRectangle(R7Vec2(sw - 10, slider_pos + 2), + R7Vec2(slider_w, slider_h), + RD7Color_Selector); + } } ui7_ctx->active_menus.push_back(ui7_ctx->cm); ui7_ctx->cm = nullptr; @@ -469,6 +502,7 @@ void Update() { it->background->Process(); it->main->Process(); it->front->Process(); + it->ctrl->Clear(); } ui7_ctx->fdl->Process(); ui7_ctx->active_menus.clear(); @@ -502,6 +536,7 @@ bool Button(const std::string &label, R7Vec2 size) { R7Vec2 pos = GetCursorPos(); UI7CtxCursorMove(size); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -540,6 +575,7 @@ void Checkbox(const std::string &label, bool &c) { R7Vec2 pos = GetCursorPos(); UI7CtxCursorMove(inp); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -577,6 +613,7 @@ void Label(const std::string &label, RD7TextFlags flags) { auto upos = pos; // Remove some y offset cause texts have some offset UI7CtxCursorMove(textdim - R7Vec2(0, 4)); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -605,6 +642,7 @@ void Progressbar(float value) { if (ui7_ctx->cm->show_scroolbar && ui7_ctx->cm->enable_scrolling) size.x -= 16; UI7CtxCursorMove(size); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -628,6 +666,7 @@ void Image(RenderD7::Image::Ref img) { if (!UI7CtxValidate()) return; R7Vec2 pos = GetCursorPos(); UI7CtxCursorMove(R7Vec2(img->GetSize().x, img->GetSize().y)); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -652,6 +691,7 @@ void BrowserList(const std::vector &entrys, int &selection, size.x = (RenderD7::R2()->GetCurrentScreen() ? 400 : 320) - (pos.x * 2); if (size.y == 0) size.y = (max_entrys * 15); UI7CtxCursorMove(size); + ui7_ctx->cm->ctrl->AddObj(); int selindex = (selection < max_entrys ? selection : (max_entrys - 1)); for (int i = 0; i < max_entrys; i++) { @@ -696,6 +736,7 @@ void InputText(const std::string &label, std::string &text, R7Vec2 pos = GetCursorPos(); UI7CtxCursorMove(inp); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -892,6 +933,7 @@ void ColorSelector(const std::string &label, unsigned int &color) { R7Vec2 pos = GetCursorPos(); UI7CtxCursorMove(inp); + ui7_ctx->cm->ctrl->AddObj(); if (ui7_ctx->cm->enable_scrolling) { R7Vec2 pb = pos; @@ -1103,6 +1145,7 @@ void RestoreCursor() { void SameLine() { if (!UI7CtxValidate()) return; if (!UI7CtxInMenu()) return; + ui7_ctx->cm->ctrl->NewRow(); ui7_ctx->cm->cursor = ui7_ctx->cm->slc; } diff --git a/source/internal_db.cpp b/source/internal_db.cpp index b6b5c52..74864c5 100644 --- a/source/internal_db.cpp +++ b/source/internal_db.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,16 @@ bool rd7i_amdt = false; void *rd7i_soc_buf = nullptr; bool rd7i_is_am_init = false; RenderD7::Theme::Ref rd7i_active_theme; +RenderD7::LoggerBase::Ref rd7i_logger; +bool rd7i_lggrf = false; + +RenderD7::LoggerBase::Ref _rd7i_logger() { + if (!rd7i_logger) { + RenderD7::Error( + "You're trying to use a RenderD7 Func without Init RenderD7!"); + } + return rd7i_logger; +} /// Global /// // Outdated HidApi (HidV2Patched) diff --git a/source/renderd7.cpp b/source/renderd7.cpp index 371e270..58a9131 100644 --- a/source/renderd7.cpp +++ b/source/renderd7.cpp @@ -33,8 +33,8 @@ #include RenderD7::R2Base::Ref rd7i_render2; -RenderD7::LoggerBase::Ref rd7i_logger; RenderD7::LoggerBase::Ref rd7i_glogger; +extern RenderD7::LoggerBase::Ref rd7i_logger; static void RD7i_ExitHook() { C2D_TextBufDelete(rd7i_text_buffer); @@ -182,14 +182,12 @@ void rd7i_init_config() { rd7i_config.clear(); rd7i_config["info"]["version"] = CFGVER; rd7i_config["info"]["renderd7ver"] = RENDERD7VSTRING; - rd7i_config["settings"]["doscreentimeout"] = 0; - rd7i_config["settings"]["forcetimeoutLB"] = true; - rd7i_config["settings"]["renderer"] = "c3d_c2d"; - rd7i_config["metrik-settings"]["enableoverlay"] = false; + rd7i_config["metrik-settings"]["show"] = false; rd7i_config["metrik-settings"]["Screen"] = true; - rd7i_config["metrik-settings"]["txtColor"] = "#ffffffff"; - rd7i_config["metrik-settings"]["Color"] = "#aa000000"; - rd7i_config["metrik-settings"]["txtSize"] = 0.7f; + rd7i_config["metrik-settings"]["Text"] = "#ffffffff"; + rd7i_config["metrik-settings"]["Bg"] = "#aa000000"; + rd7i_config["metrik-settings"]["Size"] = 0.7f; + rd7i_config["internal_logger"]["nowritetxt"] = true; std::fstream cfg_wrt(rd7i_config_path + "/config.rc7", std::ios::out); cfg_wrt << rd7i_config.dump(4); cfg_wrt.close(); @@ -198,9 +196,10 @@ void rd7i_init_config() { cfg_ldr >> rd7i_config; cfg_ldr.close(); - rd7i_metrikd = rd7i_config["metrik-settings"]["enableoverlay"].get(); - rd7i_mt_txtSize = rd7i_config["metrik-settings"]["txtSize"].get(); + rd7i_metrikd = rd7i_config["metrik-settings"]["show"].get(); + rd7i_mt_txtSize = rd7i_config["metrik-settings"]["Size"].get(); rd7i_mt_screen = rd7i_config["metrik-settings"]["Screen"].get(); + rd7i_lggrf = rd7i_config["internal_logger"]["nowritetxt"].get(); if (rd7i_metrikd) RenderD7::AddOvl(std::make_unique( @@ -363,7 +362,6 @@ Result RenderD7::Init::Main(std::string app_name) { RenderD7::Ftrace::ScopedTrace st("rd7-core", f2s(Init::Main)); rd7i_app_name = app_name; rd7i_logger = LoggerBase::New(); - rd7i_logger->Init("renderd7", true); rd7i_glogger = LoggerBase::New(); gfxInitDefault(); @@ -380,6 +378,9 @@ Result RenderD7::Init::Main(std::string app_name) { atexit(aptExit); romfsInit(); + rd7i_init_config(); + _rd7i_logger()->Init("renderd7", rd7i_lggrf); + rd7i_active_theme = Theme::New(); rd7i_active_theme->Default(); @@ -414,7 +415,6 @@ Result RenderD7::Init::Main(std::string app_name) { rd7i_last_tm = svcGetSystemTick(); if (rd7_do_splash) PushSplash(); - rd7i_init_config(); rd7i_init_input(); rd7i_init_theme(); UI7::Init(); @@ -427,13 +427,15 @@ Result RenderD7::Init::Minimal(std::string app_name) { RenderD7::Ftrace::ScopedTrace st("rd7-core", f2s(Init::Minimal)); rd7i_app_name = app_name; rd7i_logger = LoggerBase::New(); - rd7i_logger->Init("renderd7", true); rd7i_glogger = LoggerBase::New(); gfxInitDefault(); atexit(gfxExit); romfsInit(); + rd7i_init_config(); + _rd7i_logger()->Init("renderd7", rd7i_lggrf); + rd7i_active_theme = Theme::New(); rd7i_active_theme->Default(); @@ -473,7 +475,6 @@ Result RenderD7::Init::Minimal(std::string app_name) { svcGetSystemInfo(&citracheck, 0x20000, 0); rd7i_is_citra = citracheck ? true : false; - rd7i_init_config(); rd7i_init_input(); rd7i_init_theme(); UI7::Init(); @@ -612,6 +613,11 @@ void RenderD7::RSettings::Draw(void) const { if (UI7::Button("ThemeEditor")) { RenderD7::LoadThemeEditor(); } + if (UI7::Button("Logs")) { + shared_request[0x00000001] = RLOGS; + } + UI7::SameLine(); + UI7::Checkbox("No File", rd7i_lggrf); if (UI7::Button("Back")) { shared_request[0x00000002] = 1U; } @@ -800,6 +806,21 @@ void RenderD7::RSettings::Draw(void) const { } UI7::EndMenu(); } + } else if (m_state == RLOGS) { + RenderD7::R2()->OnScreen(R2Screen_Top); + if (UI7::BeginMenu("RenderD7 -> Logs")) { + UI7::SetCursorPos(R7Vec2(395, 2)); + UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight); + UI7::RestoreCursor(); + UI7::EndMenu(); + } + + RenderD7::R2()->OnScreen(R2Screen_Bottom); + if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(), + UI7MenuFlags_Scrolling)) { + for (auto &it : rd7i_logger->Lines()) UI7::Label(it); + UI7::EndMenu(); + } } } @@ -813,6 +834,7 @@ void RenderD7::RSettings::Logic() { std::fstream cfg_wrt(rd7i_config_path + "/config.rc7", std::ios::out); rd7i_config["metrik-settings"]["enableoverlay"] = rd7i_metrikd; rd7i_config["metrik-settings"]["Screen"] = rd7i_mt_screen; + rd7i_config["internal_logger"]["nowritetxt"] = rd7i_lggrf; cfg_wrt << rd7i_config.dump(4); cfg_wrt.close(); rd7i_settings = false; @@ -843,6 +865,7 @@ void RenderD7::RSettings::Logic() { std::fstream cfg_wrt(rd7i_config_path + "/config.rc7", std::ios::out); rd7i_config["metrik-settings"]["enableoverlay"] = rd7i_metrikd; rd7i_config["metrik-settings"]["Screen"] = rd7i_mt_screen; + rd7i_config["internal_logger"]["nowritetxt"] = rd7i_lggrf; cfg_wrt << rd7i_config.dump(4); cfg_wrt.close(); rd7i_settings = false; @@ -862,7 +885,7 @@ void RenderD7::RSettings::Logic() { m_state = RSETTINGS; } } - if (m_state == RIDB) { + if (m_state == RIDB || m_state == RLOGS) { if (d7_hDown & KEY_B) { m_state = RSETTINGS; }