@@ -698,13 +698,53 @@ void opt_update()
698
698
699
699
void opt_set_luma_autoboot ()
700
700
{
701
- std::string currentString = " " ;
701
+ // Commented code is disabled due to saving Luma's .ini file clearing comments, causing the settings to reset
702
+ /* std::string currentString = "";
702
703
703
704
CIniFile lumaConfig("sd:/luma/config.ini");
704
705
currentString = lumaConfig.GetString("boot", "autoboot_mode", "0"); // Work around a bug
705
706
lumaConfig.SetString("boot", "autoboot_mode", "2");
706
707
lumaConfig.SetString("autoboot", "autoboot_dsi_titleid", "0003000453524c41");
707
- lumaConfig.SaveIniFile (" sd:/luma/config.ini" );
708
+ lumaConfig.SaveIniFile("sd:/luma/config.ini"); */
709
+
710
+ FILE* file = fopen (" sd:/luma/config.ini" , " r+" );
711
+
712
+ u8 * lumaConfig = new u8 [0x2000 ];
713
+ fread (lumaConfig, 1 , 0x2000 , file);
714
+
715
+ int pos = 0 ;
716
+ while (1 ) {
717
+ if (memcmp (lumaConfig+pos, " autoboot_mode = " , 16 ) == 0 ) {
718
+ const char *dsiString = " dsi" ;
719
+ tonccpy (lumaConfig+pos+16 , dsiString, 3 );
720
+ fseek (file, pos+16 , SEEK_SET);
721
+ fwrite (lumaConfig+pos+16 , 1 , 3 , file);
722
+ break ;
723
+ }
724
+ pos++;
725
+ if (pos == 0x2000 ) {
726
+ delete[] lumaConfig;
727
+ return ;
728
+ }
729
+ }
730
+
731
+ while (1 ) {
732
+ if (memcmp (lumaConfig+pos, " autoboot_dsi_titleid = " , 23 ) == 0 ) {
733
+ const char *tidString = " 0003000453524c41" ;
734
+ tonccpy (lumaConfig+pos+23 , tidString, 16 );
735
+ fseek (file, pos+23 , SEEK_SET);
736
+ fwrite (lumaConfig+pos+23 , 1 , 16 , file);
737
+ break ;
738
+ }
739
+ pos++;
740
+ if (pos == 0x2000 ) {
741
+ delete[] lumaConfig;
742
+ return ;
743
+ }
744
+ }
745
+
746
+ delete[] lumaConfig;
747
+ fclose (file);
708
748
709
749
clearText (false );
710
750
if (ms ().rtl ()) {
@@ -952,9 +992,9 @@ int settingsMode(void)
952
992
wasBacklightOff = sys ().isRegularDS () && (REG_POWERCNT & 0xC ) == 0 ;
953
993
954
994
bool widescreenFound = false ;
955
- // bool lumaFound = false;
995
+ bool lumaFound = false ;
956
996
if (sdFound () && ms ().consoleModel >= 2 && (!isDSiMode () || !sys ().arm7SCFGLocked ())) {
957
- // lumaFound = (access("sd:/luma/config.ini", F_OK) == 0);
997
+ lumaFound = (access (" sd:/luma/config.ini" , F_OK) == 0 );
958
998
959
999
CIniFile lumaConfig (" sd:/luma/config.ini" );
960
1000
widescreenFound = ((access (" sd:/_nds/TWiLightMenu/TwlBg/Widescreen.cxi" , F_OK) == 0 ) && (lumaConfig.GetInt (" boot" , " enable_external_firm_and_modules" , 0 ) == true ));
@@ -1538,11 +1578,10 @@ int settingsMode(void)
1538
1578
.option (STR_SYSTEMSETTINGS, STR_DESCRIPTION_SYSTEMSETTINGS_1, Option::Nul (opt_reboot_system_menu), {}, {});
1539
1579
}
1540
1580
1541
- // Disabled due to saving Luma's .ini file clearing comments, causing the settings to reset
1542
- /* if (lumaFound) {
1581
+ if (lumaFound) {
1543
1582
miscPage
1544
1583
.option (STR_SET_LUMA_AUTOBOOT, STR_DESCRIPTION_SET_LUMA_AUTOBOOT, Option::Nul (opt_set_luma_autoboot), {}, {});
1545
- } */
1584
+ }
1546
1585
1547
1586
/* SettingsPage twlfirmPage(STR_TWLFIRM_SETTINGS);
1548
1587
if (isDSiMode() && ms().consoleModel >= 2) {
0 commit comments