Skip to content

Commit

Permalink
Make user interface much more responsive
Browse files Browse the repository at this point in the history
things werent being cleared correctly or displayed correctly. Mempack menu is still laggy but it pops up first try
  • Loading branch information
ariahiro64 authored May 7, 2021
1 parent 7f472a3 commit aa1af6a
Showing 1 changed file with 111 additions and 18 deletions.
129 changes: 111 additions & 18 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
#include "menu.h"
#include "cic.h"

#define ED64PLUS
#define USE_TRUETYPE

#ifdef ED64PLUS
#define ED64_FIRMWARE_PATH "ED64P"
#else
Expand Down Expand Up @@ -1135,7 +1138,6 @@ void loadgbrom(display_context_t disp, TCHAR *rom_path)
}
}
}

void loadmsx2rom(display_context_t disp, TCHAR *rom_path)
{

Expand Down Expand Up @@ -1319,7 +1321,7 @@ void loadnesrom(display_context_t disp, TCHAR *rom_path)
f_close(&romfile);

boot_cic = CIC_6102;
boot_save = 2; //For new neon64
boot_save = 2; //SRAM
force_tv = 0; //no force
cheats_on = 0; //cheats off
checksum_fix_on = 0;
Expand Down Expand Up @@ -2340,7 +2342,11 @@ void drawTextInput(display_context_t disp, char *msg)
}

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);
display_show(disp);

Expand All @@ -2361,8 +2367,14 @@ void drawConfirmBox(display_context_t disp)
}

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)

drawBoxNumber(disp, 7);
else if (mode == 1)
drawBoxNumber(disp, 8);
Expand Down Expand Up @@ -2787,7 +2799,7 @@ void drawRomConfigBox(display_context_t disp, int line)
rom_config[0]--;
}
}

drawBoxNumber(disp, 6);

drawConfigSelection(disp, rom_config[0]);
Expand Down Expand Up @@ -3025,6 +3037,11 @@ void drawSet4(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);
display_show(disp);

Expand Down Expand Up @@ -3266,7 +3283,7 @@ void handleInput(display_context_t disp, sprite_t *contr)
break;
}
}

if (keys.c[0].down || keys_held.c[0].down || keys_held.c[0].y < -25)
{
switch (input_mapping)
Expand Down Expand Up @@ -3522,7 +3539,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
printText(" ", 9, -1, disp);
printText("search...", 9, -1, disp);
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);
sleep(1000);

Expand Down Expand Up @@ -3556,6 +3577,12 @@ void handleInput(display_context_t disp, sprite_t *contr)

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);

display_show(disp);
Expand Down Expand Up @@ -3606,9 +3633,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu:

//c-up or A
drawConfirmBox(disp);
//confirm format mpk
input_mapping = mpk_format;
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);
drawConfirmBox(disp);
//confirm format mpk
input_mapping = mpk_format;
break;

case char_input:
Expand Down Expand Up @@ -3641,21 +3673,26 @@ void handleInput(display_context_t disp, sprite_t *contr)
switch (input_mapping)
{
case file_manager:

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);

display_show(disp);
char *part;

part = malloc(slen(list[cursor].filename));
sprintf(part, "%s", list[cursor].filename);
part[31] = '\0';

printText(part, 4, 14, disp);

if (slen(list[cursor].filename) > 31)
{
{
sprintf(part, "%s", list[cursor].filename + 31);
part[31] = '\0';
printText(part, 4, -1, disp);
Expand Down Expand Up @@ -3694,6 +3731,11 @@ void handleInput(display_context_t disp, sprite_t *contr)

case mpk_format:
// 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);
display_show(disp);

Expand All @@ -3717,6 +3759,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
}
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);
input_mapping = abort_screen;
}
Expand All @@ -3734,14 +3781,23 @@ void handleInput(display_context_t disp, sprite_t *contr)

case mpk_restore:
//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);
display_show(disp);

printText("Mempak-Restore:", 9, 9, disp);
printText(" ", 9, -1, disp);

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);
sleep(1000);

Expand All @@ -3752,6 +3808,11 @@ void handleInput(display_context_t disp, sprite_t *contr)

case mpk_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);
display_show(disp);

Expand All @@ -3760,7 +3821,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
printText("search...", 9, -1, disp);

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);
sleep(1000);
input_mapping = abort_screen;
Expand Down Expand Up @@ -3812,6 +3877,12 @@ void handleInput(display_context_t disp, sprite_t *contr)

//preload config or file header
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);
display_show(disp);
Expand Down Expand Up @@ -3919,7 +3990,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
if (!strcmp(extension, "Z64") || !strcmp(extension, "V64") || !strcmp(extension, "N64"))
{ //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
display_show(disp);

u16 msg = 0;
evd_ulockRegs();
Expand Down Expand Up @@ -3981,6 +4059,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu:
if (sound_on)
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);
display_show(disp);
Expand Down Expand Up @@ -4047,9 +4130,14 @@ void handleInput(display_context_t disp, sprite_t *contr)
case mempak_menu:
{
//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_text[0] = '\0';
graphics_draw_sprite(disp, 0, 0, contr);
display_show(disp);
break;
}
case char_input:
Expand Down Expand Up @@ -4112,7 +4200,11 @@ void handleInput(display_context_t disp, sprite_t *contr)
);

f_close(&file);


while (!(disp = display_lock()))
;
drawRomConfigBox(disp, 0);
display_show(disp);
drawShortInfoBox(disp, " done", 0);
toplist_reload = 1;
}
Expand Down Expand Up @@ -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));
new_scroll_pos(&cursor, &page, MAX_LIST, count);
clearScreen(disp);
display_show(disp);

Expand Down

0 comments on commit aa1af6a

Please sign in to comment.