diff --git a/src/openrct2/drawing/sprite.cpp b/src/openrct2/drawing/sprite.cpp index 9b75ea5644..91f9e0ba51 100644 --- a/src/openrct2/drawing/sprite.cpp +++ b/src/openrct2/drawing/sprite.cpp @@ -16,6 +16,7 @@ #include #include "../common.h" +#include "../core/File.h" #include "../core/FileStream.hpp" #include "../core/Memory.hpp" #include "../core/Util.hpp" @@ -194,11 +195,22 @@ extern "C" safe_strcat_path(pathHeader, "Data", sizeof(pathHeader)); safe_strcat_path(pathHeader, "csg1i.dat", sizeof(pathHeader)); + // csg1.1 and csg1.dat are the same file. + // In the CD version, it's called csg1.1 on the CD and csg1.dat on the disk. + // In the GOG version, it's always called csg1.1. + // In the Steam version, it's always called csg1.dat. char pathData[MAX_PATH]; safe_strcpy(pathData, gConfigGeneral.rct1_path, sizeof(pathData)); safe_strcat_path(pathData, "Data", sizeof(pathData)); safe_strcat_path(pathData, "csg1.1", sizeof(pathData)); + if (!File::Exists(pathData)) + { + safe_strcpy(pathData, gConfigGeneral.rct1_path, sizeof(pathData)); + safe_strcat_path(pathData, "Data", sizeof(pathData)); + safe_strcat_path(pathData, "csg1.dat", sizeof(pathData)); + } + try { auto fileHeader = FileStream(pathHeader, FILE_MODE_OPEN); @@ -632,10 +644,6 @@ extern "C" return &_g2.elements[image_id - SPR_G2_BEGIN]; } - if (_csg.data == nullptr) - { - gfx_load_csg(); - } return &_csg.elements[image_id - SPR_CSG_BEGIN]; } diff --git a/src/openrct2/rct2.c b/src/openrct2/rct2.c index 873d70be2a..ff5761e6f8 100644 --- a/src/openrct2/rct2.c +++ b/src/openrct2/rct2.c @@ -163,6 +163,7 @@ bool rct2_init() if (!gfx_load_g2()) { return false; } + gfx_load_csg(); font_sprite_initialise_characters(); if (!gOpenRCT2Headless) { diff --git a/src/openrct2/windows/options.c b/src/openrct2/windows/options.c index 6d3e45930b..60d38c5448 100644 --- a/src/openrct2/windows/options.c +++ b/src/openrct2/windows/options.c @@ -843,12 +843,19 @@ static void window_options_mouseup(rct_window *w, sint32 widgetIndex) utf8string rct1path = platform_open_directory_browser(language_get_string(STR_PATH_TO_RCT1_BROWSER)); if (rct1path) { // Check if this directory actually contains RCT1 + // The sprite file can be called either csg1.1 or csg1.dat, so check for both names. utf8 checkpath[MAX_PATH]; safe_strcpy(checkpath, rct1path, MAX_PATH); safe_strcat_path(checkpath, "Data", MAX_PATH); safe_strcat_path(checkpath, "csg1.1", MAX_PATH); - if (platform_file_exists(checkpath)) - { + + if (!platform_file_exists(checkpath)) { + safe_strcpy(checkpath, rct1path, MAX_PATH); + safe_strcat_path(checkpath, "Data", MAX_PATH); + safe_strcat_path(checkpath, "csg1.dat", MAX_PATH); + } + + if (platform_file_exists(checkpath)) { SafeFree(gConfigGeneral.rct1_path); gConfigGeneral.rct1_path = rct1path; config_save_default();