touchscreen stuff fixed

This commit is contained in:
mrdude2478 2022-04-29 11:35:25 +01:00
parent 5e94cbf9ae
commit d5c47e0607
7 changed files with 280 additions and 217 deletions

View File

@ -37,11 +37,7 @@ Third, "make clean".
This is a work in progress and lets you build with new libnx, plutonium packages. Some stuff still needs fixed to work with the new plutonium and libnx changes.
## Stuff still to fix
~~Font sizes in menus.~~ 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 \
Touchscreen not working properly.\
~~Crash when pressing A or + in the network install page.~~ Fixed \
~~All known bugs fixed~~ \
## Build Issues
Make sure you are using Libnx build at least 9865dbf9 version.

View File

@ -11,6 +11,7 @@
namespace inst::ui {
extern MainApplication *mainApp;
s32 zzz=0; //touchscreen variable
HDInstPage::HDInstPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
@ -148,12 +149,25 @@ namespace inst::ui {
if (Down & HidNpadButton_B) {
mainApp->LoadLayout(mainApp->mainPage);
}
if ((Down & HidNpadButton_A)) {
HidTouchScreenState state={0};
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != zzz))
{
zzz = state.count;
if (zzz != 1) {
this->selectNsp(this->menu->GetSelectedIndex());
if (this->ourFiles.size() == 1 && this->selectedTitles.size() == 1) {
this->startInstall();
}
}
}
}
if ((Down & HidNpadButton_Y)) {
if (this->selectedTitles.size() == this->ourFiles.size()) this->drawMenuItems(true, currentDir);
else {
@ -166,9 +180,11 @@ namespace inst::ui {
this->drawMenuItems(false, currentDir);
}
}
if ((Down & HidNpadButton_X)) {
inst::ui::mainApp->CreateShowDialog("inst.hd.help.title"_lang, "inst.hd.help.desc"_lang, {"common.ok"_lang}, true);
}
if (Down & HidNpadButton_Plus) {
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIconPath() == "romfs:/images/icons/checkbox-blank-outline.png") {
this->selectNsp(this->menu->GetSelectedIndex());

View File

@ -18,6 +18,7 @@
int statvfs(const char *path, struct statvfs *buf);
s32 prev_touchcount=0;
double GetAvailableSpace(const char* path)
{
@ -264,7 +265,15 @@ namespace inst::ui {
mainApp->Close();
}
if (Down & HidNpadButton_A) {
HidTouchScreenState state={0};
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != prev_touchcount))
{
prev_touchcount = state.count;
if (prev_touchcount != 1) {
int menuindex = this->optionMenu->GetSelectedIndex();
switch (menuindex) {
case 0:
@ -289,6 +298,8 @@ namespace inst::ui {
break;
}
}
}
}
if (Down & HidNpadButton_X) {
this->awooImage->SetVisible(false);

View File

@ -14,6 +14,7 @@
namespace inst::ui {
extern MainApplication *mainApp;
s32 xxx=0;
std::string lastUrl = "https://";
std::string lastFileID = "";
@ -172,9 +173,15 @@ namespace inst::ui {
mainApp->LoadLayout(mainApp->mainPage);
}
HidTouchScreenState state={0};
if (Down & HidNpadButton_A) {
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != xxx))
{
xxx = state.count;
if (xxx != 1) {
int var = this->menu->GetItems().size();
auto s = std::to_string(var);
//std::string s = ourUrlString; //debug stuff
@ -189,8 +196,10 @@ namespace inst::ui {
this->startInstall(false);
}
}
}
}
}
if ((Down & HidNpadButton_Y)) {
if (this->selectedUrls.size() == this->menu->GetItems().size()) this->drawMenuItems(true);

View File

@ -17,6 +17,7 @@
namespace inst::ui {
extern MainApplication *mainApp;
s32 prev_touchcount=0;
std::vector<std::string> languageStrings = {"En", "Jpn", "Fr", "De", "It", "Ru", "Zh"};
@ -165,7 +166,17 @@ namespace inst::ui {
if (Down & HidNpadButton_B) {
mainApp->LoadLayout(mainApp->mainPage);
}
if (Down & HidNpadButton_A) {
HidTouchScreenState state={0};
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != prev_touchcount))
{
prev_touchcount = state.count;
if (prev_touchcount != 1) {
std::string keyboardResult;
int rc;
std::vector<std::string> downloadUrl;
@ -301,3 +312,5 @@ namespace inst::ui {
}
}
}
}
}

View File

@ -11,6 +11,7 @@
namespace inst::ui {
extern MainApplication *mainApp;
s32 yyy=0;
sdInstPage::sdInstPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
@ -154,8 +155,15 @@ namespace inst::ui {
mainApp->LoadLayout(mainApp->mainPage);
}
if (Down & HidNpadButton_A) {
HidTouchScreenState state={0};
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != yyy))
{
yyy = state.count;
if (yyy != 1) {
int var = this->menu->GetItems().size();
auto s = std::to_string(var);
@ -170,6 +178,9 @@ namespace inst::ui {
this->startInstall();
}
}
}
}
}
if ((Down & HidNpadButton_Y)) {

View File

@ -10,6 +10,7 @@
namespace inst::ui {
extern MainApplication *mainApp;
s32 www=0; //touchscreen variable
usbInstPage::usbInstPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
@ -117,8 +118,15 @@ namespace inst::ui {
mainApp->LoadLayout(mainApp->mainPage);
}
if (Down & HidNpadButton_A) {
HidTouchScreenState state={0};
if (hidGetTouchScreenStates(&state, 1)) {
if ((Down & HidNpadButton_A) || (state.count != www))
{
www = state.count;
if (www != 1) {
int var = this->menu->GetItems().size();
auto s = std::to_string(var);
if (s == "0") {
@ -130,10 +138,9 @@ namespace inst::ui {
this->startInstall();
}
}
}
}
}
if ((Down & HidNpadButton_Y)) {
if (this->selectedTitles.size() == this->menu->GetItems().size()) this->drawMenuItems(true);