From 8dc7fdcec20a51b9f9458afe9040ad0456a073b9 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 25 Apr 2016 15:38:44 +0200 Subject: [PATCH] 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) {