mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-08 13:11:54 +00:00
Hopefully fix partitioning issues & clean up menu control code
This commit is contained in:
parent
14a3a39c01
commit
b484dc11d8
2 changed files with 33 additions and 12 deletions
|
@ -6114,9 +6114,6 @@ FRESULT f_fdisk (
|
|||
DWORD sz_disk, p_sect, b_cyl, b_sect;
|
||||
FRESULT res;
|
||||
|
||||
BYTE *empty_buff;
|
||||
empty_buff = ff_memcalloc(sizeof(BYTE), 16384);
|
||||
|
||||
stat = disk_initialize(pdrv);
|
||||
if (stat & STA_NOINIT) return FR_NOT_READY;
|
||||
if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
|
||||
|
@ -6169,14 +6166,14 @@ FRESULT f_fdisk (
|
|||
st_dword(p + 8, b_sect); /* Start sector in LBA */
|
||||
st_dword(p + 12, p_sect); /* Number of sectors */
|
||||
/* Next partition */
|
||||
b_sect += p_sect;
|
||||
|
||||
for (int cursect = 0; cursect < 1024; cursect++){
|
||||
disk_write(pdrv, empty_buff, b_sect + (32 * cursect), 32);
|
||||
for (u32 cursect = 0; cursect < 512; cursect++){
|
||||
disk_write(pdrv, buf + 0x4000, b_sect + (64 * cursect), 64);
|
||||
}
|
||||
|
||||
b_sect += p_sect;
|
||||
}
|
||||
st_word(p, 0xAA55); /* MBR signature (always at offset 510) */
|
||||
ff_memfree(empty_buff);
|
||||
|
||||
/* Write it to the MBR */
|
||||
res = (disk_write(pdrv, buf, 0, 1) == RES_OK && disk_ioctl(pdrv, CTRL_SYNC, 0) == RES_OK) ? FR_OK : FR_DISK_ERR;
|
||||
|
|
|
@ -167,8 +167,8 @@ int menu_make(menu_entry *entries, int amount, const char *toptext){
|
|||
|
||||
while (hidRead()->buttons & (KEY_B | KEY_A));
|
||||
|
||||
input->buttons = 0;
|
||||
while (!(input->buttons & (KEY_A | KEY_LDOWN | KEY_LUP | KEY_B | KEY_RUP | KEY_RDOWN))){
|
||||
scrolltimer = get_tmr_ms();
|
||||
while (1){
|
||||
if (sd_inited && !!gpio_read(GPIO_PORT_Z, GPIO_PIN_1)){
|
||||
gfx_errDisplay("menu", ERR_SD_EJECTED, 0);
|
||||
sd_unmount();
|
||||
|
@ -177,9 +177,29 @@ int menu_make(menu_entry *entries, int amount, const char *toptext){
|
|||
|
||||
input = hidRead();
|
||||
|
||||
if (!(input->buttons & (KEY_A | KEY_LDOWN | KEY_LUP | KEY_B | KEY_RUP | KEY_RDOWN)))
|
||||
if (!(input->buttons & (KEY_A | KEY_LDOWN | KEY_LUP | KEY_B | KEY_RUP | KEY_RDOWN))){
|
||||
delay = 300;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (input->buttons & (KEY_RDOWN | KEY_RUP)){
|
||||
delay = 1;
|
||||
input->Lup = input->Rup;
|
||||
input->Ldown = input->Rdown;
|
||||
}
|
||||
|
||||
|
||||
if (delay < 300){
|
||||
if (scrolltimer + delay < get_tmr_ms()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
if (delay < 300){
|
||||
scrolltimer = get_tmr_ms();
|
||||
while (input->buttons & (KEY_A | KEY_LDOWN | KEY_LUP | KEY_B | KEY_RUP | KEY_RDOWN)){
|
||||
|
@ -195,15 +215,19 @@ int menu_make(menu_entry *entries, int amount, const char *toptext){
|
|||
|
||||
if (input->buttons & (KEY_RUP | KEY_RDOWN))
|
||||
delay = 1;
|
||||
*/
|
||||
}
|
||||
|
||||
if (input->buttons & (KEY_LUP | KEY_RUP) && currentpos >= 1){
|
||||
if (delay > 46)
|
||||
delay -= 45;
|
||||
|
||||
if (input->Lup && currentpos >= 1){
|
||||
currentpos--;
|
||||
while(entries[currentpos].property & (ISSKIP | ISHIDE) && currentpos >= 1)
|
||||
currentpos--;
|
||||
}
|
||||
|
||||
else if (input->buttons & (KEY_LDOWN | KEY_RDOWN) && currentpos < amount - 1){
|
||||
else if (input->Ldown && currentpos < amount - 1){
|
||||
currentpos++;
|
||||
while(entries[currentpos].property & (ISSKIP | ISHIDE) && currentpos < amount - 1)
|
||||
currentpos++;
|
||||
|
|
Loading…
Reference in a new issue