Remove the need for hardcoding the horizontal positions for the "x"s in multiple choice options
This commit is contained in:
parent
bbadf840ef
commit
41f32ed983
@ -27,6 +27,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#include "strings.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
@ -201,12 +202,12 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
|
|||||||
u32 enabled;
|
u32 enabled;
|
||||||
bool visible;
|
bool visible;
|
||||||
} multiOptions[] = {
|
} multiOptions[] = {
|
||||||
{ .posXs = {19, 24, 29, 34}, .visible = isSdMode },
|
{ .visible = isSdMode },
|
||||||
{ .posXs = {21, 26, 31, 36}, .visible = true },
|
{ .visible = true },
|
||||||
{ .posXs = {12, 22, 31, 0}, .visible = true },
|
{ .visible = true },
|
||||||
{ .posXs = {19, 24, 29, 34}, .visible = true },
|
{ .visible = true },
|
||||||
{ .posXs = {14, 19, 24, 29}, .visible = true },
|
{ .visible = true },
|
||||||
{ .posXs = {17, 26, 32, 44}, .visible = ISN3DS },
|
{ .visible = ISN3DS },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct singleOption {
|
struct singleOption {
|
||||||
@ -234,7 +235,15 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
|
|||||||
|
|
||||||
//Parse the existing options
|
//Parse the existing options
|
||||||
for(u32 i = 0; i < multiOptionsAmount; i++)
|
for(u32 i = 0; i < multiOptionsAmount; i++)
|
||||||
|
{
|
||||||
|
//Detect the positions where the "x" should go
|
||||||
|
u32 optionNum = 0;
|
||||||
|
for(u32 j = 0; optionNum < 4 && j < strlen(multiOptionsText[i]); j++)
|
||||||
|
if(multiOptionsText[i][j] == '(') multiOptions[i].posXs[optionNum++] = j + 1;
|
||||||
|
while(optionNum < 4) multiOptions[i].posXs[optionNum++] = 0;
|
||||||
|
|
||||||
multiOptions[i].enabled = MULTICONFIG(i);
|
multiOptions[i].enabled = MULTICONFIG(i);
|
||||||
|
}
|
||||||
for(u32 i = 0; i < singleOptionsAmount; i++)
|
for(u32 i = 0; i < singleOptionsAmount; i++)
|
||||||
singleOptions[i].enabled = CONFIG(i);
|
singleOptions[i].enabled = CONFIG(i);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user