diff --git a/lib/borealis b/lib/borealis index 22b62c7..1e331f7 160000 --- a/lib/borealis +++ b/lib/borealis @@ -1 +1 @@ -Subproject commit 22b62c7bee7a156400d5109fcb8459bab0bee78a +Subproject commit 1e331f7a0fd628eeaa5865d2878e466c59c3ee24 diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index 5dbce22..d403880 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -159,25 +159,10 @@ void ListDownloadTab::createCheatSlipItem() { return true; } else { - SwkbdConfig kbd; - char usr[0x100] = {0}; - char pwd[0x100] = {0}; - Result rc = swkbdCreate(&kbd, 0); - if (R_SUCCEEDED(rc)) { - swkbdConfigMakePresetDefault(&kbd); - swkbdConfigSetOkButtonText(&kbd, "Submit"); - swkbdConfigSetGuideText(&kbd, "www.cheatslips.com e-mail"); - swkbdShow(&kbd, usr, sizeof(usr)); - swkbdClose(&kbd); - rc = swkbdCreate(&kbd, 0); - if(R_SUCCEEDED(rc)){ - swkbdConfigMakePresetPassword(&kbd); - swkbdConfigSetOkButtonText(&kbd, "Submit"); - swkbdConfigSetGuideText(&kbd, "www.cheatslips.com password"); - swkbdShow(&kbd, pwd, sizeof(pwd)); - swkbdClose(&kbd); - } - } + std::string usr, pwd; + //Result rc = swkbdCreate(&kbd, 0); + brls::Swkbd::openForText([&](std::string text) { usr = text; }, "cheatslips.com e-mail", "", 64, "", 0, "Submit", "cheatslips.com e-mail"); + brls::Swkbd::openForText([&](std::string text) { pwd = text; }, "cheatslips.com password", "", 64, "", 0, "Submit", "cheatslips.com password", true); std::string body = "{\"email\":\"" + std::string(usr) + "\",\"password\":\"" + std::string(pwd) + "\"}"; nlohmann::ordered_json token; diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp index 7fce16f..0f9125a 100644 --- a/source/tools_tab.cpp +++ b/source/tools_tab.cpp @@ -111,45 +111,35 @@ ToolsTab::ToolsTab(const std::string& tag, bool erista) : brls::List() browser = new brls::ListItem("menus/tools/browser"_i18n); browser->getClickEvent()->subscribe([&](brls::View* view){ - char url[0xc00] = {0}; - SwkbdConfig kbd; - Result rc = swkbdCreate(&kbd, 0); - if (R_SUCCEEDED(rc)) { - swkbdConfigMakePresetDefault(&kbd); - swkbdConfigSetGuideText(&kbd, "www.cheatslips.com e-mail"); - swkbdConfigSetInitialText(&kbd, "https://duckduckgo.com"); - swkbdShow(&kbd, url, sizeof(url)); - swkbdClose(&kbd); - } - else { - strcpy(url, "https://duckduckgo.com"); - } - std::string error = ""; - int at = appletGetAppletType(); - if(at == AppletType_Application) { // Running as a title - WebCommonConfig conf; - WebCommonReply out; - rc = webPageCreate(&conf, url); - if (R_FAILED(rc)) - error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc; - webConfigSetJsExtension(&conf, true); - webConfigSetPageCache(&conf, true); - webConfigSetBootLoadingIcon(&conf, true); - webConfigSetWhitelist(&conf, ".*"); - rc = webConfigShow(&conf, &out); - if (R_FAILED(rc)) - error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc; - } else { // Running under applet - error += "\uE016 Running in applet mode/through a forwarder.\n\uE016 Please launch hbmenu by holding [R] on a game"; - } - if(!error.empty()){ - brls::Dialog* dialog = new brls::Dialog(error); - brls::GenericEvent::Callback callback = [dialog](brls::View* view) { - dialog->close(); - }; - dialog->addButton("menus/common/ok"_i18n, callback); - dialog->setCancelable(true); - dialog->open(); + std::string url; + if (brls::Swkbd::openForText([&](std::string text) { url = text; }, "cheatslips.com e-mail", "", 64, "https://duckduckgo.com", 0, "Submit", "https://website.tld")) { + std::string error = ""; + int at = appletGetAppletType(); + if(at == AppletType_Application) { // Running as a title + WebCommonConfig conf; + WebCommonReply out; + Result rc = webPageCreate(&conf, url.c_str()); + if (R_FAILED(rc)) + error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc; + webConfigSetJsExtension(&conf, true); + webConfigSetPageCache(&conf, true); + webConfigSetBootLoadingIcon(&conf, true); + webConfigSetWhitelist(&conf, ".*"); + rc = webConfigShow(&conf, &out); + if (R_FAILED(rc)) + error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc; + } else { // Running under applet + error += "\uE016 Running in applet mode/through a forwarder.\n\uE016 Please launch hbmenu by holding [R] on a game"; + } + if(!error.empty()){ + brls::Dialog* dialog = new brls::Dialog(error); + brls::GenericEvent::Callback callback = [dialog](brls::View* view) { + dialog->close(); + }; + dialog->addButton("menus/common/ok"_i18n, callback); + dialog->setCancelable(true); + dialog->open(); + } } });