Skip to content

Commit

Permalink
save and load games
Browse files Browse the repository at this point in the history
better menu
  • Loading branch information
xrip committed Oct 9, 2023
1 parent c53283e commit 1e0fbd2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ const MenuItem menu_items[MENU_ITEMS_NUMBER] = {

void save() {
char pathname[255];
sprintf(pathname, "GB\\%s.save", rom_filename);
char filename[16];

gb_get_rom_name(&gb, filename);
sprintf(pathname, "GB\\%s.save", filename);
FRESULT fr = f_mount(&fs, "", 1);
FIL fd;
fr = f_open(&fd, pathname, FA_CREATE_ALWAYS | FA_WRITE);
Expand All @@ -696,7 +699,10 @@ void save() {

void load() {
char pathname[255];
sprintf(pathname, "GB\\%s.save", rom_filename);
char filename[16];

gb_get_rom_name(&gb, filename);
sprintf(pathname, "GB\\%s.save", filename);
FRESULT fr = f_mount(&fs, "", 1);
FIL fd;
fr = f_open(&fd, pathname, FA_READ);
Expand Down

0 comments on commit 1e0fbd2

Please sign in to comment.