From da0b1a13899be7c681eb046bd3cf754d9cf6086f Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Tue, 3 Jan 2023 21:31:37 +0100 Subject: [PATCH] Revert force-setting SysNAND when launching TWL Mode This being said, neither legacy FIRM nor DSiWare actually support EmuNAND; installing the same TWL title on both SysNAND and EmuNAND and then launch it from EmuNAND will work though. It is only when exiting AGB firm that we want to boot SysNAND no matter what, because the save file has been written on a partition in SysNAND. This is mainly to ensure we reboot to the proper NAND in case we reboot. --- arm9/source/main.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/arm9/source/main.c b/arm9/source/main.c index e9232dd..3ba0fb6 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -1,6 +1,6 @@ /* * This file is part of Luma3DS -* Copyright (C) 2016-2022 Aurora Wright, TuxSH +* Copyright (C) 2016-2023 Aurora Wright, TuxSH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -219,13 +219,12 @@ void main(int argc, char **argv, u32 magicWord) { u32 bootenv = CFG_BOOTENV; bool validTlnc = bootenv == 3 && hasValidTlncAutobootParams(); - bool twlIntoCtr = validTlnc && isTwlToCtrLaunch(); if (validTlnc) needToInitSd = true; - //Always force a SysNAND boot when quitting AGB_FIRM, or when doing a TWL -> (ns ->) TWL reboot - if(bootenv == 7 || (validTlnc && !twlIntoCtr)) + //Always force a SysNAND boot when quitting AGB_FIRM + if(bootenv == 7) { nandType = FIRMWARE_SYSNAND; firmSource = (BOOTCFG_NAND != 0) == (BOOTCFG_FIRM != 0) ? FIRMWARE_SYSNAND : (FirmwareSource)BOOTCFG_FIRM; @@ -236,9 +235,9 @@ void main(int argc, char **argv, u32 magicWord) goto boot; } - /* Force the last used boot options if doing TWL->CTR, or unless a button is pressed + /* Force the last used boot options if doing autolaunch from TWL, or unless a button is pressed or the no-forcing flag is set */ - if(twlIntoCtr || !(pressed || BOOTCFG_NOFORCEFLAG)) + if(validTlnc || !(pressed || BOOTCFG_NOFORCEFLAG)) { nandType = (FirmwareSource)BOOTCFG_NAND; firmSource = (FirmwareSource)BOOTCFG_FIRM; @@ -310,16 +309,9 @@ void main(int argc, char **argv, u32 magicWord) goto boot; } - // Set-up autoboot, and if we're booting into TWL mode, always use SysNAND + // Set-up autoboot if (MULTICONFIG(AUTOBOOTMODE) != 0) - { - bool ok = configureHomebrewAutoboot(); - if (ok && MULTICONFIG(AUTOBOOTMODE) == 2) - { - nandType = FIRMWARE_SYSNAND; - firmSource = FIRMWARE_SYSNAND; - } - } + configureHomebrewAutoboot(); //If booting from CTRNAND, always use SysNAND if(!isSdMode) nandType = FIRMWARE_SYSNAND;