Skip to content

Commit

Permalink
Merge pull request #1432 from mouzedrift/oddworld2
Browse files Browse the repository at this point in the history
fix crash when custom LCD Screen messages were added
  • Loading branch information
mouzedrift authored Jan 12, 2022
2 parents ad5028b + a027be0 commit 9099f4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Source/AliveLibAE/PathDataExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ void Path_Set_NewData_FromLvls()

pChunkData += sizeof(PerPathExtension);

// Apply led messages
auto pLedMsgs = reinterpret_cast<StringTable*>(pChunkData);
pChunkData = StringTable::MakeTable(pLedMsgs);
SetLcdMessagesForLvl(*pLedMsgs, static_cast<LevelIds>(lvlIdx), pExt->mPathId);
// Apply LCD Screen messages
auto pLCDScreenMsgs = reinterpret_cast<StringTable*>(pChunkData);
pChunkData = StringTable::MakeTable(pLCDScreenMsgs);
SetLcdMessagesForLvl(*pLCDScreenMsgs, static_cast<LevelIds>(lvlIdx), pExt->mPathId);

// Will be empty for AE
auto pHintFlyMsgs = reinterpret_cast<StringTable*>(pChunkData);
Expand Down
8 changes: 4 additions & 4 deletions Source/AliveLibAO/PathDataExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ void Path_Set_NewData_FromLvls()

pChunkData += sizeof(PerPathExtension);

// Apply led messages
auto pLedMsgs = reinterpret_cast<StringTable*>(pChunkData);
pChunkData = StringTable::MakeTable(pLedMsgs);
SetLcdMessagesForLvl(*pLedMsgs, static_cast<LevelIds>(lvlIdx), pExt->mPathId);
// Apply LCD Screen messages
auto pLCDScreenMsgs = reinterpret_cast<StringTable*>(pChunkData);
pChunkData = StringTable::MakeTable(pLCDScreenMsgs);
SetLcdMessagesForLvl(*pLCDScreenMsgs, static_cast<LevelIds>(lvlIdx), pExt->mPathId);

// Apply hint fly messages
auto pHintFlyMsgs = reinterpret_cast<StringTable*>(pChunkData);
Expand Down
2 changes: 1 addition & 1 deletion Source/AliveLibCommon/PathDataExtensionsTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct StringTable final
// Read the string count
u8* pDataIter = reinterpret_cast<u8*>(pTable);
const u64 stringCount = *reinterpret_cast<u64*>(pDataIter);
pDataIter += sizeof(u32);
pDataIter += sizeof(u64);

if (stringCount > 0)
{
Expand Down

0 comments on commit 9099f4a

Please sign in to comment.