Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Commit

Permalink
It's alive
Browse files Browse the repository at this point in the history
* Changed name from “qulauncher” to “ProtonELV”
* Slightly more fool-proof logic for folder swapping
* Adapted to AMS changes (titles → contents)
* Added icon
  • Loading branch information
octopuserectus committed Jan 5, 2020
1 parent 591c9f0 commit 4cab73b
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

build/main.d
build/main.o
build/ProtonELV.lst
build/ProtonELV.map
ProtonELV.elf
ProtonELV.nacp
ProtonELV.nro
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
APP_TITLE := qulauncher
APP_TITLE := ProtonELV
APP_AUTHOR := octopus
APP_VERSION := 0.0.1
APP_VERSION := 0.1
#ROMFS := romfs

#---------------------------------------------------------------------------------
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
![Logo](icon.jpg)
# ProtonELV
(with an emphasis on *expendable*)
(aka “Proton expendable launch vehicle” with an emphasis on *expendable*)

A companion homebrew for https://github.com/XorTroll/uLaunch
A companion homebrew for Nintendo Switch that might prove useful if you are into https://github.com/XorTroll/uLaunch.

At the moment it can swap qlaunch with uLaunch and reboot to payload backing up everything useful you might have had in your /contents folder in the process.
It can swap stock Home menu qlaunch with uLaunch and reboot to payload backing up everything useful you might have had in your contents folder in the process.

Planned features: online install, nigthly builds.
## Installation and setup
Download uLaunch’s release, place /ulaunch from the release to the root of your SD card, create a folder named “ProtonELV” (without quotation marks, duh) inside /ulaunch. Place the contents of /atmosphere/contents (pun not intended; four folders) from the uLaunch’s release into /ulaunch/ProtonELV.
Download ProtonELV https://github.com/octopuserectus/ProtonELV/releases and delicately place it into /switch.

It began as a mod for https://github.com/Atmosphere-NX/Atmosphere/tree/master/troposphere/reboot_to_payload I wrote while learning C.
## Controls
Controls are explained via on-screen prompts.

## Planned features
Online installation and update, install nigthly builds, not suck in general.

