Serialization operations
Serialization operation parts in interface:
Copy this to your project and extend with your parts or leave functions complete away where not used or supported.
Header parts:
GAME_ERROR
Game add-on error codes
Definition: game.h:34
virtual GAME_ERROR Deserialize(const uint8_t *data, size_t size)
Deserialize the game from the given state.
Definition: Game.h:884
virtual GAME_ERROR Serialize(uint8_t *data, size_t size)
Serialize the state of the game.
Definition: Game.h:870
virtual size_t SerializeSize()
Get the number of bytes required to serialize the game.
Definition: Game.h:856
Source parts:
size_t CMyInstance::SerializeSize()
{
return 0;
}
GAME_ERROR CMyInstance::Serialize(uint8_t* data,
size_t size)
{
}
GAME_ERROR CMyInstance::Deserialize(
const uint8_t* data,
size_t size)
{
}
@ GAME_ERROR_NOT_IMPLEMENTED
the method that the frontend called is not implemented
Definition: game.h:42
◆ SerializeSize()
virtual size_t SerializeSize |
( |
| ) |
|
|
inlinevirtual |
Get the number of bytes required to serialize the game.
- Returns
- the number of bytes, or 0 if serialization is not supported
◆ Serialize()
virtual GAME_ERROR Serialize |
( |
uint8_t * |
data, |
|
|
size_t |
size |
|
) |
| |
|
inlinevirtual |
Serialize the state of the game.
- Parameters
-
[in] | data | The buffer receiving the serialized game data |
[in] | size | The size of the buffer |
- Returns
- the error, or GAME_ERROR_NO_ERROR if the game was serialized into the buffer
◆ Deserialize()
virtual GAME_ERROR Deserialize |
( |
const uint8_t * |
data, |
|
|
size_t |
size |
|
) |
| |
|
inlinevirtual |
Deserialize the game from the given state.
- Parameters
-
[in] | data | A buffer containing the game's new state |
[in] | size | The size of the buffer |
- Returns
- the error, or GAME_ERROR_NO_ERROR if the game deserialized