From 5417ea3fba88035d57456424306378e66d889f0c Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 4 Oct 2026 11:39:14 +0200 Subject: [PATCH 1/4] Fix "openrct2 parkinfo objects" crashing every time --- src/openrct2/command_line/ParkInfoCommands.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openrct2/command_line/ParkInfoCommands.cpp b/src/openrct2/command_line/ParkInfoCommands.cpp index db3a8fed58..0930f9a741 100644 --- a/src/openrct2/command_line/ParkInfoCommands.cpp +++ b/src/openrct2/command_line/ParkInfoCommands.cpp @@ -9,6 +9,7 @@ #include "../Context.h" #include "../FileClassifier.h" +#include "../OpenRCT2.h" #include "../ParkImporter.h" #include "../core/Console.hpp" #include "../core/FileStream.h" @@ -55,6 +56,8 @@ namespace OpenRCT2 auto sourcePath = Path::GetAbsolute(rawSourcePath); auto context = CreateContext(); + // Needed for Context::Initialise(), because it will try and load the game proper otherwise, and crash. + gOpenRCT2Headless = true; context->Initialise(); auto stream = FileStream(sourcePath, FileMode::open); @@ -132,7 +135,10 @@ namespace OpenRCT2 continue; } auto* ori = GetContext()->GetObjectRepository().FindObject(obj); - Console::WriteFormat("%s Object: ", sourceGameToName[EnumValue(ori->GetFirstSourceGame())]); + auto sourceGame = ObjectSourceGame::custom; + if (ori != nullptr) + sourceGame = ori->GetFirstSourceGame(); + Console::WriteFormat("%s Object: ", sourceGameToName[EnumValue(sourceGame)]); std::string name{ obj.GetName() }; if (obj.Generation == ObjectGeneration::dat) From dff8086726b22aa2df391f9b81474670b09c3dd9 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 4 Oct 2026 11:46:09 +0200 Subject: [PATCH 2/4] Fix #27233: `openrct2 parkinfo object` segfaults when called with a scenario --- distribution/changelog.txt | 1 + src/openrct2/command_line/ParkInfoCommands.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 4cd85ab7ab..4751d4532b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -39,6 +39,7 @@ - Fix: [#27136] Guests keep waiting at a level crossing after the train has passed, due to faulty iteration over the track the train has vacated. - Fix: [#27212] Chain lifts are blue in screenshots taken from the command line. - Fix: [#27218] Tile inspector coordinate spinners are too short for coordinate 1000. +- Fix: [#27233] `openrct2 parkinfo objects` crashes when called with a scenario instead of save. - Fix: [#27234] [Plugin] Setting `TrackElement.seatRotation` fails on every ride except mazes, where it does not apply. 0.5.5 (2026-09-06) diff --git a/src/openrct2/command_line/ParkInfoCommands.cpp b/src/openrct2/command_line/ParkInfoCommands.cpp index 0930f9a741..82f92f050d 100644 --- a/src/openrct2/command_line/ParkInfoCommands.cpp +++ b/src/openrct2/command_line/ParkInfoCommands.cpp @@ -90,7 +90,7 @@ namespace OpenRCT2 // Save is an S6 (RCT2 format) parkImporter = ParkImporter::CreateS6(objectRepository); } - auto loadResult = parkImporter->LoadSavedGame(sourcePath.c_str()); + auto loadResult = parkImporter->Load(sourcePath.c_str(), false); Console::WriteLine("File contains the following objects: "); Console::WriteLine(); From 02133a10bb2478f448c9bf23d999dd2167f17a55 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 4 Oct 2026 11:51:13 +0200 Subject: [PATCH 3/4] Add missing object types to kTypeToName, guard against out of bounds read --- src/openrct2/command_line/ParkInfoCommands.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/openrct2/command_line/ParkInfoCommands.cpp b/src/openrct2/command_line/ParkInfoCommands.cpp index 82f92f050d..ac2cb89871 100644 --- a/src/openrct2/command_line/ParkInfoCommands.cpp +++ b/src/openrct2/command_line/ParkInfoCommands.cpp @@ -95,11 +95,14 @@ namespace OpenRCT2 Console::WriteLine("File contains the following objects: "); Console::WriteLine(); - constexpr std::array typeToName = { - "Ride", "SmallScenery", "LargeScenery", "Walls", "Banners", "Paths", - "PathAdditions", "SceneryGroup", "ParkEntrance", "Water", "ScenarioMeta", "TerrainSurface", - "TerrainEdge", "Station", "Music", "FootpathSurface", "FootpathRailings", + constexpr std::array kTypeToName = { + "Ride", "SmallScenery", "LargeScenery", "Walls", "Banners", "Paths", + "PathAdditions", "SceneryGroup", "ParkEntrance", "Water", "ScenarioMeta", "TerrainSurface", + "TerrainEdge", "Station", "Music", "FootpathSurface", "FootpathRailings", "Audio", + "PeepNames", "PeepAnimations", "Climate", }; + static_assert(kTypeToName.size() == static_cast(ObjectType::count)); + constexpr std::array sourceGameToName = { "Custom", "WackyWorlds", "TimeTwister", "OpenRCT2Official", "RCT1", "AddedAttractions", "LoopyLandscapes", "", "RCT2", @@ -123,10 +126,13 @@ namespace OpenRCT2 ObjectType::music, ObjectType::footpathSurface, ObjectType::footpathRailings, + ObjectType::peepNames, + ObjectType::peepAnimations, + ObjectType::climate, }) { auto& list = loadResult.RequiredObjects.GetList(objType); - Console::WriteLine("ObjectType: %s, Number of Objects: %d", typeToName[EnumValue(objType)], list.size()); + Console::WriteLine("ObjectType: %s, Number of Objects: %d", kTypeToName[EnumValue(objType)], list.size()); for (auto& obj : list) { if (obj.Generation == ObjectGeneration::json && obj.Identifier.empty()) From d71dadb7a5bd8ca33940e49b90c7f683c1ac7c9e Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 4 Oct 2026 11:54:04 +0200 Subject: [PATCH 4/4] Add missing comma to comment --- src/openrct2/command_line/ParkInfoCommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/command_line/ParkInfoCommands.cpp b/src/openrct2/command_line/ParkInfoCommands.cpp index ac2cb89871..bcb303e8c5 100644 --- a/src/openrct2/command_line/ParkInfoCommands.cpp +++ b/src/openrct2/command_line/ParkInfoCommands.cpp @@ -137,7 +137,7 @@ namespace OpenRCT2 { if (obj.Generation == ObjectGeneration::json && obj.Identifier.empty()) { - // Empty object slot don't output anything + // Empty object slot, don't output anything continue; } auto* ori = GetContext()->GetObjectRepository().FindObject(obj);