mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Remove FTP, and fix Download speed crash...?
This commit is contained in:
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "ftpScreen.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
#include "ftp.h"
|
||||
}
|
||||
|
||||
extern std::unique_ptr<Config> config;
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
extern touchPosition touch;
|
||||
|
||||
void FTPScreen::Draw(void) const {
|
||||
ftp_init();
|
||||
Result ret = 0;
|
||||
char buf[137], hostname[128];
|
||||
u32 wifiStatus = 0;
|
||||
ret = gethostname(hostname, sizeof(hostname));
|
||||
|
||||
while(ftpEnabled == 1) {
|
||||
ftp_loop();
|
||||
Gui::clearTextBufs();
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
GFX::DrawTop();
|
||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
GFX::DrawBottom();
|
||||
GFX::DrawArrow(0, 218, 0, 1);
|
||||
ret = ACU_GetWifiStatus(&wifiStatus);
|
||||
|
||||
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
|
||||
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FTP_INITIALIZED"), 320);
|
||||
snprintf(buf, 137, "IP: %s:5000", R_FAILED(ret)? Lang::get("FAILED_GET_IP").c_str() : hostname);
|
||||
|
||||
if (strlen(ftp_accepted_connection) != 0) {
|
||||
Gui::DrawStringCentered(0, 80, 0.45f, config->textColor(), ftp_accepted_connection, 320);
|
||||
}
|
||||
|
||||
if (strlen(ftp_file_transfer) != 0) {
|
||||
Gui::DrawStringCentered(0, 150, 0.45f, config->textColor(), ftp_file_transfer, 320);
|
||||
}
|
||||
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FAILED_INITIALIZE_FTP"), 320);
|
||||
snprintf(buf, 18, Lang::get("WIFI_NOT_ENABLED").c_str());
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 60, 0.48, config->textColor(), buf, 320);
|
||||
Gui::DrawStringCentered(0, 222, 0.48f, config->textColor(), Lang::get("B_FTP_EXIT"), 320);
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
Gui::clearTextBufs();
|
||||
C3D_FrameEnd(0);
|
||||
hidScanInput();
|
||||
hidTouchRead(&touch);
|
||||
u32 hDown = hidKeysDown();
|
||||
|
||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0])))
|
||||
break;
|
||||
}
|
||||
memset(ftp_accepted_connection, 0, 20); // Empty accepted connection address.
|
||||
memset(ftp_file_transfer, 0, 50); // Empty transfer status.
|
||||
ftp_exit();
|
||||
|
||||
Gui::screenBack(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Needed here, otherwise it won't compile.
|
||||
void FTPScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { }
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "config.hpp"
|
||||
#include "ftpScreen.hpp"
|
||||
#include "credits.hpp"
|
||||
#include "mainMenu.hpp"
|
||||
#include "scriptHelper.hpp"
|
||||
#include "scriptlist.hpp"
|
||||
@@ -51,7 +51,7 @@ void MainMenu::Draw(void) const {
|
||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, "UniStore");
|
||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("SCRIPTS"));
|
||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("SETTINGS"));
|
||||
GFX::DrawButton(mainButtons[3].x, mainButtons[3].y, "FTP");
|
||||
GFX::DrawButton(mainButtons[3].x, mainButtons[3].y, Lang::get("CREDITS"));
|
||||
// Selector.
|
||||
Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060);
|
||||
|
||||
@@ -90,7 +90,7 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
|
||||
break;
|
||||
case 3:
|
||||
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
||||
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
|
||||
} else if (touching(touch, mainButtons[3])) {
|
||||
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
||||
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-34
@@ -24,7 +24,6 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "credits.hpp"
|
||||
#include "keyboard.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
@@ -59,7 +58,7 @@ void Settings::DrawSubMenu(void) const {
|
||||
|
||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("LANGUAGE"));
|
||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("COLORS"));
|
||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CREDITS"));
|
||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CHANGE_BAR_STYLE"));
|
||||
// Selector.
|
||||
Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060);
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
@@ -97,6 +96,7 @@ void Settings::DrawLanguageSelection(void) const {
|
||||
|
||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||
}
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ void Settings::DrawColorChanging(void) const {
|
||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->buttonColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
}
|
||||
|
||||
@@ -226,9 +227,8 @@ void Settings::DrawMiscSettings(void) const {
|
||||
GFX::DrawArrow(0, 218, 0, 1);
|
||||
|
||||
GFX::DrawButton(mainButtons2[0].x, mainButtons2[0].y, Lang::get("CHANGE_MUSICFILE"));
|
||||
GFX::DrawButton(mainButtons2[1].x, mainButtons2[1].y, Lang::get("CHANGE_BAR_STYLE"));
|
||||
GFX::DrawButton(mainButtons2[2].x, mainButtons2[2].y, Lang::get("CHANGE_KEY_DELAY"));
|
||||
GFX::DrawButton(mainButtons2[3].x, mainButtons2[3].y, Lang::get("TOGGLE_FADE"));
|
||||
GFX::DrawButton(mainButtons2[1].x, mainButtons2[1].y, Lang::get("CHANGE_KEY_DELAY"));
|
||||
GFX::DrawButton(mainButtons2[2].x, mainButtons2[2].y, Lang::get("TOGGLE_FADE"));
|
||||
|
||||
// Selector.
|
||||
Animation::Button(mainButtons2[Selection].x, mainButtons2[Selection].y, .060);
|
||||
@@ -241,27 +241,19 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||
if (tempMusic != "") {
|
||||
config->musicPath(tempMusic);
|
||||
changesMade = true;
|
||||
}
|
||||
} else if (Selection == 1) {
|
||||
if (config->useBars() == true) config->useBars(false);
|
||||
else if (config->useBars() == false) config->useBars(true);
|
||||
changesMade = true;
|
||||
} else if (Selection == 2) {
|
||||
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||
changesMade = true;
|
||||
} else if (Selection == 3) {
|
||||
} else if (Selection == 2) {
|
||||
if (config->screenFade()) {
|
||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||
config->screenFade(false);
|
||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||
changesMade = true;
|
||||
}
|
||||
} else {
|
||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||
config->screenFade(true);
|
||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||
changesMade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,27 +264,19 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||
if (tempMusic != "") {
|
||||
config->musicPath(tempMusic);
|
||||
changesMade = true;
|
||||
}
|
||||
} else if (touching(touch, mainButtons2[1])) {
|
||||
if (config->useBars() == true) config->useBars(false);
|
||||
else if (config->useBars() == false) config->useBars(true);
|
||||
changesMade = true;
|
||||
} else if (touching(touch, mainButtons2[2])) {
|
||||
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||
changesMade = true;
|
||||
} else if (touching(touch, mainButtons2[3])) {
|
||||
} else if (touching(touch, mainButtons2[2])) {
|
||||
if (config->screenFade()) {
|
||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||
config->screenFade(false);
|
||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||
changesMade = true;
|
||||
}
|
||||
} else {
|
||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||
config->screenFade(true);
|
||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||
changesMade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,15 +291,13 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_SELECT) {
|
||||
if (config->progressDisplay()) {
|
||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
||||
config->progressDisplay(false);
|
||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||
changesMade = true;
|
||||
config->progressDisplay(false);
|
||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||
}
|
||||
} else {
|
||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
||||
config->progressDisplay(true);
|
||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||
changesMade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,7 +336,8 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
mode = 2;
|
||||
break;
|
||||
case 2:
|
||||
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||
if (config->useBars()) config->useBars(false);
|
||||
else config->useBars(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -368,7 +351,8 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
screenPos = 0;
|
||||
mode = 2;
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||
if (config->useBars()) config->useBars(false);
|
||||
else config->useBars(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +394,6 @@ void Settings::LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_A) {
|
||||
config->language(langsTemp[selectedLang]);
|
||||
Lang::load(config->language());
|
||||
changesMade = true;
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
@@ -459,7 +442,6 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||
colorSelection = colorMode;
|
||||
dropDownMenu = true;
|
||||
@@ -507,7 +489,6 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
} else if (colorMode == 11) {
|
||||
config->buttonColor(RGBA8(red, ColorHelper::getColorValue(config->buttonColor(), 1), ColorHelper::getColorValue(config->buttonColor(), 0), 255));
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
int temp = Input::getUint(255, Lang::get("ENTER_GREEN_RGB"));
|
||||
@@ -538,7 +519,6 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
} else if (colorMode == 11) {
|
||||
config->buttonColor(RGBA8(ColorHelper::getColorValue(config->buttonColor(), 2), green, ColorHelper::getColorValue(config->buttonColor(), 0), 255));
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
int temp = Input::getUint(255, Lang::get("ENTER_BLUE_RGB"));
|
||||
@@ -569,11 +549,11 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
} else if (colorMode == 11) {
|
||||
config->buttonColor(RGBA8(ColorHelper::getColorValue(config->buttonColor(), 2), ColorHelper::getColorValue(config->buttonColor(), 1), blue, 255));
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (colorSelection < screenPos) {
|
||||
screenPos = colorSelection;
|
||||
} else if (colorSelection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||
|
||||
Reference in New Issue
Block a user