2016-04-05 05:27:28 +02:00
|
|
|
/*
|
2016-07-05 16:05:53 +02:00
|
|
|
* This file is part of Luma3DS
|
|
|
|
* Copyright (C) 2016 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
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Additional Terms 7.b of GPLv3 applies to this file: Requiring preservation of specified
|
|
|
|
* reasonable legal notices or author attributions in that material or in the Appropriate Legal
|
|
|
|
* Notices displayed by works containing it.
|
2016-04-05 05:27:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2016-08-27 16:00:15 +02:00
|
|
|
#include "memory.h"
|
|
|
|
#include "fs.h"
|
2016-04-05 05:27:28 +02:00
|
|
|
#include "utils.h"
|
2016-06-10 21:48:22 +02:00
|
|
|
#include "screen.h"
|
2016-04-05 05:27:28 +02:00
|
|
|
#include "draw.h"
|
|
|
|
#include "buttons.h"
|
2016-08-28 15:50:11 +02:00
|
|
|
#include "pin.h"
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-09-02 14:14:19 +02:00
|
|
|
bool readConfig(void)
|
2016-08-27 16:00:15 +02:00
|
|
|
{
|
2016-09-13 14:54:14 +02:00
|
|
|
if(fileRead(&configData, CONFIG_PATH, sizeof(CfgData)) != sizeof(CfgData) ||
|
2016-08-27 16:00:15 +02:00
|
|
|
memcmp(configData.magic, "CONF", 4) != 0 ||
|
|
|
|
configData.formatVersionMajor != CONFIG_VERSIONMAJOR ||
|
|
|
|
configData.formatVersionMinor != CONFIG_VERSIONMINOR)
|
|
|
|
{
|
|
|
|
configData.config = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-02 14:14:19 +02:00
|
|
|
void writeConfig(ConfigurationStatus needConfig, u32 configTemp)
|
2016-08-27 16:00:15 +02:00
|
|
|
{
|
|
|
|
/* If the configuration is different from previously, overwrite it.
|
|
|
|
Just the no-forcing flag being set is not enough */
|
2016-09-13 23:01:38 +02:00
|
|
|
if(needConfig == CREATE_CONFIGURATION || (configTemp & 0xFFFFFF7F) != configData.config)
|
2016-08-27 16:00:15 +02:00
|
|
|
{
|
2016-08-31 16:11:44 +02:00
|
|
|
if(needConfig == CREATE_CONFIGURATION)
|
|
|
|
{
|
|
|
|
memcpy(configData.magic, "CONF", 4);
|
|
|
|
configData.formatVersionMajor = CONFIG_VERSIONMAJOR;
|
|
|
|
configData.formatVersionMinor = CONFIG_VERSIONMINOR;
|
|
|
|
}
|
|
|
|
|
2016-08-27 16:00:15 +02:00
|
|
|
//Merge the new options and new boot configuration
|
2016-09-13 23:01:38 +02:00
|
|
|
configData.config = (configData.config & 0xFFFFFE00) | (configTemp & 0x1FF);
|
2016-08-27 16:00:15 +02:00
|
|
|
|
2016-09-08 02:12:29 +02:00
|
|
|
if(!fileWrite(&configData, CONFIG_PATH, sizeof(CfgData)))
|
2016-08-30 16:56:19 +02:00
|
|
|
error("Error writing the configuration file");
|
2016-08-27 16:00:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-28 15:50:11 +02:00
|
|
|
void configMenu(bool oldPinStatus)
|
2016-04-05 05:27:28 +02:00
|
|
|
{
|
2016-09-08 00:49:55 +02:00
|
|
|
const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )",
|
|
|
|
"Screen brightness: 4( ) 3( ) 2( ) 1( )",
|
2016-09-04 13:40:46 +02:00
|
|
|
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
|
2016-09-08 18:47:13 +02:00
|
|
|
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )"
|
|
|
|
#ifdef DEV
|
2016-09-13 23:01:38 +02:00
|
|
|
, "Dev. features: ErrDisp( ) UNITINFO( ) Off( )"
|
2016-09-08 18:47:13 +02:00
|
|
|
#endif
|
|
|
|
};
|
2016-04-12 23:18:07 +02:00
|
|
|
|
|
|
|
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
|
2016-07-18 19:10:41 +02:00
|
|
|
"( ) Use SysNAND FIRM if booting with R (A9LH)",
|
2016-07-01 20:36:43 +02:00
|
|
|
"( ) Enable region/language emu. and ext. .code",
|
2016-09-13 23:01:38 +02:00
|
|
|
"( ) Show NAND or user string in System Settings",
|
2016-04-12 23:18:07 +02:00
|
|
|
"( ) Show GBA boot screen in patched AGB_FIRM",
|
2016-09-08 18:47:13 +02:00
|
|
|
"( ) Display splash screen before payloads"
|
|
|
|
#ifdef DEV
|
|
|
|
, "( ) Patch SVC/service/archive/ARM9 access"
|
|
|
|
#endif
|
|
|
|
};
|
2016-04-12 23:18:07 +02:00
|
|
|
|
2016-09-13 23:01:38 +02:00
|
|
|
const char *optionsDescription[] = { "Select the default EmuNAND.\n"
|
|
|
|
"It will booted with no directional pad\n"
|
|
|
|
"buttons pressed",
|
|
|
|
|
|
|
|
"Select the screen brightness",
|
|
|
|
|
|
|
|
"Activate a PIN lock.\n"
|
|
|
|
"The PIN will be asked each time\n"
|
|
|
|
"Luma3DS boots.\n"
|
|
|
|
"4, 6 or 8 digits can be selected.\n"
|
|
|
|
"The ABXY buttons and the directional\n"
|
2016-09-15 03:39:03 +02:00
|
|
|
"pad buttons can be used as keys",
|
2016-09-13 23:01:38 +02:00
|
|
|
|
|
|
|
"Select the New 3DS CPU mode.\n"
|
|
|
|
"It will be always enabled.\n"
|
|
|
|
"'Clock+L2' can cause issues with some\n"
|
|
|
|
"games",
|
|
|
|
#ifdef DEV
|
|
|
|
"Select the developer features.\n"
|
|
|
|
"'ErrDisp' displays debug information\n"
|
|
|
|
"on the 'An error has occurred' screen.\n"
|
|
|
|
"'UNITINFO' makes the console be always\n"
|
|
|
|
"detected as a development unit (which\n"
|
|
|
|
"breaks online features and allows\n"
|
|
|
|
"booting some developer software).\n"
|
2016-09-13 23:41:45 +02:00
|
|
|
"'Off' disables exception handlers\n"
|
2016-09-13 23:01:38 +02:00
|
|
|
"in FIRM",
|
|
|
|
#endif
|
|
|
|
"If enabled SysNAND will be launched on\n"
|
|
|
|
"boot. Otherwise, an EmuNAND will.\n"
|
|
|
|
"Hold L on boot to switch NAND.\n"
|
|
|
|
"To use a different EmuNAND from the\n"
|
|
|
|
"default, hold a directional pad button\n"
|
|
|
|
"(Up/Right/Down/Left equal EmuNANDs\n"
|
|
|
|
"1/2/3/4)",
|
|
|
|
|
|
|
|
"If enabled, when holding R on boot\n"
|
|
|
|
"EmuNAND will be booted with the\n"
|
|
|
|
"SysNAND FIRM. Otherwise, SysNAND will\n"
|
|
|
|
"be booted with an EmuNAND FIRM.\n"
|
|
|
|
"To use a different EmuNAND from the\n"
|
|
|
|
"default, hold a directional pad button\n"
|
|
|
|
"(Up/Right/Down/Left equal EmuNANDs\n"
|
|
|
|
"1/2/3/4)",
|
|
|
|
|
|
|
|
"Enable overriding the region and\n"
|
|
|
|
"language configuration and the usage\n"
|
|
|
|
"of patched code binaries for specific\n"
|
|
|
|
"games.\n"
|
|
|
|
"Also makes certain DLCs for\n"
|
|
|
|
"out-of-region games work.\n"
|
|
|
|
"Refer to the wiki for instructions",
|
|
|
|
|
2016-09-14 22:31:25 +02:00
|
|
|
"Show the currently booted NAND\n"
|
|
|
|
"(Sys = SysNAND, Emu = EmuNAND 1,\n"
|
|
|
|
"EmuX = EmuNAND X,\n"
|
2016-09-13 23:01:38 +02:00
|
|
|
"SysE = SysNAND with EmuNAND 1 FIRM,\n"
|
|
|
|
"SyEX = SysNAND with EmuNAND X FIRM,\n"
|
|
|
|
"EmXS = EmuNAND X with SysNAND FIRM)\n"
|
2016-09-14 22:31:25 +02:00
|
|
|
"or an user-defined custom string in\n"
|
|
|
|
"System Settings.\n"
|
|
|
|
"Refer to the wiki for instructions",
|
2016-09-13 23:01:38 +02:00
|
|
|
|
2016-09-15 03:39:03 +02:00
|
|
|
"Show the GBA boot screen when booting\n"
|
|
|
|
"GBA games",
|
2016-09-13 23:01:38 +02:00
|
|
|
|
|
|
|
"If enabled, the splash screen will be\n"
|
2016-09-15 03:39:03 +02:00
|
|
|
"displayed before booting payloads,\n"
|
2016-09-13 23:01:38 +02:00
|
|
|
"otherwise it will be displayed\n"
|
|
|
|
"afterwards.\n"
|
|
|
|
"Intended for splash screens that\n"
|
|
|
|
"display button hints"
|
|
|
|
#ifdef DEV
|
|
|
|
, "Disable SVC, service, archive and ARM9\n"
|
|
|
|
"exheader access checks"
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
struct multiOption {
|
2016-09-13 14:54:14 +02:00
|
|
|
u32 posXs[4];
|
|
|
|
u32 posY;
|
2016-04-05 05:27:28 +02:00
|
|
|
u32 enabled;
|
2016-04-12 23:18:07 +02:00
|
|
|
} multiOptions[] = {
|
2016-09-08 00:49:55 +02:00
|
|
|
{ .posXs = {19, 24, 29, 34} },
|
2016-08-15 21:37:25 +02:00
|
|
|
{ .posXs = {21, 26, 31, 36} },
|
2016-09-04 00:36:39 +02:00
|
|
|
{ .posXs = {14, 19, 24, 29} },
|
2016-09-08 18:47:13 +02:00
|
|
|
{ .posXs = {17, 26, 32, 44} }
|
|
|
|
#ifdef DEV
|
|
|
|
, { .posXs = {23, 35, 43, 0} }
|
|
|
|
#endif
|
2016-04-12 23:18:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//Calculate the amount of the various kinds of options and pre-select the first single one
|
|
|
|
u32 multiOptionsAmount = sizeof(multiOptions) / sizeof(struct multiOption),
|
|
|
|
singleOptionsAmount = sizeof(singleOptionsText) / sizeof(char *),
|
2016-04-13 15:19:35 +02:00
|
|
|
totalIndexes = multiOptionsAmount + singleOptionsAmount - 1,
|
2016-04-12 23:18:07 +02:00
|
|
|
selectedOption = multiOptionsAmount;
|
|
|
|
|
|
|
|
struct singleOption {
|
2016-09-13 14:54:14 +02:00
|
|
|
u32 posY;
|
2016-07-02 14:44:01 +02:00
|
|
|
bool enabled;
|
2016-04-12 23:18:07 +02:00
|
|
|
} singleOptions[singleOptionsAmount];
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
//Parse the existing options
|
|
|
|
for(u32 i = 0; i < multiOptionsAmount; i++)
|
|
|
|
multiOptions[i].enabled = MULTICONFIG(i);
|
|
|
|
for(u32 i = 0; i < singleOptionsAmount; i++)
|
|
|
|
singleOptions[i].enabled = CONFIG(i);
|
2016-04-05 23:01:46 +02:00
|
|
|
|
2016-09-12 18:58:10 +02:00
|
|
|
initScreens();
|
|
|
|
|
2016-09-13 16:22:26 +02:00
|
|
|
drawString(CONFIG_TITLE, true, 10, 10, COLOR_TITLE);
|
|
|
|
drawString("Press A to select, START to save", true, 10, 30, COLOR_WHITE);
|
2016-09-12 18:58:10 +02:00
|
|
|
|
2016-04-05 23:01:46 +02:00
|
|
|
//Character to display a selected option
|
|
|
|
char selected = 'x';
|
|
|
|
|
2016-09-13 14:54:14 +02:00
|
|
|
u32 endPos = 42;
|
2016-04-05 23:01:46 +02:00
|
|
|
|
2016-04-13 00:33:03 +02:00
|
|
|
//Display all the multiple choice options in white
|
2016-04-12 23:18:07 +02:00
|
|
|
for(u32 i = 0; i < multiOptionsAmount; i++)
|
2016-04-05 23:01:46 +02:00
|
|
|
{
|
2016-09-11 19:17:56 +02:00
|
|
|
if(!(i == NEWCPU && !isN3DS))
|
2016-09-11 18:42:59 +02:00
|
|
|
{
|
|
|
|
multiOptions[i].posY = endPos + SPACING_Y;
|
2016-09-13 16:22:26 +02:00
|
|
|
endPos = drawString(multiOptionsText[i], true, 10, multiOptions[i].posY, COLOR_WHITE);
|
|
|
|
drawCharacter(selected, true, 10 + multiOptions[i].posXs[multiOptions[i].enabled] * SPACING_X, multiOptions[i].posY, COLOR_WHITE);
|
2016-09-11 18:42:59 +02:00
|
|
|
}
|
2016-04-05 23:01:46 +02:00
|
|
|
}
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-04-13 15:19:35 +02:00
|
|
|
endPos += SPACING_Y / 2;
|
|
|
|
u32 color = COLOR_RED;
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-04-13 00:33:03 +02:00
|
|
|
//Display all the normal options in white except for the first one
|
2016-04-13 15:19:35 +02:00
|
|
|
for(u32 i = 0; i < singleOptionsAmount; i++)
|
2016-04-12 23:18:07 +02:00
|
|
|
{
|
|
|
|
singleOptions[i].posY = endPos + SPACING_Y;
|
2016-09-13 16:22:26 +02:00
|
|
|
endPos = drawString(singleOptionsText[i], true, 10, singleOptions[i].posY, color);
|
|
|
|
if(singleOptions[i].enabled) drawCharacter(selected, true, 10 + SPACING_X, singleOptions[i].posY, color);
|
2016-04-13 15:19:35 +02:00
|
|
|
color = COLOR_WHITE;
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-09-13 23:01:38 +02:00
|
|
|
drawString(optionsDescription[selectedOption], false, 10, 10, COLOR_WHITE);
|
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
u32 pressed = 0;
|
2016-04-05 23:01:46 +02:00
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
//Boring configuration menu
|
|
|
|
while(pressed != BUTTON_START)
|
|
|
|
{
|
2016-04-13 15:19:35 +02:00
|
|
|
do
|
|
|
|
{
|
2016-04-05 05:27:28 +02:00
|
|
|
pressed = waitInput();
|
|
|
|
}
|
|
|
|
while(!(pressed & MENU_BUTTONS));
|
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
if(pressed != BUTTON_A)
|
2016-04-05 05:27:28 +02:00
|
|
|
{
|
2016-04-13 15:19:35 +02:00
|
|
|
//Remember the previously selected option
|
|
|
|
u32 oldSelectedOption = selectedOption;
|
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
switch(pressed)
|
|
|
|
{
|
|
|
|
case BUTTON_UP:
|
2016-09-11 18:42:59 +02:00
|
|
|
if(!selectedOption) selectedOption = totalIndexes;
|
2016-09-11 19:17:56 +02:00
|
|
|
else selectedOption = (selectedOption == NEWCPU + 1 && !isN3DS) ? selectedOption - 2 : selectedOption - 1;
|
2016-04-12 23:18:07 +02:00
|
|
|
break;
|
|
|
|
case BUTTON_DOWN:
|
2016-09-11 18:42:59 +02:00
|
|
|
if(selectedOption == totalIndexes) selectedOption = 0;
|
2016-09-11 19:17:56 +02:00
|
|
|
else selectedOption = (selectedOption == NEWCPU - 1 && !isN3DS) ? selectedOption + 2 : selectedOption + 1;
|
2016-04-12 23:18:07 +02:00
|
|
|
break;
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
selectedOption = 0;
|
|
|
|
break;
|
|
|
|
case BUTTON_RIGHT:
|
2016-04-13 15:19:35 +02:00
|
|
|
selectedOption = totalIndexes;
|
2016-04-12 23:18:07 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-04-13 15:19:35 +02:00
|
|
|
if(selectedOption == oldSelectedOption) continue;
|
|
|
|
|
2016-04-13 01:08:13 +02:00
|
|
|
//The user moved to a different option, print the old option in white and the new one in red. Only print 'x's if necessary
|
2016-04-12 23:18:07 +02:00
|
|
|
if(oldSelectedOption < multiOptionsAmount)
|
|
|
|
{
|
2016-09-13 16:22:26 +02:00
|
|
|
drawString(multiOptionsText[oldSelectedOption], true, 10, multiOptions[oldSelectedOption].posY, COLOR_WHITE);
|
|
|
|
drawCharacter(selected, true, 10 + multiOptions[oldSelectedOption].posXs[multiOptions[oldSelectedOption].enabled] * SPACING_X, multiOptions[oldSelectedOption].posY, COLOR_WHITE);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
u32 singleOldSelected = oldSelectedOption - multiOptionsAmount;
|
2016-09-13 16:22:26 +02:00
|
|
|
drawString(singleOptionsText[singleOldSelected], true, 10, singleOptions[singleOldSelected].posY, COLOR_WHITE);
|
|
|
|
if(singleOptions[singleOldSelected].enabled) drawCharacter(selected, true, 10 + SPACING_X, singleOptions[singleOldSelected].posY, COLOR_WHITE);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-04-12 23:18:07 +02:00
|
|
|
if(selectedOption < multiOptionsAmount)
|
2016-09-13 16:22:26 +02:00
|
|
|
drawString(multiOptionsText[selectedOption], true, 10, multiOptions[selectedOption].posY, COLOR_RED);
|
2016-04-12 23:18:07 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
u32 singleSelected = selectedOption - multiOptionsAmount;
|
2016-09-13 16:22:26 +02:00
|
|
|
drawString(singleOptionsText[singleSelected], true, 10, singleOptions[singleSelected].posY, COLOR_RED);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
2016-09-13 23:01:38 +02:00
|
|
|
|
|
|
|
clearScreens(false, true);
|
|
|
|
drawString(optionsDescription[selectedOption], false, 10, 10, COLOR_WHITE);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-13 15:19:35 +02:00
|
|
|
//The selected option's status changed, print the 'x's accordingly
|
2016-04-12 23:18:07 +02:00
|
|
|
if(selectedOption < multiOptionsAmount)
|
|
|
|
{
|
|
|
|
u32 oldEnabled = multiOptions[selectedOption].enabled;
|
2016-09-13 16:22:26 +02:00
|
|
|
drawCharacter(selected, true, 10 + multiOptions[selectedOption].posXs[oldEnabled] * SPACING_X, multiOptions[selectedOption].posY, COLOR_BLACK);
|
2016-05-28 16:13:22 +02:00
|
|
|
multiOptions[selectedOption].enabled = (oldEnabled == 3 || !multiOptions[selectedOption].posXs[oldEnabled + 1]) ? 0 : oldEnabled + 1;
|
2016-07-01 20:27:28 +02:00
|
|
|
|
2016-09-11 19:17:56 +02:00
|
|
|
if(selectedOption == BRIGHTNESS) updateBrightness(multiOptions[BRIGHTNESS].enabled);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-07-02 14:44:01 +02:00
|
|
|
bool oldEnabled = singleOptions[selectedOption - multiOptionsAmount].enabled;
|
2016-04-12 23:18:07 +02:00
|
|
|
singleOptions[selectedOption - multiOptionsAmount].enabled = !oldEnabled;
|
2016-09-13 16:22:26 +02:00
|
|
|
if(oldEnabled) drawCharacter(selected, true, 10 + SPACING_X, singleOptions[selectedOption - multiOptionsAmount].posY, COLOR_BLACK);
|
2016-04-12 23:18:07 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-13 15:19:35 +02:00
|
|
|
|
|
|
|
//In any case, if the current option is enabled (or a multiple choice option is selected) we must display a red 'x'
|
|
|
|
if(selectedOption < multiOptionsAmount)
|
2016-09-13 16:22:26 +02:00
|
|
|
drawCharacter(selected, true, 10 + multiOptions[selectedOption].posXs[multiOptions[selectedOption].enabled] * SPACING_X, multiOptions[selectedOption].posY, COLOR_RED);
|
2016-04-13 15:19:35 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
u32 singleSelected = selectedOption - multiOptionsAmount;
|
2016-09-13 16:22:26 +02:00
|
|
|
if(singleOptions[singleSelected].enabled) drawCharacter(selected, true, 10 + SPACING_X, singleOptions[singleSelected].posY, COLOR_RED);
|
2016-04-13 15:19:35 +02:00
|
|
|
}
|
2016-04-05 05:27:28 +02:00
|
|
|
}
|
|
|
|
|
2016-09-11 19:17:56 +02:00
|
|
|
u32 oldPinLength = MULTICONFIG(PIN);
|
2016-09-04 00:36:39 +02:00
|
|
|
|
2016-09-13 23:01:38 +02:00
|
|
|
//Preserve the last-used boot options (first 9 bits)
|
|
|
|
configData.config &= 0x1FF;
|
2016-04-05 05:27:28 +02:00
|
|
|
|
|
|
|
//Parse and write the new configuration
|
2016-04-12 23:18:07 +02:00
|
|
|
for(u32 i = 0; i < multiOptionsAmount; i++)
|
2016-09-13 23:01:38 +02:00
|
|
|
configData.config |= multiOptions[i].enabled << (i * 2 + 9);
|
2016-04-12 23:18:07 +02:00
|
|
|
for(u32 i = 0; i < singleOptionsAmount; i++)
|
2016-09-08 00:49:55 +02:00
|
|
|
configData.config |= (singleOptions[i].enabled ? 1 : 0) << (i + 21);
|
2016-04-05 05:27:28 +02:00
|
|
|
|
2016-09-11 19:17:56 +02:00
|
|
|
if(MULTICONFIG(PIN) != 0) newPin(oldPinStatus && MULTICONFIG(PIN) == oldPinLength);
|
2016-09-03 23:07:51 +02:00
|
|
|
else if(oldPinStatus) fileDelete(PIN_PATH);
|
2016-08-28 15:50:11 +02:00
|
|
|
|
2016-05-09 03:41:00 +02:00
|
|
|
//Wait for the pressed buttons to change
|
2016-08-28 15:50:11 +02:00
|
|
|
while(HID_PAD & PIN_BUTTONS);
|
|
|
|
|
|
|
|
chrono(2);
|
2016-05-11 19:28:28 +02:00
|
|
|
}
|