Skip to content

Commit

Permalink
SaveGame endian fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
afritz1 committed Dec 21, 2024
1 parent 50023cf commit 8f20a76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OpenTESArena/src/Assets/ArenaTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ void ArenaTypes::SaveGame::init(const uint8_t *data)
const uint8_t *gameStateEnd = gameStateStart + GameState::SIZE;
this->gameState.init(gameStateStart);

const uint16_t *gameLevelStart = reinterpret_cast<const uint16_t*>(gameStateEnd);
const uint16_t *gameLevelEnd = gameLevelStart + this->gameLevel.size();
std::copy(gameLevelStart, gameLevelEnd, this->gameLevel.begin());
const uint8_t *gameLevelStart = gameStateEnd;
for (int i = 0; i < static_cast<int>(this->gameLevel.size()); i++)
{
this->gameLevel[i] = Bytes::getLE16(gameLevelStart + (i * 2));
}
}

void ArenaTypes::InventoryItem::init(const uint8_t *data)
Expand Down

0 comments on commit 8f20a76

Please sign in to comment.