## Credits
Let’s be honest, it’s just a few extra lines of code inside https://github.com/Atmosphere-NX/Atmosphere/tree/master/troposphere/reboot_to_payload.
Binary file added icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 60 additions & 16 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,44 +56,88 @@ static void reboot_to_payload(void) {

void swap_qmenu_ulaunch(void) {

unsigned char file_u[] = "/atmosphere/titles/0100000000001000ulaunch/exefs.nsp";
unsigned char file_q[] = "/atmosphere/titles/0100000000001000/exefs.nsp";
// unsigned char file_qlaunch[] = "/atmosphere/contents/0100000000001000/exefs.nsp";
// unsigned char file_ShopN[] = "/atmosphere/contents/010000000000100B/exefs.nsp";
// unsigned char file_LibraryAppletAuth[] = "/atmosphere/contents/0100000000001001/exefs.nsp";
// unsigned char file_flog[] = "/atmosphere/contents/01008BB00013C000/exefs.nsp";
unsigned char file_1000[] = "/ulaunch/ProtonELV/0100000000001000/exefs.nsp";
// unsigned char file_100B[] = "/ulaunch/ProtonELV/010000000000100B/exefs.nsp";
// unsigned char file_1001[] = "/ulaunch/ProtonELV/0100000000001001/exefs.nsp";
unsigned char file_C000_bak[] = "/ulaunch/ProtonELV/backup/01008BB00013C000/exefs.nsp";
unsigned char file_C000_cont[] = "/atmosphere/contents/01008BB00013C000/exefs.nsp";

int lState = 0;
if (!access((const char *)file_u, F_OK)) {
lState = 1; // all good, ulaunch inactive
} else if (!access((const char *)file_q, F_OK)) {
lState = 3; // ulaunch active
int lState = 0;

if (!access((const char *)file_1000, F_OK)) {
lState = 1; // first start
} else if ((!access((const char *)file_C000_cont, F_OK)) || (!access((const char *)file_C000_bak, F_OK))) {
lState = 3; // can swap
} else {
lState = 2; // error no uLaunch
}

switch (lState) {
case 1:
printf("Ready for liftoff!\nHere's to successful (u)launch! Poyekhali!\nReboot to payload now.\n");
mkdir("/ulaunch/ProtonELV/backup", 0700);
rename("/atmosphere/contents/0100000000001000/", "/ulaunch/ProtonELV/backup/0100000000001000/");
rename("/atmosphere/contents/010000000000100B/", "/ulaunch/ProtonELV/backup/010000000000100B/");
rename("/atmosphere/contents/0100000000001001/", "/ulaunch/ProtonELV/backup/0100000000001001/");
rename("/atmosphere/contents/01008BB00013C000/", "/ulaunch/ProtonELV/backup/01008BB00013C000/");
rename("/ulaunch/ProtonELV/0100000000001000/", "/atmosphere/contents/0100000000001000/");
rename("/ulaunch/ProtonELV/010000000000100B/", "/atmosphere/contents/010000000000100B/");
rename("/ulaunch/ProtonELV/0100000000001001/", "/atmosphere/contents/0100000000001001/");
rename("/ulaunch/ProtonELV/01008BB00013C000/", "/atmosphere/contents/01008BB00013C000/");
break;

case 2:
printf("China won the space race...\nFile [%s] access failed: %d\nThe only thing left is to pray.\n", file_1000, errno);
break;

case 3:
printf("Swapped.\nReboot to payload for the changes to apply.\n\n");
rename("/atmosphere/contents/0100000000001000/", "/ulaunch/ProtonELV/0100000000001000temp/");
rename("/ulaunch/ProtonELV/backup/0100000000001000/", "/atmosphere/contents/0100000000001000/");
rename("/ulaunch/ProtonELV/0100000000001000temp/", "/ulaunch/ProtonELV/backup/0100000000001000/");

rename("/atmosphere/contents/010000000000100B/", "/ulaunch/ProtonELV/010000000000100Btemp/");
rename("/ulaunch/ProtonELV/backup/010000000000100B/", "/atmosphere/contents/010000000000100B/");
rename("/ulaunch/ProtonELV/010000000000100Btemp/", "/ulaunch/ProtonELV/backup/010000000000100B/");

rename("/atmosphere/contents/0100000000001001/", "/ulaunch/ProtonELV/0100000000001001temp/");
rename("/ulaunch/ProtonELV/backup/0100000000001001/", "/atmosphere/contents/0100000000001001/");
rename("/ulaunch/ProtonELV/0100000000001001temp/", "/ulaunch/ProtonELV/backup/0100000000001001/");

rename("/atmosphere/contents/01008BB00013C000/", "/ulaunch/ProtonELV/01008BB00013C000temp/");
rename("/ulaunch/ProtonELV/backup/01008BB00013C000/", "/atmosphere/contents/01008BB00013C000/");
rename("/ulaunch/ProtonELV/01008BB00013C000temp/", "/ulaunch/ProtonELV/backup/01008BB00013C000/");
break;
}
/* switch (lState) {
case 1:
printf("qlaunch is active, swapped with uLaunch.\n\n");
if (!rename("/atmosphere/titles/0100000000001000/", "/atmosphere/titles/0100000000001000qlaunch/")) {
rename("/atmosphere/titles/0100000000001000ulaunch/", "/atmosphere/titles/0100000000001000/");
if (!rename("/atmosphere/contents/0100000000001000/", "/atmosphere/contents/0100000000001000qlaunch/")) {
rename("/atmosphere/contents/0100000000001000ulaunch/", "/atmosphere/contents/0100000000001000/");
} else {
mkdir("/atmosphere/titles/0100000000001000qlaunch/", 0700);
rename("/atmosphere/titles/0100000000001000ulaunch/", "/atmosphere/titles/0100000000001000/");
mkdir("/atmosphere/contents/0100000000001000qlaunch/", 0700);
rename("/atmosphere/contents/0100000000001000ulaunch/", "/atmosphere/contents/0100000000001000/");
}
break;
case 2:
printf("File [%s] access failed: %d\nConsult the information at the top of the screen to set things up.\n\n", file_u, errno);
break;
case 3:
printf("uLaunch is active, swapped with qlaunch.\n\n");
rename("/atmosphere/titles/0100000000001000/", "/atmosphere/titles/0100000000001000ulaunch/");
rename("/atmosphere/titles/0100000000001000qlaunch/", "/atmosphere/titles/0100000000001000/");
rename("/atmosphere/contents/0100000000001000/", "/atmosphere/contents/0100000000001000ulaunch/");
rename("/atmosphere/contents/0100000000001000qlaunch/", "/atmosphere/contents/0100000000001000/");
break;
}
} */
}

int main(int argc, char **argv)
{
consoleInit(NULL);
printf("Place 'SdOut/titles/010100000000001000/exefs.nsp' into\n'/atmosphere/titles/0100000000001000ulaunch/'\nThe three remaining folders from '/SdOut/titles' should go into \n'/atmosphere/titles' for this app to work.\n\nReboot to payload to apply changes\n\nPress [X] to swap qlaunch with uLaunch\n");
printf("First setup/update:\nplace four folders from release: '/atmosphere/contents'\ninto '/ulaunch/ProtonELV' (create).\n\nPress [X] to swap qlaunch with uLaunch\n");

bool can_reboot = true;
Result rc = splInitialize();
Expand Down

0 comments on commit 4cab73b

Please sign in to comment.