Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inital launch #34

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions ios_kernel/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ int _main(void* arg)
// nop out odm log to not spam logs when stopping drive
*(volatile uint32_t*) 0x1073880c = 0xe12fff1e; // bx lr

// disable halt on panic
*(volatile uint32_t*) 0x08129ce0 = 0xe12fff1e; // bx lr

restore_mmu(control_register);

// invalidate all cache
Expand Down
58 changes: 58 additions & 0 deletions ios_mcp/source/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static void option_DumpOtpAndSeeprom(void);
static void option_LoadNetConf(void);
static void option_InstallWUP(void);
static void option_EditParental(void);
static void option_SetInitialLaunch(void);
static void option_Shutdown(void);

extern int ppcHeartBeatThreadId;
Expand All @@ -59,6 +60,7 @@ static const Menu mainMenuOptions[] = {
{"Pair Gamepad", {.callback = option_PairDRC}},
{"Install WUP", {.callback = option_InstallWUP}},
{"Edit Parental Controls", {.callback = option_EditParental}},
{"Set Initinal Launch", {.callback = option_SetInitialLaunch}},
{"Debug System Region", {.callback = option_DebugSystemRegion}},
{"System Information", {.callback = option_SystemInformation}},
{"Submit System Data", {.callback = option_SubmitSystemData}},
Expand Down Expand Up @@ -916,6 +918,62 @@ int read_otp_seeprom(void *buf, int index)
return 0;
}

static void option_SetInitialLaunch(void)
{
static const Menu initialLaunchOptions[] = {
{"Back", { .tid = 256} },
{"2 - Default", {.tid = 2}},
{"0 - Initial Setup", {.tid = 0}},
{"255 - Factory Reset", {.tid = 255}},
};

const int option_count = sizeof(initialLaunchOptions) / sizeof(Menu);

int selected = 0;

gfx_clear(COLOR_BACKGROUND);
while (1) {
uint32_t index = 16 + 8 + 2 + 8;
gfx_set_font_color(COLOR_PRIMARY);

uint8_t currentInitialLaunch;
int rval = SCIGetInitialLaunch(&currentInitialLaunch);

if(rval<0)
gfx_printf(16, index, GfxPrintFlag_ClearBG, "Error getting current Initial Launch Value: %X" , rval);
else
gfx_printf(16, index, GfxPrintFlag_ClearBG, "Current initial Launch Value: %u", currentInitialLaunch);
index += CHAR_SIZE_DRC_Y + 4;

selected = drawMenu("Set Initial Launch Value",
initialLaunchOptions, option_count, selected, MenuFlag_NoClearScreen, 16, index);
index += (CHAR_SIZE_DRC_Y + 4) * option_count;

uint64_t newil = initialLaunchOptions[selected].tid;
if (newil == 256)
return;


index += (CHAR_SIZE_DRC_Y + 4) * 2;

gfx_set_font_color(COLOR_PRIMARY);
gfx_printf(16, index, GfxPrintFlag_ClearBG,
"Setting Initial Launch to %u", (uint8_t)newil);
index += CHAR_SIZE_DRC_Y + 4;

rval = SCISetInitialLaunch((uint8_t)newil);

if (rval < 0) {
gfx_set_font_color(COLOR_ERROR);
gfx_printf(16, index, GfxPrintFlag_ClearBG, "Error! %X", rval);
} else {
gfx_set_font_color(COLOR_SUCCESS);
gfx_print(16, index, GfxPrintFlag_ClearBG, "Success! ");
}

}
}

static void option_Shutdown(void)
{
if (fsaHandle > 0) {
Expand Down
10 changes: 10 additions & 0 deletions ios_mcp/source/sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,13 @@ int SCIGetParentalSecAnswer(char* buf, uint32_t buf_size)
{
return _SCIReadSysConfig("parent.sec_answer", UC_DATA_TYPE_STRING, buf_size, buf);
}

int SCISetInitialLaunch(uint8_t initialLaunch)
{
return _SCIWriteSysConfig("cafe.initial_launch", UC_DATA_TYPE_U8, 1, &initialLaunch);
}

int SCIGetInitialLaunch(uint8_t* outInitialLaunch)
{
return _SCIReadSysConfig("cafe.initial_launch", UC_DATA_TYPE_U8, 1, outInitialLaunch);
}
4 changes: 4 additions & 0 deletions ios_mcp/source/sci.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ int SCIGetParentalPinCode(char* pin, uint32_t pin_size);
int SCIGetParentalCustomSecQuestion(char* buf, uint32_t buf_size);

int SCIGetParentalSecAnswer(char* buf, uint32_t buf_size);

int SCISetInitialLaunch(uint8_t initialLaunch);

int SCIGetInitialLaunch(uint8_t* outInitialLaunch);