From 02ea4c6b4b9eac2294bd9d235be7ee8d23e7ff59 Mon Sep 17 00:00:00 2001 From: Tobi-D7 Date: Sat, 23 Apr 2022 01:00:19 +0200 Subject: [PATCH] __ --- renderd7.cpp | 32 ++++++++++++++++++++++++++------ renderd7.hpp | 13 +++++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/renderd7.cpp b/renderd7.cpp index 207b316..fc004f6 100644 --- a/renderd7.cpp +++ b/renderd7.cpp @@ -96,7 +96,7 @@ std::string Date(void) struct tm timeStruct; time(&unixTime); localtime_r(&unixTime, &timeStruct); - return _FMT_("%04i-%02i-%02i %02i:%02i:%02i", timeStruct.tm_year + 1900, timeStruct.tm_mon + 1, timeStruct.tm_mday, + return _FMT_("%04i-%02i-%02i_%02i:%02i:%02i", timeStruct.tm_year + 1900, timeStruct.tm_mon + 1, timeStruct.tm_mday, timeStruct.tm_hour, timeStruct.tm_min, timeStruct.tm_sec); } @@ -686,7 +686,7 @@ Result RenderD7::Init::Main(std::string app_name) { if (consoleModel != 3) gfxSetWide(true); } - + consoleInit(GFX_BOTTOM, NULL); if (mt_dumpcsv) { mt_cname = csvpc; @@ -697,9 +697,29 @@ Result RenderD7::Init::Main(std::string app_name) strss << "sdmc:/" << csvpc << "/" << Date() << ".csv"; mt_cname = strss.str();*/ //mt_cname = "sdmc:/test.csv"; + //Handle fileh; std::cout << mt_cname << std::endl; - FILE* logfile = fopen((mt_cname.c_str()), "w"); - fclose(logfile); + Result ret = FS_OpenArchive(&sdmc_archive, ARCHIVE_SDMC); + if (R_FAILED(ret)) + { + std::cout <<"Failed Init sd!\n"; + } + std::string moddedname = mt_cname; + moddedname.erase(0, 5); + std::cout << moddedname << std::endl; + + + ret = FS_CreateFile(sdmc_archive, moddedname.c_str(), 0); + if (R_FAILED(ret)) + { + std::cout <<"Failed To Create File!\n"; + } + //FILE* logfile = fopen((mt_cname.c_str()), "w"); + //fclose(logfile); + if ((access(mt_cname.c_str(), F_OK) == 0)) + { + std::cout << "File Exist!" << std::endl; + } mt_csv.open((mt_cname), std::ofstream::app); mt_csv << "FPS,CPU,GPU,CMD\n"; mt_csv.close(); @@ -1194,7 +1214,7 @@ void RenderD7::AddOvl(std::unique_ptr overlay) overlays.push(std::move(overlay)); } -/*RenderD7::Console::Console() +RenderD7::Console::Console() { this->x = 0; this->y = 0; @@ -1243,7 +1263,7 @@ bool RenderD7::Console::Update() bool dr_sc = true; return dr_sc; } -*/ + std::string RenderD7::FormatString(std::string fmt_str, ...) { diff --git a/renderd7.hpp b/renderd7.hpp index bf57f51..b19f7fc 100644 --- a/renderd7.hpp +++ b/renderd7.hpp @@ -19,7 +19,7 @@ #include #include #include "external/lodepng.h" -#include "external/fs.h" + #include #include "lang.hpp" #include "parameter.hpp" @@ -28,6 +28,11 @@ #include "stringtool.hpp" #include "Clock.hpp" +extern "C" +{ + #include "external/fs.h" +} + #define RENDERD7VSTRING "0.7.2" #define CHANGELOG "0.7.2: Implement MT to csv file saving. Add RGB2HEX. \n0.7.1: Add the New Overlay Handler. Its Just in code and does nothing yet. \n0.7.0: Made Big Progress In the MT Ovl but it still crashes On a Scnd C3D_FrameEnd(). Implement 800px but doesn't work that good. \n0.6.2: Fix Crash when exiting trouth Home Menu. \n0.6.10: rewrite Threadsystem, Improve framerate\n0.6.02: Fix Code in lang.hpp\nadd Draw Text Left Function.\nadd changelog\n0.6.01: add Threading system." #define DEFAULT_CENTER 0.5f @@ -343,11 +348,11 @@ namespace RenderD7 void DrawCheckbox(Checkbox box); std::string FormatString(std::string fmt_str, ...); std::string GetTimeStr(void); - /*class Console + class Console { public: Console(); - Console(int x, int y, int w, int h, int a = 255); + Console(int x, int y, int w, int h, u8 a = 255); Console(int x, int y, int w, int h, RenderD7::Color::rgba col); Console(int x, int y, int w, int h, std::string name, RenderD7::Color::rgba col = {255, 255, 255, 255}, RenderD7::Color::rgba barcol = {0, 0, 0, 255}, RenderD7::Color::rgba outlinecol = {222, 222, 222, 255}); void On(C3D_RenderTarget *t_cscreen); @@ -363,7 +368,7 @@ namespace RenderD7 RenderD7::Color::rgba color = {255, 255, 255, 255}; RenderD7::Color::rgba outlinecol = {222, 222, 222, 255}; RenderD7::Color::rgba barcolor = {0, 0, 0, 255}; - };*/ + }; bool NameIsEndingWith(const std::string &name, const std::vector &extensions); void GetDirContentsExt(std::vector &dircontent, const std::vector &extensions);