diff --git a/include/async_task.hpp b/include/async_task.hpp index a94ec45..3e22681 100644 --- a/include/async_task.hpp +++ b/include/async_task.hpp @@ -97,8 +97,9 @@ namespace nxdt::tasks } protected: - /* Set class as non-copyable. */ + /* Set class as non-copyable and non-moveable. */ NON_COPYABLE(AsyncTask); + NON_MOVEABLE(AsyncTask); virtual ~AsyncTask(void) noexcept { diff --git a/include/defines.h b/include/defines.h index 52a9de4..68e61f8 100644 --- a/include/defines.h +++ b/include/defines.h @@ -47,6 +47,10 @@ cls(const cls&) = delete; \ cls& operator=(const cls&) = delete +#define NON_MOVEABLE(cls) \ + cls(cls&&) = delete; \ + cls& operator=(cls&&) = delete + #define ALWAYS_INLINE inline __attribute__((always_inline)) #define ALWAYS_INLINE_LAMBDA __attribute__((always_inline)) diff --git a/include/root_view.hpp b/include/root_view.hpp index 8dba159..49857ca 100644 --- a/include/root_view.hpp +++ b/include/root_view.hpp @@ -51,6 +51,7 @@ namespace nxdt::views protected: void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override; void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override; + brls::View *getDefaultFocus(void) override; public: RootView(void); diff --git a/include/tasks.hpp b/include/tasks.hpp index e7a1f77..4cff63b 100644 --- a/include/tasks.hpp +++ b/include/tasks.hpp @@ -72,7 +72,7 @@ namespace nxdt::tasks StatusInfoTask(void); ~StatusInfoTask(void); - const StatusInfoData* GetStatusInfoData(void); + bool IsInternetConnectionAvailable(void); ALWAYS_INLINE StatusInfoEvent::Subscription RegisterListener(StatusInfoEvent::Callback cb) { diff --git a/libs/borealis b/libs/borealis index 1e2134a..cf58d01 160000 --- a/libs/borealis +++ b/libs/borealis @@ -1 +1 @@ -Subproject commit 1e2134a2ef140a7bca3fb799aba294dda1db1075 +Subproject commit cf58d0115c358faa39c71867c6e49f0aa5756e59 diff --git a/romfs/i18n/en-US/generic.json b/romfs/i18n/en-US/generic.json index 47a19eb..df0d422 100644 --- a/romfs/i18n/en-US/generic.json +++ b/romfs/i18n/en-US/generic.json @@ -1,3 +1,5 @@ { - "unknown": "Unknown" + "unknown": "Unknown", + + "applet_mode_warning": "\uE8B2 Warning: the application is running under Applet Mode! \uE8B2\nThis mode severely limits the amount of usable RAM. If you consistently reproduce any crashes, please consider running the application via title override (hold R while launching a game)." } diff --git a/source/main.cpp b/source/main.cpp index b6e0f0d..f7f1d42 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -23,6 +23,8 @@ #include #include +using namespace brls::i18n::literals; /* For _i18n. */ + int main(int argc, char *argv[]) { /* Set scope guard to clean up resources at exit. */ @@ -40,11 +42,18 @@ int main(int argc, char *argv[]) /* Initialize Borealis. */ if (!brls::Application::init(APP_TITLE)) return EXIT_FAILURE; - /* Create root view. */ - nxdt::views::RootView *root_view = new nxdt::views::RootView(); - - /* Add the root view to the stack. */ - brls::Application::pushView(root_view); + /* Check if we're running under applet mode. */ + if (utilsAppletModeCheck()) + { + /* Push crash frame with the applet mode warning. */ + brls::Application::pushView(new brls::CrashFrame("generic/applet_mode_warning"_i18n, [](brls::View *view) { + /* Swap crash frame with root view whenever the crash frame button is clicked. */ + brls::Application::swapView(new nxdt::views::RootView()); + })); + } else { + /* Push root view. */ + brls::Application::pushView(new nxdt::views::RootView()); + } /* Run the application. */ while(brls::Application::mainLoop()); diff --git a/source/options_tab.cpp b/source/options_tab.cpp index 1d49cf7..a805288 100644 --- a/source/options_tab.cpp +++ b/source/options_tab.cpp @@ -241,13 +241,14 @@ namespace nxdt::views brls::ListItem *update_nswdb_xml = new brls::ListItem("options_tab/update_nswdb_xml/label"_i18n, "options_tab/update_nswdb_xml/description"_i18n); update_nswdb_xml->getClickEvent()->subscribe([this](brls::View* view) { - if (!this->status_info_task->GetStatusInfoData()->ip_addr) + if (!this->status_info_task->IsInternetConnectionAvailable()) { /* Display a notification if no Internet connection is available. */ this->DisplayNotification("options_tab/notifications/no_internet_connection"_i18n); return; } + /* Open update dialog. */ OptionsTabUpdateFileDialog *dialog = new OptionsTabUpdateFileDialog(NSWDB_XML_PATH, NSWDB_XML_URL, false, "options_tab/notifications/nswdb_xml_updated"_i18n); dialog->open(false); }); @@ -264,7 +265,7 @@ namespace nxdt::views this->DisplayNotification("options_tab/notifications/is_nso"_i18n); return; } else - if (!this->status_info_task->GetStatusInfoData()->ip_addr) + if (!this->status_info_task->IsInternetConnectionAvailable()) { /* Display a notification if no Internet connection is available. */ this->DisplayNotification("options_tab/notifications/no_internet_connection"_i18n); diff --git a/source/root_view.cpp b/source/root_view.cpp index e730cb1..8881539 100644 --- a/source/root_view.cpp +++ b/source/root_view.cpp @@ -266,4 +266,9 @@ namespace nxdt::views this->usb_icon->setBoundaries(x_pos, y_pos, 0, 0); this->usb_icon->invalidate(); } + + brls::View* RootView::getDefaultFocus(void) + { + return this->sidebar->getChild(0); + } } diff --git a/source/tasks.cpp b/source/tasks.cpp index d288847..69a9977 100644 --- a/source/tasks.cpp +++ b/source/tasks.cpp @@ -42,9 +42,9 @@ namespace nxdt::tasks brls::Logger::debug("Status info task stopped."); } - const StatusInfoData* StatusInfoTask::GetStatusInfoData(void) + bool StatusInfoTask::IsInternetConnectionAvailable(void) { - return &(this->status_info_data); + return (this->status_info_data.ip_addr != NULL); } void StatusInfoTask::run(retro_time_t current_time)