mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-22 10:16:39 +00:00
Display a CrashFrame warning at startup if the application is running under applet mode.
Other changes include: * defines: added NON_MOVEABLE macro. * AsyncTask: set class as non-moveable, too. * RootView: provide an override for getDefaultFocus(). * StatusInfoTask: replace GetStatusInfoData with IsInternetConnectionAvailable().
This commit is contained in:
parent
bc842d8905
commit
962cf00ba9
10 changed files with 36 additions and 13 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1e2134a2ef140a7bca3fb799aba294dda1db1075
|
||||
Subproject commit cf58d0115c358faa39c71867c6e49f0aa5756e59
|
|
@ -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)."
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <scope_guard.hpp>
|
||||
#include <root_view.hpp>
|
||||
|
||||
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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue