OS: Ubuntu 16.04
Version: 0.0.5
Commit/Build: 65beeee
Some SV4 files fail to load with the game saying 'File contains invalid data' or outright crashing.
Output to stderr just before the crash or notification is as follows:
WARNING[/home/michael/Dropbox/Aptana Studio 3 Workspace/OpenRCT2-4/src/util/util.c:295 (safe_strcpy)]: Truncating string "WALLRH32" to 9 bytes.
ERROR[/home/michael/Dropbox/Aptana Studio 3 Workspace/OpenRCT2-4/src/rct1/S4Importer.cpp:757 (LoadObjects)]: Failed to load SCGURBAN.
Two parks that exhibit this behaviour:
Further testing shows that the Blackpool Pleasure Beach did not cause a crash before this #4024 (https://github.com/OpenRCT2/OpenRCT2/commit/dca816cfd394f7fff85f380370e18fce9435979a)
Specifically, this is the output when BPB crashes:
WARNING[/home/michael/Dropbox/Aptana Studio 3 Workspace/OpenRCT2-4/src/util/util.c:295 (safe_strcpy)]: Truncating string "WALLRH32" to 9 bytes.
Thread 1 "openrct2" received signal SIGSEGV, Segmentation fault.
0x01491327 in research_insert_ride_entry ()
(gdb) bt
#0 0x01491327 in research_insert_ride_entry ()
#1 0x015763e9 in S4Importer::ImportResearch() ()
#2 0x015795c8 in S4Importer::Import() ()
#3 0x01579977 in rct1_load_saved_game ()
#4 0x014b35f9 in game_load_save ()
#5 0x01473b19 in window_loadsave_select ()
#6 0x0147430e in window_loadsave_mouseup ()
#7 0x01503731 in game_handle_input ()
#8 0x014e6dc5 in rct2_update ()
#9 0x0143263a in openrct2_launch ()
#10 0x01429696 in main ()
It crashes because it attempt to load a rideEntry with the value 0xffffffff. It then crashes on line https://github.com/OpenRCT2/OpenRCT2/blob/17b69d257b11379b9b498baac630f58b2a3d25b2/src/management/research.c#L601.
Putting a bit of code in to skip such ride entries will prevent a crash, but cause a broken state:

Issue cause by multiple object entries of the same type "PTCT1 ". Anything that is loaded after this (and this is the 13th object loaded) will be referencing the wrong ride type. Will be a pain to fix.
Do you mean that this happens if we have two RCT1 ride / vehicle types that map to the same RCT2 object?
Yeah for some reason this map has multiple "PTCT1" entries.
PTCT1 is the Wooden Roller Coaster train. But RCT1 also has a reversed WRC train, for which RCT2 has no direct equivalent, so this is changed to a regular one when importing. The same applies to the reversed Steel RC train, and also to some trains for which no direct equivalent exists.
The map is in the code and also on this wiki page.
I will look at this tonight, the issue is that rides are referencing the wrong ride entry, not that there are multiple ride entries that are the same object.
When loading Luna Park, it runs out of map animation slots. It creates one for every single fence object, which looks like same behaviour as placing them in normal game... I am not entirely sure why or whether this is correct.
Most helpful comment
It crashes because it attempt to load a rideEntry with the value
0xffffffff. It then crashes on line https://github.com/OpenRCT2/OpenRCT2/blob/17b69d257b11379b9b498baac630f58b2a3d25b2/src/management/research.c#L601.Putting a bit of code in to skip such ride entries will prevent a crash, but cause a broken state: