Close #17341: Always allow loading with incorrect checksum

This commit is contained in:
Gymnasiast 2022-10-08 22:58:23 +02:00
parent bfd333bb38
commit c33e377d7c
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
8 changed files with 0 additions and 34 deletions

View File

@ -2710,8 +2710,6 @@ STR_5503 :Enter hostname or IP address:
STR_5504 :Show multiplayer status
STR_5505 :Unable to connect to server.
STR_5506 :Guests ignore intensities
STR_5508 :Allow loading files with incorrect checksums
STR_5509 :Allows loading scenarios and saves{NEWLINE}that have an incorrect checksum,{NEWLINE}like the scenarios from the demo{NEWLINE}or damaged saves.
STR_5510 :Default sound device
STR_5511 :(UNKNOWN)
STR_5512 :Save Game As

View File

@ -196,7 +196,6 @@ enum WindowOptionsWidgetIdx {
// Advanced
WIDX_DEBUGGING_TOOLS = WIDX_PAGE_START,
WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM,
WIDX_SAVE_PLUGIN_DATA_CHECKBOX,
WIDX_STAY_CONNECTED_AFTER_DESYNC,
WIDX_ALWAYS_NATIVE_LOADSAVE,
@ -384,7 +383,6 @@ static rct_widget window_options_misc_widgets[] = {
static rct_widget window_options_advanced_widgets[] = {
MAIN_OPTIONS_WIDGETS,
MakeWidget ({ 10, 54}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ENABLE_DEBUGGING_TOOLS, STR_ENABLE_DEBUGGING_TOOLS_TIP ), // Enable debugging tools
MakeWidget ({ 10, 69}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM, STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM_TIP), // Allow loading with incorrect checksum
MakeWidget ({ 10, 84}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP ), // Export plug-in objects with saved games
MakeWidget ({ 10, 99}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_STAY_CONNECTED_AFTER_DESYNC, STR_STAY_CONNECTED_AFTER_DESYNC_TIP ), // Do not disconnect after the client desynchronises with the server
MakeWidget ({ 10, 114}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ALWAYS_NATIVE_LOADSAVE, STR_ALWAYS_NATIVE_LOADSAVE_TIP ), // Use native load/save window
@ -1878,11 +1876,6 @@ private:
config_save_default();
gfx_invalidate_screen();
break;
case WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM:
gConfigGeneral.allow_loading_with_incorrect_checksum = !gConfigGeneral.allow_loading_with_incorrect_checksum;
config_save_default();
Invalidate();
break;
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
gConfigGeneral.save_plugin_data ^= 1;
config_save_default();
@ -2001,8 +1994,6 @@ private:
void AdvancedPrepareDraw()
{
SetCheckboxValue(WIDX_DEBUGGING_TOOLS, gConfigGeneral.debugging_tools);
WidgetSetCheckboxValue(
*this, WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM, gConfigGeneral.allow_loading_with_incorrect_checksum);
SetCheckboxValue(WIDX_SAVE_PLUGIN_DATA_CHECKBOX, gConfigGeneral.save_plugin_data);
SetCheckboxValue(WIDX_STAY_CONNECTED_AFTER_DESYNC, gConfigNetwork.stay_connected);
SetCheckboxValue(WIDX_ALWAYS_NATIVE_LOADSAVE, gConfigGeneral.use_native_browse_dialog);

View File

@ -192,7 +192,6 @@ namespace Config
model->enable_light_fx_for_vehicles = isHardware && reader->GetBoolean("enable_light_fx_for_vehicles", false);
model->upper_case_banners = reader->GetBoolean("upper_case_banners", false);
model->disable_lightning_effect = reader->GetBoolean("disable_lightning_effect", false);
model->allow_loading_with_incorrect_checksum = reader->GetBoolean("allow_loading_with_incorrect_checksum", true);
model->steam_overlay_pause = reader->GetBoolean("steam_overlay_pause", true);
model->window_scale = reader->GetFloat("window_scale", Platform::GetDefaultScale());
model->show_fps = reader->GetBoolean("show_fps", false);
@ -278,7 +277,6 @@ namespace Config
writer->WriteBoolean("enable_light_fx_for_vehicles", model->enable_light_fx_for_vehicles);
writer->WriteBoolean("upper_case_banners", model->upper_case_banners);
writer->WriteBoolean("disable_lightning_effect", model->disable_lightning_effect);
writer->WriteBoolean("allow_loading_with_incorrect_checksum", model->allow_loading_with_incorrect_checksum);
writer->WriteBoolean("steam_overlay_pause", model->steam_overlay_pause);
writer->WriteFloat("window_scale", model->window_scale);
writer->WriteBoolean("show_fps", model->show_fps);

View File

@ -89,7 +89,6 @@ struct GeneralConfiguration
// Miscellaneous
bool play_intro;
int32_t window_snap_proximity;
bool allow_loading_with_incorrect_checksum;
bool save_plugin_data;
bool debugging_tools;
int32_t autosave_frequency;

View File

@ -2841,8 +2841,6 @@ enum : uint16_t
STR_SHOW_MULTIPLAYER_STATUS_TIP = 5504,
STR_UNABLE_TO_CONNECT_TO_SERVER = 5505,
STR_CHEAT_IGNORE_INTENSITY = 5506,
STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM = 5508,
STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM_TIP = 5509,
STR_OPTIONS_SOUND_VALUE_DEFAULT = 5510,
STR_OPTIONS_SOUND_VALUE_UNKNOWN = 5511,
STR_SAVE_GAME_AS = 5512,

View File

@ -53,12 +53,6 @@ namespace RCT1
bool LoadFromStream(OpenRCT2::IStream* stream) override
{
auto checksumType = SawyerEncoding::ValidateTrackChecksum(stream);
if (!gConfigGeneral.allow_loading_with_incorrect_checksum && checksumType == RCT12TrackDesignVersion::unknown)
{
throw IOException("Invalid checksum.");
}
auto chunkReader = SawyerChunkReader(stream);
auto data = chunkReader.ReadChunkTrack();
_stream.WriteArray<const uint8_t>(reinterpret_cast<const uint8_t*>(data->GetData()), data->GetLength());

View File

@ -141,12 +141,6 @@ namespace RCT2
OpenRCT2::IStream* stream, bool isScenario, [[maybe_unused]] bool skipObjectCheck = false,
const utf8* path = String::Empty) override
{
if (isScenario && !gConfigGeneral.allow_loading_with_incorrect_checksum
&& !SawyerEncoding::ValidateChecksum(stream))
{
throw IOException("Invalid checksum.");
}
auto chunkReader = SawyerChunkReader(stream);
chunkReader.ReadChunk(&_s6.header, sizeof(_s6.header));

View File

@ -57,12 +57,6 @@ namespace RCT2
bool LoadFromStream(OpenRCT2::IStream* stream) override
{
if (!gConfigGeneral.allow_loading_with_incorrect_checksum
&& SawyerEncoding::ValidateTrackChecksum(stream) != RCT12TrackDesignVersion::TD6)
{
throw IOException("Invalid checksum.");
}
auto chunkReader = SawyerChunkReader(stream);
auto data = chunkReader.ReadChunkTrack();
_stream.WriteArray<const uint8_t>(reinterpret_cast<const uint8_t*>(data->GetData()), data->GetLength());