Skip to content

Commit

Permalink
slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ariahiro64 committed Sep 30, 2021
1 parent fc740cf commit 12a8279
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
28 changes: 15 additions & 13 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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)
{
Expand All @@ -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 */
);
Expand All @@ -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;
Expand All @@ -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

Expand All @@ -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)
{
Expand All @@ -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 */
);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/memorypak.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -305,7 +305,7 @@ void view_mpk_file(display_context_t disp, char *mpk_filename)
else
{
printText("empty", 11, -1, disp);
}
}
}
}

Expand Down Expand Up @@ -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++)
{
Expand All @@ -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);
}
Expand Down

0 comments on commit 12a8279

Please sign in to comment.