Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CXXFLAGS := $(CFLAGS) -fno-exceptions -Wno-missing-field-initializers -std=gnu++
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=${DEVKITPRO}/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := -lfreetype -lSDL2_mixer -lmodplug -lmpg123 -lvorbisidec -logg -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lpng -ljpeg `sdl2-config --libs` `freetype-config --libs` -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -lz -lnx
LIBS := -lfreetype -lSDL2_mixer -lmodplug -lmpg123 -lvorbisidec -logg -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lpng -ljpeg `sdl2-config --libs` `freetype-config --libs` -lwebp -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -lz -lnx


#---------------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions source/Tools/autorcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
int Tools::toggle_rcm() {
FsStorage store;
int ret = 0;
int boot0_partition = 0; //boot0 is represented by 0x0 internally
Result rc = fsOpenBisStorage(&store, boot0_partition);
Result rc = fsOpenBisStorage(&store, FsBisStorageId_Boot0);
//UI::printmessage("fsOpenBisStorage Result: %d\n", rc);
u64 size = 0;
fsStorageGetSize(&store, &size);
Expand Down
20 changes: 10 additions & 10 deletions source/Tools/nandDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ void Tools::calculate_time(u64 begin, u64 end) {
ui->MessageBox("Notice", timeBuff, TYPE_OK);
}

int Tools::DumpPartition(int part_number, string name) {
int Tools::DumpPartition(FsBisStorageId part_number, string name) {
switch(part_number){
case 0:
case FsBisStorageId_Boot0:
buffer_size = BOOT_BLOCK_SIZE;
break;
case 10:
case FsBisStorageId_Boot1:
buffer_size = BOOT_BLOCK_SIZE;
break;
case 20:
case FsBisStorageId_UserDataRoot:
buffer_size = NAND_BLOCK_SIZE;
break;
case 27:
case FsBisStorageId_CalibrationBinary:
buffer_size = CAL0_BLOCK_SIZE;
break;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ int Tools::DumpPartition(int part_number, string name) {
}
float dump_percent=0.0f;
u64 file_num=0;
if(part_number==partitions::rawnand) {
if(part_number==FsBisStorageId_UserDataRoot) {
file_num = check_progress();
}

Expand All @@ -156,7 +156,7 @@ int Tools::DumpPartition(int part_number, string name) {
prog.max = file_max;
prog.curr = 0;
prog.step = buffer_size;
if(part_number==partitions::rawnand)
if(part_number==FsBisStorageId_UserDataRoot)
ui->CreateProgressBar(&prog, "Dumping file " + to_string(file_num+1) + " of " + to_string(total_files) + "...");
else ui->CreateProgressBar(&prog, "Dumping file " + to_string(file_num+1) + " of " + to_string(total_files+1) + "...");

Expand All @@ -171,7 +171,7 @@ int Tools::DumpPartition(int part_number, string name) {
//UI::printmessage("didnt open file, nullptr\n");
return -1;
}
if(part_number==partitions::rawnand){
if(part_number==FsBisStorageId_UserDataRoot){
char placehldr[] = "ReiNX";
fseek(fp, MAX_SIZE-sizeof(placehldr), SEEK_SET);
fwrite(placehldr, 1, sizeof(placehldr), fp);
Expand All @@ -187,7 +187,7 @@ int Tools::DumpPartition(int part_number, string name) {
}
fclose(fp);
file_num++;
if(part_number==partitions::rawnand)
if(part_number==FsBisStorageId_UserDataRoot)
write_progress(file_num);
if((CheckFreeSpace() < MAX_SIZE) && (file_num<10)){
fsStorageClose(&store);
Expand All @@ -207,7 +207,7 @@ int Tools::DumpPartition(int part_number, string name) {
calculate_time(start, finish);
timeExit();
create_combine_batch();
if(part_number==partitions::rawnand)
if(part_number==FsBisStorageId_UserDataRoot)
delete_progress();

return 0;
Expand Down
20 changes: 1 addition & 19 deletions source/Tools/nandDump.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,10 @@
#define BOOT_BLOCK_SIZE 0x400000
using namespace std;

enum partitions {
boot0 = 0,
boot1 = 10,
rawnand = 20,
BCPKG21,
BCPKG22,
BCPKG23,
BCPKG24,
BCPKG25,
BCPKG26,
ProdInfo = 27,
ProdInfoF,
SAFE,
USER,
SYSTEM1,
SYSTEM2
};

namespace Tools {

int create_combine_batch();
u64 CheckFreeSpace();
void calculate_time(u64 begin, u64 end);
int DumpPartition(int part_number, string name);
int DumpPartition(FsBisStorageId part_number, string name);
}
8 changes: 4 additions & 4 deletions source/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void UI::optAutoRCM() {
void UI::optDumpCal0() {
if(Tools::CheckFreeSpace() >= CAL0_BLOCK_SIZE) {
appletBeginBlockingHomeButton(0);
Tools::DumpPartition(ProdInfo, "cal0.bin");
Tools::DumpPartition(FsBisStorageId_CalibrationBinary, "cal0.bin");
appletEndBlockingHomeButton();
} else {
MessageBox("Warning!", "Not enough space on the SD card to write to!", TYPE_OK);
Expand All @@ -129,8 +129,8 @@ void UI::optDumpCal0() {
void UI::optDumpBoots() {
if(Tools::CheckFreeSpace() >= BOOT_BLOCK_SIZE*2) {
appletBeginBlockingHomeButton(0);
Tools::DumpPartition(boot0, "boot0.bin");
Tools::DumpPartition(boot1, "boot1.bin");
Tools::DumpPartition(FsBisStorageId_Boot0, "boot0.bin");
Tools::DumpPartition(FsBisStorageId_Boot1, "boot1.bin");
appletEndBlockingHomeButton();
} else {
MessageBox("Warning!", "Not enough space on the SD card to write to!", TYPE_OK);
Expand All @@ -140,7 +140,7 @@ void UI::optDumpBoots() {
void UI::optDumpNand() {
if(Tools::CheckFreeSpace() >= (u64)MAX_SIZE) {
appletBeginBlockingHomeButton(0);
Tools::DumpPartition(rawnand, "nand.bin");
Tools::DumpPartition(FsBisStorageId_UserDataRoot, "nand.bin");
appletEndBlockingHomeButton();
} else {
MessageBox("Warning!", "Not enough space on the SD card to write to!", TYPE_OK);
Expand Down
5 changes: 3 additions & 2 deletions source/Utils/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ extern "C" {
#include <stddef.h>

/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest

#ifndef SHA256_BLOCK_SIZE
#define SHA256_BLOCK_SIZE 0x20 // SHA256 outputs a 32 byte digest
#endif
/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
Expand Down