Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
Update for SigHax
Browse files Browse the repository at this point in the history
  • Loading branch information
KunoichiZ committed May 20, 2017
1 parent 2f530db commit 0df6081
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 38 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

Formerly known as "ARN Updater"

A `arm9loaderhax.bin` updater for Luma3DS (formerly AuReiNand) as a 3DS homebrew (no more SD swaps!)
A `boot.firm` updater for Luma3DS and SigHax (formerly AuReiNand) as a 3DS homebrew (no more SD swaps!)

## Usage

Refer to the [wiki](https://github.com/Hamcha/lumaupdate/wiki) for usage information.
Originally from [Hamcha's wiki](https://github.com/Hamcha/lumaupdate/wiki):

For SigHax Users:
1. Install Luma Updater's CIA then launch it.

## Requirements

Expand All @@ -25,7 +28,7 @@ Refer to the [wiki](https://github.com/Hamcha/lumaupdate/wiki) for usage informa

`make` should create the output folder and fill it with both the 3dsx and the cia builds

`make 3dsx` will only build the 3dsx version
`make 3dsx` will only build the 3dsx version [outdated]

#### Extra flags

Expand Down Expand Up @@ -53,3 +56,4 @@ Refer to `LICENSE.libmd5-rfc.txt` for the full text.
- Hourlies built and provided by [astronautlevel](https://github.com/astronautlevel2)
- Makefiles are somewhat derived by stripping down [Steveice10](https://github.com/Steveice10)'s buildtools
- CIA jingle by [Cydon @ FreeSound](https://www.freesound.org/people/cydon/)
- Original code by [Hamcha](https://github.com/Hamcha/lumaupdate)
Binary file added bannertool.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions lumaupdater.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
payload type = a9lh
payload path = arm9loaderhax.bin
payload type = sighax
payload path = boot.firm
log enable = yes
selfupdate = yes
backup = yes
Binary file added makerom.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion source/console.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "console.h"

#ifndef GIT_VER
#define GIT_VER "v1.5"
#define GIT_VER "v2.0"
#endif

PrintConsole* consoleCurrent = nullptr;
Expand Down
25 changes: 13 additions & 12 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct UpdateInfo {
bool backupExists = false;

// Configuration options
PayloadType payloadType = PayloadType::A9LH;
std::string payloadPath = "/arm9loaderhax.bin";
PayloadType payloadType = PayloadType::SIGHAX;
std::string payloadPath = "/boot.firm";
bool backupExisting = true;
bool selfUpdate = true;
bool writeLog = true;
Expand Down Expand Up @@ -218,15 +218,15 @@ static UpdateChoice drawConfirmationScreen(const UpdateInfo& args, const bool us

std::string payloadType;
switch (args.payloadType) {
case PayloadType::A9LH:
payloadType = "arm9loaderhax";
case PayloadType::SIGHAX:
payloadType = "sighax";
break;
case PayloadType::Menuhax:
/*case PayloadType::Menuhax:
payloadType = "Menuhax";
break;
case PayloadType::Homebrew:
payloadType = "Homebrew";
break;
break;*/
}

std::printf(" Payload type: %s%s%s\n", CONSOLE_WHITE, payloadType.c_str(), CONSOLE_RESET);
Expand Down Expand Up @@ -519,19 +519,20 @@ int main(int argc, char* argv[]) {
}

// Load config values
updateInfo.payloadPath = config.Get("payload path", DEFAULT_A9LH_PATH);
updateInfo.payloadPath = config.Get("payload path", DEFAULT_SIGHAX_PATH);
updateInfo.backupExisting = tolower(config.Get("backup", "y")[0]) == 'y';
updateInfo.selfUpdate = tolower(config.Get("selfupdate", "y")[0]) == 'y';
updateInfo.writeLog = tolower(config.Get("log enable", "y")[0]) == 'y';

payloadType = config.Get("payload type", "a9lh");
if (payloadType == "a9lh") {
updateInfo.payloadType = PayloadType::A9LH;
} else if (payloadType == "menuhax") {
payloadType = config.Get("payload type", "SIGHAX");
if (payloadType == "SIGHAX") {
updateInfo.payloadType = PayloadType::SIGHAX;
}
/*if (payloadType == "menuhax") {
updateInfo.payloadType = PayloadType::Menuhax;
} else if (payloadType == "homebrew") {
updateInfo.payloadType = PayloadType::Homebrew;
} else {
}*/ else {
logPrintf("Unknown or wrong config value: '%s' for 'payload type'\n", payloadType.c_str());
gfxFlushBuffers();
WAIT_START
Expand Down
8 changes: 4 additions & 4 deletions source/release.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ bool releaseGetPayload(const PayloadType payloadType, const ReleaseVer& release,

std::string payloadPath;
switch (payloadType) {
case PayloadType::A9LH:
payloadPath = DEFAULT_A9LH_PATH;
case PayloadType::SIGHAX:
payloadPath = DEFAULT_SIGHAX_PATH;
break;
case PayloadType::Menuhax:
/*case PayloadType::Menuhax:
payloadPath = DEFAULT_MHAX_PATH;
break;
case PayloadType::Homebrew:
payloadPath = DEFAULT_3DSX_PATH;
break;
break;*/
}

try {
Expand Down
12 changes: 6 additions & 6 deletions source/release.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include "libs.h"

#define DEFAULT_A9LH_PATH "arm9loaderhax.bin"
#define DEFAULT_MHAX_PATH "Luma3DS.dat"
#define DEFAULT_3DSX_PATH "3DS/Luma3DS/Luma3DS.3dsx"
#define DEFAULT_SIGHAX_PATH "boot.firm"
//#define DEFAULT_MHAX_PATH "Luma3DS.dat"
//#define DEFAULT_3DSX_PATH "3DS/Luma3DS/Luma3DS.3dsx"

enum class PayloadType {
A9LH, /*!< arm9loaderhax payload (arm9loaderhax.bin) */
Menuhax, /*!< menuhax payload (Luma3DS.dat) */
Homebrew /*!< hblauncher payload (Luma3DS.3dsx/smdh) */
SIGHAX, /*!< sighax payload (boot.firm) */
/*Menuhax, !< menuhax payload (Luma3DS.dat) */
/*Homebrew !< hblauncher payload (Luma3DS.3dsx/smdh) */
};

struct ReleaseVer {
Expand Down
20 changes: 10 additions & 10 deletions source/update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "utils.h"

static inline bool pathchange(u8* buf, const size_t bufSize, const std::string& path) {
const static char original[] = "sdmc:/arm9loaderhax.bin";
const static char original[] = "sdmc:/boot.firm";
const static size_t prefixSize = 12; // S \0 D \0 M \0 C \0 : \0 / \0
const static size_t originalSize = sizeof(original)/sizeof(char);
u8 pathLength = path.length();
Expand Down Expand Up @@ -49,7 +49,7 @@ static inline bool pathchange(u8* buf, const size_t bufSize, const std::string&
return false;
}

// Replace "arm9loaderhax.bin" with own payload path
// Replace "boot.firm" with own payload path
size_t offset = curProposedOffset + prefixSize;
u8 i = 0;
for (i = 0; i < pathLength; ++i) {
Expand All @@ -63,7 +63,7 @@ static inline bool pathchange(u8* buf, const size_t bufSize, const std::string&
return true;
}

static inline bool backupA9LH(const std::string& payloadName) {
static inline bool backupSighax(const std::string& payloadName) {
std::ifstream original(payloadName, std::ifstream::binary);
if (!original.good()) {
logPrintf("Could not open %s\n", payloadName.c_str());
Expand Down Expand Up @@ -104,7 +104,7 @@ UpdateResult update(const UpdateArgs& args) {

logPrintf("Copying %s to %s.bak...\n", args.payloadPath.c_str(), args.payloadPath.c_str());
gfxFlushBuffers();
if (!backupA9LH(args.payloadPath)) {
if (!backupSighax(args.payloadPath)) {
logPrintf("\nCould not backup %s (!!), aborting...\n", args.payloadPath.c_str());
return { false, "BACKUP FAILED" };
}
Expand All @@ -121,17 +121,17 @@ UpdateResult update(const UpdateArgs& args) {
size_t offset = 0;
size_t payloadSize = 0;
if (!releaseGetPayload(args.payloadType, args.chosenVersion, args.isHourly, &payloadData, &offset, &payloadSize)) {
logPrintf("FATAL\nCould not get A9LH payload...\n");
logPrintf("FATAL\nCould not get sighax payload...\n");
std::free(payloadData);
return { false, "DOWNLOAD FAILED" };
}

if (args.payloadType == PayloadType::A9LH && args.payloadPath != std::string("/") + DEFAULT_A9LH_PATH) {
if (args.payloadType == PayloadType::SIGHAX && args.payloadPath != std::string("/") + DEFAULT_SIGHAX_PATH) {
consoleScreen(GFX_TOP);
consoleSetProgressData("Applying path changing", 0.6);
consoleScreen(GFX_BOTTOM);

logPrintf("Requested payload path is not %s, applying path patch...\n", DEFAULT_A9LH_PATH);
logPrintf("Requested payload path is not %s, applying path patch...\n", DEFAULT_SIGHAX_PATH);
if (!pathchange(payloadData + offset, payloadSize, args.payloadPath)) {
std::free(payloadData);
return { false, "PATHCHANGE FAILED" };
Expand Down Expand Up @@ -159,9 +159,9 @@ UpdateResult update(const UpdateArgs& args) {
consoleScreen(GFX_BOTTOM);

logPrintf("Saving payload to SD (as %s)...\n", args.payloadPath.c_str());
std::ofstream a9lhfile("/" + args.payloadPath, std::ofstream::binary);
a9lhfile.write((const char*)(payloadData + offset), payloadSize);
a9lhfile.close();
std::ofstream sighaxfile("/" + args.payloadPath, std::ofstream::binary);
sighaxfile.write((const char*)(payloadData + offset), payloadSize);
sighaxfile.close();

logPrintf("All done, freeing resources and exiting...\n");
std::free(payloadData);
Expand Down

0 comments on commit 0df6081

Please sign in to comment.