diff --git a/assets/gfx/sprites.t3s b/assets/gfx/sprites.t3s
index b5f7abc..6a21ec8 100644
--- a/assets/gfx/sprites.t3s
+++ b/assets/gfx/sprites.t3s
@@ -5,6 +5,7 @@ sprites/bottom_screen_bot.png
sprites/bottom_screen_top.png
sprites/button.png
sprites/delete.png
+sprites/dev_by.png
sprites/download_all.png
sprites/dropdown.png
sprites/noIcon.png
@@ -15,6 +16,7 @@ sprites/selector.png
sprites/side_arrow.png
sprites/uniStore.png
sprites/uniStore_HD.png
+sprites/universal-updater.png
sprites/update.png
sprites/updateStore.png
sprites/view.png
diff --git a/assets/gfx/sprites/dev_by.png b/assets/gfx/sprites/dev_by.png
new file mode 100644
index 0000000..ace84f2
Binary files /dev/null and b/assets/gfx/sprites/dev_by.png differ
diff --git a/assets/gfx/sprites/universal-updater.png b/assets/gfx/sprites/universal-updater.png
new file mode 100644
index 0000000..d7f565e
Binary files /dev/null and b/assets/gfx/sprites/universal-updater.png differ
diff --git a/include/screens/startup.hpp b/include/screens/startup.hpp
new file mode 100644
index 0000000..9673d7c
--- /dev/null
+++ b/include/screens/startup.hpp
@@ -0,0 +1,42 @@
+/*
+* This file is part of Universal-Updater
+* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
+*
+* 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 .
+*
+* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
+* * Requiring preservation of specified reasonable legal notices or
+* author attributions in that material or in the Appropriate Legal
+* Notices displayed by works containing it.
+* * Prohibiting misrepresentation of the origin of that material,
+* or requiring that modified versions of such material be marked in
+* reasonable ways as different from the original version.
+*/
+
+#ifndef STARTUP_HPP
+#define STARTUP_HPP
+
+#include "common.hpp"
+
+class Startup : public Screen {
+public:
+ void Draw(void) const override;
+ void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
+ Startup(int mode = 0, std::string file = "NOT_USED");
+private:
+ int mode = 0, delay = 150;
+ std::string file = "NOT_USED";
+};
+
+#endif
\ No newline at end of file
diff --git a/include/utils/config.hpp b/include/utils/config.hpp
index bea04d2..f865582 100644
--- a/include/utils/config.hpp
+++ b/include/utils/config.hpp
@@ -113,6 +113,9 @@ public:
// Language.
std::string language() { return this->v_language; }
void language(std::string v) { this->v_language = v; if (!this->changesMade) this->changesMade = true; }
+ // First startup.
+ bool firstStartup() { return this->v_firstStartup; }
+ void firstStartup(bool v) { this->v_firstStartup = v; if (!this->changesMade) this->changesMade = true; }
// Mainly helper.
bool getBool(const std::string &key);
@@ -130,7 +133,7 @@ private:
v_outdatedColor, v_uptodateColor, v_notfoundColor, v_futureColor;
std::string v_scriptPath, v_musicPath, v_storePath, v_autobootFile, v_language;
int v_langPath, v_viewMode, v_autoboot, v_keyDelay;
- bool v_logging, v_useBars, v_screenFade, v_progressDisplay;
+ bool v_logging, v_useBars, v_screenFade, v_progressDisplay, v_firstStartup;
};
#endif
\ No newline at end of file
diff --git a/source/init.cpp b/source/init.cpp
index bfd15cc..2363411 100644
--- a/source/init.cpp
+++ b/source/init.cpp
@@ -33,6 +33,7 @@
#include "mainMenu.hpp"
#include "screenCommon.hpp"
#include "scriptlist.hpp"
+#include "startup.hpp"
#include "sound.h"
#include "unistore.hpp"
@@ -95,7 +96,7 @@ Result Init::Initialize() {
mkdir("sdmc:/3ds/Universal-Updater", 0777);
mkdir("sdmc:/3ds/Universal-Updater/scripts", 0777);
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
-
+
// We need to make sure, the file exist.
config = std::make_unique();
@@ -116,26 +117,32 @@ Result Init::Initialize() {
AutobootWhat = config->autoboot();
- if (config->autoboot() == 1) {
- if (access(config->autobootFile().c_str(), F_OK) == 0) {
- Gui::setScreen(std::make_unique(true, config->autobootFile()), false, true);
+ if (!config->firstStartup()) {
+ if (AutobootWhat == 1) {
+ if (access(config->autobootFile().c_str(), F_OK) == 0) {
+ Gui::setScreen(std::make_unique(true, config->autobootFile()), false, true);
+ } else {
+ AutobootWhat = 0;
+ config->autoboot(0);
+ Gui::setScreen(std::make_unique(), false, true);
+ }
+ } else if (AutobootWhat == 2) {
+ if (access(config->autobootFile().c_str(), F_OK) == 0) {
+ Gui::setScreen(std::make_unique(), false, true);
+ } else {
+ AutobootWhat = 0;
+ config->autoboot(0);
+ Gui::setScreen(std::make_unique(), false, true);
+ }
} else {
AutobootWhat = 0;
config->autoboot(0);
Gui::setScreen(std::make_unique(), false, true);
}
- } else if (config->autoboot() == 2) {
- if (access(config->autobootFile().c_str(), F_OK) == 0) {
- Gui::setScreen(std::make_unique(), false, true);
- } else {
- AutobootWhat = 0;
- config->autoboot(0);
- Gui::setScreen(std::make_unique(), false, true);
- }
- } else {
- AutobootWhat = 0;
- config->autoboot(0);
- Gui::setScreen(std::make_unique(), false, true);
+ }
+
+ if (config->firstStartup()) {
+ Gui::setScreen(std::make_unique(AutobootWhat, config->autobootFile()), false, true);
}
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
diff --git a/source/screens/mainMenu.cpp b/source/screens/mainMenu.cpp
index bf1ce98..20d80e0 100644
--- a/source/screens/mainMenu.cpp
+++ b/source/screens/mainMenu.cpp
@@ -50,6 +50,7 @@ void MainMenu::Draw(void) const {
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
}
+ GFX::DrawSprite(sprites_universal_updater_idx, 110, 30);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
diff --git a/source/screens/startup.cpp b/source/screens/startup.cpp
new file mode 100644
index 0000000..5ec7a76
--- /dev/null
+++ b/source/screens/startup.cpp
@@ -0,0 +1,74 @@
+/*
+* This file is part of Universal-Updater
+* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
+*
+* 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 .
+*
+* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
+* * Requiring preservation of specified reasonable legal notices or
+* author attributions in that material or in the Appropriate Legal
+* Notices displayed by works containing it.
+* * Prohibiting misrepresentation of the origin of that material,
+* or requiring that modified versions of such material be marked in
+* reasonable ways as different from the original version.
+*/
+
+#include "mainMenu.hpp"
+#include "scriptlist.hpp"
+#include "startup.hpp"
+#include "unistore.hpp"
+#include
+
+extern bool touching(touchPosition touch, Structs::ButtonPos button);
+extern int fadealpha;
+extern bool fadein;
+extern std::unique_ptr config;
+
+Startup::Startup(int mode, std::string file) {
+ this->mode = mode; this->file = file;
+}
+
+void Startup::Draw(void) const {
+ GFX::DrawTop();
+ GFX::DrawSprite(sprites_dev_by_idx, 0, 25);
+ if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
+ GFX::DrawBottom();
+ if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
+}
+
+void Startup::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
+ if (this->delay > 0) {
+ this->delay -= 2;
+ if (this->delay <= 0) {
+ if (this->mode == 0) {
+ config->firstStartup(false);
+ Gui::setScreen(std::make_unique(), true, true);
+ } else if (this->mode == 1) {
+ config->firstStartup(false);
+ if (access(this->file.c_str(), F_OK) == 0) {
+ Gui::setScreen(std::make_unique(true, this->file), true, true);
+ } else {
+ Gui::setScreen(std::make_unique(), true, true);
+ }
+ } else if (this->mode == 2) {
+ config->firstStartup(false);
+ if (access(this->file.c_str(), F_OK) == 0) {
+ Gui::setScreen(std::make_unique(), true, true);
+ } else {
+ Gui::setScreen(std::make_unique(), true, true);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/utils/config.cpp b/source/utils/config.cpp
index dc27d94..b45cb38 100644
--- a/source/utils/config.cpp
+++ b/source/utils/config.cpp
@@ -61,6 +61,7 @@ void Config::initialize() {
this->setBool("SCREEN_FADE", false);
this->setBool("PROGRESS_DISPLAY", true);
this->setString("LANGUAGE", "en");
+ this->setBool("FIRST_STARTUP", true);
// Write to file.
fwrite(this->json.dump(1, '\t').c_str(), 1, this->json.dump(1, '\t').size(), file);
@@ -165,7 +166,7 @@ Config::Config() {
if (!this->json.contains("AUTOBOOT")) {
this->autoboot(0);
} else {
- this->viewMode(this->getInt("AUTOBOOT"));
+ this->autoboot(this->getInt("AUTOBOOT"));
}
if (!this->json.contains("STOREPATH")) {
@@ -228,6 +229,12 @@ Config::Config() {
this->language(this->getString("LANGUAGE"));
}
+ if (!this->json.contains("FIRST_STARTUP")) {
+ this->firstStartup(true);
+ } else {
+ this->firstStartup(this->getBool("FIRST_STARTUP"));
+ }
+
this->changesMade = false; // No changes made yet.
}
@@ -261,6 +268,7 @@ void Config::save() {
this->setBool("SCREEN_FADE", this->screenFade());
this->setBool("PROGRESS_DISPLAY", this->progressDisplay());
this->setString("LANGUAGE", this->language());
+ this->setBool("FIRST_STARTUP", this->firstStartup());
// Write changes to file.
fwrite(this->json.dump(1, '\t').c_str(), 1, this->json.dump(1, '\t').size(), file);
fclose(file);