Fix fail
This commit is contained in:
parent
40369d44df
commit
4d9cbc4e19
13
source/pin.c
13
source/pin.c
@ -69,7 +69,7 @@ void newPin(void)
|
|||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
int charDrawPos = 20 * SPACING_X;
|
int charDrawPos = 20 * SPACING_X;
|
||||||
|
|
||||||
while(true)
|
while(cnt < PIN_LENGTH)
|
||||||
{
|
{
|
||||||
u32 pressed;
|
u32 pressed;
|
||||||
do
|
do
|
||||||
@ -87,10 +87,8 @@ void newPin(void)
|
|||||||
// visualize character on screen.
|
// visualize character on screen.
|
||||||
drawCharacter(key, 10 + charDrawPos, 10, COLOR_WHITE);
|
drawCharacter(key, 10 + charDrawPos, 10, COLOR_WHITE);
|
||||||
charDrawPos += 2 * SPACING_X;
|
charDrawPos += 2 * SPACING_X;
|
||||||
|
}
|
||||||
|
|
||||||
// we leave the rest of the array zeroed out.
|
|
||||||
if(cnt >= PIN_LENGTH)
|
|
||||||
{
|
|
||||||
PINData pin = {0};
|
PINData pin = {0};
|
||||||
u8 __attribute__((aligned(4))) tmp[32] = {0};
|
u8 __attribute__((aligned(4))) tmp[32] = {0};
|
||||||
u8 __attribute__((aligned(4))) zeroes[16] = {0};
|
u8 __attribute__((aligned(4))) zeroes[16] = {0};
|
||||||
@ -106,8 +104,6 @@ void newPin(void)
|
|||||||
memcpy(pin.hash, tmp, 32);
|
memcpy(pin.hash, tmp, 32);
|
||||||
|
|
||||||
fileWrite(&pin, "/luma/pin.bin", sizeof(PINData));
|
fileWrite(&pin, "/luma/pin.bin", sizeof(PINData));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while(HID_PAD & PIN_BUTTONS);
|
while(HID_PAD & PIN_BUTTONS);
|
||||||
}
|
}
|
||||||
@ -123,10 +119,10 @@ void verifyPin(PINData *in, bool allowQuit)
|
|||||||
u8 __attribute__((aligned(4))) enteredPassword[16 * ((PIN_LENGTH + 15) / 16)] = {0};
|
u8 __attribute__((aligned(4))) enteredPassword[16 * ((PIN_LENGTH + 15) / 16)] = {0};
|
||||||
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
bool unlock;
|
bool unlock = false;
|
||||||
int charDrawPos = 5 * SPACING_X;
|
int charDrawPos = 5 * SPACING_X;
|
||||||
|
|
||||||
while(true)
|
while(!unlock)
|
||||||
{
|
{
|
||||||
u32 pressed;
|
u32 pressed;
|
||||||
do
|
do
|
||||||
@ -166,7 +162,6 @@ void verifyPin(PINData *in, bool allowQuit)
|
|||||||
drawString("Pin: ", 10, 10 + 2 * SPACING_Y, COLOR_WHITE);
|
drawString("Pin: ", 10, 10 + 2 * SPACING_Y, COLOR_WHITE);
|
||||||
drawString("Wrong pin! Try again!", 10, 10 + 3 * SPACING_Y, COLOR_RED);
|
drawString("Wrong pin! Try again!", 10, 10 + 3 * SPACING_Y, COLOR_RED);
|
||||||
}
|
}
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user