mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
fixed bugs in network install menu
This commit is contained in:
parent
3352771041
commit
303a76258f
@ -41,7 +41,7 @@ This is a work in progress and lets you build with new libnx, plutonium packages
|
|||||||
~~Threading in the main menu - to stop GUI freezing or Network installs failing.~~ Fixed \
|
~~Threading in the main menu - to stop GUI freezing or Network installs failing.~~ Fixed \
|
||||||
~~Options page - stop jumping back to top of page after something is selected.~~ Fixed \
|
~~Options page - stop jumping back to top of page after something is selected.~~ Fixed \
|
||||||
Touchscreen not working properly.\
|
Touchscreen not working properly.\
|
||||||
Crash when pressing A or + in the network install page.
|
~~Crash when pressing A or + in the network install page.~~ Fixed \
|
||||||
|
|
||||||
## Build Issues
|
## Build Issues
|
||||||
Make sure you are using Libnx build at least 9865dbf9 version.
|
Make sure you are using Libnx build at least 9865dbf9 version.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
namespace inst::config {
|
namespace inst::config {
|
||||||
static const std::string appDir = "sdmc:/switch/tinwoo";
|
static const std::string appDir = "sdmc:/switch/tinwoo";
|
||||||
static const std::string configPath = appDir + "/config.json";
|
static const std::string configPath = appDir + "/config.json";
|
||||||
static const std::string appVersion = "1.0.4";
|
static const std::string appVersion = "1.0.5";
|
||||||
|
|
||||||
extern std::string gAuthKey;
|
extern std::string gAuthKey;
|
||||||
extern std::string sigPatchesUrl;
|
extern std::string sigPatchesUrl;
|
||||||
|
@ -270,9 +270,6 @@ namespace netInstStuff{
|
|||||||
|
|
||||||
// Break on input pressed
|
// Break on input pressed
|
||||||
u64 kDown = padGetButtonsDown(&pad);
|
u64 kDown = padGetButtonsDown(&pad);
|
||||||
|
|
||||||
//fix the A button on this page - for some reason it crashes the appif pressed...27/4/22
|
|
||||||
|
|
||||||
|
|
||||||
if (kDown & HidNpadButton_B)
|
if (kDown & HidNpadButton_B)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "util/curl.hpp"
|
#include "util/curl.hpp"
|
||||||
#include "util/lang.hpp"
|
#include "util/lang.hpp"
|
||||||
#include "netInstall.hpp"
|
#include "netInstall.hpp"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#define COLOR(hex) pu::ui::Color::FromHex(hex)
|
#define COLOR(hex) pu::ui::Color::FromHex(hex)
|
||||||
|
|
||||||
@ -29,14 +30,12 @@ namespace inst::ui {
|
|||||||
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
|
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
|
||||||
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
|
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
|
||||||
else this->SetBackgroundImage("romfs:/images/Background.png");
|
else this->SetBackgroundImage("romfs:/images/Background.png");
|
||||||
//this->appVersionText = TextBlock::New(0, 0, "", 0);
|
this->appVersionText = TextBlock::New(1210, 680, "");
|
||||||
this->appVersionText = TextBlock::New(0, 0, "");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->SetBackgroundImage("romfs:/images/Background.png");
|
this->SetBackgroundImage("romfs:/images/Background.png");
|
||||||
this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
|
this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
|
||||||
//this->appVersionText = TextBlock::New(0, 0, "", 0);
|
this->appVersionText = TextBlock::New(1210, 680, "");
|
||||||
this->appVersionText = TextBlock::New(0, 0, "");
|
|
||||||
}
|
}
|
||||||
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
|
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
|
||||||
//this->pageInfoText = TextBlock::New(10, 109, "", 30);
|
//this->pageInfoText = TextBlock::New(10, 109, "", 30);
|
||||||
@ -62,6 +61,7 @@ namespace inst::ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void netInstPage::drawMenuItems(bool clearItems) {
|
void netInstPage::drawMenuItems(bool clearItems) {
|
||||||
|
int myindex = this->menu->GetSelectedIndex(); //store index so when page redraws we can get the last item we checked.
|
||||||
if (clearItems) this->selectedUrls = {};
|
if (clearItems) this->selectedUrls = {};
|
||||||
if (clearItems) this->alternativeNames = {};
|
if (clearItems) this->alternativeNames = {};
|
||||||
this->menu->ClearItems();
|
this->menu->ClearItems();
|
||||||
@ -70,12 +70,14 @@ namespace inst::ui {
|
|||||||
auto ourEntry = pu::ui::elm::MenuItem::New(itm);
|
auto ourEntry = pu::ui::elm::MenuItem::New(itm);
|
||||||
ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||||
for (long unsigned int i = 0; i < this->selectedUrls.size(); i++) {
|
long unsigned int i;
|
||||||
|
for (i = 0; i < this->selectedUrls.size(); i++) {
|
||||||
if (this->selectedUrls[i] == url) {
|
if (this->selectedUrls[i] == url) {
|
||||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->menu->AddItem(ourEntry);
|
this->menu->AddItem(ourEntry);
|
||||||
|
this->menu->SetSelectedIndex(myindex); //jump to the index we saved from above
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +86,9 @@ namespace inst::ui {
|
|||||||
for (long unsigned int i = 0; i < this->selectedUrls.size(); i++) {
|
for (long unsigned int i = 0; i < this->selectedUrls.size(); i++) {
|
||||||
if (this->selectedUrls[i] == this->ourUrls[selectedIndex]) this->selectedUrls.erase(this->selectedUrls.begin() + i);
|
if (this->selectedUrls[i] == this->ourUrls[selectedIndex]) this->selectedUrls.erase(this->selectedUrls.begin() + i);
|
||||||
}
|
}
|
||||||
} else this->selectedUrls.push_back(this->ourUrls[selectedIndex]);
|
}
|
||||||
|
|
||||||
|
else this->selectedUrls.push_back(this->ourUrls[selectedIndex]);
|
||||||
this->drawMenuItems(false);
|
this->drawMenuItems(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,10 +141,10 @@ namespace inst::ui {
|
|||||||
this->pageInfoText->SetText("inst.net.top_info"_lang);
|
this->pageInfoText->SetText("inst.net.top_info"_lang);
|
||||||
this->butText->SetText("inst.net.buttons1"_lang);
|
this->butText->SetText("inst.net.buttons1"_lang);
|
||||||
this->drawMenuItems(true);
|
this->drawMenuItems(true);
|
||||||
this->menu->SetSelectedIndex(0);
|
|
||||||
mainApp->CallForRender();
|
mainApp->CallForRender();
|
||||||
this->infoImage->SetVisible(false);
|
this->infoImage->SetVisible(false); //
|
||||||
this->menu->SetVisible(true);
|
this->menu->SetVisible(true);
|
||||||
|
this->menu->SetSelectedIndex(0); //when page first loads jump to start of the menu
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -167,12 +171,27 @@ namespace inst::ui {
|
|||||||
if (Down & HidNpadButton_B) {
|
if (Down & HidNpadButton_B) {
|
||||||
mainApp->LoadLayout(mainApp->mainPage);
|
mainApp->LoadLayout(mainApp->mainPage);
|
||||||
}
|
}
|
||||||
if ((Down & HidNpadButton_A) /*|| (Up & HidGestureType_Touch)*/) {
|
|
||||||
this->selectTitle(this->menu->GetSelectedIndex());
|
|
||||||
if (this->menu->GetItems().size() == 1 && this->selectedUrls.size() == 1) {
|
if (Down & HidNpadButton_A) {
|
||||||
this->startInstall(false);
|
|
||||||
|
int var = this->menu->GetItems().size();
|
||||||
|
auto s = std::to_string(var);
|
||||||
|
//std::string s = ourUrlString; //debug stuff
|
||||||
|
//this->appVersionText->SetText(s); //debug stuff
|
||||||
|
|
||||||
|
if (s == "0") {
|
||||||
|
//do nothing here because there's no items in the list, that way the app won't freeze
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this->selectTitle(this->menu->GetSelectedIndex());
|
||||||
|
if (this->menu->GetItems().size() == 1 && this->selectedUrls.size() == 1) {
|
||||||
|
this->startInstall(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Down & HidNpadButton_Y)) {
|
if ((Down & HidNpadButton_Y)) {
|
||||||
if (this->selectedUrls.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
|
if (this->selectedUrls.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
|
||||||
else {
|
else {
|
||||||
@ -183,13 +202,23 @@ namespace inst::ui {
|
|||||||
this->drawMenuItems(false);
|
this->drawMenuItems(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Down & HidNpadButton_Plus) {
|
if (Down & HidNpadButton_Plus) {
|
||||||
if (this->selectedUrls.size() == 0) {
|
int var = this->menu->GetItems().size();
|
||||||
this->selectTitle(this->menu->GetSelectedIndex());
|
auto s = std::to_string(var);
|
||||||
this->startInstall(false);
|
|
||||||
return;
|
if (s == "0") {
|
||||||
|
//do nothing here because there's no items in the list, that way the app won't freeze
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (this->selectedUrls.size() == 0) {
|
||||||
|
this->selectTitle(this->menu->GetSelectedIndex());
|
||||||
|
this->startInstall(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this->startInstall(false);
|
this->startInstall(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user