mirror of
https://github.com/HamletDuFromage/sigpatches-updater.git
synced 2024-11-08 05:01:46 +00:00
Added ability to self-update the app
This commit is contained in:
parent
3064375eb0
commit
24c3399b34
8 changed files with 20 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,4 +5,5 @@ build/
|
|||
*.nacp
|
||||
*.nro
|
||||
sigpatches-updater/
|
||||
switch/
|
||||
*.zip
|
||||
|
|
2
Makefile
2
Makefile
|
@ -45,7 +45,7 @@ INCLUDES := include libs/minizip/include
|
|||
#ROMFS := romfs
|
||||
APP_TITLE := Sigpatches Updater
|
||||
APP_AUTHOR := HamletDuFromage
|
||||
APP_VERSION := 0.1
|
||||
APP_VERSION := 0.2
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
|
|
|
@ -13,7 +13,7 @@ A Nintendo Switch homebrew to fetch and extract the latest sigpatches
|
|||
|
||||
## FAQ
|
||||
|
||||
### What are sigpatches
|
||||
### What are sigpatches?
|
||||
Sigpatches allow your Switch to install and run unofficial NSP file (digital titles that appear on the home menu). \
|
||||
Note that you must use CFW to launch these applications even after installation as sigpatches are always required to do so.
|
||||
|
||||
|
|
5
create_release.sh
Executable file
5
create_release.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#rm -r switch/
|
||||
mkdir -p switch/sigpatches-updater/
|
||||
mv sigpatches-updater.nro switch/sigpatches-updater/sigpatches-updater.nro
|
||||
zip -r sigpatches-updater.zip switch
|
|
@ -8,6 +8,8 @@
|
|||
#define DOWNLOAD_PATH "/config/sigpatches-updater/"
|
||||
#define SIGPATCHES_FILENAME "/config/sigpatches-updater/sigpatches.zip"
|
||||
|
||||
#define APP_URL "https://github.com/HamletDuFromage/sigpatches-updater/releases/latest/download/sigpatches-updater.zip"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <vector>
|
||||
#include <switch.h>
|
||||
|
||||
#define VERSION "0.1"
|
||||
#define VERSION "0.2"
|
||||
|
||||
#define WIDTH 80 // The width of the console
|
||||
#define HEIGHT 45 // Height of the console
|
||||
|
|
|
@ -32,6 +32,8 @@ int main(int argc, char* argv[]){
|
|||
bool downloaded = false;
|
||||
std::string results("");
|
||||
auto items = fetchLinks(SIGPATCHES_URL);
|
||||
std::get<0>(items).push_back("Update the sigpatches-updater app");
|
||||
std::get<1>(items).push_back(std::string(APP_URL));
|
||||
int nbItems = std::get<0>(items).size();
|
||||
if(nbItems == 0) menu = -1;
|
||||
while (appletMainLoop())
|
||||
|
@ -61,7 +63,7 @@ int main(int argc, char* argv[]){
|
|||
std::cout << "Press [B] go back to the main screen" << std::endl;
|
||||
std::cout << std::endl << std::endl;
|
||||
|
||||
std::cout << "The following sigpatches will be downloaded: " << std::endl;
|
||||
std::cout << "The following package will be downloaded: " << std::endl;
|
||||
std::cout << prettifyString("Name:\n", "[1;36m") << std::get<0>(items)[cursor] << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << prettifyString("Download url:\n", "[1;36m")<< std::get<1>(items)[cursor] << std::endl;
|
||||
|
@ -75,12 +77,12 @@ int main(int argc, char* argv[]){
|
|||
//if(1){
|
||||
if(downloadFile(std::get<1>(items)[cursor].c_str(), SIGPATCHES_FILENAME, OFF)){
|
||||
if(isArchive(SIGPATCHES_FILENAME)){
|
||||
if(extract(SIGPATCHES_FILENAME)) results += prettifyString("Successfully downloaded the sigpatches archive and successfully extracted them", "[1;32m");
|
||||
else results += "Could not extract the sigpatches archive.";
|
||||
if(extract(SIGPATCHES_FILENAME)) results += prettifyString("Successfully downloaded the archive and successfully extracted it", "[1;32m");
|
||||
else results += "Could not extract the archive.";
|
||||
}
|
||||
else results += "The download link is broken. If the issue persists after a day, leave a comment on the Gbatemp thread or open an issue on github.com/HamletDuFromage/sigpatches-updater";
|
||||
else results += "The download link is broken. If the issue persists after a couple of hours, leave a comment on the Gbatemp thread or open an issue on github.com/HamletDuFromage/sigpatches-updater";
|
||||
}
|
||||
else results += "Couldn't download the sigpatches archive";
|
||||
else results += "Couldn't download the archive";
|
||||
downloaded = true;
|
||||
}
|
||||
std::cout << results << std::endl;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
void displayList(std::vector<std::string> items, int cursor){
|
||||
for (int i = 0; i < (int) items.size(); i++){
|
||||
|
||||
if(i == items.size() - 1 ) std::cout << std::endl;
|
||||
if(cursor == i) std::cout << prettifyString(">> ", "[1;36m");
|
||||
std::cout << "\033[1m" << items[i].substr(0, WIDTH - 4) << "\033[0m" << std::endl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue