Skip to content

Commit f8dcef9

Browse files
committed
Added cpu_to_le32 for saving
1 parent 5cf1154 commit f8dcef9

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

TheForceEngine/TFE_DarkForces/agent.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ namespace TFE_DarkForces
451451
{
452452
return JFALSE;
453453
}
454-
saveData->agentData.selectedMission = TFE_Endian::le32_to_cpu(saveData->agentData.selectedMission);
455-
saveData->agentData.nextMission = TFE_Endian::le32_to_cpu(saveData->agentData.nextMission);
454+
saveData->agentData.selectedMission = TFE_Endian::cpu_to_le32(saveData->agentData.selectedMission);
455+
saveData->agentData.nextMission = TFE_Endian::cpu_to_le32(saveData->agentData.nextMission);
456456
for (s32 i = 0; i < 140; i++)
457457
{
458-
saveData->ammo[i] = TFE_Endian::le32_to_cpu(saveData->ammo[i]);
458+
saveData->ammo[i] = TFE_Endian::cpu_to_le32(saveData->ammo[i]);
459459
}
460460
file->writeBuffer(saveData, sizeof(LevelSaveData));
461461
return JTRUE;

TheForceEngine/TFE_System/endian.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ namespace TFE_Endian
1515
return SDL_SwapLE32(x);
1616
}
1717

18+
inline u32 cpu_to_le32(u32 x)
19+
{
20+
return SDL_SwapLE32(x);
21+
}
22+
1823
inline u64 le64_to_cpu(u64 x)
1924
{
2025
return SDL_SwapLE64(x);

0 commit comments

Comments
 (0)