mirror of
https://github.com/rvtr/SLOT-1-Boot-Menu.git
synced 2025-06-18 12:25:32 -04:00
Add (I'm assuming) non-working TwlNmenu jump
This commit is contained in:
parent
7dc647e969
commit
383053e42f
BIN
.github/launcher-preview.png
vendored
Normal file
BIN
.github/launcher-preview.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
7
Makefile
7
Makefile
@ -11,6 +11,9 @@
|
||||
|
||||
# SUBDIRS = banner \
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
TARGET_PLATFORM := TWL
|
||||
|
||||
TWL_ARCHGEN = LIMITED
|
||||
@ -19,6 +22,9 @@ TARGET_BIN = SLOT1_Booter.srl
|
||||
|
||||
SRCS = main.c screen.c font.c
|
||||
|
||||
MAKEROM_ROMROOT = ./data
|
||||
MAKEROM_ROMFILES = *.srl
|
||||
|
||||
ROM_SPEC = specfile.rsf
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@ -31,3 +37,4 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
|
||||
do-build: $(TARGETS)
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
19
README.md
19
README.md
@ -1,2 +1,19 @@
|
||||
# SLOT-1-Boot-Menu
|
||||
A SLOT-1 home menu alternative for DSi development units
|
||||

|
||||
|
||||
A SLOT-1 home menu alternative for DSi development units. Some dev units like the X4 [prototype](https://wiki.raregamingdump.ca/index.php/DSi_Pre-X4_Prototype) *(this says unconfirmed pre-X4 but the same shells are used on confirmed X4s)* have no home menu, so you can't run backup tools through any NAND exploit or by installing a TAD. Since prototypes can still boot from SLOT-1, this program acts as a secondary home menu to give access to running software from the SD and makes prototypes a bit more usable.
|
||||
|
||||
- Full NAND/SD access from SLOT-1
|
||||
- Boot an SRL from the SD (`sdmc:/boot.nds`)
|
||||
- Boot MachineSettings and the Launcher from NAND
|
||||
<!-- - Can check the DSi version (todo because I don't know C and this is my first "real" C program... even if it's 99% stitched together SDK code) -->
|
||||
- Boot TwlNmenu from ROM
|
||||
|
||||
## Compiling
|
||||
You will need the TwlSDK 5.5 and TwlSystem 2.2.0 installed and fully set up. (please don't ask how, I don't even know how I set up my copy)
|
||||
|
||||
Once set up, just run `make` in the cygwin terminal!
|
||||
|
||||
## Credits
|
||||
- [minitwlpayload](https://github.com/yellows8/dsi/tree/master/exploits/minitwlpayload) to boot SRLs on the SD card
|
||||
- [stylehax](https://github.com/nathanfarlow/stylehax) for the payload loading code
|
34
include/twlnmenu.h
Normal file
34
include/twlnmenu.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SLOT-1 Boot Menu
|
||||
File: screen.h
|
||||
|
||||
This source code is derived from "os_jump" in the TwlSDK
|
||||
|
||||
$Date:: 2024-02-01#$
|
||||
$Author: Lillian Skinner (rmc) $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TWLNMENU_H_
|
||||
#define TWLNMENU_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
#include <nitro/types.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Function Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL WriteTwlNmenu(void);
|
||||
static void JumpTwlNmenu(void)
|
||||
|
||||
/*===========================================================================*/
|
||||
#ifdef __cplusplus
|
||||
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* SCREEN_H_ */
|
51
src/main.c
51
src/main.c
@ -14,12 +14,15 @@
|
||||
#include "screen.h"
|
||||
#include "DEMO.h"
|
||||
#include "payload.h"
|
||||
#include "twlnmenu.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Constant Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define VERSION 61
|
||||
#define KEY_REPEAT_START 25 // Number of frames until key repeat starts
|
||||
#define KEY_REPEAT_SPAN 10 // Number of frames between key repeats
|
||||
#define DMA_NO_FS 1
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Structure Definitions
|
||||
@ -55,6 +58,7 @@ static void InitHeap(void);
|
||||
static void ReadKey(KeyInfo* pKey);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void VBlankIntr(void);
|
||||
|
||||
void TwlMain(void)
|
||||
{
|
||||
@ -72,6 +76,8 @@ void TwlMain(void)
|
||||
InitHeap();
|
||||
InitScreen();
|
||||
InitInterrupts();
|
||||
|
||||
FS_Init(DMA_NO_FS);
|
||||
|
||||
GX_DispOn();
|
||||
GXS_DispOn();
|
||||
@ -89,22 +95,30 @@ void TwlMain(void)
|
||||
// Clear the main screen
|
||||
ClearScreen();
|
||||
|
||||
// 32 wide
|
||||
PutMainScreen(0, 0, 0xff, "SLOT-1 Boot Menu");
|
||||
PutMainScreen(0, 3, 0xff, "By rmc and Nintendo.");
|
||||
PutMainScreen(0, 4, 0xff, "https://rvtr.github.io/");
|
||||
PutMainScreen(0, 1, 0xff, " ------ SLOT-1 BOOT MENU ------ ");
|
||||
PutMainScreen(0, 3, 0xff, " By rmc ");
|
||||
PutMainScreen(0, 4, 0xff, " https://rvtr.github.io/ ");
|
||||
PutMainScreen(0, 6, 0xff, " ------------------------------ ");
|
||||
|
||||
PutSubScreen(0, 0, 0xff, "SLOT-1 Boot Menu");
|
||||
PutSubScreen(0, 2, 0xff, " A: Launcher");
|
||||
PutSubScreen(0, 3, 0xff, " B: MachineSettings");
|
||||
PutSubScreen(0, 4, 0xff, " X: SD card (smdc:/boot.nds)");
|
||||
// 32 wide, 24 tall
|
||||
PutSubScreen(0, 0, 0xff, " SLOT-1 BOOT MENU ver.%06d", VERSION);
|
||||
PutSubScreen(0, 2, 0xff, " -- KEY -------- COMMAND ------ ");
|
||||
PutSubScreen(0, 4, 0xf2, " A: Launcher ");
|
||||
PutSubScreen(0, 6, 0xf2, " B: Settings ");
|
||||
PutSubScreen(0, 8, 0xf2, " X: TwlNmenu ");
|
||||
PutSubScreen(0, 10, 0xf2, " Y: SD (boot.nds) ");
|
||||
PutSubScreen(0, 20, 0xff, " ------------------------------ ");
|
||||
PutSubScreen(0, 21, 0xff, " STATUS: ");
|
||||
PutSubScreen(0, 22, 0xff, " Currently no error occurs ");
|
||||
|
||||
|
||||
if (gKey.trg & PAD_BUTTON_A)
|
||||
{
|
||||
if (FALSE == OS_JumpToSystemMenu() )
|
||||
// OSi_CanArbitraryJumpTo(0x00030015484e4241)
|
||||
{
|
||||
//Jump failure
|
||||
OS_Panic("Failed jump to Launcher!");
|
||||
PutSubScreen(0, 22, 0xf1, " Failed jump to Launcher ");
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,13 +127,23 @@ void TwlMain(void)
|
||||
if (FALSE == OS_JumpToWirelessSetting())
|
||||
{
|
||||
//Jump failure
|
||||
OS_Panic("Failed jump to MachineSetting!");
|
||||
PutSubScreen(0, 22, 0xf1, " Failed jump to MachineSettings ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gKey.trg & PAD_BUTTON_X)
|
||||
{
|
||||
result = WriteTwlNmenu();
|
||||
if(result = TRUE )
|
||||
{
|
||||
JumpTwlNmenu();
|
||||
}
|
||||
PutSubScreen(0, 22, 0xf1, " Failed to write to TwlNmenu ");
|
||||
}
|
||||
|
||||
if (gKey.trg & PAD_BUTTON_Y)
|
||||
{
|
||||
// Adapted from nathanfarlow's stylehax (adapted from shutterbug2000 and zoogie's memory pit)
|
||||
// """Adapted""" from nathanfarlow's stylehax (adapted from shutterbug2000 and zoogie's memory pit)
|
||||
uu8 *payload_dest = (uu8 *)0x02200000;
|
||||
|
||||
int i;
|
||||
@ -133,7 +157,8 @@ void TwlMain(void)
|
||||
// Wait for V-Blank (this supports threading)
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
|
||||
|
||||
OS_WaitVBlankIntr();
|
||||
OS_Terminate();
|
||||
}
|
||||
|
||||
|
103
src/twlnmenu.c
Normal file
103
src/twlnmenu.c
Normal file
@ -0,0 +1,103 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SLOT-1 Boot Menu
|
||||
File: main.c
|
||||
|
||||
This source code is derived from "os_jump" in the TwlSDK
|
||||
|
||||
$Date:: 2024-02-01#$
|
||||
$Author: Lillian Skinner (rmc) $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "DEMO.h"
|
||||
#include "twlnmenu.h"
|
||||
|
||||
static u64 ROM_SRL_TID[1] =
|
||||
{
|
||||
0x0003001134544E41
|
||||
};
|
||||
static const char ROM_SRL_PATH[1][32] =
|
||||
{
|
||||
"rom:/TwlNmenu.srl"
|
||||
};
|
||||
|
||||
|
||||
static BOOL WriteTwlNmenu(void)
|
||||
{
|
||||
FSFile file;
|
||||
BOOL open_is_ok;
|
||||
BOOL read_is_ok;
|
||||
void* pTempBuf;
|
||||
u32 file_size;
|
||||
u32 alloc_size;
|
||||
BOOL result = TRUE;
|
||||
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFile(&file, OS_TMP_APP_PATH);
|
||||
if (open_is_ok)
|
||||
{
|
||||
FS_CloseFile(&file);
|
||||
OS_Printf("%s is already exist.", OS_TMP_APP_PATH);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFile(&file, ROM_SRL_PATH);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
OS_Printf("FS_OpenFile(%s) ERROR!", ROM_SRL_PATH);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
file_size = FS_GetFileLength(&file) ;
|
||||
alloc_size = ROUND_UP(file_size, 32) ;
|
||||
pTempBuf = OS_Alloc( alloc_size );
|
||||
SDK_NULL_ASSERT(pTempBuf);
|
||||
DC_InvalidateRange(pTempBuf, alloc_size);
|
||||
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
|
||||
if (!read_is_ok)
|
||||
{
|
||||
OS_Panic("FS_ReadFile(%s) ERROR!", ROM_SRL_PATH);
|
||||
FS_CloseFile(&file);
|
||||
OS_Free(pTempBuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FS_CloseFile(&file);
|
||||
|
||||
if (!FS_CreateFile(OS_TMP_APP_PATH, FS_PERMIT_R | FS_PERMIT_W))
|
||||
{
|
||||
OS_Panic("FS_CreateFile(%s) failed.", OS_TMP_APP_PATH);
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFileEx(&file, OS_TMP_APP_PATH, FS_FILEMODE_W);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
OS_Panic("FS_OpenFile(%s) failed.\n", OS_TMP_APP_PATH);
|
||||
result = FALSE;
|
||||
}
|
||||
else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1)
|
||||
{
|
||||
OS_Panic("FS_WritFile() failed.\n");
|
||||
result = FALSE;
|
||||
}
|
||||
(void)FS_CloseFile(&file);
|
||||
}
|
||||
|
||||
OS_Free(pTempBuf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void JumpTwlNmenu(void) {
|
||||
OS_DoApplicationJump( ROM_SRL_TID[0], OS_APP_JUMP_TMP );
|
||||
PutSubScreen(0, 22, 0xf1, " Failed jump to TwlNmenu ");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user