GekkoNet 1.0
C/C++ Peer to Peer Game Networking SDK
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1#pragma once
2
3#include "gekkonet.h"
4#include "gekko_types.h"
5#include "sync.h"
6#include "storage.h"
7
8#include <vector>
9#include <memory>
10
11namespace Gekko {
13 public:
14 void Init(u32 input_size);
15
16 GekkoGameEvent* GetEvent(bool advance);
17
18 void Reset();
19
20 private:
22
24
26
27 std::vector<std::unique_ptr<GekkoGameEvent>> _buffer_advance;
28
29 std::vector<std::unique_ptr<GekkoGameEvent>> _buffer_others;
30
31 std::vector<std::unique_ptr<u8[]>> _input_memory_buffer;
32 };
33
35 public:
36 void Init(u32 input_size);
37
38 bool AddAdvanceEvent(SyncSystem& sync, bool rolling_back, bool running_ahead = false);
39
40 void AddSaveEvent(SyncSystem& sync, StateStorage& storage, Frame* last_saved_frame = nullptr);
41
42 void AddLoadEvent(SyncSystem& sync, StateStorage& storage);
43
44 void AddStateSaveEvent(Frame frame, StateEntry* state, bool portable = false);
45
46 void AddStateLoadEvent(Frame frame, u8* state, u32 state_len);
47
48 void AddRunaheadSaveEvent(SyncSystem& sync, StateStorage& storage);
49
51
52 std::vector<GekkoGameEvent*>& GetEvents();
53
54 void Reset();
55
56 void Clear();
57
58 i32 Count();
59
61
62 private:
63 std::vector<GekkoGameEvent*> _current_events;
64
66 };
67
69 public:
71
73
74 void Reset();
75
76 private:
78
79 std::vector<std::unique_ptr<GekkoSessionEvent>> _buffer;
80 };
81
83 public:
84 void Reset();
85
86 std::vector<GekkoSessionEvent*>& GetRecentEvents();
87
88 void AddPlayerSyncingEvent(Handle handle, u8 sync, u8 max);
89
91
93
95
97
99
100 void AddDesyncDetectedEvent(Frame frame, Handle remote, u32 check_local, u32 check_remote);
101
103
104 void AddReplayDesyncEvent(Frame frame, u32 checksum, u32 recorded_checksum);
105
106 private:
107 void AddEvent(GekkoSessionEvent* ev);
108
109 private:
110 std::vector<GekkoSessionEvent*> _events;
111
113 };
114}
int32_t i32
Definition gekko_types.h:12
int32_t Handle
Definition gekko_types.h:19
int32_t Frame
Definition gekko_types.h:18
uint8_t u8
Definition gekko_types.h:5
uint16_t u16
Definition gekko_types.h:6
uint32_t u32
Definition gekko_types.h:7
std::vector< std::unique_ptr< u8[]> > _input_memory_buffer
Definition event.h:31
void Init(u32 input_size)
Definition event.cpp:7
std::vector< std::unique_ptr< GekkoGameEvent > > _buffer_others
Definition event.h:29
std::vector< std::unique_ptr< GekkoGameEvent > > _buffer_advance
Definition event.h:27
GekkoGameEvent * GetEvent(bool advance)
Definition event.cpp:38
void AddStateSaveEvent(Frame frame, StateEntry *state, bool portable=false)
Definition event.cpp:235
void AddLoadEvent(SyncSystem &sync, StateStorage &storage)
Definition event.cpp:226
void AddStateLoadEvent(Frame frame, u8 *state, u32 state_len)
Definition event.cpp:251
std::vector< GekkoGameEvent * > _current_events
Definition event.h:63
std::vector< GekkoGameEvent * > & GetEvents()
Definition event.cpp:275
void AddRunaheadSaveEvent(SyncSystem &sync, StateStorage &storage)
Definition event.cpp:263
GameEventBuffer _event_buffer
Definition event.h:65
void AddRunaheadLoadEvent(StateStorage &storage)
Definition event.cpp:268
void Init(u32 input_size)
Definition event.cpp:185
GekkoGameEvent ** Data()
Definition event.cpp:295
void AddSaveEvent(SyncSystem &sync, StateStorage &storage, Frame *last_saved_frame=nullptr)
Definition event.cpp:215
bool AddAdvanceEvent(SyncSystem &sync, bool rolling_back, bool running_ahead=false)
Definition event.cpp:191
GekkoSessionEvent * GetEvent()
Definition event.cpp:68
std::vector< std::unique_ptr< GekkoSessionEvent > > _buffer
Definition event.h:79
void AddEvent(GekkoSessionEvent *ev)
Definition event.cpp:100
void AddDesyncDetectedEvent(Frame frame, Handle remote, u32 check_local, u32 check_remote)
Definition event.cpp:157
std::vector< GekkoSessionEvent * > & GetRecentEvents()
Definition event.cpp:105
void AddReplayDesyncEvent(Frame frame, u32 checksum, u32 recorded_checksum)
Definition event.cpp:175
void AddPlayerDisconnectedEvent(Handle handle)
Definition event.cpp:128
void AddPlayerSyncingEvent(Handle handle, u8 sync, u8 max)
Definition event.cpp:110
std::vector< GekkoSessionEvent * > _events
Definition event.h:110
void AddPlayerConnectedEvent(Handle handle)
Definition event.cpp:120
SessionEventBuffer _event_buffer
Definition event.h:112