From bd0cf31bf5295db7776bc26225b2cc5727899eb8 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 19 Apr 2009 14:12:54 +0000 Subject: [PATCH] Correct saving of games --- Src/C64_SDL.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Src/C64_SDL.h b/Src/C64_SDL.h index d86d474..fd2bbe1 100644 --- a/Src/C64_SDL.h +++ b/Src/C64_SDL.h @@ -121,8 +121,14 @@ void C64::select_disc(Prefs *np, bool start) } else { + const char *save_game = strrchr(name, '/'); + + if (!save_game) + save_game = name; + else + save_game = save_game + 1; /* Skip '/' */ strncpy(np->DrivePath[0], name, 255); - strncpy(this->save_game_name, name, 255); + strncpy(this->save_game_name, save_game, 255); if (strstr(name, ".prg") || strstr(name, ".PRG") || strstr(name, ".p00") || strstr(name, ".P00") || strstr(name, ".s00") || strstr(name, ".S00")) { @@ -410,7 +416,7 @@ void C64::save_load_state(Prefs *np, int opt) char save_buf[255]; char prefs_buf[255]; - snprintf(save_buf, 255, "%s.sav", + snprintf(save_buf, 255, "%s/%s.sav", SAVES_PATH, this->save_game_name); snprintf(prefs_buf, 255, "%s.prefs", save_buf);