From 4fa571a041da3083747d17acf653c0b66e04b2a9 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Tue, 18 Aug 2015 10:04:10 +0200 Subject: [PATCH] Add option to allow loading scenarios with an incorrect checksum --- data/language/english_uk.txt | 4 +++- src/config.c | 1 + src/config.h | 1 + src/localisation/string_ids.h | 3 +++ src/scenario.c | 2 +- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index e609ee119b..f39d020b6a 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3845,4 +3845,6 @@ STR_5503 :Enter hostname or IP address: STR_5504 :{SMALLFONT}{BLACK}Show multiplayer status STR_5505 :Unable to connect to server. STR_5506 :Guests ignore intensities -STR_5507 :Handymen mow grass by default \ No newline at end of file +STR_5507 :Handymen mow grass by default +STR_5508 :Allow loading files with incorrect checksums +STR_5509 :{SMALLFONT}{BLACK}Allows loading scenarios and saves that have an incorrect checksum, like the scenarios from the demo or damaged saves. diff --git a/src/config.c b/src/config.c index 41ef33dccb..304bb22e98 100644 --- a/src/config.c +++ b/src/config.c @@ -191,6 +191,7 @@ config_property_definition _generalDefinitions[] = { { offsetof(general_configuration, minimize_fullscreen_focus_loss), "minimize_fullscreen_focus_loss",CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, { offsetof(general_configuration, day_night_cycle), "day_night_cycle", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(general_configuration, upper_case_banners), "upper_case_banners", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(general_configuration, allow_loading_with_incorrect_checksum),"allow_loading_with_incorrect_checksum", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, }; config_property_definition _interfaceDefinitions[] = { diff --git a/src/config.h b/src/config.h index 35ed2e74c5..b472fb7e3e 100644 --- a/src/config.h +++ b/src/config.h @@ -164,6 +164,7 @@ typedef struct { uint8 minimize_fullscreen_focus_loss; uint8 day_night_cycle; uint8 upper_case_banners; + uint8 allow_loading_with_incorrect_checksum; } general_configuration; typedef struct { diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index b03c6b3c28..4dcb4c42f4 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2047,6 +2047,9 @@ enum { STR_SHOW_MULTIPLAYER_STATUS_TIP = 5504, STR_UNABLE_TO_CONNECT_TO_SERVER = 5505, + STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM = 5508, + STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM_TIP = 5509, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/scenario.c b/src/scenario.c index 3eed3a5182..925071bb7f 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -109,7 +109,7 @@ int scenario_load(const char *path) rw = platform_sdl_rwfromfile(path, "rb"); if (rw != NULL) { - if (!sawyercoding_validate_checksum(rw)) { + if (!sawyercoding_validate_checksum(rw) && !gConfigGeneral.allow_loading_with_incorrect_checksum) { SDL_RWclose(rw); RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255; RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = STR_FILE_CONTAINS_INVALID_DATA;