-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
183 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
libsave/include/SatisfactorySave/GameTypes/FactoryGame/FGSaveSession.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
|
||
#include <optional> | ||
#include <vector> | ||
|
||
#include "../../IO/Archive/Archive.h" | ||
#include "../UE/Core/Containers/Map.h" | ||
#include "SatisfactorySave/GameTypes/FactoryGame/FGObjectReference.h" | ||
#include "SatisfactorySave/GameTypes/Save/SaveObject.h" | ||
#include "satisfactorysave_export.h" | ||
|
||
namespace SatisfactorySave { | ||
|
||
struct SATISFACTORYSAVE_API FPerStreamingLevelSaveData { | ||
// The original struct in the game files actually uses TOCBlob64 and DataBlob64 buffers here, but instead we | ||
// are directly serializing the data types within these buffers. | ||
SaveObjectList SaveObjects; | ||
std::optional<std::vector<FObjectReferenceDisc>> TOC_DestroyedActors; | ||
|
||
std::vector<FObjectReferenceDisc> DestroyedActors; | ||
|
||
void serialize(Archive& ar); | ||
}; | ||
|
||
struct SATISFACTORYSAVE_API FPersistentAndRuntimeSaveData { | ||
// The original struct in the game files actually uses TOCBlob64 and DataBlob64 buffers here, but instead we | ||
// are directly serializing the data types within these buffers. | ||
SaveObjectList SaveObjects; | ||
std::optional<TMap<std::string, std::vector<FObjectReferenceDisc>>> TOC_LevelToDestroyedActorsMap; | ||
|
||
TMap<std::string, std::vector<FObjectReferenceDisc>> LevelToDestroyedActorsMap; | ||
|
||
void serialize(Archive& ar); | ||
}; | ||
|
||
struct SATISFACTORYSAVE_API FUnresolvedWorldSaveData { | ||
std::vector<FObjectReferenceDisc> DestroyedActors; | ||
|
||
inline void serialize(Archive& ar) { | ||
ar << DestroyedActors; | ||
} | ||
}; | ||
|
||
} // namespace SatisfactorySave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "GameTypes/FactoryGame/FGSaveSession.h" | ||
|
||
#include "../Save/SerializationUtils.h" | ||
#include "IO/Archive/IStreamArchive.h" | ||
#include "IO/Archive/OStreamArchive.h" | ||
|
||
void SatisfactorySave::FPerStreamingLevelSaveData::serialize(Archive& ar) { | ||
if (ar.isIArchive()) { | ||
auto& inAr = dynamic_cast<IStreamArchive&>(ar); | ||
parseTOCBlob(inAr, SaveObjects, TOC_DestroyedActors); | ||
parseDataBlob(inAr, SaveObjects); | ||
} else { | ||
auto& outAr = dynamic_cast<OStreamArchive&>(ar); | ||
saveTOCBlob(outAr, SaveObjects, TOC_DestroyedActors); | ||
saveDataBlob(outAr, SaveObjects); | ||
} | ||
|
||
ar << DestroyedActors; | ||
} | ||
|
||
void SatisfactorySave::FPersistentAndRuntimeSaveData::serialize(Archive& ar) { | ||
if (ar.isIArchive()) { | ||
auto& inAr = dynamic_cast<IStreamArchive&>(ar); | ||
parseTOCBlob(inAr, SaveObjects, TOC_LevelToDestroyedActorsMap); | ||
parseDataBlob(inAr, SaveObjects); | ||
} else { | ||
auto& outAr = dynamic_cast<OStreamArchive&>(ar); | ||
saveTOCBlob(outAr, SaveObjects, TOC_LevelToDestroyedActorsMap); | ||
saveDataBlob(outAr, SaveObjects); | ||
} | ||
|
||
ar << LevelToDestroyedActorsMap; | ||
} |
Oops, something went wrong.