mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
Add notification for mismatched g2.dat entries size (#17496)
Added expected number of sprites to StringIds.h and a mismatch check upon loading g2.dat in Drawing.Sprite.cpp. If the mismatch catch fails, then an error is logged and a notification is displayed * Add improper install warning
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
- Change: [#16952] Make “Object Selection” order more coherent.
|
||||
- Change: [#17002] Weather no longer resets when converting a save to scenario.
|
||||
- Change: [#17294] New ride window remembers scroll position per tab instead of highlighted ride.
|
||||
- Change: [#17496] Added warning for mismatched g2.dat entry size
|
||||
- Removed: [#16864] Title sequence editor (replaced by plug-in).
|
||||
- Removed: [#16911, #17411] Residual support for pre-Vista Windows systems.
|
||||
- Fix: [#13997] Placing a track design interferes with other players building a ride.
|
||||
|
||||
@@ -282,6 +282,22 @@ bool gfx_load_g2()
|
||||
// Read element data
|
||||
_g2.data = fs.ReadArray<uint8_t>(_g2.header.total_size);
|
||||
|
||||
if (_g2.header.num_entries != G2_SPRITE_COUNT)
|
||||
{
|
||||
std::string errorMessage = "Mismatched g2.dat size.\nExpected: " + std::to_string(G2_SPRITE_COUNT) + "\nActual: "
|
||||
+ std::to_string(_g2.header.num_entries) + "\ng2.dat may be installed improperly.\nPath to g2.dat: " + path;
|
||||
|
||||
log_error(errorMessage.c_str());
|
||||
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
uiContext->ShowMessageBox(errorMessage);
|
||||
uiContext->ShowMessageBox("Warning: You may experience graphical glitches if you continue. It's recommended "
|
||||
"that you update g2.dat if you're seeing this message");
|
||||
}
|
||||
}
|
||||
|
||||
// Fix entry data offsets
|
||||
for (uint32_t i = 0; i < _g2.header.num_entries; i++)
|
||||
{
|
||||
|
||||
@@ -1158,6 +1158,8 @@ enum
|
||||
SPR_CSG_BEGIN = SPR_G2_END,
|
||||
SPR_CSG_END = SPR_CSG_BEGIN + RCT1::Limits::Num_LL_CSG_Entries,
|
||||
|
||||
G2_SPRITE_COUNT = SPR_G2_END - SPR_G2_BEGIN,
|
||||
|
||||
SPR_SCROLLING_TEXT_START = SPR_CSG_END,
|
||||
SPR_SCROLLING_TEXT_END = SPR_SCROLLING_TEXT_START + OpenRCT2::MaxScrollingTextEntries,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user