Switch over to Universal-Core. (#18)

* Don't build here.

* WIP: Switch to Universal-Core.

* Update Submodule repo & azure-pipelines.
This commit is contained in:
StackZ
2020-02-08 06:20:50 +01:00
committed by GitHub
parent 0ef5d2c5ab
commit 09be8e0b94
55 changed files with 1064 additions and 1327 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "Universal-Core"]
path = Universal-Core
url = https://github.com/Universal-Team/Universal-Core.git
+3 -2
View File
@@ -75,9 +75,10 @@ endif
#---------------------------------------------------------------------------------
TARGET := Universal-Updater
BUILD := build
SOURCES := source source/download source/lang source/screens source/utils
UNIVCORE := Universal-Core
SOURCES := $(UNIVCORE) source source/download source/lang source/screens source/utils
DATA := data
INCLUDES := include include/download include/lang include/screens include/utils
INCLUDES := $(UNIVCORE) include include/download include/lang include/screens include/utils
GRAPHICS := assets/gfx
#GFXBUILD := $(BUILD)
ROMFS := romfs
+1
Submodule Universal-Core added at c82ad8d6e1
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 17 KiB

+2 -1
View File
@@ -1,7 +1,7 @@
trigger:
branches:
include: ['*']
exclude: [translation, cleanup]
exclude: [translation, cleanup, full-rewrite]
tags:
include: ['*']
@@ -39,6 +39,7 @@ steps:
sudo 7z e makerom_015_ctrtool.zip Linux_x86_64/makerom
sudo chmod +x makerom
rm makerom_015_ctrtool.zip
git submodule update --init --recursive
displayName: 'Setup devkitPro'
- script: |
@@ -24,8 +24,8 @@
* reasonable ways as different from the original version.
*/
#ifndef COLORS_HPP
#define COLORS_HPP
#ifndef COLORHELPER_HPP
#define COLORHELPER_HPP
#include <citro2d.h>
#include <citro3d.h>
@@ -48,6 +48,7 @@
#define UnselectedColordefault C2D_Color32(77, 118, 132, 255)
#define BLACK C2D_Color32(0, 0, 0, 255)
#define WHITE C2D_Color32(255, 255, 255, 255)
#define TRANSPARENT C2D_Color32(0, 0, 0, 0)
typedef u32 Color;
+6 -3
View File
@@ -24,12 +24,13 @@
* reasonable ways as different from the original version.
*/
#pragma once
#ifndef DOWNLOAD_HPP
#define DOWNLOAD_HPP
#include "utils/common.hpp"
#include "common.hpp"
#define APP_TITLE "Universal-Updater"
#define VERSION_STRING "2.2.0"
#define VERSION_STRING "2.2.1"
enum DownloadError {
DL_ERROR_NONE = 0,
@@ -87,3 +88,5 @@ std::string getLatestCommit(std::string repo, std::string item);
* @return the string from the API.
*/
std::string getLatestCommit(std::string repo, std::string array, std::string item);
#endif
+14 -17
View File
@@ -24,26 +24,23 @@
* reasonable ways as different from the original version.
*/
#ifndef SCREEN_HPP
#define SCREEN_HPP
#ifndef GFX_HPP
#define GFX_HPP
#include <3ds.h>
#include <memory>
#include "colorHelper.hpp"
#include "gui.hpp"
#include "sprites.h"
class screen
namespace GFX
{
public:
virtual ~screen() {}
virtual void Logic(u32 hDown, u32 hHeld, touchPosition touch) = 0;
virtual void Draw() const = 0;
private:
};
namespace Screen {
void set(std::unique_ptr<screen> screen2);
void fade(std::unique_ptr<screen> screen2, bool fadeout = true);
void back(void);
void loop(u32 hDown, u32 hHeld, touchPosition touch);
// Basic GUI.
void DrawTop(void);
void DrawBottom(void);
// Draw arrow.
void DrawArrow(int x, int y, float rotation = 0, int arrowSprite = 0);
// Draw Sprites.
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
void DrawSpriteBlend(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
}
#endif
-73
View File
@@ -1,73 +0,0 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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 GUI_HPP
#define GUI_HPP
#include "colors.hpp"
#include "sprites.h"
#include "screens/screen.hpp"
namespace Gui
{
// Init and Exit of the GUI.
Result init(void);
void exit(void);
C3D_RenderTarget* target(gfxScreen_t t);
void setDraw(C3D_RenderTarget * screen);
// Clear Text.
void clearTextBufs(void);
// Draw a Sprite from the sheet.
void sprite(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
void spriteBlend(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
void DrawArrow(int x, int y, float rotation = 0, int arrowSprite = 0);
void drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed = .060, u32 colour = C2D_Color32(0, 0, 0, 0));
// Misc.
bool Draw_Rect(float x, float y, float w, float h, u32 color);
// Text / String Functions.
void DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0);
void DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0);
void GetStringSize(float size, float *width, float *height, std::string Text);
float GetStringWidth(float size, std::string Text);
float GetStringHeight(float size, std::string Text);
// Basic GUI.
void DrawTop(void);
void DrawBottom(void);
void DisplayWarnMsg(std::string Text);
bool promptMsg(std::string promptMsg);
}
void DisplayMsg(std::string text);
#endif
+13 -21
View File
@@ -24,29 +24,21 @@
* reasonable ways as different from the original version.
*/
#ifndef STRUCTS_HPP
#define STRUCTS_HPP
#ifndef INIT_HPP
#define INIT_HPP
#include <string>
#include <3ds.h>
class Structs
{
public:
struct ButtonPos {
int x;
int y;
int w;
int h;
int link;
};
namespace Init {
// Init, Mainloop & Exit.
Result Initialize();
Result MainLoop();
Result Exit();
struct Key {
std::string character;
int x;
int y;
int w;
};
private:
};
// Sound / Music stuff.
void loadSoundEffects(void);
void playMusic(void);
void stopMusic(void);
}
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef LANG_HPP
#define LANG_HPP
#include "utils/json.hpp"
#include "json.hpp"
#include <string>
@@ -24,14 +24,16 @@
* reasonable ways as different from the original version.
*/
#ifndef SCREENCOMMON_HPP
#define SCREENCOMMON_HPP
#ifndef MSG_HPP
#define MSG_HPP
#include "gui.hpp"
#include <string>
#include "lang/lang.hpp"
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
namespace Msg
{
void DisplayMsg(std::string text);
void DisplayWarnMsg(std::string Text);
bool promptMsg(std::string promptMsg);
}
#endif
+5 -7
View File
@@ -27,14 +27,12 @@
#ifndef CREDITS_HPP
#define CREDITS_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "utils/structs.hpp"
#include "common.hpp"
#include "structs.hpp"
#include <vector>
class Credits : public screen
class Credits : public Screen
{
public:
void Draw(void) const override;
@@ -43,8 +41,8 @@ private:
int creditsPage = 1;
std::vector<Structs::ButtonPos> arrowPos = {
{0, 215, 25, 25, -1}, // Back Arrow.
{295, 215, 25, 25, -1}, // Next Page.
{0, 215, 25, 25}, // Back Arrow.
{295, 215, 25, 25}, // Next Page.
};
};
+4 -5
View File
@@ -24,13 +24,12 @@
* reasonable ways as different from the original version.
*/
#include "screens/screen.hpp"
#include "utils/structs.hpp"
#include "common.hpp"
#include "structs.hpp"
#include <vector>
class FTPScreen : public screen
class FTPScreen : public Screen
{
public:
void Draw(void) const override;
@@ -39,6 +38,6 @@ public:
private:
int ftpEnabled = 1;
std::vector<Structs::ButtonPos> arrowPos = {
{0, 215, 25, 25, -1}, // Back Arrow.
{0, 215, 25, 25}, // Back Arrow.
};
};
+8 -9
View File
@@ -27,13 +27,12 @@
#ifndef MAINMENU_HPP
#define MAINMENU_HPP
#include "screens/screen.hpp"
#include "utils/structs.hpp"
#include "common.hpp"
#include "structs.hpp"
#include <vector>
class MainMenu : public screen
class MainMenu : public Screen
{
public:
void Draw(void) const override;
@@ -42,11 +41,11 @@ private:
int Selection = 0;
std::vector<Structs::ButtonPos> mainButtons = {
{10, 70, 140, 40, -1}, // Scripts.
{170, 70, 140, 40, -1}, // UniStore.
{10, 145, 140, 40, -1}, // Settings.
{170, 145, 140, 40, -1}, // FTP.
{0, 215, 25, 25, -1}, // Back Arrow.
{10, 70, 140, 40}, // Scripts.
{170, 70, 140, 40}, // UniStore.
{10, 145, 140, 40}, // Settings.
{170, 145, 140, 40}, // FTP.
{0, 215, 25, 25}, // Back Arrow.
};
};
+11 -12
View File
@@ -27,14 +27,13 @@
#ifndef SCRIPTBROWSE_HPP
#define SCRIPTBROWSE_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "common.hpp"
#include "fileBrowse.hpp"
#include "structs.hpp"
#include "utils/config.hpp"
#include "utils/fileBrowse.h"
#include "utils/structs.hpp"
#include <vector>
class ScriptBrowse : public screen
class ScriptBrowse : public Screen
{
public:
void Draw(void) const override;
@@ -49,12 +48,12 @@ private:
int keyRepeatDelay = 0;
int fastMode = false;
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25, -1}, // Arrow Up.
{295, 215, 25, 25, -1}, // Arrow Down.
{0, 215, 25, 25, -1}, // Back Arrow.
{5, 0, 25, 25, -1}, // Download All.
{45, 0, 25, 25, -1}, // ViewMode Change.
{80, 0, 25, 25, -1}, // Search.
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
{0, 215, 25, 25}, // Back Arrow.
{5, 0, 25, 25}, // Download All.
{45, 0, 25, 25}, // ViewMode Change.
{80, 0, 25, 25}, // Search.
};
};
+11 -14
View File
@@ -27,15 +27,12 @@
#ifndef SCRIPTCREATOR_HPP
#define SCRIPTCREATOR_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "utils/json.hpp"
#include "utils/structs.hpp"
#include "common.hpp"
#include "structs.hpp"
#include <vector>
class ScriptCreator : public screen
class ScriptCreator : public Screen
{
public:
void Draw(void) const override;
@@ -88,18 +85,18 @@ private:
std::string jsonFileName;
// Main Pos.
std::vector<Structs::ButtonPos> mainButtons = {
{90, 40, 140, 35, -1}, // New Script.
{90, 100, 140, 35, -1}, // Existing Script.
{90, 40, 140, 35}, // New Script.
{90, 100, 140, 35}, // Existing Script.
};
// Creator Button Pos.
std::vector<Structs::ButtonPos> creatorButtons = {
{10, 40, 140, 35, -1},
{170, 40, 140, 35, -1},
{10, 100, 140, 35, -1},
{170, 100, 140, 35, -1},
{10, 160, 140, 35, -1},
{170, 160, 140, 35, -1},
{10, 40, 140, 35},
{170, 40, 140, 35},
{10, 100, 140, 35},
{170, 100, 140, 35},
{10, 160, 140, 35},
{170, 160, 140, 35},
};
};
+14 -14
View File
@@ -27,13 +27,13 @@
#ifndef SCRIPTLIST_HPP
#define SCRIPTLIST_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "common.hpp"
#include "fileBrowse.hpp"
#include "structs.hpp"
#include "utils/fileBrowse.h"
#include "utils/structs.hpp"
#include <vector>
class ScriptList : public screen
class ScriptList : public Screen
{
public:
void Draw(void) const override;
@@ -61,18 +61,18 @@ private:
int fastMode = false;
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25, -1}, // Arrow Up.
{295, 215, 25, 25, -1}, // Arrow Down.
{0, 215, 25, 25, -1}, // Back Arrow.
{5, 0, 25, 25, -1}, // viewMode Change
{45, 0, 25, 25, -1}, // Search.
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
{0, 215, 25, 25}, // Back Arrow.
{5, 0, 25, 25}, // viewMode Change
{45, 0, 25, 25}, // Search.
};
std::vector<Structs::ButtonPos> subPos = {
{10, 70, 140, 40, -1}, // Script list.
{170, 70, 140, 40, -1}, // Get Scripts.
{10, 145, 140, 40, -1}, // Script Creator.
{170, 145, 140, 40, -1}, // Script path change.
{10, 70, 140, 40}, // Script list.
{170, 70, 140, 40}, // Get Scripts.
{10, 145, 140, 40}, // Script Creator.
{170, 145, 140, 40}, // Script path change.
};
};
+25 -27
View File
@@ -27,15 +27,13 @@
#ifndef SETTINGS_HPP
#define SETTINGS_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "utils/fileBrowse.h"
#include "utils/structs.hpp"
#include "common.hpp"
#include "fileBrowse.hpp"
#include "structs.hpp"
#include <vector>
class Settings : public screen
class Settings : public Screen
{
public:
void Draw(void) const override;
@@ -58,36 +56,36 @@ private:
void MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch);
std::vector<Structs::ButtonPos> mainButtons = {
{90, 40, 140, 35, -1}, // Language.
{90, 100, 140, 35, -1}, // Colors.
{90, 160, 140, 35, -1}, // Misc.
{90, 40, 140, 35}, // Language.
{90, 100, 140, 35}, // Colors.
{90, 160, 140, 35}, // Misc.
};
std::vector<Structs::ButtonPos> langBlocks = {
{37, 32, 20, 20, -1},
{37, 72, 20, 20, -1},
{37, 112, 20, 20, -1},
{37, 152, 20, 20, -1},
{37, 188, 20, 20, -1},
{177, 32, 20, 20, -1},
{177, 72, 20, 20, -1},
{177, 112, 20, 20, -1},
{177, 152, 20, 20, -1},
{177, 188, 20, 20, -1},
{37, 32, 20, 20},
{37, 72, 20, 20},
{37, 112, 20, 20},
{37, 152, 20, 20},
{37, 188, 20, 20},
{177, 32, 20, 20},
{177, 72, 20, 20},
{177, 112, 20, 20},
{177, 152, 20, 20},
{177, 188, 20, 20},
};
std::vector<Structs::ButtonPos> buttons = {
{10, 85, 95, 41, -1},
{115, 85, 95, 41, -1},
{220, 85, 95, 41, -1},
{10, 85, 95, 41},
{115, 85, 95, 41},
{220, 85, 95, 41},
};
std::vector<Structs::ButtonPos> arrowPos = {
{0, 0, 25, 25, -1}, // Previous Arrow.
{295, 0, 25, 25, -1}, // Next Arrow.
{0, 215, 25, 25, -1}, // Back Arrow.
{0, 0, 25, 25, -1}, // Back Arrow top left.
{295, 215, 25, 25, -1}, // Next Page / Misc Arrow.
{0, 0, 25, 25}, // Previous Arrow.
{295, 0, 25, 25}, // Next Arrow.
{0, 215, 25, 25}, // Back Arrow.
{0, 0, 25, 25}, // Back Arrow top left.
{295, 215, 25, 25}, // Next Page / Misc Arrow.
};
};
+21 -21
View File
@@ -27,13 +27,13 @@
#ifndef UNISTORE_HPP
#define UNISTORE_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "common.hpp"
#include "fileBrowse.hpp"
#include "structs.hpp"
#include "utils/fileBrowse.h"
#include "utils/structs.hpp"
#include <vector>
class UniStore : public screen
class UniStore : public Screen
{
public:
void Draw(void) const override;
@@ -83,31 +83,31 @@ private:
std::vector<DirEntry> dirContents;
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25, -1}, // Arrow Up.
{295, 215, 25, 25, -1}, // Arrow Down.
{0, 215, 25, 25, -1}, // Back Arrow.
{5, 0, 25, 25, -1}, // ViewMode Change.
{45, 0, 25, 25, -1}, // Search.
{85, 0, 25, 25, -1}, // Update.
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
{0, 215, 25, 25}, // Back Arrow.
{5, 0, 25, 25}, // ViewMode Change.
{45, 0, 25, 25}, // Search.
{85, 0, 25, 25}, // Update.
};
std::vector<Structs::ButtonPos> URLBtn = {
{10, 70, 140, 40, -1}, // FULL URL.
{170, 70, 140, 40, -1}, // Github.
{10, 145, 140, 40, -1}, // TinyDB.
{170, 145, 140, 40, -1}, // QR Code?
{10, 70, 140, 40}, // FULL URL.
{170, 70, 140, 40}, // Github.
{10, 145, 140, 40}, // TinyDB.
{170, 145, 140, 40}, // QR Code?
};
std::vector<Structs::ButtonPos> GitHubPos = {
{30, 50, 260, 30, -1}, // Owner & Repo.
{30, 130, 260, 30, -1}, // Filename.
{135, 180, 50, 30, -1}, // OK.
{30, 50, 260, 30}, // Owner & Repo.
{30, 130, 260, 30}, // Filename.
{135, 180, 50, 30}, // OK.
};
std::vector<Structs::ButtonPos> subPos = {
{90, 40, 140, 35, -1}, // StoreList.
{90, 100, 140, 35, -1}, // storeSearch.
{90, 160, 140, 35, -1}, // storePathChange.
{90, 40, 140, 35}, // StoreList.
{90, 100, 140, 35}, // storeSearch.
{90, 160, 140, 35}, // storePathChange.
};
};
+9 -3
View File
@@ -31,7 +31,7 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "utils/files.h"
#include "files.h"
#include <malloc.h>
#include <stdio.h>
@@ -42,8 +42,14 @@ extern "C" {
#ifdef __cplusplus
}
#include "utils/json.hpp"
#include "utils/stringutils.hpp"
#include "config.hpp"
#include "gfx.hpp"
#include "gui.hpp"
#include "json.hpp"
#include "lang.hpp"
#include "msg.hpp"
#include "screenCommon.hpp"
#include "stringutils.hpp"
#include <cstdio>
#include <iostream>
+4 -1
View File
@@ -24,7 +24,8 @@
* reasonable ways as different from the original version.
*/
#pragma once
#ifndef EXTRACT_HPP
#define EXTRACT_HPP
#include "common.hpp"
@@ -39,3 +40,5 @@ enum ExtractError {
};
Result extractArchive(std::string archivePath, std::string wantedFile, std::string outputPath);
#endif
@@ -1,5 +1,5 @@
#ifndef FILE_BROWSE_H
#define FILE_BROWSE_H
#ifndef FILE_BROWSE_HPP
#define FILE_BROWSE_HPP
#include <dirent.h>
#include <string>
@@ -12,17 +12,9 @@ struct DirEntry {
std::string name;
std::string path;
bool isDirectory;
char tid[5];
off_t size;
};
typedef struct {
char gameTitle[12]; //!< 12 characters for the game title.
char gameCode[4]; //!< 4 characters for the game code.
} sNDSHeadertitlecodeonly;
void findNdsFiles(vector<DirEntry>& dirContents);
bool nameEndsWith(const std::string& name, const std::vector<std::string> extensionList);
void getDirectoryContents(std::vector<DirEntry>& dirContents, const std::vector<std::string> extensionList);
void getDirectoryContents(std::vector<DirEntry>& dirContents);
@@ -32,4 +24,4 @@ bool returnIfExist(const std::string &path, const std::vector<std::string> &exte
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode = 1);
#endif //FILE_BROWSE_H
#endif //FILE_BROWSE_HPP
+6 -1
View File
@@ -24,6 +24,11 @@
* reasonable ways as different from the original version.
*/
#pragma once
#ifndef FORMATTING_HPP
#define FORMATTING_HPP
#include <string>
std::string formatBytes(int bytes);
#endif
+4 -1
View File
@@ -1,4 +1,5 @@
#pragma once
#ifndef STRINGUTILS_HPP
#define STRINGUTILS_HPP
#include "common.hpp"
@@ -8,3 +9,5 @@ namespace StringUtils
{
std::string format(const std::string& fmt_str, ...);
}
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
* reasonable ways as different from the original version.
*/
#include "colors.hpp"
#include "colorHelper.hpp"
int ColorHelper::getColorValue(int color, int bgr)
{
+14 -18
View File
@@ -24,19 +24,15 @@
* reasonable ways as different from the original version.
*/
#include "config.hpp"
#include "download.hpp"
#include "formatting.hpp"
#include "gui.hpp"
#include "lang.hpp"
#include "screenCommon.hpp"
#include "download/download.hpp"
#include "lang/lang.hpp"
#include "screens/screenCommon.hpp"
#include "utils/config.hpp"
#include "utils/formatting.hpp"
#include <vector>
#include <string>
#include <vector>
#define USER_AGENT APP_TITLE "-" VERSION_STRING
@@ -410,28 +406,28 @@ bool checkWifiStatus(void) {
}
void downloadFailed(void) {
DisplayMsg(Lang::get("DOWNLOAD_FAILED"));
Msg::DisplayMsg(Lang::get("DOWNLOAD_FAILED"));
for (int i = 0; i < 60*2; i++) {
gspWaitForVBlank();
}
}
void notImplemented(void) {
DisplayMsg(Lang::get("NOT_IMPLEMENTED"));
Msg::DisplayMsg(Lang::get("NOT_IMPLEMENTED"));
for (int i = 0; i < 60*2; i++) {
gspWaitForVBlank();
}
}
void doneMsg(void) {
DisplayMsg(Lang::get("DONE"));
Msg::DisplayMsg(Lang::get("DONE"));
for (int i = 0; i < 60*2; i++) {
gspWaitForVBlank();
}
}
void notConnectedMsg(void) {
DisplayMsg(Lang::get("CONNECT_WIFI"));
Msg::DisplayMsg(Lang::get("CONNECT_WIFI"));
for (int i = 0; i < 60*2; i++) {
gspWaitForVBlank();
}
@@ -654,9 +650,9 @@ void displayProgressBar() {
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
Gui::DrawStringCentered(0, 1, 0.7f, Config::TxtColor, progressBarMsg, 400);
// Display 'Currently Extracting: <Filename>'.
@@ -675,7 +671,7 @@ void displayProgressBar() {
Gui::Draw_Rect(31, 121, (int)(((float)downloadNow/(float)downloadTotal) * 338.0f), 28, Config::progressbarColor);
}
}
Gui::DrawBottom();
GFX::DrawBottom();
C3D_FrameEnd(0);
gspWaitForVBlank();
}
+125
View File
@@ -0,0 +1,125 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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"
extern bool isScriptSelected;
extern u32 barColor;
extern u32 bgTopColor;
extern u32 bgBottomColor;
extern u32 TextColor;
void GFX::DrawTop(void) {
Gui::ScreenDraw(Top);
if (isScriptSelected == false) {
Gui::Draw_Rect(0, 0, 400, 25, Config::Color1);
Gui::Draw_Rect(0, 25, 400, 190, Config::Color2);
Gui::Draw_Rect(0, 215, 400, 25, Config::Color1);
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);
}
}
}
void GFX::DrawBottom(void) {
Gui::ScreenDraw(Bottom);
if (isScriptSelected == false) {
Gui::Draw_Rect(0, 0, 320, 25, Config::Color1);
Gui::Draw_Rect(0, 25, 320, 190, Config::Color3);
Gui::Draw_Rect(0, 215, 320, 25, Config::Color1);
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);
}
}
}
extern C2D_SpriteSheet sprites;
void GFX::DrawSprite(int img, int x, int y, float ScaleX, float ScaleY)
{
Gui::DrawSprite(sprites, img, x, y, ScaleX, 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::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, img), x, y, 0.5f, &tint, ScaleX, 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::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
if (arrowSprite == 0) {
C2D_SpriteFromSheet(&sprite, sprites, sprites_arrow_idx);
} else {
C2D_SpriteFromSheet(&sprite, sprites, sprites_side_arrow_idx);
}
C2D_SpriteRotateDegrees(&sprite, rotation);
C2D_SpriteSetPos(&sprite, x, y);
C2D_SpriteSetDepth(&sprite, 0.5);
C2D_DrawSpriteTinted(&sprite, &tint);
}
-321
View File
@@ -1,321 +0,0 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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 "gui.hpp"
#include "screens/screenCommon.hpp"
#include "utils/config.hpp"
#include "utils/structs.hpp"
C3D_RenderTarget* top;
C3D_RenderTarget* bottom;
C2D_TextBuf sizeBuf;
C2D_SpriteSheet sprites;
bool currentScreen = false;
extern bool isScriptSelected;
extern u32 barColor;
extern u32 bgTopColor;
extern u32 bgBottomColor;
extern u32 TextColor;
// Clear Text.
void Gui::clearTextBufs(void)
{
C2D_TextBufClear(sizeBuf);
}
// Initialize GUI.
Result Gui::init(void)
{
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
C2D_Prepare();
top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
sizeBuf = C2D_TextBufNew(4096);
return 0;
}
// Exit the whole GUI.
void Gui::exit(void)
{
C2D_TextBufDelete(sizeBuf);
C2D_SpriteSheetFree(sprites);
C2D_Fini();
C3D_Fini();
}
void DisplayMsg(std::string text) {
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
if (isScriptSelected == false) {
Gui::DrawString(10, 40, 0.45f, Config::TxtColor, text, 380);
} else if (isScriptSelected == true) {
Gui::DrawString(10, 40, 0.45f, TextColor, text, 380);
}
Gui::DrawBottom();
C3D_FrameEnd(0);
}
void Gui::sprite(int key, int x, int y, float ScaleX, float ScaleY)
{
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, NULL, ScaleX, ScaleY);
}
void Gui::spriteBlend(int key, 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::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint, ScaleX, ScaleY);
}
void Gui::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::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
if (arrowSprite == 0) {
C2D_SpriteFromSheet(&sprite, sprites, sprites_arrow_idx);
} else {
C2D_SpriteFromSheet(&sprite, sprites, sprites_side_arrow_idx);
}
C2D_SpriteRotateDegrees(&sprite, rotation);
C2D_SpriteSetPos(&sprite, x, y);
C2D_SpriteSetDepth(&sprite, 0.5);
C2D_DrawSpriteTinted(&sprite, &tint);
}
void Gui::drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed, u32 colour)
{
static constexpr int w = 2;
static float timer = 0.0f;
float highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 0.5) / 0.5);
u8 r = Config::SelectedColor & 0xFF;
u8 g = (Config::SelectedColor >> 8) & 0xFF;
u8 b = (Config::SelectedColor >> 16) & 0xFF;
u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255);
// BG Color for the Selector.
C2D_DrawRectSolid(xPos, yPos, 0.5, Width, Height, colour); // Black.
// Animated Selector part.
C2D_DrawRectSolid(xPos, yPos, 0.5, Width, w, color); // top
C2D_DrawRectSolid(xPos, yPos + w, 0.5, w, Height - 2 * w, color); // left
C2D_DrawRectSolid(xPos + Width - w, yPos + w, 0.5, w, Height - 2 * w, color); // right
C2D_DrawRectSolid(xPos, yPos + Height - w, 0.5, Width, w, color); // bottom
timer += speed; // Speed of the animation. Example : .030 / .060
}
void Gui::DisplayWarnMsg(std::string Text)
{
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
if (isScriptSelected == false) {
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, Text, 400);
} else if (isScriptSelected == true) {
Gui::DrawStringCentered(0, 1, 0.6f, TextColor, Text, 400);
}
Gui::DrawBottom();
C3D_FrameEnd(0);
for (int i = 0; i < 60*3; i++) {
gspWaitForVBlank();
}
}
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth) {
Gui::DrawString((currentScreen ? 200 : 160)+x-((maxWidth == 0 ? (int)Gui::GetStringWidth(size, Text) : std::min(maxWidth, (int)Gui::GetStringWidth(size, Text)))/2), y, size, color, Text, maxWidth);
}
// Draw String or Text.
void Gui::DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth) {
C2D_Text c2d_text;
C2D_TextParse(&c2d_text, sizeBuf, Text.c_str());
C2D_TextOptimize(&c2d_text);
if(maxWidth == 0) {
C2D_DrawText(&c2d_text, C2D_WithColor, x, y, 0.5f, size, size, color);
} else {
C2D_DrawText(&c2d_text, C2D_WithColor, x, y, 0.5f, std::min(size, size*(maxWidth/Gui::GetStringWidth(size, Text))), size, color);
}
}
// Get String or Text Width.
float Gui::GetStringWidth(float size, std::string Text) {
float width = 0;
GetStringSize(size, &width, NULL, Text);
return width;
}
// Get String or Text Size.
void Gui::GetStringSize(float size, float *width, float *height, std::string Text) {
C2D_Text c2d_text;
C2D_TextParse(&c2d_text, sizeBuf, Text.c_str());
C2D_TextGetDimensions(&c2d_text, size, size, width, height);
}
// Get String or Text Height.
float Gui::GetStringHeight(float size, std::string Text) {
float height = 0;
GetStringSize(size, NULL, &height, Text.c_str());
return height;
}
// Draw a Rectangle.
bool Gui::Draw_Rect(float x, float y, float w, float h, u32 color) {
return C2D_DrawRectSolid(x, y, 0.5f, w, h, color);
}
// Select, on which Screen should be drawn.
void Gui::setDraw(C3D_RenderTarget * screen)
{
C2D_SceneBegin(screen);
currentScreen = screen == top ? 1 : 0;
}
void Gui::DrawTop(void) {
Gui::setDraw(top);
if (isScriptSelected == false) {
Gui::Draw_Rect(0, 0, 400, 25, Config::Color1);
Gui::Draw_Rect(0, 25, 400, 190, Config::Color2);
Gui::Draw_Rect(0, 215, 400, 25, Config::Color1);
if (Config::UseBars == true) {
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
Gui::sprite(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) {
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
}
}
}
void Gui::DrawBottom(void) {
Gui::setDraw(bottom);
if (isScriptSelected == false) {
Gui::Draw_Rect(0, 0, 320, 25, Config::Color1);
Gui::Draw_Rect(0, 25, 320, 190, Config::Color3);
Gui::Draw_Rect(0, 215, 320, 25, Config::Color1);
if (Config::UseBars == true) {
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(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) {
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
}
}
}
std::vector<Structs::ButtonPos> promptBtn = {
{10, 100, 140, 35, -1}, // Yes.
{170, 100, 140, 35, -1}, // No.
};
extern touchPosition touch;
extern bool touching(touchPosition touch, Structs::ButtonPos button);
// Display a Message, which needs to be confirmed with A/B.
bool Gui::promptMsg(std::string promptMsg)
{
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
if (isScriptSelected == false) {
Gui::DrawString((400-Gui::GetStringWidth(0.6f, promptMsg.c_str()))/2, 100, 0.6f, Config::TxtColor, promptMsg.c_str(), 400);
Gui::DrawString((400-Gui::GetStringWidth(0.72f, Lang::get("CONFIRM_OR_CANCEL")))/2, 217, 0.72f, Config::TxtColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
} else if (isScriptSelected == true) {
Gui::DrawString((400-Gui::GetStringWidth(0.6f, promptMsg.c_str()))/2, 100, 0.6f, TextColor, promptMsg.c_str(), 400);
Gui::DrawString((400-Gui::GetStringWidth(0.72f, Lang::get("CONFIRM_OR_CANCEL")))/2, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
}
Gui::DrawBottom();
if (isScriptSelected == false) {
Gui::Draw_Rect(10, 100, 140, 35, Config::Color1);
Gui::Draw_Rect(170, 100, 140, 35, Config::Color1);
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, Config::TxtColor, Lang::get("YES"), 140);
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, Config::TxtColor, 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);
}
C3D_FrameEnd(0);
while(1)
{
gspWaitForVBlank();
hidScanInput();
hidTouchRead(&touch);
if ((hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_TOUCH && touching(touch, promptBtn[0]))) {
return true;
} else if ((hidKeysDown() & KEY_B) || (hidKeysDown() & KEY_TOUCH && touching(touch, promptBtn[1]))) {
return false;
}
}
}
+171
View File
@@ -0,0 +1,171 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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 "init.hpp"
#include "gfx.hpp"
#include "gui.hpp"
#include "lang.hpp"
#include "logging.hpp"
#include "mainMenu.hpp"
#include "screenCommon.hpp"
#include "sound.h"
#include <3ds.h>
#include <dirent.h>
#include <unistd.h>
// The classic Fade Effect! ;P
int fadealpha = 255;
bool fadein = true;
bool exiting = false;
bool dspFound = false;
touchPosition touch;
sound *bgm = NULL;
bool songIsFound = false;
// Include all spritesheet's.
C2D_SpriteSheet sprites;
// If button Position pressed -> Do something.
bool touching(touchPosition touch, Structs::ButtonPos button) {
if (touch.px >= button.x && touch.px <= (button.x + button.w) && touch.py >= button.y && touch.py <= (button.y + button.h))
return true;
else
return false;
}
void Init::loadSoundEffects(void) {
if (dspFound == true) {
if( access( Config::MusicPath.c_str(), F_OK ) != -1 ) {
bgm = new sound(Config::MusicPath, 1, true);
songIsFound = true;
}
}
}
void Init::playMusic(void) {
if (songIsFound == true) {
bgm->play();
}
}
void Init::stopMusic(void) {
if (songIsFound == true) {
bgm->stop();
}
}
Result Init::Initialize() {
gfxInitDefault();
romfsInit();
Gui::init();
Gui::loadSheet("romfs:/gfx/sprites.t3x", sprites);
sdmcInit();
cfguInit();
acInit();
// Create Folder if missing.
mkdir("sdmc:/3ds", 0777);
mkdir("sdmc:/3ds/Universal-Updater", 0777);
mkdir("sdmc:/3ds/Universal-Updater/scripts", 0777);
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
// We need to make sure, the file exist.
if(access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) {
Config::initializeNewConfig();
}
Config::load();
Lang::load(Config::lang);
if (Config::Logging == true) {
Logging::createLogFile();
}
Gui::setScreen(std::make_unique<MainMenu>());
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
ndspInit();
dspFound = true;
loadSoundEffects();
playMusic();
}
return 0;
}
Result Init::MainLoop() {
// Initialize everything.
Initialize();
// Loop as long as the status is not exiting.
while (aptMainLoop() && !exiting)
{
hidScanInput();
u32 hHeld = hidKeysHeld();
u32 hDown = hidKeysDown();
hidTouchRead(&touch);
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
Gui::clearTextBufs();
Gui::mainLoop(hDown, hHeld, touch);
C3D_FrameEnd(0);
gspWaitForVBlank();
if (fadein == true) {
fadealpha -= 3;
if (fadealpha < 0) {
fadealpha = 0;
fadein = false;
}
}
}
// Exit all services and exit the app.
Exit();
return 0;
}
Result Init::Exit() {
if (songIsFound == true) {
stopMusic();
}
delete bgm;
if (dspFound == true) {
ndspExit();
}
Config::save();
Gui::exit();
Gui::unloadSheet(sprites);
gfxExit();
cfguExit();
acExit();
romfsExit();
sdmcExit();
return 0;
}
+11 -11
View File
@@ -1,15 +1,15 @@
#include "config.hpp"
#include "gfx.hpp"
#include "gui.hpp"
#include "keyboard.hpp"
#include "utils/config.hpp"
#include "utils/structs.hpp"
#include "structs.hpp"
#include <string>
#include <stdio.h>
#include <ctype.h>
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
extern C3D_RenderTarget* Top;
extern C3D_RenderTarget* Bottom;
bool caps = false, enter = false;
int shift = 0;
@@ -128,13 +128,13 @@ std::string Input::Numpad(uint maxLength, std::string Text)
C3D_FrameEnd(0);
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
Gui::DrawString(180, 217, 0.8, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
if(cursorBlink < -20) cursorBlink = 20;
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
DrawNumpad();
scanKeys();
@@ -211,9 +211,9 @@ std::string Input::getString(uint maxLength, std::string Text, float inputTextSi
C3D_FrameEnd(0);
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
Gui::DrawTop();
GFX::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
Gui::DrawBottom();
GFX::DrawBottom();
drawKeyboard();
C2D_DrawRectSolid(0, 81, 0.5f, 320, 20, Config::Color1 & C2D_Color32(200, 200, 200, 200));
Gui::DrawString(2, 82, inputTextSize, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 316);
+2 -3
View File
@@ -1,6 +1,5 @@
#include "lang/lang.hpp"
#include "utils/config.hpp"
#include "config.hpp"
#include "lang.hpp"
#include <stdio.h>
+3 -116
View File
@@ -24,122 +24,9 @@
* reasonable ways as different from the original version.
*/
#include "gui.hpp"
#include "logging.hpp"
#include "init.hpp"
#include "lang/lang.hpp"
#include "screens/mainMenu.hpp"
#include "screens/screenCommon.hpp"
#include "utils/config.hpp"
#include "utils/sound.h"
#include "utils/structs.hpp"
#include <3ds.h>
#include <dirent.h>
#include <unistd.h>
bool exiting = false;
bool dspFound = false;
touchPosition touch;
sound *bgm = NULL;
bool songIsFound = false;
// If button Position pressed -> Do something.
bool touching(touchPosition touch, Structs::ButtonPos button) {
if (touch.px >= button.x && touch.px <= (button.x + button.w) && touch.py >= button.y && touch.py <= (button.y + button.h))
return true;
else
return false;
}
void loadSoundEffects(void) {
if (dspFound == true) {
if( access( Config::MusicPath.c_str(), F_OK ) != -1 ) {
bgm = new sound(Config::MusicPath, 1, true);
songIsFound = true;
}
}
}
void playMusic(void) {
if (songIsFound == true) {
bgm->play();
}
}
void stopMusic(void) {
if (songIsFound == true) {
bgm->stop();
}
}
int main()
{
gfxInitDefault();
romfsInit();
Gui::init();
sdmcInit();
cfguInit();
acInit();
// Create Folder if missing.
mkdir("sdmc:/3ds", 0777);
mkdir("sdmc:/3ds/Universal-Updater", 0777);
mkdir("sdmc:/3ds/Universal-Updater/scripts", 0777);
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
// We need to make sure, the file exist.
if(access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) {
Config::initializeNewConfig();
}
Config::load();
Lang::load(Config::lang);
if (Config::Logging == true) {
Logging::createLogFile();
}
Screen::set(std::make_unique<MainMenu>());
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
ndspInit();
dspFound = true;
loadSoundEffects();
playMusic();
}
// Loop as long as the status is not exit
while (aptMainLoop() && !exiting)
{
hidScanInput();
u32 hHeld = hidKeysHeld();
u32 hDown = hidKeysDown();
hidTouchRead(&touch);
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::clearTextBufs();
Screen::loop(hDown, hHeld, touch);
C3D_FrameEnd(0);
gspWaitForVBlank();
}
if (songIsFound == true) {
stopMusic();
}
delete bgm;
if (dspFound == true) {
ndspExit();
}
Config::save();
Gui::exit();
gfxExit();
cfguExit();
acExit();
romfsExit();
sdmcExit();
int main() {
Init::MainLoop(); // Init::MainLoop() has the whole logic already. ;P
return 0;
}
+120
View File
@@ -0,0 +1,120 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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 "msg.hpp"
extern bool isScriptSelected;
extern u32 barColor;
extern u32 bgTopColor;
extern u32 bgBottomColor;
extern u32 TextColor;
void Msg::DisplayMsg(std::string text) {
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
if (isScriptSelected == false) {
Gui::DrawString(10, 40, 0.45f, Config::TxtColor, text, 380);
} else if (isScriptSelected == true) {
Gui::DrawString(10, 40, 0.45f, TextColor, text, 380);
}
GFX::DrawBottom();
C3D_FrameEnd(0);
}
void Msg::DisplayWarnMsg(std::string Text)
{
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
if (isScriptSelected == false) {
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, Text, 400);
} else if (isScriptSelected == true) {
Gui::DrawStringCentered(0, 1, 0.6f, TextColor, Text, 400);
}
GFX::DrawBottom();
C3D_FrameEnd(0);
for (int i = 0; i < 60*3; i++) {
gspWaitForVBlank();
}
}
std::vector<Structs::ButtonPos> promptBtn = {
{10, 100, 140, 35}, // Yes.
{170, 100, 140, 35}, // No.
};
extern touchPosition touch;
extern bool touching(touchPosition touch, Structs::ButtonPos button);
// Display a Message, which needs to be confirmed with A/B.
bool Msg::promptMsg(std::string promptMsg)
{
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
if (isScriptSelected == false) {
Gui::DrawString((400-Gui::GetStringWidth(0.6f, promptMsg.c_str()))/2, 100, 0.6f, Config::TxtColor, promptMsg.c_str(), 400);
Gui::DrawString((400-Gui::GetStringWidth(0.72f, Lang::get("CONFIRM_OR_CANCEL")))/2, 217, 0.72f, Config::TxtColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
} else if (isScriptSelected == true) {
Gui::DrawString((400-Gui::GetStringWidth(0.6f, promptMsg.c_str()))/2, 100, 0.6f, TextColor, promptMsg.c_str(), 400);
Gui::DrawString((400-Gui::GetStringWidth(0.72f, Lang::get("CONFIRM_OR_CANCEL")))/2, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
}
GFX::DrawBottom();
if (isScriptSelected == false) {
Gui::Draw_Rect(10, 100, 140, 35, Config::Color1);
Gui::Draw_Rect(170, 100, 140, 35, Config::Color1);
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, Config::TxtColor, Lang::get("YES"), 140);
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, Config::TxtColor, 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);
}
C3D_FrameEnd(0);
while(1)
{
gspWaitForVBlank();
hidScanInput();
hidTouchRead(&touch);
if ((hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_TOUCH && touching(touch, promptBtn[0]))) {
return true;
} else if ((hidKeysDown() & KEY_B) || (hidKeysDown() & KEY_TOUCH && touching(touch, promptBtn[1]))) {
return false;
}
}
}
+12 -14
View File
@@ -24,38 +24,36 @@
* reasonable ways as different from the original version.
*/
#include "screens/credits.hpp"
#include "utils/config.hpp"
#include "credits.hpp"
extern bool touching(touchPosition touch, Structs::ButtonPos button);
void Credits::Draw(void) const {
std::string title = "Universal-Updater - ";
title += Lang::get("CREDITS");
Gui::DrawTop();
GFX::DrawTop();
if (creditsPage != 4) {
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, title, 400);
}
Gui::DrawStringCentered(0, 40, 0.8f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 400);
Gui::DrawStringCentered(0, 70, 0.8f, Config::TxtColor, Lang::get("MAIN_DEV"), 400);
Gui::sprite(sprites_stackZ_idx, 150, 95);
Gui::DrawStringCentered(0, 30, 0.7f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 390);
Gui::DrawStringCentered(0, 70, 0.7f, Config::TxtColor, Lang::get("MAIN_DEV"), 390);
GFX::DrawSprite(sprites_stackZ_idx, 120, 105);
std::string currentVersion = Lang::get("CURRENT_VERSION");
currentVersion += V_STRING;
Gui::DrawString(395-Gui::GetStringWidth(0.70f, currentVersion), 219, 0.70f, Config::TxtColor, currentVersion, 400);
} else {
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190));
Gui::sprite(sprites_discord_idx, 115, 35);
GFX::DrawSprite(sprites_discord_idx, 115, 35);
}
Gui::DrawBottom();
GFX::DrawBottom();
if (creditsPage != 4) {
Gui::DrawArrow(0, 218, 0, 1);
Gui::DrawArrow(318, 240, 180.0, 1);
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawArrow(318, 240, 180.0, 1);
}
if (creditsPage == 1) {
@@ -77,14 +75,14 @@ void Credits::Draw(void) const {
} else if (creditsPage == 4) {
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, 190));
Gui::DrawStringCentered(0, -2, 0.55f, Config::TxtColor, Lang::get("LINK"), 320);
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawArrow(0, 218, 0, 1);
}
}
void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_LEFT || hDown & KEY_L) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
if (creditsPage == 1) {
Screen::back();
Gui::screenBack();
return;
} else if (creditsPage > 1) {
creditsPage--;
@@ -96,7 +94,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
if (hDown & KEY_B) {
Screen::back();
Gui::screenBack();
return;
}
}
+5 -9
View File
@@ -24,12 +24,8 @@
* reasonable ways as different from the original version.
*/
#include "lang/lang.hpp"
#include "screens/ftpScreen.hpp"
#include "screens/screenCommon.hpp"
#include "utils/config.hpp"
#include "ftpScreen.hpp"
#include <algorithm>
#include <fstream>
@@ -54,14 +50,14 @@ void FTPScreen::Draw(void) const
ftp_loop();
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
} else {
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
ret = ACU_GetWifiStatus(&wifiStatus);
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
@@ -95,7 +91,7 @@ void FTPScreen::Draw(void) const
memset(ftp_file_transfer, 0, 50); // Empty transfer status.
ftp_exit();
Screen::back();
Gui::screenBack();
return;
}
+19 -20
View File
@@ -24,13 +24,12 @@
* reasonable ways as different from the original version.
*/
#include "screens/ftpScreen.hpp"
#include "screens/mainMenu.hpp"
#include "screens/scriptlist.hpp"
#include "screens/settings.hpp"
#include "screens/unistore.hpp"
#include "utils/config.hpp"
#include "config.hpp"
#include "ftpScreen.hpp"
#include "mainMenu.hpp"
#include "scriptlist.hpp"
#include "settings.hpp"
#include "unistore.hpp"
extern bool exiting;
extern bool touching(touchPosition touch, Structs::ButtonPos button);
@@ -38,7 +37,7 @@ extern int fadealpha;
extern bool fadein;
void MainMenu::Draw(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
@@ -49,13 +48,13 @@ void MainMenu::Draw(void) const {
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 4; i++) {
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
if (Selection == i) {
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -65,7 +64,7 @@ void MainMenu::Draw(void) const {
Gui::DrawStringCentered(80, mainButtons[3].y+12, 0.6f, Config::TxtColor, "FTP", 130);
// Draw UniStore Icon. ;P
Gui::sprite(sprites_uniStore_idx, 10, 65);
GFX::DrawSprite(sprites_uniStore_idx, 10, 65);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
}
@@ -88,29 +87,29 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_A) {
switch(Selection) {
case 0:
Screen::set(std::make_unique<UniStore>());
Gui::setScreen(std::make_unique<UniStore>());
break;
case 1:
Screen::set(std::make_unique<ScriptList>());
Gui::setScreen(std::make_unique<ScriptList>());
break;
case 2:
Screen::set(std::make_unique<Settings>());
Gui::setScreen(std::make_unique<Settings>());
break;
case 3:
Screen::set(std::make_unique<FTPScreen>());
Gui::setScreen(std::make_unique<FTPScreen>());
break;
}
}
if (hDown & KEY_TOUCH) {
if (touching(touch, mainButtons[0])) {
Screen::set(std::make_unique<UniStore>());
Gui::setScreen(std::make_unique<UniStore>());
} else if (touching(touch, mainButtons[1])) {
Screen::set(std::make_unique<ScriptList>());
Gui::setScreen(std::make_unique<ScriptList>());
} else if (touching(touch, mainButtons[2])) {
Screen::set(std::make_unique<Settings>());
Gui::setScreen(std::make_unique<Settings>());
} else if (touching(touch, mainButtons[3])) {
Screen::set(std::make_unique<FTPScreen>());
Gui::setScreen(std::make_unique<FTPScreen>());
}
}
}
-73
View File
@@ -1,73 +0,0 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <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 "screens/screen.hpp"
#include <stack>
// Fade stuff.
int fadealpha = 255;
bool fadein = true;
std::stack<std::unique_ptr<screen>> screens;
// Set a specific Screen.
void Screen::set(std::unique_ptr<screen> screen2)
{
screens.push(std::move(screen2));
}
// Fade into another Screen, but first do a fadeout.
void Screen::fade(std::unique_ptr<screen> screen2, bool fadeout) {
if (fadeout) {
fadealpha += 6;
if (fadealpha > 255) {
fadealpha = 255;
screens.push(std::move(screen2));
fadein = true;
fadeout = false;
}
}
}
// Go a Screen back.
void Screen::back()
{
screens.pop();
}
// For the Mainloop.
void Screen::loop(u32 hDown, u32 hHeld, touchPosition touch) {
screens.top()->Draw();
screens.top()->Logic(hDown, hHeld, touch);
if (fadein == true) {
fadealpha -= 6;
if (fadealpha < 0) {
fadealpha = 0;
fadein = false;
}
}
}
+19 -21
View File
@@ -24,12 +24,10 @@
* reasonable ways as different from the original version.
*/
#include "download/download.hpp"
#include "screens/scriptBrowse.hpp"
#include "utils/fileBrowse.h"
#include "utils/json.hpp"
#include "download.hpp"
#include "fileBrowse.hpp"
#include "json.hpp"
#include "scriptBrowse.hpp"
#include <unistd.h>
@@ -94,7 +92,7 @@ void findExistingFiles(nlohmann::json &json) {
}
ScriptBrowse::ScriptBrowse() {
DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
Msg::DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
// Get repo info
downloadToFile("https://github.com/Universal-Team/extras/raw/scripts/info/scriptInfo.json", metaFile);
@@ -107,7 +105,7 @@ ScriptBrowse::ScriptBrowse() {
}
void ScriptBrowse::Draw(void) const {
Gui::DrawTop();
GFX::DrawTop();
std::string revision = std::to_string(int64_t(infoJson[selection]["curRevision"]));
revision += " / ";
revision += std::to_string(int64_t(infoJson[selection]["revision"]));
@@ -128,13 +126,13 @@ void ScriptBrowse::Draw(void) const {
} else if(infoJson[selection]["curRevision"] > infoJson[selection]["revision"]) {
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 370);
}
Gui::DrawBottom();
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawArrow(0, 218, 0, 1);
Gui::spriteBlend(sprites_download_all_idx, arrowPos[3].x, arrowPos[3].y);
Gui::spriteBlend(sprites_view_idx, arrowPos[4].x, arrowPos[4].y);
GFX::DrawSpriteBlend(sprites_download_all_idx, arrowPos[3].x, arrowPos[3].y);
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[4].x, arrowPos[4].y);
//Gui::spriteBlend(sprites_search_idx, arrowPos[5].x, arrowPos[5].y);
Gui::DrawStringCentered(-23, 1, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts);
@@ -143,7 +141,7 @@ void ScriptBrowse::Draw(void) const {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
if(screenPos + i == selection) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
}
if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
@@ -158,7 +156,7 @@ void ScriptBrowse::Draw(void) const {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
if(screenPosList + i == selection) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
}
if(infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
@@ -175,7 +173,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (keyRepeatDelay) keyRepeatDelay--;
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
infoJson.clear();
Screen::back();
Gui::screenBack();
return;
}
@@ -217,7 +215,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
titleFix[l] = '-';
}
}
DisplayMsg(fileName);
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
}
@@ -234,7 +232,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
titleFix[l] = '-';
}
}
DisplayMsg(fileName);
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
}
@@ -253,7 +251,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
titleFix[i] = '-';
}
}
DisplayMsg(fileName);
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[selection]["curRevision"] = infoJson[selection]["revision"];
@@ -302,7 +300,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
titleFix[l] = '-';
}
}
DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[i]["curRevision"] = infoJson[i]["revision"];
}
+7 -10
View File
@@ -24,13 +24,10 @@
* reasonable ways as different from the original version.
*/
#include "utils/fileBrowse.hpp"
#include "keyboard.hpp"
#include "logging.hpp"
#include "screens/scriptCreator.hpp"
#include "utils/config.hpp"
#include "utils/fileBrowse.h"
#include "scriptCreator.hpp"
#include <fstream>
#include <unistd.h>
@@ -80,14 +77,14 @@ void ScriptCreator::Draw(void) const {
}
void ScriptCreator::DrawSubMenu(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400);
}
Gui::DrawBottom();
GFX::DrawBottom();
for (int i = 0; i < 2; i++) {
if (Selection == i) {
@@ -102,14 +99,14 @@ void ScriptCreator::DrawSubMenu(void) const {
}
void ScriptCreator::DrawScriptScreen(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
}
Gui::DrawBottom();
GFX::DrawBottom();
// Draw Page.
for (int i = 0; i < 2; i++) {
@@ -287,7 +284,7 @@ void ScriptCreator::setInfoStuff(void) {
void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_B) {
Screen::back();
Gui::screenBack();
return;
}
+34 -37
View File
@@ -24,14 +24,11 @@
* reasonable ways as different from the original version.
*/
#include "download/download.hpp"
#include "screens/scriptBrowse.hpp"
#include "screens/scriptCreator.hpp"
#include "screens/scriptlist.hpp"
#include "utils/config.hpp"
#include "utils/scriptHelper.hpp"
#include "download.hpp"
#include "scriptBrowse.hpp"
#include "scriptCreator.hpp"
#include "scriptHelper.hpp"
#include "scriptlist.hpp"
#include <algorithm>
#include <fstream>
@@ -82,7 +79,7 @@ void checkForValidate(void) {
fclose(file);
int ver = ScriptHelper::getNum(json, "info", "version");
if (ver < SCRIPT_VERSION || ver > SCRIPT_VERSION) {
Gui::DisplayWarnMsg(Lang::get("INCOMPATIBLE_SCRIPT"));
Msg::DisplayWarnMsg(Lang::get("INCOMPATIBLE_SCRIPT"));
}
}
@@ -190,7 +187,7 @@ void runFunctions(nlohmann::json &json) {
else missing = true;
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
if(!missing) {
if (Gui::promptMsg(promptmsg)) {
if (Msg::promptMsg(promptmsg)) {
removeDirRecursive(directory.c_str());
}
}
@@ -270,20 +267,20 @@ void loadColors(nlohmann::json &json) {
}
void ScriptList::DrawSubMenu(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 4; i++) {
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor);
if (SubSelection == i) {
Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -298,7 +295,7 @@ void ScriptList::DrawList(void) const {
std::string line1;
std::string line2;
std::string scriptAmount = std::to_string(selection +1) + " / " + std::to_string(fileInfo.size());
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
@@ -310,11 +307,11 @@ void ScriptList::DrawList(void) const {
Gui::DrawStringCentered(0, 100, 0.7f, Config::TxtColor, Lang::get("AUTHOR") + std::string(fileInfo[selection].author), 400);
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[selection].shortDesc), 400);
Gui::DrawBottom();
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 218, 0, 1);
Gui::spriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
GFX::DrawBottom();
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
@@ -322,7 +319,7 @@ void ScriptList::DrawList(void) const {
line1 = fileInfo[screenPos + i].title;
line2 = fileInfo[screenPos + i].author;
if(screenPos + i == selection) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
@@ -332,7 +329,7 @@ void ScriptList::DrawList(void) const {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
line1 = fileInfo[screenPosList + i].title;
if(screenPosList + i == selection) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
}
@@ -361,7 +358,7 @@ void loadDesc(void) {
void ScriptList::DrawSingleObject(void) const {
std::string info;
std::string entryAmount = std::to_string(selection2+1) + " / " + std::to_string(fileInfo2.size());
Gui::DrawTop();
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, Config::TxtColor, entryAmount);
@@ -372,18 +369,18 @@ void ScriptList::DrawSingleObject(void) const {
for(uint i=0;i<lines.size();i++) {
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
}
Gui::DrawBottom();
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 218, 0, 1);
Gui::spriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
GFX::DrawBottom();
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
info = fileInfo2[screenPos2 + i];
if(screenPos2 + i == selection2) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, selected);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
}
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
}
@@ -393,7 +390,7 @@ void ScriptList::DrawSingleObject(void) const {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
info = fileInfo2[screenPosList2 + i];
if(screenPosList2 + i == selection2) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, selected);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
}
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, TextColor, info, 320);
}
@@ -403,7 +400,7 @@ void ScriptList::DrawSingleObject(void) const {
void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
Screen::back();
Gui::screenBack();
return;
}
@@ -430,19 +427,19 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
mode = 1;
} else {
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
Msg::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
}
break;
case 1:
if (checkWifiStatus() == true) {
Screen::set(std::make_unique<ScriptBrowse>());
Gui::setScreen(std::make_unique<ScriptBrowse>());
} else {
notConnectedMsg();
}
break;
case 2:
if (isTesting == true) {
Screen::set(std::make_unique<ScriptCreator>());
Gui::setScreen(std::make_unique<ScriptCreator>());
} else {
notImplemented();
}
@@ -467,17 +464,17 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
mode = 1;
} else {
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
Msg::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
}
} else if (touching(touch, subPos[1])) {
if (checkWifiStatus() == true) {
Screen::set(std::make_unique<ScriptBrowse>());
Gui::setScreen(std::make_unique<ScriptBrowse>());
} else {
notConnectedMsg();
}
} else if (touching(touch, subPos[2])) {
if (isTesting == true) {
Screen::set(std::make_unique<ScriptCreator>());
Gui::setScreen(std::make_unique<ScriptCreator>());
} else {
notImplemented();
}
+24 -27
View File
@@ -24,12 +24,9 @@
* reasonable ways as different from the original version.
*/
#include "credits.hpp"
#include "keyboard.hpp"
#include "screens/credits.hpp"
#include "screens/settings.hpp"
#include "utils/config.hpp"
#include "settings.hpp"
extern bool touching(touchPosition touch, Structs::ButtonPos button);
@@ -53,20 +50,20 @@ void Settings::Draw(void) const {
void Settings::DrawSubMenu(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
Gui::DrawArrow(318, 240, 180.0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawArrow(318, 240, 180.0, 1);
for (int i = 0; i < 3; i++) {
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
if (Selection == i) {
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -76,19 +73,19 @@ void Settings::DrawSubMenu(void) const {
}
void Settings::DrawLanguageSelection(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int language = 0; language < 10; language++) {
Gui::Draw_Rect(langBlocks[language].x, langBlocks[language].y, langBlocks[language].w, langBlocks[language].h, Config::UnselectedColor);
if (Config::lang == language) {
Gui::drawAnimatedSelector(langBlocks[language].x, langBlocks[language].y, langBlocks[language].w, langBlocks[language].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(langBlocks[language].x, langBlocks[language].y, langBlocks[language].w, langBlocks[language].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -106,7 +103,7 @@ void Settings::DrawLanguageSelection(void) const {
}
void Settings::DrawColorChanging(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
@@ -128,15 +125,15 @@ void Settings::DrawColorChanging(void) const {
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
Gui::DrawArrow(0, 0, 0, 1);
Gui::DrawArrow(318, 22, 180.0, 1);
GFX::DrawArrow(0, 0, 0, 1);
GFX::DrawArrow(318, 22, 180.0, 1);
for (int i = 0; i < 7; i++) {
if (colorMode == i) {
Gui::drawAnimatedSelector(54 + i * 25, 2, 16, 16, .060, C2D_Color32(140, 140, 140, 255));
Gui::drawAnimatedSelector(54 + i * 25, 2, 16, 16, .060, TRANSPARENT, C2D_Color32(140, 140, 140, 255));
}
}
@@ -187,20 +184,20 @@ void Settings::DrawColorChanging(void) const {
}
void Settings::DrawMiscSettings(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 2; i++) {
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
if (Selection == i) {
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -258,7 +255,7 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
if (hDown & KEY_A) {
if (Selection + 1 == 3) Screen::set(std::make_unique<Credits>());
if (Selection + 1 == 3) Gui::setScreen(std::make_unique<Credits>());
else mode = Selection+1;
}
@@ -268,12 +265,12 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} else if (touching(touch, mainButtons[1])) {
mode = 2;
} else if (touching(touch, mainButtons[2])) {
Screen::set(std::make_unique<Credits>());
Gui::setScreen(std::make_unique<Credits>());
}
}
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
Screen::back();
Gui::screenBack();
return;
}
+51 -55
View File
@@ -24,17 +24,13 @@
* reasonable ways as different from the original version.
*/
#include "download.hpp"
#include "fileBrowse.hpp"
#include "formatting.hpp"
#include "json.hpp"
#include "keyboard.hpp"
#include "download/download.hpp"
#include "screens/unistore.hpp"
#include "utils/config.hpp"
#include "utils/fileBrowse.h"
#include "utils/formatting.hpp"
#include "utils/json.hpp"
#include "utils/scriptHelper.hpp"
#include "scriptHelper.hpp"
#include "unistore.hpp"
#include <algorithm>
#include <regex>
@@ -186,21 +182,21 @@ void loadStoreColors(nlohmann::json &json) {
}
void UniStore::DrawSubMenu(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
}
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 3; i++) {
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor);
if (subSelection == i) {
Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -215,7 +211,7 @@ void UniStore::DrawStoreList(void) const {
std::string line1;
std::string line2;
std::string storeAmount = std::to_string(selection +1) + " / " + std::to_string(storeInfo.size());
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, storeInfo[selection].title, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount);
@@ -227,13 +223,13 @@ void UniStore::DrawStoreList(void) const {
Gui::DrawStringCentered(0, 120-((descLines.size()*20)/2)+i*20, 0.6f, Config::TxtColor, descLines[i], 400);
}
Gui::DrawBottom();
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 218, 0, 1);
Gui::spriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
Gui::spriteBlend(sprites_search_idx, arrowPos[4].x, arrowPos[4].y);
Gui::spriteBlend(sprites_update_idx, arrowPos[5].x, arrowPos[5].y);
GFX::DrawBottom();
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
GFX::DrawSpriteBlend(sprites_search_idx, arrowPos[4].x, arrowPos[4].y);
GFX::DrawSpriteBlend(sprites_update_idx, arrowPos[5].x, arrowPos[5].y);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
@@ -241,7 +237,7 @@ void UniStore::DrawStoreList(void) const {
line1 = storeInfo[screenPos + i].title;
line2 = storeInfo[screenPos + i].author;
if(screenPos + i == selection) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
@@ -251,7 +247,7 @@ void UniStore::DrawStoreList(void) const {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
line1 = storeInfo[screenPosList + i].title;
if(screenPosList + i == selection) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
}
@@ -261,7 +257,7 @@ void UniStore::DrawStoreList(void) const {
void UniStore::DrawStore(void) const {
std::string entryAmount = std::to_string(selectedOptionAppStore+1) + " / " + std::to_string((int)appStoreJson.at("storeContent").size());
std::string info;
Gui::DrawTop();
GFX::DrawTop();
// Top Background.
if (appStoreJson.at("storeInfo").contains("iconIndexTop") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["iconIndexTop"], 0, 0);
@@ -302,16 +298,16 @@ void UniStore::DrawStore(void) const {
}
}
Gui::DrawBottom();
GFX::DrawBottom();
// Bottom Background.
if (appStoreJson.at("storeInfo").contains("iconIndexBottom") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["iconIndexBottom"], 0, 0);
}
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 218, 0, 1);
Gui::spriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawArrow(0, 218, 0, 1);
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) {
@@ -320,7 +316,7 @@ void UniStore::DrawStore(void) const {
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
} else {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, selected);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
}
} else {
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
@@ -338,7 +334,7 @@ void UniStore::DrawStore(void) const {
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
} else {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, selected);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
}
} else {
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
@@ -370,7 +366,7 @@ void UniStore::Draw(void) const {
void UniStore::updateStore(int selectedStore) {
if (checkWifiStatus()) {
if (Gui::promptMsg(Lang::get("WOULD_YOU_LIKE_UPDATE"))) {
if (Msg::promptMsg(Lang::get("WOULD_YOU_LIKE_UPDATE"))) {
if(storeInfo[selectedStore].url != "" && storeInfo[selectedStore].url != "MISSING: storeInfo.url" &&
storeInfo[selectedStore].file != "" && storeInfo[selectedStore].file != "MISSING: storeInfo.file") {
ScriptHelper::downloadFile(storeInfo[selectedStore].url, storeInfo[selectedStore].file, Lang::get("UPDATING"));
@@ -397,7 +393,7 @@ void UniStore::updateStore(int selectedStore) {
void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
Screen::back();
Gui::screenBack();
return;
}
@@ -423,7 +419,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
mode = 1;
} else {
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
}
break;
case 1:
@@ -456,7 +452,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
mode = 1;
} else {
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
}
} else if (touching(touch, subPos[1])) {
if (checkWifiStatus() == true) {
@@ -559,7 +555,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (ScriptHelper::checkIfValid(dirContents[selection].name, 1) == true) {
updateStore(selection);
currentStoreFile = dirContents[selection].name;
DisplayMsg(Lang::get("PREPARE_STORE"));
Msg::DisplayMsg(Lang::get("PREPARE_STORE"));
if (storeInfo[selection].storeSheet != "" || storeInfo[selection].storeSheet != "MISSING: storeInfo.sheet") {
if(access(storeInfo[selection].storeSheet.c_str(), F_OK) != -1 ) {
loadStoreSheet(selection);
@@ -599,7 +595,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
if (hDown & KEY_SELECT) {
if (Gui::promptMsg(Lang::get("DELETE_STORE"))) {
if (Msg::promptMsg(Lang::get("DELETE_STORE"))) {
deleteStore(selection);
}
}
@@ -611,7 +607,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name, 1) == true) {
updateStore(screenPos + i);
currentStoreFile = dirContents[screenPos + i].name;
DisplayMsg(Lang::get("PREPARE_STORE"));
Msg::DisplayMsg(Lang::get("PREPARE_STORE"));
if (storeInfo[screenPos + i].storeSheet != "" || storeInfo[screenPos + i].storeSheet != "MISSING: storeInfo.sheet") {
if(access(storeInfo[screenPos + i].storeSheet.c_str(), F_OK) != -1 ) {
loadStoreSheet(screenPos + i);
@@ -633,7 +629,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name, 1) == true) {
updateStore(screenPosList + i);
currentStoreFile = dirContents[screenPosList + i].name;
DisplayMsg(Lang::get("PREPARE_STORE"));
Msg::DisplayMsg(Lang::get("PREPARE_STORE"));
if (storeInfo[screenPosList + i].storeSheet != "" || storeInfo[screenPosList + i].storeSheet != "MISSING: storeInfo.sheet") {
if(access(storeInfo[screenPosList + i].storeSheet.c_str(), F_OK) != -1 ) {
loadStoreSheet(screenPosList + i);
@@ -835,7 +831,7 @@ void UniStore::execute() {
else missing = true;
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
if(!missing) {
if (Gui::promptMsg(promptmsg)) {
if (Msg::promptMsg(promptmsg)) {
removeDirRecursive(directory.c_str());
}
}
@@ -867,21 +863,21 @@ void UniStore::execute() {
}
void UniStore::DrawSearch(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SEARCH"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SEARCH"), 400);
}
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 3; i++) {
Gui::Draw_Rect(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, Config::UnselectedColor);
if (searchSelection == i) {
Gui::drawAnimatedSelector(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, .060, TRANSPARENT, Config::SelectedColor);
}
}
@@ -930,16 +926,16 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
void UniStore::DrawGitHubScreen(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GITHUB"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GITHUB"), 400);
}
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
Gui::DrawStringCentered(0, 28, 0.7f, Config::TxtColor, Lang::get("OWNER_AND_REPO"), 300);
Gui::DrawStringCentered(0, 108, 0.7f, Config::TxtColor, Lang::get("FILENAME"), 300);
@@ -984,16 +980,16 @@ void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
void UniStore::DrawFullURLScreen(void) const {
Gui::DrawTop();
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
}
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
GFX::DrawBottom();
GFX::DrawArrow(0, 218, 0, 1);
Gui::DrawStringCentered(0, 28, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 320);
Gui::DrawStringCentered(0, 108, 0.7f, Config::TxtColor, Lang::get("FILENAME"), 320);
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/cia.h"
#include "cia.h"
bool updatingSelf = false;
+3 -4
View File
@@ -24,11 +24,10 @@
* reasonable ways as different from the original version.
*/
#include "common.hpp"
#include "config.hpp"
#include "gui.hpp"
#include "utils/common.hpp"
#include "utils/config.hpp"
#include "utils/json.hpp"
#include "json.hpp"
#include <string>
#include <unistd.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/console.h"
#include "console.h"
#include <arpa/inet.h>
#include <errno.h>
+1 -1
View File
@@ -24,7 +24,7 @@
* reasonable ways as different from the original version.
*/
#include "utils/extract.hpp"
#include "extract.hpp"
#include <archive.h>
#include <archive_entry.h>
+23 -91
View File
@@ -1,11 +1,10 @@
#include "common.hpp"
#include "config.hpp"
#include "fileBrowse.hpp"
#include "gfx.hpp"
#include "gui.hpp"
#include "screens/screenCommon.hpp"
#include "utils/common.hpp"
#include "utils/config.hpp"
#include "utils/fileBrowse.h"
#include "utils/structs.hpp"
#include "screenCommon.hpp"
#include "structs.hpp"
#include <3ds.h>
#include <cstring>
@@ -31,82 +30,15 @@ extern bool touching(touchPosition touch, Structs::ButtonPos button);
extern touchPosition touch;
std::vector<Structs::ButtonPos> buttonPositions = {
{295, 0, 25, 25, -1}, // Arrow Up.
{295, 215, 25, 25, -1}, // Arrow Down.
{15, 220, 50, 15, -1}, // Open.
{80, 220, 50, 15, -1}, // Select.
{145, 220, 50, 15, -1}, // Refresh.
{210, 220, 50, 15, -1}, // Back.
{0, 0, 25, 25, -1}, // ViewMode Change.
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
{15, 220, 50, 15}, // Open.
{80, 220, 50, 15}, // Select.
{145, 220, 50, 15}, // Refresh.
{210, 220, 50, 15}, // Back.
{0, 0, 25, 25}, // ViewMode Change.
};
/**
* Get the title ID.
* @param ndsFile DS ROM image.
* @param buf Output buffer for title ID. (Must be at least 4 characters.)
* @return 0 on success; non-zero on error.
*/
int grabTID(FILE *ndsFile, char *buf) {
fseek(ndsFile, offsetof(sNDSHeadertitlecodeonly, gameCode), SEEK_SET);
size_t read = fread(buf, 1, 4, ndsFile);
return !(read == 4);
}
void findNdsFiles(vector<DirEntry>& dirContents) {
struct stat st;
DIR *pdir = opendir(".");
if (pdir == NULL) {
DisplayMsg("Unable to open the directory.");
for(int i=0;i<120;i++)
gspWaitForVBlank();
} else {
while (continueNdsScan)
{
DirEntry dirEntry;
struct dirent* pent = readdir(pdir);
if (pent == NULL) break;
stat(pent->d_name, &st);
dirEntry.name = pent->d_name;
char scanningMessage[512];
snprintf(scanningMessage, sizeof(scanningMessage), "Scanning SD card for DS roms...\n\n(Press B to cancel)\n\n\n\n\n\n\n\n\n%s", dirEntry.name.c_str());
DisplayMsg(scanningMessage);
dirEntry.isDirectory = (st.st_mode & S_IFDIR) ? true : false;
if(!(dirEntry.isDirectory) && dirEntry.name.length() >= 3) {
if (strcasecmp(dirEntry.name.substr(dirEntry.name.length()-3, 3).c_str(), "nds") == 0) {
// Get game's TID
FILE *f_nds_file = fopen(dirEntry.name.c_str(), "rb");
// char game_TID[5];
grabTID(f_nds_file, dirEntry.tid);
dirEntry.tid[4] = 0;
fclose(f_nds_file);
// dirEntry.tid = game_TID;
dirContents.push_back(dirEntry);
file_count++;
}
} else if (dirEntry.isDirectory
&& dirEntry.name.compare(".") != 0
&& dirEntry.name.compare("_nds") != 0
&& dirEntry.name.compare("3ds") != 0
&& dirEntry.name.compare("DCIM") != 0
&& dirEntry.name.compare("gm9") != 0
&& dirEntry.name.compare("luma") != 0
&& dirEntry.name.compare("Nintendo 3DS") != 0
&& dirEntry.name.compare("private") != 0
&& dirEntry.name.compare("retroarch") != 0) {
chdir(dirEntry.name.c_str());
findNdsFiles(dirContents);
chdir("..");
}
}
closedir(pdir);
}
}
off_t getFileSize(const char *fileName)
{
FILE* fp = fopen(fileName, "rb");
@@ -153,7 +85,7 @@ void getDirectoryContents(std::vector<DirEntry>& dirContents, const std::vector<
DIR *pdir = opendir(".");
if(pdir == NULL) {
DisplayMsg("Unable to open the directory.");
Msg::DisplayMsg("Unable to open the directory.");
for(int i=0;i<120;i++) gspWaitForVBlank();
} else {
while(true) {
@@ -223,9 +155,9 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
while (1) {
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, BLACK);
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
C2D_TargetClear(Top, BLACK);
C2D_TargetClear(Bottom, BLACK);
GFX::DrawTop();
char path[PATH_MAX];
getcwd(path, PATH_MAX);
if (Config::UseBars == true) {
@@ -235,13 +167,13 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, Config::TxtColor, path, 390);
Gui::DrawStringCentered(0, 218, 0.60f, Config::TxtColor, selectText, 390);
}
Gui::DrawBottom();
GFX::DrawBottom();
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)dirContents.size();i++) {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
dirs = dirContents[screenPos + i].name;
if(screenPos + i == selectedFile) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, dirs, 320);
}
@@ -250,7 +182,7 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
dirs = dirContents[screenPosList + i].name;
if(screenPosList + i == selectedFile) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, Config::SelectedColor);
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
}
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, dirs, 320);
}
@@ -261,9 +193,9 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
} else {
Gui::DrawStringCentered(0, 2, 0.45f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 260);
}
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);
Gui::spriteBlend(sprites_view_idx, buttonPositions[6].x, buttonPositions[6].y);
GFX::DrawArrow(295, -1);
GFX::DrawArrow(315, 240, 180.0);
GFX::DrawSpriteBlend(sprites_view_idx, buttonPositions[6].x, buttonPositions[6].y);
Gui::Draw_Rect(buttonPositions[2].x, buttonPositions[2].y, buttonPositions[2].w, buttonPositions[2].h, C2D_Color32(0, 0, 0, 190));
Gui::Draw_Rect(buttonPositions[3].x, buttonPositions[3].y, buttonPositions[3].w, buttonPositions[3].h, C2D_Color32(0, 0, 0, 190));
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/files.h"
#include "files.h"
// Blacklist!
#define BLACKLIST_CTRNAND "ctrnand:/"
+1 -3
View File
@@ -24,9 +24,7 @@
* reasonable ways as different from the original version.
*/
#include <string>
#include "utils/formatting.hpp"
#include "formatting.hpp"
// adapted from GM9i's byte parsing.
std::string formatBytes(int bytes) {
+2 -2
View File
@@ -4,8 +4,8 @@
* from https://cr.yp.to/ftp/filesystem.html
*/
#include "utils/console.h"
#include "utils/ftp.h"
#include "console.h"
#include "ftp.h"
#include <arpa/inet.h>
#include <ctype.h>
+9 -10
View File
@@ -24,18 +24,17 @@
* reasonable ways as different from the original version.
*/
#include "download.hpp"
#include "extract.hpp"
#include "gui.hpp"
#include "download/download.hpp"
#include "utils/extract.hpp"
#include "utils/scriptHelper.hpp"
#include "utils/thread.hpp"
#include "msg.hpp"
#include "scriptHelper.hpp"
#include "thread.hpp"
#include <fstream>
extern "C" {
#include "utils/cia.h"
#include "cia.h"
}
extern bool showProgressBar;
@@ -96,13 +95,13 @@ void ScriptHelper::downloadFile(std::string file, std::string output, std::strin
// Remove a File.
void ScriptHelper::removeFile(std::string file, std::string message) {
DisplayMsg(message);
Msg::DisplayMsg(message);
deleteFile(file.c_str());
}
// Install a file.
void ScriptHelper::installFile(std::string file, std::string message) {
DisplayMsg(message);
Msg::DisplayMsg(message);
installCia(file.c_str());
}
@@ -127,7 +126,7 @@ Result ScriptHelper::createFile(const char * path) {
// Display a Message for a specific amount of time.
void ScriptHelper::displayTimeMsg(std::string message, int seconds) {
DisplayMsg(message);
Msg::DisplayMsg(message);
for (int i = 0; i < 60*seconds; i++) {
gspWaitForVBlank();
}
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/sound.h"
#include "sound.h"
#include <cstdio>
#include <cstdlib>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/stringutils.hpp"
#include "stringutils.hpp"
bool matchPattern(std::string pattern, std::string tested)
{
+1 -1
View File
@@ -1,4 +1,4 @@
#include "utils/thread.hpp"
#include "thread.hpp"
#include <3ds.h>
#include <stdio.h>