Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kronos2308 committed Oct 27, 2023
1 parent b70a1d9 commit 559fd74
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ INCLUDES := include
EXEFS_SRC := exefs_src
APP_TITLE := Haku33
APP_AUTHOR := Kronos2308
APP_VERSION := 5.4
APP_VERSION := 5.6
ROMFS := romfs

#---------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion compile.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

set /p IP=<C:/My-Switch-ip.txt
set /p IP=<%temp%/My-Switch-ip.txt

dir /b *.nro>%temp%\filete.txt
set /p File=<%temp%\filete.txt
Expand All @@ -15,5 +15,6 @@ if %a% equ 0 color 0a

echo -----------------------------------
"C:\devkitPro\tools\bin\nxlink.exe" %File%
"C:\devkitPro\tools\bin\nxlink.exe" %File% -a %IP%
%systemroot%\system32\timeout.exe 55

Binary file modified romfs/TegraExplorer.bin
Binary file not shown.
15 changes: 8 additions & 7 deletions romfs/startup.te
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#REQUIRE KEYS
is=["8000000000000120","8000000000000047"]
is=["8000000000000120","8000000000000047","8000000000000000"]
p=println
pr=print
pe={pause() exit()}
pe={hwfly() pause() exit()}
println("Haku33 Kronos2308 Hard Reset, Kronos2308 - Fork from TegraExplorer")
wait={t=timer()while(timer()<(t+tw)){print("Wait for",(t+tw-timer()/1000),"seconds \r")}}
emumenu={op=["Wipe Console","Wipe emunand only"].copy()r=menu(op,0)clear()if(r==0){p("Selected sysmmc")mount=mountsys}if(r==1){p("Selected emummc")mount=mountemu}}
hwfly={if(fsexists("sd:/payload.bin.bak")){copyfile("sd:/payload.bin.bak", "sd:/payload.bin")delfile("sd:/payload.bin.bak")}}

p("System wiper\n")
op=["Wipe Console"].copy()
if (emu()){op+"Wipe emunand only"}
r=menu(op,0)clear()
if(r==0){p("Selected sysmmc")mount=mountsys}
if(r==1){p("Selected emummc")mount=mountemu}
mount=mountsys
if (emu()){emumenu()}
if(mount("SYSTEM")){p("Mount failed!")pe()}
color(0xFF0000)
p("Are you sure you want to wipe everything?\nThis includes:\n- Saves\n- Game Data\n- All other data on the system\n\nUse this only as a last resort!")
Expand Down Expand Up @@ -39,6 +39,7 @@ delfile("sd:/startup.te")
delfile("sd:/Haku33.nro")
delfile("sd:/Switch/Haku33.nro")
delfile("sd:/Switch/Haku33/Haku33.nro")
hwfly()

p("\n\nDone!")
p("\n\nPress Any button to full power off!")
Expand Down
37 changes: 0 additions & 37 deletions romfs/startup_mariko.te

This file was deleted.

6 changes: 3 additions & 3 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void SetupClean (){
copy_me("romfs:/boot.dat", "/boot.dat");
copy_me("romfs:/boot.ini", "/boot.ini");

//force boot HWFLY
//force boot HWFLY PicoFly
copy_me("sdmc:/payload.bin","sdmc:/payload.bin.bak");
copy_me("romfs:/TegraExplorer.bin", "/payload.bin");

Expand All @@ -152,7 +152,7 @@ void SetupClean (){
copy_me("romfs:/hekate_keys.ini", "/bootloader/hekate_keys.ini");

//copy Script
copy_me("romfs:/startup_mariko.te", "/startup.te");
copy_me("romfs:/startup.te", "/startup.te");

led_on(1);
spsmInitialize();
Expand All @@ -163,7 +163,7 @@ void SetupClean (){
copy_me("romfs:/startup.te", "/startup.te");
led_on(1);
bpcInitialize();
if(init_slp()){reboot_to_payload();}
if(init_slp()){reboot_to_payload("romfs:/TegraExplorer.bin");}
bpcExit();
}
}
Expand Down
22 changes: 13 additions & 9 deletions source/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
static alignas(0x1000) u8 g_reboot_payload[IRAM_PAYLOAD_MAX_SIZE];
static alignas(0x1000) u8 g_ff_page[0x1000];
static alignas(0x1000) u8 g_work_page[0x1000];
bool can_reboot = true;

void do_iram_dram_copy(void *buf, uintptr_t iram_addr, size_t size, int option) {
memcpy(g_work_page, buf, size);
Expand Down Expand Up @@ -41,9 +42,19 @@ static void clear_iram(void) {
}
}

void reboot_to_payload(void) {
void reboot_to_payload(const char* payload) {
clear_iram();

FILE *f = fopen(payload, "rb");
if (f == NULL) {
can_reboot = false;
return 0;
} else {
can_reboot = true;
fread(g_reboot_payload, 1, sizeof(g_reboot_payload), f);
fclose(f);
}

for (size_t i = 0; i < IRAM_PAYLOAD_MAX_SIZE; i += 0x1000) {
copy_to_iram(IRAM_PAYLOAD_BASE + i, &g_reboot_payload[i], 0x1000);
}
Expand All @@ -53,18 +64,11 @@ void reboot_to_payload(void) {

bool init_slp()
{
bool can_reboot = true;
Result rc = splInitialize();
if (R_FAILED(rc)) {
can_reboot = false;
} else {
FILE *f = fopen("romfs:/TegraExplorer.bin", "rb");
if (f == NULL) {
can_reboot = false;
} else {
fread(g_reboot_payload, 1, sizeof(g_reboot_payload), f);
fclose(f);
}
can_reboot = true;
}
return can_reboot;
}
Expand Down
2 changes: 1 addition & 1 deletion source/reboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#include <unistd.h>
#include <switch.h>

void reboot_to_payload(void);
void reboot_to_payload(const char* payload);
bool init_slp(void);
void exit_spl(bool can_reboot);
Binary file added stuff/iconUP.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 559fd74

Please sign in to comment.