Skip to content

Commit

Permalink
Removed manual exit after downloading an update
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmmaTech committed Oct 11, 2021
1 parent 971e0e8 commit 0903ac8
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ include $(DEVKITPRO)/libnx/switch_rules
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
VERSION := 2.0.0
VERSION := 2.0.1
STABLE := Stable

APP_TITLE := Calculator_NX Rewrite
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# Calculator_NX

### Currently under a rewrite. All features may not be implemented or work correctly.

## Features

Calculator_NX can calculate any expression with the addition, subtraction, multiplication, division and exopoint operators.
Expand All @@ -21,6 +19,10 @@ After it's fully installed, please install the dependencies below.

Finally, run the `build.sh` file which will build the cnx_forwarder, the Calculator_NX app, and the Calculator_NX overlay.

### Cleaning

Run the `clean.sh` file to clean all the build files.

## License

Calculator_NX uses the MIT License. Read the license for more details.
13 changes: 13 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Set dir to project root
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR

# Clean the main application build files
make clean

# Clean the overlay build files
pushd overlay
make clean
popd
17 changes: 17 additions & 0 deletions include/shouldQuit.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <singleton.hpp>

struct ShouldQuit
{
NON_COPYABLE(ShouldQuit)
NON_MOVABLE(ShouldQuit)

static ShouldQuit& getInstance();

void set(bool n);
bool get();

private:
ShouldQuit() = default;

bool shouldQuit;
};
4 changes: 2 additions & 2 deletions overlay/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ include $(DEVKITPRO)/libnx/switch_rules
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
VERSION := 2.0.0.3
STABLE := Nightly
VERSION := 2.0.0
STABLE := Stable

APP_TITLE := Calculator_NX
APP_AUTHOR := EmreTech
Expand Down
8 changes: 7 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <constants.hpp>
#include <mainActivity.hpp>
#include <download.hpp>
#include <shouldQuit.hpp>

using namespace brls::literals;

Expand Down Expand Up @@ -49,7 +50,12 @@ int main(int argc, char *argv[])

// Start the main application loop

while (brls::Application::mainLoop());
ShouldQuit::getInstance().set(false);
while (brls::Application::mainLoop())
{
if (ShouldQuit::getInstance().get())
brls::Application::quit();
}

httpExit();
return EXIT_SUCCESS;
Expand Down
17 changes: 17 additions & 0 deletions source/shouldQuit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <shouldQuit.hpp>

ShouldQuit& ShouldQuit::getInstance()
{
static ShouldQuit sq;
return sq;
}

void ShouldQuit::set(bool n)
{
shouldQuit = n;
}

bool ShouldQuit::get()
{
return shouldQuit;
}
3 changes: 3 additions & 0 deletions source/updaterTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <download.hpp>
#include <constants.hpp>
#include <fs.hpp>
#include <shouldQuit.hpp>
#include <mainActivity.hpp>

using namespace brls::literals;
Expand Down Expand Up @@ -75,5 +76,7 @@ bool UpdaterTab::onContinueButton(brls::View *view)

ContinButton->hide([]{});
MainLabel->setText("text/updater/exit_message"_i18n);
ShouldQuit::getInstance().set(true);

return true;
}

0 comments on commit 0903ac8

Please sign in to comment.