From 8dc7fdcec20a51b9f9458afe9040ad0456a073b9 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 25 Apr 2016 15:38:44 +0200 Subject: [PATCH 1/3] Enable SV4 files to be loaded from the native load/save dialog --- src/game.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 062389e52a..671667fc71 100644 --- a/src/game.c +++ b/src/game.c @@ -41,6 +41,7 @@ #include "peep/peep.h" #include "peep/staff.h" #include "platform/platform.h" +#include "rct1.h" #include "ride/ride.h" #include "ride/ride_ratings.h" #include "ride/vehicle.h" @@ -933,7 +934,19 @@ bool game_load_save(const utf8 *path) return false; } - bool result = game_load_sv6(rw); + char *extension = strrchr(path, '.'); + if (extension == NULL) { + return false; + } + extension++; + + bool result = false; + if (_stricmp(extension, "sv6") == 0) { + result = game_load_sv6(rw); + } else if (_stricmp(extension, "sv4") == 0) { + result = rct1_load_saved_game(path); + } + SDL_RWclose(rw); if (result) { From 7521a70ac858c41f8855b8d60018364530dd89c4 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 25 Apr 2016 19:11:51 +0200 Subject: [PATCH 2/3] Use get_file_extension_type() --- src/game.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/game.c b/src/game.c index 671667fc71..225dd372b1 100644 --- a/src/game.c +++ b/src/game.c @@ -934,16 +934,12 @@ bool game_load_save(const utf8 *path) return false; } - char *extension = strrchr(path, '.'); - if (extension == NULL) { - return false; - } - extension++; - + uint32 extension_type = get_file_extension_type(path); bool result = false; - if (_stricmp(extension, "sv6") == 0) { + + if (extension_type == FILE_EXTENSION_SV6) { result = game_load_sv6(rw); - } else if (_stricmp(extension, "sv4") == 0) { + } else if (extension_type == FILE_EXTENSION_SV4) { result = rct1_load_saved_game(path); } @@ -959,7 +955,7 @@ bool game_load_save(const utf8 *path) } return true; } else { - // If loading the SV6 failed, the current park state will be corrupted + // If loading the SV6 or SV4 failed, the current park state will be corrupted // so just go back to the title screen. title_load(); return false; From 57d2618fb52f10fd3814f9d15a3c8acdef7c95b5 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 25 Apr 2016 19:16:58 +0200 Subject: [PATCH 3/3] Use gFirstTimeSave --- src/game.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game.c b/src/game.c index 225dd372b1..82955101ef 100644 --- a/src/game.c +++ b/src/game.c @@ -941,6 +941,8 @@ bool game_load_save(const utf8 *path) result = game_load_sv6(rw); } else if (extension_type == FILE_EXTENSION_SV4) { result = rct1_load_saved_game(path); + if (result) + gFirstTimeSave = 1; } SDL_RWclose(rw);