diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 12b77958..f58d1a7b 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -14,7 +14,7 @@ "DEBUG", "SWITCH", "__SWITCH__", - "VERSION_STRING=\"3.7.11\"" + "VERSION_STRING=\"3.7.12\"" ], "compilerPath": "F:/devkitPro/devkitA64/bin/aarch64-none-elf-g++", "cStandard": "c11", diff --git a/Makefile b/Makefile index f25d28c8..6643f81a 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- VERSION_MAJOR := 3 VERSION_MINOR := 7 -VERSION_MICRO := 11 +VERSION_MICRO := 12 NIGHTLY := APP_TITLE := EdiZon SE diff --git a/include/helpers/config.hpp b/include/helpers/config.hpp index f3d93fa7..0cdfec9a 100644 --- a/include/helpers/config.hpp +++ b/include/helpers/config.hpp @@ -11,7 +11,10 @@ namespace Config { typedef struct ConfigData { char magic[8]; bool hideSX; + bool option_once; + bool options[3]; char latestCommit[40]; + char edizon_dir[40]; u64 lasttitle = 0; } config_data_t; diff --git a/source/guis/gui_cheats.cpp b/source/guis/gui_cheats.cpp index b23f6ebe..d752ce7e 100644 --- a/source/guis/gui_cheats.cpp +++ b/source/guis/gui_cheats.cpp @@ -636,7 +636,7 @@ void GuiCheats::draw() Gui::drawTextAligned(font14, 700, 142, currTheme.textColor, "Others", ALIGNED_LEFT); ss.str(""); - ss << "EdiZon SE : 3.7.11"; + ss << "EdiZon SE : 3.7.12"; if (m_32bitmode) ss << " 32 bit pointer mode"; Gui::drawTextAligned(font14, 900, 62, currTheme.textColor, ss.str().c_str(), ALIGNED_LEFT); @@ -1517,6 +1517,11 @@ void GuiCheats::onInput(u32 kdown) { // Gui::g_nextGui = GUI_MAIN; PSsaveSTATE(); + if (kheld & KEY_R) + { + Config::getConfig()->option_once = true; + Config::writeConfig(); + } if (kheld & KEY_ZL) { if (!m_debugger -> m_dmnt) @@ -5920,28 +5925,44 @@ void GuiCheats::iconloadcheck() } bool GuiCheats::autoattachcheck() { - std::stringstream filenoiconStr; - filenoiconStr << EDIZON_DIR "/noautoattach.txt"; - if (access(filenoiconStr.str().c_str(), F_OK) != 0) + if (Config::getConfig()->options[0] == 0) { + Config::readConfig(); if (m_debugger->m_dmnt) - dmntchtForceOpenCheatProcess(); + dmntchtForceOpenCheatProcess(); return true; } else return false; + // std::stringstream filenoiconStr; + // filenoiconStr << EDIZON_DIR "/noautoattach.txt"; + // if (access(filenoiconStr.str().c_str(), F_OK) != 0) + // { + // if (m_debugger->m_dmnt) + // dmntchtForceOpenCheatProcess(); + // return true; + // } + // else + // return false; // testlz(); } bool GuiCheats::autoexitcheck() { - std::stringstream filenoiconStr; - filenoiconStr << EDIZON_DIR "/noautoexit.txt"; - if (access(filenoiconStr.str().c_str(), F_OK) != 0) + Config::readConfig(); + if (Config::getConfig()->options[1] == 0) { return true; } else return false; + // std::stringstream filenoiconStr; + // filenoiconStr << EDIZON_DIR "/noautoexit.txt"; + // if (access(filenoiconStr.str().c_str(), F_OK) != 0) + // { + // return true; + // } + // else + // return false; } void GuiCheats::testlz() { diff --git a/source/guis/gui_choose_mission.cpp b/source/guis/gui_choose_mission.cpp index eea7af8c..2cf94f62 100644 --- a/source/guis/gui_choose_mission.cpp +++ b/source/guis/gui_choose_mission.cpp @@ -1,51 +1,30 @@ #include "guis/gui_choose_mission.hpp" - #include "helpers/config.hpp" GuiChooseMission::GuiChooseMission() : Gui() { - Config::getConfig()->hideSX = false; + Config::getConfig()->option_once = false; + // m_edizon_dir = Config::getConfig()->edizon_dir; } - GuiChooseMission::~GuiChooseMission() { - } - void GuiChooseMission::update() { Gui::update(); } - +static const char *const optionNames[] = {"No Auto Attach \uE0A2", "No Auto Exit after detach \uE0A3", "Disable this screen \uE0B4"}; void GuiChooseMission::draw() { Gui::beginDraw(); - Gui::drawRectangle(0, 0, Gui::g_framebuffer_width, Gui::g_framebuffer_height, Gui::makeColor(0x00, 0x39, 0x29, 0xFF)); - Gui::drawTextAligned(fontHuge, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2 - 100, COLOR_WHITE, "\uE150", ALIGNED_CENTER); - - // Gui::drawTextAligned(font20, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2, COLOR_WHITE, "EdiZon detected that you're running the 'SX OS' CFW. Please note that this CFW has erroneously\n implemented services that can cause unexpected failures, corruption of save data\n or backups, the editor failing to load save files or configs, RAM editing not being\n supported and other issues. For the safety of your Switch, use a free open\n source CFW instead. \n To continue anyway press \uE0E0, otherwise press \uE0E1 to exit.", ALIGNED_CENTER); + Gui::drawTextAligned(fontHuge, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2 - 100, COLOR_WHITE, "Welcome", ALIGNED_CENTER); Gui::drawTextAligned(font20, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2, currTheme.textColor, "Use L, R, ZL, ZR and B to choose storage directory for your search press A to continue", ALIGNED_CENTER); + Gui::drawTextAligned(font20, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2+60, currTheme.textColor, "Use X, Y, - to toggle options, if you disable this screen use R+B to exit will show this on next launch", ALIGNED_CENTER); Gui::drawTextAligned(font20, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2 + 250, COLOR_WHITE, m_edizon_dir.c_str() , ALIGNED_CENTER);//"\uE070 Don't show this warning anymore" - - // if (!Config::getConfig()->hideSX) - // Gui::drawRectangle(Gui::g_framebuffer_width / 2 - 228, Gui::g_framebuffer_height / 2 + 258, 14, 16, Gui::makeColor(0xC5, 0x39, 0x29, 0xFF)); - + for (u8 i = 0; i < 3; i++) + { + // Gui::drawRectangled((Gui::g_framebuffer_width / 4) * (i + 1), Gui::g_framebuffer_height / 2 + 270, 300, 60, currTheme.separatorColor); + Gui::drawTextAligned(font20, (Gui::g_framebuffer_width / 4) * (i + 1), Gui::g_framebuffer_height / 2 + 300, Config::getConfig()->options[i] ? COLOR_WHITE : currTheme.textColor, optionNames[i], ALIGNED_CENTER); + } Gui::endDraw(); } - // while (!(kheld & KEY_ZL)) - // { - // hidScanInput(); - // kheld = hidKeysHeld(CONTROLLER_PLAYER_1) | hidKeysHeld(CONTROLLER_HANDHELD); - // kdown = hidKeysDown(CONTROLLER_PLAYER_1)|hidKeysDown(CONTROLLER_HANDHELD); - // Gui::beginDraw(); - // Gui::drawRectangle(0, 0, Gui::g_framebuffer_width, Gui::g_framebuffer_height, currTheme.backgroundColor); - // Gui::drawTextAligned(fontHuge, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2 - 100, currTheme.textColor, "\uE12C", ALIGNED_CENTER); - // Gui::drawTextAligned(font20, Gui::g_framebuffer_width / 2, Gui::g_framebuffer_height / 2, currTheme.textColor, "Use L, R and B to choose your sessoin directory press A to continue", ALIGNED_CENTER); - // Gui::drawTextAligned(font20, Gui::g_framebuffer_width - 50, Gui::g_framebuffer_height - 50, currTheme.textColor, "\uE0E1 Back", ALIGNED_RIGHT); - // Gui::endDraw(); - // } - // if (kheld & KEY_ZR) - // m_edizon_dir = "/switch/EdiZon1"; - // if (kheld & KEY_L) - // m_edizon_dir = "/switch/EdiZon2"; - // printf("%s\n", m_edizon_dir.c_str()); void GuiChooseMission::onInput(u32 kdown) { if (kdown & KEY_L) @@ -68,8 +47,25 @@ void GuiChooseMission::onInput(u32 kdown) { m_edizon_dir = "/switch/EdiZon"; } + else if (kdown & KEY_X) + { + Config::getConfig()->options[0] = !Config::getConfig()->options[0]; + } + else if (kdown & KEY_Y) + { + Config::getConfig()->options[1] = !Config::getConfig()->options[1]; + } + else if (kdown & KEY_MINUS) + { + Config::getConfig()->options[2] = !Config::getConfig()->options[2]; + } else if (kdown & KEY_A) + { Gui::g_nextGui = GUI_CHEATS; + memcpy(Config::getConfig()->edizon_dir, m_edizon_dir.c_str(), m_edizon_dir.size()); + Config::getConfig()->edizon_dir[m_edizon_dir.size()] = 0; + Config::writeConfig(); + } } void GuiChooseMission::onTouch(touchPosition &touch) { diff --git a/source/helpers/config.cpp b/source/helpers/config.cpp index 38d71b40..be76770a 100644 --- a/source/helpers/config.cpp +++ b/source/helpers/config.cpp @@ -10,7 +10,7 @@ if (access(CONFIG_PATH, F_OK) == 0) { fread(&configData, 1, sizeof(config_data_t), configFile); fclose(configFile); - if (strcmp(configData.magic, "EDZNCFG") != 0) { + if (strcmp(configData.magic, "EDZNCF1") != 0) { memset(&configData, 0x00, sizeof(config_data_t)); Config::writeConfig(); } @@ -21,7 +21,7 @@ if (access(CONFIG_PATH, F_OK) == 0) { void Config::writeConfig() { FILE *configFile = fopen(CONFIG_PATH, "wr"); -memcpy(configData.magic, "EDZNCFG", 8); +memcpy(configData.magic, "EDZNCF1", 8); fwrite(&configData, 1, sizeof(config_data_t), configFile); fclose(configFile); diff --git a/source/main.cpp b/source/main.cpp index 19273b85..fb2cb6b2 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -107,14 +107,19 @@ void update() bool multimissioncheck() { - std::stringstream filenoiconStr; - filenoiconStr << EDIZON_DIR "/nomultimission.txt"; - if (access(filenoiconStr.str().c_str(), F_OK) != 0) - { + Config::readConfig(); + if (Config::getConfig()->option_once || (Config::getConfig()->options[2] == 0)) return true; - } else return false; + // std::stringstream filenoiconStr; + // filenoiconStr << EDIZON_DIR "/nomultimission.txt"; + // if (access(filenoiconStr.str().c_str(), F_OK) != 0) + // { + // return true; + // } + // else + // return false; } void createFolders() { @@ -223,6 +228,10 @@ int main(int argc, char **argv) if (l_debugger->getRunningApplicationPID() != 0) { Gui::g_splashDisplayed = true; + Config::readConfig(); + m_edizon_dir = Config::getConfig()->edizon_dir; + if (m_edizon_dir.compare(0, sizeof(EDIZON_DIR)-1, EDIZON_DIR) != 0) + m_edizon_dir = EDIZON_DIR; if (multimissioncheck()) Gui::g_nextGui = GUI_CHOOSE_MISSION; else