mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
Some, uhh.. changes?
This commit is contained in:
+11
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,19 +24,21 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef ANIMATION_HPP
|
||||
#define ANIMATION_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_ANIMATION_HPP
|
||||
#define _UNIVERSAL_UPDATER_ANIMATION_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
enum class ProgressBar {
|
||||
Downloading,
|
||||
Extracting,
|
||||
Installing
|
||||
};
|
||||
|
||||
namespace Animation {
|
||||
// Downloading Progressbar.
|
||||
void DrawProgressBar(float currentProgress, float totalProgress, int mode);
|
||||
// Extracting progressbar.
|
||||
void DrawProgressBarExtract(u64 currentProgress, u64 totalProgress, int mode);
|
||||
// Installing progressbar.
|
||||
void DrawProgressBarInstall(u64 currentProgress, u64 totalProgress, int mode);
|
||||
// Progressbar.
|
||||
void DrawProgressBar(u64 currentProgress, u64 totalProgress);
|
||||
// Draw Button.
|
||||
void Button(int x, int y, float speed = .030);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,13 +24,13 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef DOWNLOAD_HPP
|
||||
#define DOWNLOAD_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_DOWNLOAD_HPP
|
||||
#define _UNIVERSAL_UPDATER_DOWNLOAD_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#define APP_TITLE "Universal-Updater"
|
||||
#define VERSION_STRING "2.4.0"
|
||||
#define VERSION_STRING "2.5.0"
|
||||
|
||||
// The Release Fetch struct.
|
||||
struct ReleaseFetch {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef GFX_HPP
|
||||
#define GFX_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_GFX_HPP
|
||||
#define _UNIVERSAL_UPDATER_GFX_HPP
|
||||
|
||||
#include "colorHelper.hpp"
|
||||
#include "gui.hpp"
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
#ifndef KEYBOARD_HPP
|
||||
#define KEYBOARD_HPP
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 _UNIVERSAL_UPDATER_KEYBOARD_HPP
|
||||
#define _UNIVERSAL_UPDATER_KEYBOARD_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef MSG_HPP
|
||||
#define MSG_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_MSG_HPP
|
||||
#define UNIVERSAL_UPDATER_MSG_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef INIT_HPP
|
||||
#define INIT_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_INIT_HPP
|
||||
#define _UNIVERSAL_UPDATER_INIT_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
|
||||
+28
-2
@@ -1,5 +1,31 @@
|
||||
#ifndef LANG_HPP
|
||||
#define LANG_HPP
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 _UNIVERSAL_UPDATER_LANG_HPP
|
||||
#define _UNIVERSAL_UPDATER_LANG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef LOGGING_HPP
|
||||
#define LOGGING_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_LOGGING_HPP
|
||||
#define _UNIVERSAL_UPDATER_LOGGING_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef CREDITS_HPP
|
||||
#define CREDITS_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_CREDITS_HPP
|
||||
#define _UNIVERSAL_UPDATER_CREDITS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,6 +24,9 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_UPDATER_FTP_SCREEN_HPP
|
||||
#define _UNIVERSAL_UPDATER_FTP_SCREEN_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
@@ -39,4 +42,6 @@ private:
|
||||
const std::vector<Structs::ButtonPos> arrowPos = {
|
||||
{0, 215, 25, 25} // Back Arrow.
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef MAINMENU_HPP
|
||||
#define MAINMENU_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_MAINMENU_HPP
|
||||
#define _UNIVERSAL_UPDATER_MAINMENU_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTBROWSE_HPP
|
||||
#define SCRIPTBROWSE_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_SCRIPT_BROWSE_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_BROWSE_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "fileBrowse.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTCREATOR_HPP
|
||||
#define SCRIPTCREATOR_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_SCRIPT_CREATOR_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_CREATOR_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "json.hpp"
|
||||
@@ -37,7 +37,6 @@ class ScriptCreator : public Screen {
|
||||
public:
|
||||
void Draw(void) const override;
|
||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||
|
||||
private:
|
||||
std::string entryName = "";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTLIST_HPP
|
||||
#define SCRIPTLIST_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_SCRIPT_LIST_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_LIST_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "fileBrowse.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SETTINGS_HPP
|
||||
#define SETTINGS_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_SETTINGS_HPP
|
||||
#define _UNIVERSAL_UPDATER_SETTINGS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "fileBrowse.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef STARTUP_HPP
|
||||
#define STARTUP_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_STARTUP_HPP
|
||||
#define _UNIVERSAL_UPDATER_STARTUP_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef UNISTORE_HPP
|
||||
#define UNISTORE_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_UNISTORE_HPP
|
||||
#define _UNIVERSAL_UPDATER_UNISTORE_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "fileBrowse.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef UNIVERSAL_STORE_V1_HPP
|
||||
#define UNIVERSAL_STORE_V1_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V1_HPP
|
||||
#define _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V1_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "json.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef UNIVERSAL_STORE_V2_HPP
|
||||
#define UNIVERSAL_STORE_V2_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V2_HPP
|
||||
#define _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V2_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "json.hpp"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CIA_HPP
|
||||
#define CIA_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_CIA_HPP
|
||||
#define _UNIVERSAL_UPDATER_CIA_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef COLORHELPER_HPP
|
||||
#define COLORHELPER_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_COLOR_HELPER_HPP
|
||||
#define _UNIVERSAL_UPDATER_COLOR_HELPER_HPP
|
||||
|
||||
#include <citro2d.h>
|
||||
#include <citro3d.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef EXTRACT_HPP
|
||||
#define EXTRACT_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_EXTRACT_HPP
|
||||
#define _UNIVERSAL_UPDATER_EXTRACT_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
#ifndef FILE_BROWSE_HPP
|
||||
#define FILE_BROWSE_HPP
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 _UNIVERSAL_UPDATER_FILE_BROWSE_HPP
|
||||
#define _UNIVERSAL_UPDATER_FILE_BROWSE_HPP
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string>
|
||||
@@ -27,4 +53,4 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
||||
void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath);
|
||||
int fcopy(const char *sourcePath, const char *destinationPath);
|
||||
|
||||
#endif //FILE_BROWSE_HPP
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,7 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef _UNIVERSAL_UPDATER_FILES_H
|
||||
#define _UNIVERSAL_UPDATER_FILES_H
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
@@ -32,4 +33,6 @@ Result makeDirs(const char * path);
|
||||
Result openFile(Handle* fileHandle, const char * path, bool write);
|
||||
Result deleteFile(const char * path);
|
||||
Result removeDir(const char * path);
|
||||
Result removeDirRecursive(const char * path);
|
||||
Result removeDirRecursive(const char * path);
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef FORMATTING_HPP
|
||||
#define FORMATTING_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_FORMATTING_HPP
|
||||
#define _UNIVERSAL_UPDATER_FORMATTING_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+1
-1
@@ -15,4 +15,4 @@ extern char ftp_accepted_connection[50], ftp_file_transfer[100];
|
||||
|
||||
int ftp_init(void);
|
||||
loop_status_t ftp_loop(void);
|
||||
void ftp_exit(void);
|
||||
void ftp_exit(void);
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTHELPER_HPP
|
||||
#define SCRIPTHELPER_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_SCRIPT_HELPER_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_HELPER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SOUND_H
|
||||
#define SOUND_H
|
||||
#ifndef _UNIVERSAL_UPDATER_SOUND_H
|
||||
#define _UNIVERSAL_UPDATER_SOUND_H
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef STORE_HPP
|
||||
#define STORE_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_STORE_HPP
|
||||
#define _UNIVERSAL_UPDATER_STORE_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <3ds.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef STRINGUTILS_HPP
|
||||
#define STRINGUTILS_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_STRING_UTILS_HPP
|
||||
#define _UNIVERSAL_UPDATER_STRING_UTILS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef THREAD_HPP
|
||||
#define THREAD_HPP
|
||||
#ifndef _UNIVERSAL_UPDATER_THREAD_HPP
|
||||
#define _UNIVERSAL_UPDATER_THREAD_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <vector>
|
||||
|
||||
+8
-45
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -27,49 +27,18 @@
|
||||
#include "common.hpp"
|
||||
|
||||
extern bool isScriptSelected;
|
||||
extern u32 progressBar;
|
||||
extern u32 selected;
|
||||
extern u32 progressBar, selected;
|
||||
extern ProgressBar progressbarType;
|
||||
|
||||
extern std::unique_ptr<Config> config;
|
||||
extern C2D_SpriteSheet sprites;
|
||||
|
||||
// Draws a Rectangle as the progressbar.
|
||||
void Animation::DrawProgressBar(float currentProgress, float totalProgress, int mode) {
|
||||
void Animation::DrawProgressBar(u64 currentProgress, u64 totalProgress) {
|
||||
if (config->progressDisplay()) {
|
||||
// Outline of progressbar.
|
||||
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
||||
|
||||
if (mode == 1) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||
} else {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::DrawProgressBarInstall(u64 currentProgress, u64 totalProgress, int mode) {
|
||||
if (config->progressDisplay()) {
|
||||
// Outline of progressbar.
|
||||
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
||||
|
||||
if (mode == 1) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||
} else {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::DrawProgressBarExtract(u64 currentProgress, u64 totalProgress, int mode) {
|
||||
if (config->progressDisplay()) {
|
||||
// Outline of progressbar.
|
||||
Gui::Draw_Rect(30, 140, 340, 30, BLACK);
|
||||
|
||||
if (mode == 1) {
|
||||
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||
} else {
|
||||
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||
}
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, isScriptSelected ? progressBar : config->progressbarColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,15 +46,9 @@ void Animation::Button(int x, int y, float speed) {
|
||||
static float timer = 0.0f;
|
||||
float highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 0.5) / 0.5);
|
||||
u8 r, g, b;
|
||||
if (isScriptSelected) {
|
||||
r = selected & 0xFF;
|
||||
g = (selected >> 8) & 0xFF;
|
||||
b = (selected >> 16) & 0xFF;
|
||||
} else {
|
||||
r = config->selectedColor() & 0xFF;
|
||||
g = (config->selectedColor() >> 8) & 0xFF;
|
||||
b = (config->selectedColor() >> 16) & 0xFF;
|
||||
}
|
||||
r = (isScriptSelected ? selected : config->selectedColor()) & 0xFF;
|
||||
g = ((isScriptSelected ? selected : config->selectedColor()) >> 8) & 0xFF;
|
||||
b = ((isScriptSelected ? selected : config->selectedColor()) >> 16) & 0xFF;
|
||||
|
||||
u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -50,7 +50,7 @@ extern int filesExtracted;
|
||||
extern std::string extractingFile;
|
||||
char progressBarMsg[128] = "";
|
||||
bool showProgressBar = false;
|
||||
int progressBarType = 0; // 0 = Download | 1 = Extract | 2 = Install
|
||||
ProgressBar progressbarType = ProgressBar::Downloading;
|
||||
|
||||
// That are our extract Progressbar variables.
|
||||
extern u64 extractSize, writeOffset;
|
||||
@@ -351,13 +351,8 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
||||
C2D_TargetClear(Top, BLACK);
|
||||
C2D_TargetClear(Bottom, BLACK);
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, Lang::get("VERSION_SELECT"), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, releaseAmount), 239-Gui::GetStringHeight(0.6f, releaseAmount), 0.6f, TextColor, releaseAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, Lang::get("VERSION_SELECT"), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, releaseAmount), 237-Gui::GetStringHeight(0.6f, releaseAmount), 0.6f, TextColor, releaseAmount);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, TextColor, Lang::get("VERSION_SELECT"), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, releaseAmount), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, releaseAmount), 0.6f, TextColor, releaseAmount);
|
||||
// Display Informations.
|
||||
Gui::DrawStringCentered(0, 35, 0.7f, TextColor, Lang::get("TAG_NAME") + std::string(bruh[selectedRelease].TagName), 400);
|
||||
Gui::DrawStringCentered(0, 65, 0.7f, TextColor, Lang::get("TARGET") + std::string(bruh[selectedRelease].Target), 400);
|
||||
@@ -570,6 +565,7 @@ Result downloadFromRelease(std::string url, std::string asset, std::string path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parsedAPI.size() == 0) {
|
||||
// All were prereleases and those are being ignored
|
||||
return -2; // TODO: Maybe change this? I'm note sure what good return values are -Pk11
|
||||
@@ -615,7 +611,7 @@ Result downloadFromRelease(std::string url, std::string asset, std::string path,
|
||||
} else {
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), Message.c_str());
|
||||
showProgressBar = true;
|
||||
progressBarType = 0;
|
||||
progressbarType = ProgressBar::Downloading;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
ret = downloadToFile(assetUrl, path);
|
||||
}
|
||||
@@ -850,89 +846,53 @@ void displayProgressBar() {
|
||||
downloadTotal = downloadNow;
|
||||
}
|
||||
|
||||
if (progressBarType == 0) curl_easy_getinfo(hnd, CURLINFO_SPEED_DOWNLOAD_T, &downloadSpeed); // Get download speed.
|
||||
if (progressbarType == ProgressBar::Downloading) curl_easy_getinfo(hnd, CURLINFO_SPEED_DOWNLOAD_T, &downloadSpeed); // Get download speed.
|
||||
|
||||
// Downloading.
|
||||
if (progressBarType == 0){
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%) \n\n\n\n\n %s %lld %s",
|
||||
formatBytes(downloadNow).c_str(),
|
||||
formatBytes(downloadTotal).c_str(),
|
||||
((float)downloadNow/(float)downloadTotal) * 100.0f,
|
||||
Lang::get("DOWNLOAD_SPEED").c_str(), (downloadSpeed / 1000), Lang::get("KB_PER_SECOND").c_str());
|
||||
// Extracting.
|
||||
} else if (progressBarType == 1) {
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%)",
|
||||
formatBytes(writeOffset).c_str(),
|
||||
formatBytes(extractSize).c_str(),
|
||||
((float)writeOffset/(float)extractSize) * 100.0f);
|
||||
// Installing.
|
||||
} else if (progressBarType == 2){
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%)",
|
||||
formatBytes(installOffset).c_str(),
|
||||
formatBytes(installSize).c_str(),
|
||||
((float)installOffset/(float)installSize) * 100.0f);
|
||||
};
|
||||
switch(progressbarType) {
|
||||
case ProgressBar::Downloading:
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%) \n\n\n\n\n %s %lld %s",
|
||||
formatBytes(downloadNow).c_str(),
|
||||
formatBytes(downloadTotal).c_str(),
|
||||
((float)downloadNow/(float)downloadTotal) * 100.0f,
|
||||
Lang::get("DOWNLOAD_SPEED").c_str(), (downloadSpeed / 1000), Lang::get("KB_PER_SECOND").c_str());
|
||||
break;
|
||||
case ProgressBar::Extracting:
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%)",
|
||||
formatBytes(writeOffset).c_str(),
|
||||
formatBytes(extractSize).c_str(),
|
||||
((float)writeOffset/(float)extractSize) * 100.0f);
|
||||
break;
|
||||
case ProgressBar::Installing:
|
||||
snprintf(str, sizeof(str), "%s / %s (%.2f%%)",
|
||||
formatBytes(installOffset).c_str(),
|
||||
formatBytes(installSize).c_str(),
|
||||
((float)installOffset/(float)installSize) * 100.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
Gui::clearTextBufs();
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
C2D_TargetClear(Top, BLACK);
|
||||
C2D_TargetClear(Bottom, BLACK);
|
||||
GFX::DrawTop();
|
||||
// Display this by all.
|
||||
if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, 1, 0.7f, TextColor, progressBarMsg, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 1, 0.7f, config->textColor(), progressBarMsg, 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, 1, 0.7f, isScriptSelected ? TextColor : config->textColor(), progressBarMsg, 400);
|
||||
|
||||
// Only display this by downloading.
|
||||
if (progressBarType == 0) {
|
||||
if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, config->textColor(), str, 400);
|
||||
}
|
||||
|
||||
if (isScriptSelected == true) {
|
||||
Animation::DrawProgressBar(downloadNow, downloadTotal, 1);
|
||||
} else {
|
||||
Animation::DrawProgressBar(downloadNow, downloadTotal, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Only Display this by extracting.
|
||||
if (progressBarType == 1) {
|
||||
// Text.
|
||||
if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, 180, 0.6f, TextColor, str, 400);
|
||||
Gui::DrawStringCentered(0, 100, 0.6f, TextColor, std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
||||
Gui::DrawStringCentered(0, 40, 0.6f, TextColor, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 180, 0.6f, config->textColor(), str, 400);
|
||||
Gui::DrawStringCentered(0, 100, 0.6f, config->textColor(), std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
||||
Gui::DrawStringCentered(0, 40, 0.6f, config->textColor(), Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
||||
}
|
||||
// Progressbar.
|
||||
if (isScriptSelected == true) {
|
||||
Animation::DrawProgressBarExtract(writeOffset, extractSize, 1);
|
||||
} else {
|
||||
Animation::DrawProgressBarExtract(writeOffset, extractSize, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Only display this by installing.
|
||||
if (progressBarType == 2) {
|
||||
if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, config->textColor(), str, 400);
|
||||
}
|
||||
|
||||
if (isScriptSelected == true) {
|
||||
Animation::DrawProgressBarInstall(installOffset, installSize, 1);
|
||||
} else {
|
||||
Animation::DrawProgressBarInstall(installOffset, installSize, 2);
|
||||
}
|
||||
switch(progressbarType) {
|
||||
case ProgressBar::Downloading:
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, isScriptSelected ? TextColor : config->textColor(), str, 400);
|
||||
Animation::DrawProgressBar(downloadNow, downloadTotal);
|
||||
break;
|
||||
case ProgressBar::Extracting:
|
||||
Gui::DrawStringCentered(0, 180, 0.6f, isScriptSelected ? TextColor : config->textColor(), str, 400);
|
||||
Gui::DrawStringCentered(0, 100, 0.6f, isScriptSelected ? TextColor : config->textColor(), std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
||||
Gui::DrawStringCentered(0, 40, 0.6f, isScriptSelected ? TextColor : config->textColor(), Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
||||
Animation::DrawProgressBar(writeOffset, extractSize);
|
||||
break;
|
||||
case ProgressBar::Installing:
|
||||
Gui::DrawStringCentered(0, 80, 0.6f, isScriptSelected ? TextColor : config->textColor(), str, 400);
|
||||
Animation::DrawProgressBar(installOffset, installSize);
|
||||
break;
|
||||
}
|
||||
GFX::DrawBottom();
|
||||
C3D_FrameEnd(0);
|
||||
|
||||
+23
-66
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -29,50 +29,27 @@
|
||||
|
||||
extern std::unique_ptr<Config> config;
|
||||
extern bool isScriptSelected;
|
||||
extern u32 barColor;
|
||||
extern u32 bgTopColor;
|
||||
extern u32 bgBottomColor;
|
||||
extern u32 TextColor;
|
||||
extern u32 barColor, bgTopColor, bgBottomColor, TextColor;
|
||||
|
||||
void GFX::DrawTop(void) {
|
||||
Gui::ScreenDraw(Top);
|
||||
if (isScriptSelected == false) {
|
||||
Gui::Draw_Rect(0, 0, 400, 25, config->barColor());
|
||||
Gui::Draw_Rect(0, 25, 400, 190, config->topBG());
|
||||
Gui::Draw_Rect(0, 215, 400, 25, config->barColor());
|
||||
if (config->useBars() == true) {
|
||||
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
}
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::Draw_Rect(0, 0, 400, 30, barColor);
|
||||
Gui::Draw_Rect(0, 25, 400, 190, bgBottomColor);
|
||||
Gui::Draw_Rect(0, 215, 400, 25, barColor);
|
||||
if (config->useBars() == true) {
|
||||
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
}
|
||||
Gui::Draw_Rect(0, 0, 400, 25, isScriptSelected ? barColor : config->barColor());
|
||||
Gui::Draw_Rect(0, 25, 400, 190, isScriptSelected ? bgTopColor : config->topBG());
|
||||
Gui::Draw_Rect(0, 215, 400, 25, isScriptSelected ? barColor : config->barColor());
|
||||
if (config->useBars()) {
|
||||
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
}
|
||||
}
|
||||
|
||||
void GFX::DrawBottom(void) {
|
||||
Gui::ScreenDraw(Bottom);
|
||||
if (isScriptSelected == false) {
|
||||
Gui::Draw_Rect(0, 0, 320, 25, config->barColor());
|
||||
Gui::Draw_Rect(0, 25, 320, 190, config->bottomBG());
|
||||
Gui::Draw_Rect(0, 215, 320, 25, config->barColor());
|
||||
if (config->useBars() == true) {
|
||||
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::Draw_Rect(0, 0, 320, 30, barColor);
|
||||
Gui::Draw_Rect(0, 25, 320, 190, bgBottomColor);
|
||||
Gui::Draw_Rect(0, 215, 320, 25, barColor);
|
||||
if (config->useBars() == true) {
|
||||
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
Gui::Draw_Rect(0, 0, 320, 25, isScriptSelected ? barColor : config->barColor());
|
||||
Gui::Draw_Rect(0, 25, 320, 190, isScriptSelected ? bgBottomColor : config->bottomBG());
|
||||
Gui::Draw_Rect(0, 215, 320, 25, isScriptSelected ? barColor : config->barColor());
|
||||
if (config->useBars()) {
|
||||
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,17 +61,10 @@ void GFX::DrawSprite(int img, int x, int y, float ScaleX, float ScaleY) {
|
||||
|
||||
void GFX::DrawSpriteBlend(int img, int x, int y, float ScaleX, float ScaleY) {
|
||||
C2D_ImageTint tint;
|
||||
if (isScriptSelected) {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||
} else {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, config->textColor(), 0.5);
|
||||
}
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
|
||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, img), x, y, 0.5f, &tint, ScaleX, ScaleY);
|
||||
}
|
||||
@@ -102,17 +72,10 @@ void GFX::DrawSpriteBlend(int img, int x, int y, float ScaleX, float ScaleY) {
|
||||
void GFX::DrawArrow(int x, int y, float rotation, int arrowSprite) {
|
||||
C2D_Sprite sprite;
|
||||
C2D_ImageTint tint;
|
||||
if (isScriptSelected) {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||
} else {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, config->textColor(), 0.5);
|
||||
}
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, isScriptSelected ? TextColor : config->textColor(), 0.5);
|
||||
|
||||
if (arrowSprite == 0) {
|
||||
C2D_SpriteFromSheet(&sprite, sprites, sprites_arrow_idx);
|
||||
@@ -134,11 +97,5 @@ void GFX::DrawButton(int x, int y, std::string ButtonText, u32 color) {
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, color, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, color, 0.5);
|
||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, sprites_button_idx), x, y, 0.5f, &tint);
|
||||
|
||||
// Draw String. TODO: Center.
|
||||
if (isScriptSelected) {
|
||||
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, TextColor, ButtonText, 145, 30);
|
||||
} else {
|
||||
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, config->textColor(), ButtonText, 145, 30);
|
||||
}
|
||||
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, isScriptSelected ? TextColor : config->textColor(), ButtonText, 145, 30);
|
||||
}
|
||||
+31
-5
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 "config.hpp"
|
||||
#include "gfx.hpp"
|
||||
#include "gui.hpp"
|
||||
@@ -80,7 +106,7 @@ extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
|
||||
|
||||
void Input::DrawNumpad() {
|
||||
for(uint i=0;i<(sizeof(NumpadStruct)/sizeof(NumpadStruct[0]));i++) {
|
||||
for(uint i = 0; i < (sizeof(NumpadStruct)/sizeof(NumpadStruct[0])); i++) {
|
||||
Gui::Draw_Rect(NumpadStruct[i].x, NumpadStruct[i].y, 60, 50, config->barColor());
|
||||
char c[2] = {NumpadStruct[i].character[0]};
|
||||
Gui::DrawString(NumpadStruct[i].x+25, NumpadStruct[i].y+15, 0.72f, config->textColor(), c, 50);
|
||||
@@ -88,7 +114,7 @@ void Input::DrawNumpad() {
|
||||
}
|
||||
|
||||
void Input::drawKeyboard() {
|
||||
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
||||
for(uint i = 0; i < (sizeof(keysQWERTY)/sizeof(keysQWERTY[0])); i++) {
|
||||
C2D_DrawRectSolid(keysQWERTY[i].x, keysQWERTY[i].y+103, 0.5f, 20, 20, config->barColor() & C2D_Color32(255, 255, 255, 200));
|
||||
if (shift) {
|
||||
char c[2] = {caps ? (char)toupper(keysQWERTYShift[i].character[0]) : keysQWERTYShift[i].character[0]};
|
||||
@@ -99,7 +125,7 @@ void Input::drawKeyboard() {
|
||||
}
|
||||
}
|
||||
|
||||
for(uint i=0;i<(sizeof(modifierKeys)/sizeof(modifierKeys[0]));i++) {
|
||||
for(uint i = 0; i < (sizeof(modifierKeys)/sizeof(modifierKeys[0])); i++) {
|
||||
std::string enter = modifierKeys[2].character;
|
||||
std::string arrowUp = modifierKeys[3].character;
|
||||
std::string backSpace = modifierKeys[0].character;
|
||||
@@ -234,7 +260,7 @@ std::string Input::getString(uint maxLength, std::string Text, float inputTextSi
|
||||
touchRead(&touch);
|
||||
if (string.length() < maxLength) {
|
||||
// Check if a regular key was pressed
|
||||
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
||||
for(uint i = 0; i < (sizeof(keysQWERTY)/sizeof(keysQWERTY[0])); i++) {
|
||||
if ((touch.px > keysQWERTY[i].x-2 && touch.px < keysQWERTY[i].x+18) && (touch.py > keysQWERTY[i].y+(103)-2 && touch.py < keysQWERTY[i].y+18+(103))) {
|
||||
char c = (shift ? keysQWERTYShift[i] : keysQWERTY[i]).character[0];
|
||||
string += (shift || caps ? toupper(c) : c);
|
||||
@@ -244,7 +270,7 @@ std::string Input::getString(uint maxLength, std::string Text, float inputTextSi
|
||||
}
|
||||
}
|
||||
// Check if a modifier key was pressed
|
||||
for(uint i=0;i<(sizeof(modifierKeys)/sizeof(modifierKeys[0]));i++) {
|
||||
for(uint i = 0; i < (sizeof(modifierKeys)/sizeof(modifierKeys[0])); i++) {
|
||||
if ((touch.px > modifierKeys[i].x-2 && touch.px < modifierKeys[i].x+modifierKeys[i].w+2) && (touch.py > modifierKeys[i].y+(103)-2 && touch.py < modifierKeys[i].y+18+(103))) {
|
||||
if (modifierKeys[i].character == "\uE071") {
|
||||
string = string.substr(0, string.length()-1);
|
||||
|
||||
+12
-37
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -30,10 +30,7 @@
|
||||
extern std::unique_ptr<Config> config;
|
||||
extern bool isScriptSelected;
|
||||
|
||||
extern u32 barColor;
|
||||
extern u32 bgTopColor;
|
||||
extern u32 bgBottomColor;
|
||||
extern u32 TextColor;
|
||||
extern u32 barColor, bgTopColor, bgBottomColor, TextColor;
|
||||
|
||||
// I do not think we need that at all.
|
||||
void Msg::DisplayStartMSG() {
|
||||
@@ -61,12 +58,7 @@ void Msg::DisplayMsg(std::string text) {
|
||||
C2D_TargetClear(Top, BLACK);
|
||||
C2D_TargetClear(Bottom, BLACK);
|
||||
GFX::DrawTop();
|
||||
if (isScriptSelected == false) {
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, config->textColor(), text, 395, 70);
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, TextColor, text, 395, 70);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, isScriptSelected ? TextColor : config->textColor(), text, 395, 70);
|
||||
GFX::DrawBottom();
|
||||
C3D_FrameEnd(0);
|
||||
}
|
||||
@@ -77,12 +69,7 @@ void Msg::DisplayWarnMsg(std::string Text) {
|
||||
C2D_TargetClear(Top, BLACK);
|
||||
C2D_TargetClear(Bottom, BLACK);
|
||||
GFX::DrawTop();
|
||||
if (isScriptSelected == false) {
|
||||
Gui::DrawStringCentered(0, 1, 0.6f, config->textColor(), Text, 400);
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, 1, 0.6f, TextColor, Text, 400);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 1, 0.6f, isScriptSelected ? TextColor : config->textColor(), Text, 400);
|
||||
GFX::DrawBottom();
|
||||
C3D_FrameEnd(0);
|
||||
for (int i = 0; i < 60*3; i++) {
|
||||
@@ -91,9 +78,9 @@ void Msg::DisplayWarnMsg(std::string Text) {
|
||||
}
|
||||
|
||||
|
||||
std::vector<Structs::ButtonPos> promptBtn = {
|
||||
const std::vector<Structs::ButtonPos> promptBtn = {
|
||||
{10, 100, 140, 35}, // Yes.
|
||||
{170, 100, 140, 35}, // No.
|
||||
{170, 100, 140, 35} // No.
|
||||
};
|
||||
|
||||
extern touchPosition touch;
|
||||
@@ -106,26 +93,14 @@ bool Msg::promptMsg(std::string promptMsg) {
|
||||
C2D_TargetClear(Top, BLACK);
|
||||
C2D_TargetClear(Bottom, BLACK);
|
||||
GFX::DrawTop();
|
||||
if (isScriptSelected == false) {
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, config->textColor(), promptMsg, 395, 70);
|
||||
Gui::DrawStringCentered(0, 217, 0.72f, config->textColor(), Lang::get("CONFIRM_OR_CANCEL"), 400);
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, TextColor, promptMsg, 395, 70);
|
||||
Gui::DrawStringCentered(0, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, isScriptSelected ? TextColor : config->textColor(), promptMsg, 395, 70);
|
||||
Gui::DrawStringCentered(0, 217, 0.72f, isScriptSelected ? TextColor : config->textColor(), Lang::get("CONFIRM_OR_CANCEL"), 400);
|
||||
|
||||
GFX::DrawBottom();
|
||||
if (isScriptSelected == false) {
|
||||
Gui::Draw_Rect(10, 100, 140, 35, config->barColor());
|
||||
Gui::Draw_Rect(170, 100, 140, 35, config->barColor());
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, config->textColor(), Lang::get("YES"), 140);
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, config->textColor(), Lang::get("NO"), 140);
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::Draw_Rect(10, 100, 140, 35, barColor);
|
||||
Gui::Draw_Rect(170, 100, 140, 35, barColor);
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, TextColor, Lang::get("YES"), 140);
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, TextColor, Lang::get("NO"), 140);
|
||||
}
|
||||
Gui::Draw_Rect(10, 100, 140, 35, isScriptSelected ? barColor : config->barColor());
|
||||
Gui::Draw_Rect(170, 100, 140, 35, isScriptSelected ? barColor : config->barColor());
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, isScriptSelected ? TextColor : config->textColor(), Lang::get("YES"), 140);
|
||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, isScriptSelected ? TextColor : config->textColor(), Lang::get("NO"), 140);
|
||||
|
||||
C3D_FrameEnd(0);
|
||||
while(1) {
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -63,7 +63,7 @@ bool touching(touchPosition touch, Structs::ButtonPos button) {
|
||||
}
|
||||
|
||||
void Init::loadSoundEffects(void) {
|
||||
if (dspFound == true) {
|
||||
if (dspFound) {
|
||||
if (access(config->musicPath().c_str(), F_OK ) != -1) {
|
||||
bgm = new sound(config->musicPath(), 1, true);
|
||||
songIsFound = true;
|
||||
@@ -72,13 +72,13 @@ void Init::loadSoundEffects(void) {
|
||||
}
|
||||
|
||||
void Init::playMusic(void) {
|
||||
if (songIsFound == true) {
|
||||
if (songIsFound) {
|
||||
bgm->play();
|
||||
}
|
||||
}
|
||||
|
||||
void Init::stopMusic(void) {
|
||||
if (songIsFound == true) {
|
||||
if (songIsFound) {
|
||||
bgm->stop();
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ Result Init::Initialize() {
|
||||
|
||||
// In case it takes a bit longer to autoboot a script or so.
|
||||
Msg::DisplayStartMSG();
|
||||
if (config->logging() == true) {
|
||||
if (config->logging()) {
|
||||
Logging::createLogFile();
|
||||
}
|
||||
|
||||
@@ -186,11 +186,11 @@ Result Init::MainLoop() {
|
||||
}
|
||||
|
||||
Result Init::Exit() {
|
||||
if (songIsFound == true) {
|
||||
if (songIsFound) {
|
||||
stopMusic();
|
||||
}
|
||||
delete bgm;
|
||||
if (dspFound == true) {
|
||||
if (dspFound) {
|
||||
ndspExit();
|
||||
}
|
||||
|
||||
|
||||
+30
-3
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 "config.hpp"
|
||||
#include "lang.hpp"
|
||||
|
||||
@@ -8,9 +34,10 @@ extern std::unique_ptr<Config> config;
|
||||
nlohmann::json appJson;
|
||||
|
||||
std::string Lang::get(const std::string &key) {
|
||||
if(!appJson.contains(key)) {
|
||||
if (!appJson.contains(key)) {
|
||||
return "MISSING: " + key;
|
||||
}
|
||||
|
||||
return appJson.at(key).get_ref<const std::string&>();
|
||||
}
|
||||
|
||||
@@ -20,7 +47,7 @@ void Lang::load(const std::string lang) {
|
||||
FILE* values;
|
||||
if (config->langPath() == 1) {
|
||||
// Check if exist.
|
||||
if (access("sdmc:/3ds/Universal-Updater/app.json", F_OK) == 0 ) {
|
||||
if (access("sdmc:/3ds/Universal-Updater/app.json", F_OK) == 0) {
|
||||
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
@@ -35,7 +62,7 @@ void Lang::load(const std::string lang) {
|
||||
|
||||
} else {
|
||||
// Check if exist.
|
||||
if (access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0 ) {
|
||||
if (access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0) {
|
||||
values = fopen(std::string(("romfs:/lang/" + lang + "/app.json")).c_str(), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -84,11 +84,7 @@ void Credits::Draw(void) const {
|
||||
title += Lang::get("CREDITS");
|
||||
GFX::DrawTop();
|
||||
if (creditsPage != 3) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), title, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), title, 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), title, 400);
|
||||
Gui::DrawStringCentered(0, 30, 0.7f, config->textColor(), Lang::get("DEVELOPED_BY"), 390);
|
||||
Gui::DrawStringCentered(0, 60, 0.7f, config->textColor(), Lang::get("MAIN_DEV"), 390);
|
||||
GFX::DrawSprite(sprites_stackie_idx, 5, 85);
|
||||
@@ -113,7 +109,7 @@ void Credits::DrawBottom(void) const {
|
||||
GFX::DrawBottom();
|
||||
if (creditsPage == 0) {
|
||||
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), Lang::get("TRANSLATORS"), 320);
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)Translators.size();i++) {
|
||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)Translators.size(); i++) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||
line1 = Translators[screenPos + i];
|
||||
line2 = Languages[screenPos + i];
|
||||
@@ -125,7 +121,7 @@ void Credits::DrawBottom(void) const {
|
||||
}
|
||||
} else if (creditsPage == 1) {
|
||||
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), "Universal-Team", 320);
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)UniversalTeam.size();i++) {
|
||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)UniversalTeam.size(); i++) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||
line1 = UniversalTeam[screenPos + i];
|
||||
if (screenPos + i == Selection) {
|
||||
@@ -135,7 +131,7 @@ void Credits::DrawBottom(void) const {
|
||||
}
|
||||
} else if (creditsPage == 2) {
|
||||
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), Lang::get("SCRIPTCREATORS"), 320);
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)ScriptCreators.size();i++) {
|
||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)ScriptCreators.size(); i++) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||
line1 = ScriptCreators[screenPos + i];
|
||||
line2 = ScriptAmount[screenPos + i];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -50,11 +50,7 @@ void FTPScreen::Draw(void) const {
|
||||
Gui::clearTextBufs();
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||
} else {
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||
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);
|
||||
@@ -64,13 +60,15 @@ void FTPScreen::Draw(void) const {
|
||||
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FTP_INITIALIZED"), 320);
|
||||
snprintf(buf, 137, "IP: %s:5000", R_FAILED(ret)? Lang::get("FAILED_GET_IP").c_str() : hostname);
|
||||
|
||||
if (strlen(ftp_accepted_connection) != 0)
|
||||
if (strlen(ftp_accepted_connection) != 0) {
|
||||
Gui::DrawStringCentered(0, 80, 0.45f, config->textColor(), ftp_accepted_connection, 320);
|
||||
}
|
||||
|
||||
if (strlen(ftp_file_transfer) != 0)
|
||||
if (strlen(ftp_file_transfer) != 0) {
|
||||
Gui::DrawStringCentered(0, 150, 0.45f, config->textColor(), ftp_file_transfer, 320);
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FAILED_INITIALIZE_FTP"), 320);
|
||||
snprintf(buf, 18, Lang::get("WIFI_NOT_ENABLED").c_str());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -41,15 +41,8 @@ extern u32 TextColor;
|
||||
|
||||
void MainMenu::Draw(void) const {
|
||||
GFX::DrawTop();
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), (config->useBars() ? 239 : 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();
|
||||
@@ -76,7 +69,7 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
|
||||
// Navigation.
|
||||
if (hDown & KEY_UP) {
|
||||
if(Selection > 1) Selection -= 2;
|
||||
if (Selection > 1) Selection -= 2;
|
||||
} else if (hDown & KEY_DOWN) {
|
||||
if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
||||
} else if (hDown & KEY_LEFT) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -152,14 +152,8 @@ void ScriptBrowse::DrawBrowse(void) const {
|
||||
std::string revision = std::to_string(int64_t(infoJson[Selection]["curRevision"]));
|
||||
revision += " | ";
|
||||
revision += std::to_string(int64_t(infoJson[Selection]["revision"]));
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, config->textColor(), revision);
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), std::string(infoJson[Selection]["title"]), 400);
|
||||
} else {
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, config->textColor(), revision);
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), std::string(infoJson[Selection]["title"]), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), std::string(infoJson[Selection]["title"]), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, revision), 0.6f, config->textColor(), revision);
|
||||
|
||||
Gui::DrawStringCentered(0, 120, 0.6f, config->textColor(), std::string(infoJson[Selection]["shortDesc"]), 400);
|
||||
if (infoJson[Selection]["curRevision"] == -1) {
|
||||
@@ -262,11 +256,7 @@ void ScriptBrowse::DrawBrowse(void) const {
|
||||
void ScriptBrowse::DrawGlossary(void) const {
|
||||
GFX::DrawTop();
|
||||
if (loaded) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||
|
||||
Gui::Draw_Rect(20, 30, 30, 30, config->notfoundColor());
|
||||
Gui::DrawString(65, 35, 0.7f, config->textColor(), Lang::get("SCRIPT_NOT_FOUND"), 300);
|
||||
@@ -360,7 +350,7 @@ void ScriptBrowse::DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
}
|
||||
|
||||
void ScriptBrowse::downloadAll() {
|
||||
if (infoJson.size() != 0) {
|
||||
if (infoJson.size() > 0) {
|
||||
for (int i = 0; i < (int)infoJson.size(); i++) {
|
||||
int current = i+1;
|
||||
int total = infoJson.size();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -83,11 +83,7 @@ void ScriptCreator::Draw(void) const {
|
||||
|
||||
void ScriptCreator::DrawSubMenu(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SCRIPTCREATOR"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SCRIPTCREATOR"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("SCRIPTCREATOR"), 400);
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
@@ -107,11 +103,7 @@ void ScriptCreator::DrawSubMenu(void) const {
|
||||
|
||||
void ScriptCreator::DrawScriptScreen(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Selected Entry: " + entryName, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Selected Entry: " + entryName, 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Selected Entry: " + entryName, 400);
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -124,13 +124,7 @@ u32 getColor(std::string colorString) {
|
||||
}
|
||||
|
||||
// Color listing!
|
||||
u32 barColor;
|
||||
u32 bgTopColor;
|
||||
u32 bgBottomColor;
|
||||
u32 TextColor;
|
||||
u32 selected;
|
||||
u32 unselected;
|
||||
u32 progressBar;
|
||||
u32 barColor, bgTopColor, bgBottomColor, TextColor, selected, unselected, progressBar;
|
||||
|
||||
// Load the colors from the script.
|
||||
void loadColors(nlohmann::json &json) {
|
||||
@@ -159,11 +153,7 @@ void loadColors(nlohmann::json &json) {
|
||||
|
||||
void ScriptList::DrawSubMenu(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
@@ -231,13 +221,8 @@ void ScriptList::DrawList(void) const {
|
||||
std::string line2;
|
||||
std::string scriptAmount = std::to_string(Selection +1) + " | " + std::to_string(fileInfo.size());
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, config->textColor(), scriptAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 237-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, config->textColor(), scriptAmount);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, config->textColor(), scriptAmount);
|
||||
|
||||
Gui::DrawStringCentered(0, 80, 0.7f, config->textColor(), Lang::get("TITLE") + std::string(fileInfo[Selection].title), 400);
|
||||
Gui::DrawStringCentered(0, 100, 0.7f, config->textColor(), Lang::get("AUTHOR") + std::string(fileInfo[Selection].author), 400);
|
||||
@@ -312,14 +297,8 @@ void ScriptList::DrawSingleObject(void) const {
|
||||
std::string info;
|
||||
std::string entryAmount = std::to_string(Selection+1) + " | " + std::to_string(fileInfo2.size());
|
||||
GFX::DrawTop();
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
|
||||
for(uint i = 0; i < lines.size(); i++) {
|
||||
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -51,12 +51,7 @@ void Settings::Draw(void) const {
|
||||
|
||||
void Settings::DrawSubMenu(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
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);
|
||||
@@ -88,11 +83,7 @@ const std::vector<std::string> languages = {
|
||||
void Settings::DrawLanguageSelection(void) const {
|
||||
std::string line1;
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SELECT_LANG"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SELECT_LANG"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("SELECT_LANG"), 400);
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
@@ -128,11 +119,7 @@ const std::vector<std::string> colorList = {
|
||||
void Settings::DrawColorChanging(void) const {
|
||||
std::string line1;
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
|
||||
if (!dropDownMenu) {
|
||||
if (colorMode == 3) {
|
||||
@@ -233,12 +220,7 @@ void Settings::DrawColorChanging(void) const {
|
||||
|
||||
void Settings::DrawMiscSettings(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
+11
-18
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -142,12 +142,7 @@ void UniStore::loadStoreDesc(void) {
|
||||
|
||||
void UniStore::DrawSubMenu(void) const {
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("UNISTORE_SUBMENU"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("UNISTORE_SUBMENU"), 400);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("UNISTORE_SUBMENU"), 400);
|
||||
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
@@ -169,15 +164,9 @@ void UniStore::DrawStoreList(void) const {
|
||||
std::string line2;
|
||||
std::string storeAmount = std::to_string(Selection +1) + " | " + std::to_string(storeInfo.size());
|
||||
GFX::DrawTop();
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), storeInfo[Selection].title, 400);
|
||||
Gui::DrawString(5, 220, 0.6f, config->textColor(), Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, config->textColor(), storeAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), storeInfo[Selection].title, 400);
|
||||
Gui::DrawString(5, 218, 0.6f, config->textColor(), Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 237-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, config->textColor(), storeAmount);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), storeInfo[Selection].title, 400);
|
||||
Gui::DrawString(5, config->useBars() ? 220 : 218, 0.6f, config->textColor(), Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, config->textColor(), storeAmount);
|
||||
|
||||
for(uint i = 0; i < descLines.size(); i++) {
|
||||
Gui::DrawStringCentered(0, 120-((descLines.size()*20)/2)+i*20, 0.6f, config->textColor(), descLines[i], 400);
|
||||
@@ -755,7 +744,9 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
Selection = 0;
|
||||
mode = 4;
|
||||
} else if (Selection == 2) {
|
||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||
if (Msg::promptMsg("TinyDB might be down. This would lead to Download Failed!\nDo you still like to continue?")) {
|
||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||
}
|
||||
} else if (Selection == 3) {
|
||||
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", config->storePath() + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
||||
}
|
||||
@@ -768,7 +759,9 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
Selection = 0;
|
||||
mode = 4;
|
||||
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[2])) {
|
||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||
if (Msg::promptMsg("TinyDB might be down. This would lead to Download Failed!\nDo you still like to continue?")) {
|
||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||
}
|
||||
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[3])) {
|
||||
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", config->storePath() + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -34,16 +34,9 @@
|
||||
extern std::unique_ptr<Config> config;
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
extern u32 getColor(std::string colorString);
|
||||
extern bool isScriptSelected;
|
||||
|
||||
extern u32 barColor;
|
||||
extern u32 bgTopColor;
|
||||
extern u32 bgBottomColor;
|
||||
extern u32 TextColor;
|
||||
extern u32 progressBar;
|
||||
extern u32 selected;
|
||||
extern u32 unselected;
|
||||
extern bool didAutoboot;
|
||||
extern u32 barColor, bgTopColor, bgBottomColor, TextColor, progressBar, selected, unselected;
|
||||
extern bool didAutoboot, isScriptSelected;
|
||||
|
||||
UniStoreV1::UniStoreV1(nlohmann::json &JSON, const std::string sheetPath, bool displayInf) {
|
||||
this->storeJson = JSON;
|
||||
@@ -123,13 +116,8 @@ void UniStoreV1::Draw(void) const {
|
||||
}
|
||||
|
||||
if (displayInformations != false) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, std::string(this->storeJson["storeInfo"]["title"]), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, std::string(this->storeJson["storeInfo"]["title"]), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, TextColor, std::string(this->storeJson["storeInfo"]["title"]), 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), (config->useBars() ? 239 : 237)-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||
|
||||
Gui::DrawStringCentered(0, 32, 0.6f, TextColor, Lang::get("TITLE") + std::string(this->storeJson["storeContent"][Selection]["info"]["title"]), 400);
|
||||
Gui::DrawStringCentered(0, 57, 0.6f, TextColor, Lang::get("AUTHOR") + std::string(this->storeJson["storeContent"][Selection]["info"]["author"]), 400);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -287,17 +287,9 @@ void UniStoreV2::displaySelectedEntry(int selection, int storeIndex) const {
|
||||
Gui::DrawStringCentered(0, 218, 0.7f, this->returnTextColor(), std::to_string(this->downloadPage + 1) + " | " + std::to_string(1 + (this->objects.size() / DOWNLOAD_ENTRIES)));
|
||||
|
||||
if (this->storeJson.at("storeContent").at(selection).at("info").contains("title")) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
||||
} else {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), "?", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), "?", 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, this->returnTextColor(), "?", 400);
|
||||
}
|
||||
|
||||
if (this->storeJson.at("storeContent").at(selection).at("info").contains("author")) {
|
||||
@@ -359,12 +351,7 @@ void UniStoreV2::displaySelectedEntry(int selection, int storeIndex) const {
|
||||
void UniStoreV2::Draw(void) const {
|
||||
if (this->mode == 0) {
|
||||
this->DrawBaseTop();
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
|
||||
this->DrawGrid();
|
||||
|
||||
@@ -380,12 +367,7 @@ void UniStoreV2::Draw(void) const {
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha));
|
||||
} else if (this->mode == 1) {
|
||||
this->DrawBaseTop();
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||
|
||||
this->DrawList();
|
||||
Gui::DrawStringCentered(0, 218, 0.6f, this->returnTextColor(), std::to_string(this->storePageList + 1) + " | " + std::to_string((this->sortedStore->getSize() / STORE_ENTRIES_LIST)+1));
|
||||
@@ -421,24 +403,16 @@ void UniStoreV2::DrawSelectMenu(int option) const {
|
||||
|
||||
this->DrawBaseTop();
|
||||
|
||||
if (option == 0) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), Lang::get("SELECT_AUTHOR"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_AUTHOR"), 400);
|
||||
}
|
||||
} else if (option == 1) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), Lang::get("SELECT_CATEGORY"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_CATEGORY"), 400);
|
||||
}
|
||||
} else if (option == 2) {
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), Lang::get("SELECT_CONSOLE"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_CONSOLE"), 400);
|
||||
}
|
||||
switch(option) {
|
||||
case 0:
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_AUTHOR"), 400);
|
||||
break;
|
||||
case 1:
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_CATEGORY"), 400);
|
||||
break;
|
||||
case 2:
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.6f, this->returnTextColor(), Lang::get("SELECT_CONSOLE"), 400);
|
||||
break;
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 218, 0.6f, this->returnTextColor(), std::to_string(this->categoryPage + 1) + " | " + std::to_string((options.size() / DOWNLOAD_ENTRIES)+1));
|
||||
@@ -455,12 +429,16 @@ void UniStoreV2::DrawSelectMenu(int option) const {
|
||||
Gui::DrawStringCentered(0, downloadBoxes[i].y+4, 0.5f, this->returnTextColor(), options[i + (this->categoryPage * DOWNLOAD_ENTRIES)], 280);
|
||||
}
|
||||
} else {
|
||||
if (option == 0) {
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_AUTHORS_AVAILABLE"), 280);
|
||||
} else if (option == 1) {
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_CATEGORIES_AVAILABLE"), 280);
|
||||
} else if (option == 2) {
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_CONSOLES_AVAILABLE"), 280);
|
||||
switch(option) {
|
||||
case 0:
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_AUTHORS_AVAILABLE"), 280);
|
||||
break;
|
||||
case 1:
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_CATEGORIES_AVAILABLE"), 280);
|
||||
break;
|
||||
case 2:
|
||||
Gui::DrawStringCentered(0, downloadBoxes[0].y+4, 0.5f, this->returnTextColor(), Lang::get("NO_CONSOLES_AVAILABLE"), 280);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include "colorHelper.hpp"
|
||||
|
||||
int ColorHelper::getColorValue(int color, int bgr)
|
||||
{
|
||||
int ColorHelper::getColorValue(int color, int bgr) {
|
||||
char colorName[10];
|
||||
int i;
|
||||
std::stringstream ss;
|
||||
@@ -40,8 +39,7 @@ int ColorHelper::getColorValue(int color, int bgr)
|
||||
return i;
|
||||
}
|
||||
|
||||
std::string ColorHelper::getColorName(int color, int bgr)
|
||||
{
|
||||
std::string ColorHelper::getColorName(int color, int bgr) {
|
||||
char colorName[10];
|
||||
int i = getColorValue(color, bgr);
|
||||
itoa(i, colorName, 10);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -24,9 +24,9 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "colorHelper.hpp"
|
||||
#include "common.hpp"
|
||||
#include "config.hpp"
|
||||
#include "colorHelper.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
+30
-13
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* 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 "common.hpp"
|
||||
#include "config.hpp"
|
||||
#include "fileBrowse.hpp"
|
||||
@@ -29,7 +55,7 @@ std::vector<DirEntry> dirContents;
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
extern touchPosition touch;
|
||||
|
||||
std::vector<Structs::ButtonPos> buttonPositions = {
|
||||
const std::vector<Structs::ButtonPos> buttonPositions = {
|
||||
{295, 0, 25, 25}, // Arrow Up.
|
||||
{295, 215, 25, 25}, // Arrow Down.
|
||||
{15, 220, 50, 15}, // Open.
|
||||
@@ -178,13 +204,8 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
||||
GFX::DrawTop();
|
||||
char path[PATH_MAX];
|
||||
getcwd(path, PATH_MAX);
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 2, 0.60f, config->textColor(), path, 390);
|
||||
Gui::DrawStringCentered(0, 220, 0.60f, config->textColor(), selectText, 390);
|
||||
} else {
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, config->textColor(), path, 390);
|
||||
Gui::DrawStringCentered(0, 218, 0.60f, config->textColor(), selectText, 390);
|
||||
}
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, config->useBars() ? 0 : 2, 0.60f, config->textColor(), path, 390);
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 220 : 218, 0.60f, config->textColor(), selectText, 390);
|
||||
GFX::DrawBottom();
|
||||
if (config->viewMode() == 0) {
|
||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)dirContents.size(); i++) {
|
||||
@@ -206,11 +227,7 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
||||
}
|
||||
}
|
||||
|
||||
if (config->useBars() == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.45f, config->textColor(), Lang::get("FILEBROWSE_MSG"), 260);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.45f, config->textColor(), Lang::get("FILEBROWSE_MSG"), 260);
|
||||
}
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.45f, config->textColor(), Lang::get("FILEBROWSE_MSG"), 260);
|
||||
GFX::DrawArrow(295, -1);
|
||||
GFX::DrawArrow(315, 240, 180.0);
|
||||
GFX::DrawSpriteBlend(sprites_view_idx, buttonPositions[6].x, buttonPositions[6].y);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "files.h"
|
||||
|
||||
|
||||
FS_Path getPathInfo(const char * path, FS_ArchiveID * archive) {
|
||||
*archive = ARCHIVE_SDMC;
|
||||
FS_Path filePath = {0};
|
||||
@@ -8,8 +7,7 @@ FS_Path getPathInfo(const char * path, FS_ArchiveID * archive) {
|
||||
|
||||
if (!strncmp(path, "sdmc:/", 6)) {
|
||||
prefixlen = 5;
|
||||
}
|
||||
else if (*path != '/') {
|
||||
} else if (*path != '/') {
|
||||
//if the path is local (doesnt start with a slash), it needs to be appended to the working dir to be valid
|
||||
char * actualPath = NULL;
|
||||
asprintf(&actualPath, "%s%s", WORKING_DIR, path);
|
||||
@@ -18,8 +16,9 @@ FS_Path getPathInfo(const char * path, FS_ArchiveID * archive) {
|
||||
}
|
||||
|
||||
//if the filePath wasnt set above, set it
|
||||
if (filePath.size == 0)
|
||||
if (filePath.size == 0) {
|
||||
filePath = fsMakePath(PATH_ASCII, path+prefixlen);
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -29,16 +29,17 @@
|
||||
// adapted from GM9i's byte parsing.
|
||||
std::string formatBytes(int bytes) {
|
||||
char out[32];
|
||||
if (bytes == 1)
|
||||
if (bytes == 1) {
|
||||
snprintf(out, sizeof(out), "%d Byte", bytes);
|
||||
else if (bytes < 1024)
|
||||
} else if (bytes < 1024) {
|
||||
snprintf(out, sizeof(out), "%d Bytes", bytes);
|
||||
else if (bytes < 1024 * 1024)
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
snprintf(out, sizeof(out), "%.1f KB", (float)bytes / 1024);
|
||||
else if (bytes < 1024 * 1024 * 1024)
|
||||
} else if (bytes < 1024 * 1024 * 1024) {
|
||||
snprintf(out, sizeof(out), "%.1f MB", (float)bytes / 1024 / 1024);
|
||||
else
|
||||
} else {
|
||||
snprintf(out, sizeof(out), "%.1f GB", (float)bytes / 1024 / 1024 / 1024);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
extern bool showProgressBar;
|
||||
extern int progressBarType;
|
||||
extern ProgressBar progressbarType;
|
||||
extern char progressBarMsg[128];
|
||||
extern int filesExtracted;
|
||||
|
||||
@@ -61,6 +61,7 @@ int ScriptHelper::getNum(nlohmann::json json, const std::string &key, const std:
|
||||
|
||||
if (!json.at(key).contains(key2)) return 0;
|
||||
if (!json.at(key).at(key2).is_number()) return 0;
|
||||
|
||||
return json.at(key).at(key2).get_ref<const int64_t&>();
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ Result ScriptHelper::downloadFile(std::string file, std::string output, std::str
|
||||
Result ret = NONE;
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||
showProgressBar = true;
|
||||
progressBarType = 0;
|
||||
progressbarType = ProgressBar::Downloading;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
if (downloadToFile(file, output) != 0) {
|
||||
showProgressBar = false;
|
||||
@@ -112,7 +113,7 @@ Result ScriptHelper::removeFile(std::string file, std::string message) {
|
||||
void ScriptHelper::installFile(std::string file, bool updatingSelf, std::string message) {
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||
showProgressBar = true;
|
||||
progressBarType = 2;
|
||||
progressbarType = ProgressBar::Installing;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
installCia(file.c_str(), updatingSelf);
|
||||
showProgressBar = false;
|
||||
@@ -123,7 +124,7 @@ void ScriptHelper::extractFile(std::string file, std::string input, std::string
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||
showProgressBar = true;
|
||||
filesExtracted = 0;
|
||||
progressBarType = 1;
|
||||
progressbarType = ProgressBar::Extracting;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
extractArchive(file, input, output);
|
||||
showProgressBar = false;
|
||||
@@ -170,13 +171,8 @@ void ScriptHelper::bootTitle(const std::string TitleID, bool isNAND, std::string
|
||||
else MSG += Lang::get("MEDIATYPE_SD") + "\n" + TitleID;
|
||||
u64 ID = std::stoull(TitleID, 0, 16);
|
||||
if (Msg::promptMsg(MSG)) {
|
||||
if (isNAND == true) {
|
||||
Msg::DisplayMsg(message);
|
||||
CIA_LaunchTitle(ID, MEDIATYPE_NAND);
|
||||
} else {
|
||||
Msg::DisplayMsg(message);
|
||||
CIA_LaunchTitle(ID, MEDIATYPE_SD);
|
||||
}
|
||||
Msg::DisplayMsg(message);
|
||||
CIA_LaunchTitle(ID, isNAND ? MEDIATYPE_NAND : MEDIATYPE_SD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,13 +187,13 @@ Result ScriptHelper::prompt(std::string message) {
|
||||
|
||||
Result ScriptHelper::copyFile(std::string source, std::string destination, std::string message) {
|
||||
Result ret = NONE;
|
||||
if (access(source.c_str(), F_OK) != 0 ) {
|
||||
if (access(source.c_str(), F_OK) != 0) {
|
||||
return COPY_ERROR;
|
||||
}
|
||||
|
||||
Msg::DisplayMsg(message);
|
||||
// If destination does not exist, create dirs.
|
||||
if (access(destination.c_str(), F_OK) != 0 ) {
|
||||
if (access(destination.c_str(), F_OK) != 0) {
|
||||
makeDirs(destination.c_str());
|
||||
}
|
||||
|
||||
@@ -207,7 +203,7 @@ Result ScriptHelper::copyFile(std::string source, std::string destination, std::
|
||||
|
||||
Result ScriptHelper::renameFile(std::string oldName, std::string newName, std::string message) {
|
||||
Result ret = NONE;
|
||||
if (access(oldName.c_str(), F_OK) != 0 ) {
|
||||
if (access(oldName.c_str(), F_OK) != 0) {
|
||||
return MOVE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ typedef struct _WavHeader {
|
||||
static_assert(sizeof(WavHeader) == 44, "WavHeader size is not 44 bytes.");
|
||||
|
||||
sound::sound(const string& path, int channel, bool toloop) {
|
||||
|
||||
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
|
||||
ndspSetOutputCount(2); // Num of buffers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -6,16 +6,14 @@
|
||||
|
||||
static std::vector<Thread> threads;
|
||||
|
||||
void Threads::create(ThreadFunc entrypoint)
|
||||
{
|
||||
void Threads::create(ThreadFunc entrypoint) {
|
||||
s32 prio = 0;
|
||||
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
|
||||
Thread thread = threadCreate((ThreadFunc)entrypoint, NULL, 64 * 1024, prio - 1, -2, false);
|
||||
threads.push_back(thread);
|
||||
}
|
||||
|
||||
void Threads::destroy(void)
|
||||
{
|
||||
void Threads::destroy(void) {
|
||||
for (u32 i = 0; i < threads.size(); i++) {
|
||||
threadJoin(threads.at(i), U64_MAX);
|
||||
threadFree(threads.at(i));
|
||||
|
||||
Reference in New Issue
Block a user