Make user interface much more responsive

things werent being cleared correctly or displayed correctly. Mempack menu is still laggy but it pops up first try
This commit is contained in:
AriaHiro64 2021-05-07 01:45:33 -04:00 committed by GitHub
parent 7f472a3266
commit aa1af6a8cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,9 @@
#include "menu.h" #include "menu.h"
#include "cic.h" #include "cic.h"
#define ED64PLUS
#define USE_TRUETYPE
#ifdef ED64PLUS #ifdef ED64PLUS
#define ED64_FIRMWARE_PATH "ED64P" #define ED64_FIRMWARE_PATH "ED64P"
#else #else
@ -1135,7 +1138,6 @@ void loadgbrom(display_context_t disp, TCHAR *rom_path)
} }
} }
} }
void loadmsx2rom(display_context_t disp, TCHAR *rom_path) void loadmsx2rom(display_context_t disp, TCHAR *rom_path)
{ {
@ -1319,7 +1321,7 @@ void loadnesrom(display_context_t disp, TCHAR *rom_path)
f_close(&romfile); f_close(&romfile);
boot_cic = CIC_6102; boot_cic = CIC_6102;
boot_save = 2; //For new neon64 boot_save = 2; //SRAM
force_tv = 0; //no force force_tv = 0; //no force
cheats_on = 0; //cheats off cheats_on = 0; //cheats off
checksum_fix_on = 0; checksum_fix_on = 0;
@ -2340,7 +2342,11 @@ void drawTextInput(display_context_t disp, char *msg)
} }
void drawConfirmBox(display_context_t disp) void drawConfirmBox(display_context_t disp)
{ { while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 5); drawBoxNumber(disp, 5);
display_show(disp); display_show(disp);
@ -2361,8 +2367,14 @@ void drawConfirmBox(display_context_t disp)
} }
void drawShortInfoBox(display_context_t disp, char *text, u8 mode) void drawShortInfoBox(display_context_t disp, char *text, u8 mode)
{ { while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
if (mode == 0) if (mode == 0)
drawBoxNumber(disp, 7); drawBoxNumber(disp, 7);
else if (mode == 1) else if (mode == 1)
drawBoxNumber(disp, 8); drawBoxNumber(disp, 8);
@ -3025,6 +3037,11 @@ void drawSet4(display_context_t disp)
void showAboutScreen(display_context_t disp) void showAboutScreen(display_context_t disp)
{ {
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
@ -3522,7 +3539,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
printText(" ", 9, -1, disp); printText(" ", 9, -1, disp);
printText("search...", 9, -1, disp); printText("search...", 9, -1, disp);
mpk_to_file(disp, input_text, 0); mpk_to_file(disp, input_text, 0);
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawShortInfoBox(disp, " done", 0); drawShortInfoBox(disp, " done", 0);
sleep(1000); sleep(1000);
@ -3556,6 +3577,12 @@ void handleInput(display_context_t disp, sprite_t *contr)
input_mapping = mempak_menu; input_mapping = mempak_menu;
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
@ -3606,9 +3633,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu: case mempak_menu:
//c-up or A //c-up or A
drawConfirmBox(disp); while (!(disp = display_lock()))
//confirm format mpk ;
input_mapping = mpk_format; new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawConfirmBox(disp);
//confirm format mpk
input_mapping = mpk_format;
break; break;
case char_input: case char_input:
@ -3644,8 +3676,13 @@ void handleInput(display_context_t disp, sprite_t *contr)
if (list[cursor].type != DT_DIR && empty == 0) if (list[cursor].type != DT_DIR && empty == 0)
{ {
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 11); drawBoxNumber(disp, 11);
display_show(disp);
char *part; char *part;
part = malloc(slen(list[cursor].filename)); part = malloc(slen(list[cursor].filename));
@ -3694,6 +3731,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mpk_format: case mpk_format:
// format mpk // format mpk
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
@ -3717,6 +3759,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
} }
else else
{ {
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawShortInfoBox(disp, " done", 0); drawShortInfoBox(disp, " done", 0);
input_mapping = abort_screen; input_mapping = abort_screen;
} }
@ -3734,6 +3781,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mpk_restore: case mpk_restore:
//restore mpk //restore mpk
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
@ -3741,7 +3793,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
printText(" ", 9, -1, disp); printText(" ", 9, -1, disp);
file_to_mpk(disp, rom_filename); file_to_mpk(disp, rom_filename);
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawShortInfoBox(disp, " done", 0); drawShortInfoBox(disp, " done", 0);
sleep(1000); sleep(1000);
@ -3752,6 +3808,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mpk_quick_backup: case mpk_quick_backup:
//quick-backup //quick-backup
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
@ -3760,7 +3821,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
printText("search...", 9, -1, disp); printText("search...", 9, -1, disp);
mpk_to_file(disp, list[cursor].filename, 1); //quick mpk_to_file(disp, list[cursor].filename, 1); //quick
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawShortInfoBox(disp, " done", 0); drawShortInfoBox(disp, " done", 0);
sleep(1000); sleep(1000);
input_mapping = abort_screen; input_mapping = abort_screen;
@ -3812,6 +3877,12 @@ void handleInput(display_context_t disp, sprite_t *contr)
//preload config or file header //preload config or file header
readRomConfig(disp, rom_filename, name_file); readRomConfig(disp, rom_filename, name_file);
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawRomConfigBox(disp, 0); drawRomConfigBox(disp, 0);
display_show(disp); display_show(disp);
@ -3919,7 +3990,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
if (!strcmp(extension, "Z64") || !strcmp(extension, "V64") || !strcmp(extension, "N64")) if (!strcmp(extension, "Z64") || !strcmp(extension, "V64") || !strcmp(extension, "N64"))
{ //rom { //rom
//load rom //load rom
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 3); //rominfo drawBoxNumber(disp, 3); //rominfo
display_show(disp);
u16 msg = 0; u16 msg = 0;
evd_ulockRegs(); evd_ulockRegs();
@ -3981,6 +4059,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu: case mempak_menu:
if (sound_on) if (sound_on)
playSound(2); playSound(2);
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
display_dir(list, cursor, page, MAX_LIST, count, disp);
drawBoxNumber(disp, 4); drawBoxNumber(disp, 4);
display_show(disp); display_show(disp);
@ -4047,9 +4130,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu: case mempak_menu:
{ {
//open up charinput screen //open up charinput screen
while (!(disp = display_lock()))
;
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); //part clear?
input_mapping = char_input; input_mapping = char_input;
input_text[0] = '\0'; input_text[0] = '\0';
graphics_draw_sprite(disp, 0, 0, contr); graphics_draw_sprite(disp, 0, 0, contr);
display_show(disp);
break; break;
} }
case char_input: case char_input:
@ -4113,6 +4201,10 @@ void handleInput(display_context_t disp, sprite_t *contr)
f_close(&file); f_close(&file);
while (!(disp = display_lock()))
;
drawRomConfigBox(disp, 0);
display_show(disp);
drawShortInfoBox(disp, " done", 0); drawShortInfoBox(disp, " done", 0);
toplist_reload = 1; toplist_reload = 1;
} }
@ -4233,6 +4325,7 @@ void handleInput(display_context_t disp, sprite_t *contr)
; ;
graphics_set_color(graphics_make_color(0xFF, 0xFF, 0xFF, 0xFF), graphics_make_color(0x00, 0x00, 0x00, 0x00)); graphics_set_color(graphics_make_color(0xFF, 0xFF, 0xFF, 0xFF), graphics_make_color(0x00, 0x00, 0x00, 0x00));
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp); clearScreen(disp);
display_show(disp); display_show(disp);