Skip to content

Commit

Permalink
save/load fix
Browse files Browse the repository at this point in the history
gamepad 1 default controller
  • Loading branch information
xrip committed Dec 24, 2023
1 parent 060d865 commit 2f3dc3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions infones/InfoNES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@ char* replaceSpecialCharacters(const char* str) {
void save_state(const char * rom_filename)
{
char pathname[255];
sprintf(pathname, "%s.save", replaceSpecialCharacters(rom_filename));
sprintf(pathname, "%s\\%s.save", "NES", replaceSpecialCharacters(rom_filename));
FRESULT fr = f_mount(&fs, "", 1);
FIL fd;
fr = f_open(&fd, pathname, FA_CREATE_ALWAYS | FA_WRITE);
Expand Down Expand Up @@ -1831,7 +1831,7 @@ void save_state(const char * rom_filename)
void load_state(const char * rom_filename)
{
char pathname[255];
sprintf(pathname, "NES\\%s.save", replaceSpecialCharacters(rom_filename));
sprintf(pathname, "%s\\%s.save", "NES", replaceSpecialCharacters(rom_filename));
FRESULT fr = f_mount(&fs, "", 1);
FIL fd;
fr = f_open(&fd, pathname, FA_READ);
Expand Down
10 changes: 5 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ typedef struct __attribute__((__packed__)) {
} SETTINGS;

SETTINGS settings = {
.version = 1,
.version = 2,
.show_fps = false,
.flash_line = true,
.flash_frame = true,
.palette = RGB333,
.snd_vol = 8,
.player_1_input = KEYBOARD,
.player_2_input = GAMEPAD1,
.player_1_input = GAMEPAD1,
.player_2_input = KEYBOARD,
.nes_palette = 0,
};

Expand Down Expand Up @@ -979,7 +979,7 @@ int InfoNES_Menu() {

void load_config() {
char pathname[256];
sprintf(pathname, "%s\\emulator.cfg", HOME_DIR);
sprintf(pathname, "%s\\emulator.cfg", "NES");
FRESULT fr = f_mount(&fs, "", 1);
FIL fd;
fr = f_open(&fd, pathname, FA_READ);
Expand All @@ -993,7 +993,7 @@ void load_config() {

void save_config() {
char pathname[256];
sprintf(pathname, "%s\\emulator.cfg", HOME_DIR);
sprintf(pathname, "%s\\emulator.cfg", "NES");
FRESULT fr = f_mount(&fs, "", 1);
if (FR_OK != fr) {
FIL fd;
Expand Down

0 comments on commit 2f3dc3a

Please sign in to comment.