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

Commit

Permalink
This should have been the previous release
Browse files Browse the repository at this point in the history
  • Loading branch information
octopuserectus committed Jan 12, 2020
1 parent c30935e commit 0435b4d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DATA := data
INCLUDES := include
APP_TITLE := ProtonELV
APP_AUTHOR := octopus
APP_VERSION := 0.1
APP_VERSION := 1.0
#ROMFS := romfs

#---------------------------------------------------------------------------------
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

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

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.
It can swap stock Home menu (qlaunch) with uLaunch and apply changes via rebooting to payload, backing up everything useful (e.g. a Home menu theme) you might have had in your relevant “contents” folders in the process.

## 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.
* Download uLaunch’s release https://github.com/XorTroll/uLaunch/releases archive, place /ulaunch from the archive 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 archive into /ulaunch/ProtonELV.
* Uninstall a custom Home menu theme if you have one and reboot. I found no way to swap folders which are MITM’ed without rebooting.
* Download ProtonELV.nro https://github.com/octopuserectus/ProtonELV/releases and delicately place it into /switch or wherever you want.
* Start humming “L’Internationale”.
* Run ProtonELV via Homebrew Menu (applet or title redirection mode, whatever rocks your spaceship).

## Controls
Controls are explained via on-screen prompts.

## Planned features
## Planned features (aka “would never implement those”)
Online install and update, install nigthly builds, not suck in general.

## Credits
Expand Down
97 changes: 45 additions & 52 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,90 +54,83 @@ static void reboot_to_payload(void) {
splSetConfig((SplConfigItem)65001, 2);
}

void swap_qmenu_ulaunch(void) {

// 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";
void swapper(void) {
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/");
}

void protonelv(void) {
unsigned char file_1000[] = "/ulaunch/ProtonELV/0100000000001000/exefs.nsp"; // qlaunch
unsigned char file_100B[] = "/ulaunch/ProtonELV/010000000000100B/exefs.nsp"; // ShopN
unsigned char file_1001[] = "/ulaunch/ProtonELV/0100000000001001/exefs.nsp"; // LibraryAppletAuth
unsigned char file_C000[] = "/ulaunch/ProtonELV/01008BB00013C000/exefs.nsp"; // flog
unsigned char file_C000_bak[] = "/ulaunch/ProtonELV/backup/01008BB00013C000/exefs.nsp";
unsigned char file_C000_cont[] = "/atmosphere/contents/01008BB00013C000/exefs.nsp";
unsigned char flag_elonmusk[] = "/ulaunch/ProtonELV/elon.musk"; // commemorate successful first launch with this flag

int lState = 0;

if (!access((const char *)file_1000, F_OK)) {
if ((!access((const char *)file_1000, F_OK)) && (!access((const char *)file_100B, F_OK)) && (!access((const char *)file_1001, F_OK)) && (!access((const char *)file_C000, 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 if ((!access((const char *)file_C000_cont, F_OK)) && (!access((const char *)flag_elonmusk, F_OK))) {
lState = 3; // reverting to Home menu
} else if ((!access((const char *)file_C000_bak, F_OK)) && (!access((const char *)flag_elonmusk, F_OK))) {
lState = 4; // back to uLaunch
} else {
lState = 2; // error no uLaunch
lState = 2; // error for dyslexics (is it rude?)
}

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/");
FILE *flag = fopen((const char *)flag_elonmusk, "w");
fclose(flag);
printf("Ready for liftoff! Poyekhali!\nHere's to successful (u)launch!\nReboot to payload now.\n\n");
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);
printf("China won the space race...\nFile [%s] access failed: %d\nThe only thing left is to pray (or read instructions).\n\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/contents/0100000000001000/", "/atmosphere/contents/0100000000001000qlaunch/")) {
rename("/atmosphere/contents/0100000000001000ulaunch/", "/atmosphere/contents/0100000000001000/");
} else {
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);
printf("Reverted to stock Home menu.\nReboot to payload for the changes to apply.\nYou can press [X] again if you regret your life's decisions.\n\n");
swapper();
break;
case 3:
printf("uLaunch is active, swapped with qlaunch.\n\n");
rename("/atmosphere/contents/0100000000001000/", "/atmosphere/contents/0100000000001000ulaunch/");
rename("/atmosphere/contents/0100000000001000qlaunch/", "/atmosphere/contents/0100000000001000/");

case 4:
printf("Replaced Home menu with uLaunch.\nReboot to payload for the changes to apply.\nYou can press [X] again if you regret your life's decisions.\n\n");
swapper();
break;
} */
}
}

int main(int argc, char **argv)
{
consoleInit(NULL);
printf("First setup/update:\nplace four folders from release: '/atmosphere/contents'\ninto '/ulaunch/ProtonELV' (create).\n\nPress [X] to swap qlaunch with uLaunch\n");
printf("First setup instructions: https://u.nu/c3mn\n\nPress [X] to swap qlaunch with uLaunch\n");

bool can_reboot = true;
Result rc = splInitialize();
Expand Down Expand Up @@ -177,7 +170,7 @@ bool can_reboot = true;
if (kDown & KEY_L) { break; } // break in order to return to hbmenu

if (kDown & KEY_X) {
swap_qmenu_ulaunch();
protonelv();
}

consoleUpdate(NULL);
Expand Down

0 comments on commit 0435b4d

Please sign in to comment.