From 12a827958e00a97cc29dce410acb92b88405c588 Mon Sep 17 00:00:00 2001 From: ariahiro64 Date: Thu, 30 Sep 2021 17:48:49 -0400 Subject: [PATCH] slight cleanup --- src/main.c | 28 +++++++++++++++------------- src/memorypak.c | 12 ++++++------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main.c b/src/main.c index 653e2905..3661f0ff 100755 --- a/src/main.c +++ b/src/main.c @@ -1148,7 +1148,8 @@ void loadgbrom(display_context_t disp, TCHAR *rom_path) } } } -void loadmsx2rom(display_context_t disp, TCHAR *rom_path) + +void loadggrom(display_context_t disp, TCHAR *rom_path) //TODO: this could be merged with MSX { FRESULT romresult; @@ -1160,12 +1161,12 @@ void loadmsx2rom(display_context_t disp, TCHAR *rom_path) { int romfsize = f_size(&romfile); - //max 128KB rom - if (romfsize > 128 * 1024) + //max 512KB rom + if (romfsize > 512 * 1024) { //error - drawShortInfoBox(disp, " error: rom > 128KB", 1); + drawShortInfoBox(disp, " error: rom > 512KB", 1); input_mapping = abort_screen; return; @@ -1177,7 +1178,7 @@ void loadmsx2rom(display_context_t disp, TCHAR *rom_path) FRESULT result; FIL file; UINT bytesread; - result = f_open(&file, "/"ED64_FIRMWARE_PATH"/ultraMSX2.z64", FA_READ); + result = f_open(&file, "/"ED64_FIRMWARE_PATH"/UltraSMS.z64", FA_READ); if (result == FR_OK) { @@ -1198,7 +1199,7 @@ void loadmsx2rom(display_context_t disp, TCHAR *rom_path) romresult = f_read ( &romfile, /* [IN] File object */ - (void *)0xb0000000 + 0x2df48, /* [OUT] Buffer to store read data */ //TODO: why is the offset this particular number + (void *)0xb0000000 + 0x1b410, /* [OUT] Buffer to store read data */ //TODO: why is the offset this particular number romfsize, /* [IN] Number of bytes to read */ &rombytesread /* [OUT] Number of bytes read */ ); @@ -1218,8 +1219,7 @@ void loadmsx2rom(display_context_t disp, TCHAR *rom_path) } } } - -void loadggrom(display_context_t disp, TCHAR *rom_path) //TODO: this could be merged with MSX +void loadmsx2rom(display_context_t disp, TCHAR *rom_path) { FRESULT romresult; @@ -1231,8 +1231,8 @@ void loadggrom(display_context_t disp, TCHAR *rom_path) //TODO: this could be me { int romfsize = f_size(&romfile); - //max 512KB rom - if (romfsize > 512 * 1024) + //max 128KB rom + if (romfsize > 128 * 1024) { //error @@ -1248,7 +1248,7 @@ void loadggrom(display_context_t disp, TCHAR *rom_path) //TODO: this could be me FRESULT result; FIL file; UINT bytesread; - result = f_open(&file, "/"ED64_FIRMWARE_PATH"/UltraSMS.z64", FA_READ); + result = f_open(&file, "/"ED64_FIRMWARE_PATH"/ultraMSX2.z64", FA_READ); if (result == FR_OK) { @@ -1269,7 +1269,7 @@ void loadggrom(display_context_t disp, TCHAR *rom_path) //TODO: this could be me romresult = f_read ( &romfile, /* [IN] File object */ - (void *)0xb0000000 + 0x1b410, /* [OUT] Buffer to store read data */ //TODO: why is the offset this particular number + (void *)0xb0000000 + 0x2df48, /* [OUT] Buffer to store read data */ //TODO: why is the offset this particular number romfsize, /* [IN] Number of bytes to read */ &rombytesread /* [OUT] Number of bytes read */ ); @@ -4079,6 +4079,8 @@ void handleInput(display_context_t disp, sprite_t *contr) } else if (!strcmp(extension, "MPK")) { //mpk file + while (!(disp = display_lock())) + ; clearScreen(disp); drawBoxNumber(disp, 4); display_show(disp); @@ -4131,8 +4133,8 @@ void handleInput(display_context_t disp, sprite_t *contr) new_scroll_pos(&cursor, &page, MAX_LIST, count); clearScreen(disp); //part clear? display_dir(list, cursor, page, MAX_LIST, count, disp); - view_mpk(disp); drawBoxNumber(disp, 4); + view_mpk(disp); display_show(disp); if (sound_on) playSound(2); diff --git a/src/memorypak.c b/src/memorypak.c index 343bf92d..341f8c8f 100755 --- a/src/memorypak.c +++ b/src/memorypak.c @@ -187,8 +187,8 @@ void view_mpk_file(display_context_t disp, char *mpk_filename) 32768, /* [IN] Number of bytes to read */ &bytesread /* [OUT] Number of bytes read */ ); - - + + f_close(&file); printText("File contents:", 11, 5, disp); @@ -305,7 +305,7 @@ void view_mpk_file(display_context_t disp, char *mpk_filename) else { printText("empty", 11, -1, disp); - } + } } } @@ -420,7 +420,7 @@ void mpk_to_file(display_context_t disp, char *mpk_filename, int quick) if (result == FR_OK) { controller_init(); - + int err = 0; for (int j = 0; j < 128; j++) { @@ -438,9 +438,9 @@ void mpk_to_file(display_context_t disp, char *mpk_filename, int quick) f_close(&file); - + sprintf(buff, "File: %s%i.MPK", mpk_filename, v); - + printText(buff, 9, -1, disp); printText("backup done...", 9, -1, disp); }