Skip to content

Commit 9c678d1

Browse files
committed
Updated c_managed_session_overlapped_task
1 parent eb8f306 commit 9c678d1

2 files changed

Lines changed: 81 additions & 44 deletions

File tree

game/source/networking/online/online_session.cpp

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,28 @@ HOOK_DECLARE_CLASS_MEMBER(0x00442C30, c_managed_session_overlapped_task, process
1616
HOOK_DECLARE_CLASS_MEMBER(0x00442C40, c_managed_session_overlapped_task, process_game_end);
1717
HOOK_DECLARE_CLASS_MEMBER(0x00442C50, c_managed_session_overlapped_task, process_game_start);
1818
HOOK_DECLARE_CLASS_MEMBER(0x00442C60, c_managed_session_overlapped_task, process_modify);
19-
//HOOK_DECLARE_CLASS_MEMBER(0x00442C70, c_managed_session_overlapped_task, process_modify_immediately);
19+
//HOOK_DECLARE_CLASS(0x00442C70, c_managed_session_overlapped_task, process_modify_immediately);
2020
HOOK_DECLARE_CLASS_MEMBER(0x00442C80, c_managed_session_overlapped_task, process_remove_players);
2121
HOOK_DECLARE_CLASS_MEMBER(0x00442CA0, c_managed_session_overlapped_task, process_session_host_migrate);
2222
HOOK_DECLARE_CLASS_MEMBER(0x00442CB0, c_managed_session_overlapped_task, start_);
2323

24-
//.text:00442C00 ; void __cdecl c_managed_session_overlapped_task::process_add_players(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*, uns64 const*, bool const*, bool const*, int32);
25-
void __thiscall c_managed_session_overlapped_task::process_add_players(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns64 const* a4, bool const* a5, bool const* a6, int32 player_count)
24+
void c_managed_session_overlapped_task::filter_local_users(int32 player_count, uns64 const* players, bool const* online_enabled, bool const* private_slots)
2625
{
26+
// $TODO: implement me
27+
}
28+
29+
void c_managed_session_overlapped_task::process_add_players(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, bool const* private_slots, int32 player_count)
30+
{
31+
//INVOKE_CLASS_MEMBER(0x00442C00, c_managed_session_overlapped_task, process_add_players, managed_session_index, completion_routine, session, player_xuids, online_enabled, private_slots, player_count);
32+
2733
m_session = session;
2834
m_managed_session_index = managed_session_index;
29-
m_completion_routine = callback;
35+
m_completion_routine = completion_routine;
3036
m_context = _process_add_players;
3137
m_result = false;
3238
m_return_result = 0;
3339

34-
// $TODO: implement `filter_local_users`
35-
//filter_local_users(player_count, a4, a5, a6);
40+
filter_local_users(player_count, player_xuids, online_enabled, private_slots);
3641

3742
if (!m_player_count)
3843
{
@@ -45,28 +50,37 @@ void __thiscall c_managed_session_overlapped_task::process_add_players(int32 man
4550
}
4651
}
4752

48-
//.text:00442C10 ; bool __cdecl c_managed_session_overlapped_task::process_add_players_immediately(s_online_session*, uns64 const*, bool const*, bool const*, int32)
53+
bool c_managed_session_overlapped_task::process_add_players_immediately(s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, bool const* private_slots, int32 player_count)
54+
{
55+
//return INVOKE_CLASS_MEMBER(0x00442C10, c_managed_session_overlapped_task, process_add_players_immediately, session, player_xuids, online_enabled, private_slots, player_count);
56+
57+
// $TODO: implement me
4958

50-
//.text:00442C20 ; void __cdecl c_managed_session_overlapped_task::process_create(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*, c_flags<e_online_session_flags, uns16, 9>);
51-
void __thiscall c_managed_session_overlapped_task::process_create(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns16 flags)
59+
return true;
60+
}
61+
62+
void c_managed_session_overlapped_task::process_create(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns16 mask)
5263
{
64+
//INVOKE_CLASS_MEMBER(0x00442C20, c_managed_session_overlapped_task, process_create, managed_session_index, completion_routine, session, mask);
65+
5366
m_context = _process_create;
5467
m_session = session;
5568
m_managed_session_index = managed_session_index;
56-
m_completion_routine = callback;
69+
m_completion_routine = completion_routine;
5770
m_result = false;
5871
m_return_result = 0;
59-
m_mask = flags;
72+
m_mask = mask;
6073

6174
if (!overlapped_task_start_internal(this, __FILE__, __LINE__))
6275
reset();
6376
}
6477

65-
//.text:00442C30 ; void __cdecl c_managed_session_overlapped_task::process_delete(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*);
66-
void __thiscall c_managed_session_overlapped_task::process_delete(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session)
78+
void c_managed_session_overlapped_task::process_delete(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session)
6779
{
80+
//INVOKE_CLASS_MEMBER(0x00442C30, c_managed_session_overlapped_task, process_delete, managed_session_index, completion_routine, session);
81+
6882
m_managed_session_index = managed_session_index;
69-
m_completion_routine = callback;
83+
m_completion_routine = completion_routine;
7084
m_session = session;
7185
m_context = _process_delete;
7286
m_result = false;
@@ -76,11 +90,12 @@ void __thiscall c_managed_session_overlapped_task::process_delete(int32 managed_
7690
reset();
7791
}
7892

79-
//.text:00442C40 ; void __cdecl c_managed_session_overlapped_task::process_game_end(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*);
80-
void __thiscall c_managed_session_overlapped_task::process_game_end(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session)
93+
void c_managed_session_overlapped_task::process_game_end(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session)
8194
{
95+
//INVOKE_CLASS_MEMBER(0x00442C40, c_managed_session_overlapped_task, process_game_end, managed_session_index, completion_routine, session);
96+
8297
m_managed_session_index = managed_session_index;
83-
m_completion_routine = callback;
98+
m_completion_routine = completion_routine;
8499
m_session = session;
85100
m_context = _process_end;
86101
m_result = false;
@@ -90,11 +105,12 @@ void __thiscall c_managed_session_overlapped_task::process_game_end(int32 manage
90105
reset();
91106
}
92107

93-
//.text:00442C50 ; void __cdecl c_managed_session_overlapped_task::process_game_start(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*);
94-
void __thiscall c_managed_session_overlapped_task::process_game_start(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session)
108+
void c_managed_session_overlapped_task::process_game_start(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session)
95109
{
110+
//INVOKE_CLASS_MEMBER(0x00442C50, c_managed_session_overlapped_task, process_game_start, managed_session_index, completion_routine, session);
111+
96112
m_managed_session_index = managed_session_index;
97-
m_completion_routine = callback;
113+
m_completion_routine = completion_routine;
98114
m_session = session;
99115
m_context = _process_start;
100116
m_result = false;
@@ -104,36 +120,44 @@ void __thiscall c_managed_session_overlapped_task::process_game_start(int32 mana
104120
reset();
105121
}
106122

107-
//.text:00442C60 ; void __cdecl c_managed_session_overlapped_task::process_modify(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*, s_online_session*, s_online_session*);
108-
void __thiscall c_managed_session_overlapped_task::process_modify(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, s_online_session* desired_session, s_online_session* actual_session)
123+
void c_managed_session_overlapped_task::process_modify(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, s_online_session* desired_session, s_online_session* actual_session)
109124
{
125+
//INVOKE_CLASS_MEMBER(0x00442C60, c_managed_session_overlapped_task, process_modify, managed_session_index, completion_routine, session, desired_session, actual_session);
126+
110127
m_managed_session_index = managed_session_index;
111128
m_desired_session = desired_session;
112129
m_session = session;
113130
m_actual_session = actual_session;
114131
m_context = _process_modify;
115-
m_completion_routine = callback;
132+
m_completion_routine = completion_routine;
116133
m_result = false;
117134
m_return_result = 0;
118135

119136
if (!overlapped_task_start_internal(this, __FILE__, __LINE__))
120137
reset();
121138
}
122139

123-
//.text:00442C70 ; static bool __cdecl c_managed_session_overlapped_task::process_modify_immediately(s_online_session*, s_online_session*);
140+
bool __cdecl c_managed_session_overlapped_task::process_modify_immediately(s_online_session* desired_session, s_online_session* actual_session)
141+
{
142+
//return INVOKE(0x00442C70, c_managed_session_overlapped_task::process_modify_immediately, desired_session, actual_session);
143+
144+
// $TODO: implement me
124145

125-
//.text:00442C80 ; void __cdecl c_managed_session_overlapped_task::process_remove_players(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*, uns64 const*, bool const*, int32);
126-
void __thiscall c_managed_session_overlapped_task::process_remove_players(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns64 const* a4, bool const* a5, int32 player_count)
146+
return true;
147+
}
148+
149+
void c_managed_session_overlapped_task::process_remove_players(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, int32 player_count)
127150
{
151+
//INVOKE_CLASS_MEMBER(0x00442C80, c_managed_session_overlapped_task, process_remove_players, managed_session_index, completion_routine, session, player_xuids, online_enabled, player_count);
152+
128153
m_session = session;
129154
m_managed_session_index = managed_session_index;
130-
m_completion_routine = callback;
155+
m_completion_routine = completion_routine;
131156
m_context = _process_remove_players;
132157
m_result = false;
133158
m_return_result = 0;
134159

135-
// $TODO: implement `filter_local_users`
136-
//filter_local_users(player_count, a5, a6, NULL);
160+
filter_local_users(player_count, player_xuids, online_enabled, NULL);
137161

138162
if (!m_player_count)
139163
{
@@ -146,27 +170,34 @@ void __thiscall c_managed_session_overlapped_task::process_remove_players(int32
146170
}
147171
}
148172

149-
//.text:00442C90 ; bool __cdecl c_managed_session_overlapped_task::process_remove_players_immediately(s_online_session*, uns64 const*, bool const*, int32);
173+
bool c_managed_session_overlapped_task::process_remove_players_immediately(s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, int32 player_count)
174+
{
175+
//return INVOKE_CLASS_MEMBER(0x00442C90, c_managed_session_overlapped_task, process_remove_players_immediately, session, player_xuids, online_enabled, player_count);
176+
177+
return true;
178+
}
150179

151-
//.text:00442CA0 ; void __cdecl c_managed_session_overlapped_task::process_session_host_migrate(int32, void(__cdecl*)(int32, bool, uns32), s_online_session*, bool, s_transport_session_description*);
152-
void __thiscall c_managed_session_overlapped_task::process_session_host_migrate(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, bool is_host, s_transport_session_description* host_migration_description)
180+
void c_managed_session_overlapped_task::process_session_host_migrate(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, bool is_host, s_transport_session_description* host_migration_description)
153181
{
182+
//INVOKE_CLASS_MEMBER(0x00442CA0, c_managed_session_overlapped_task, process_session_host_migrate, managed_session_index, completion_routine, session, is_host, host_migration_description);
183+
154184
m_managed_session_index = managed_session_index;
155185
m_is_host = is_host;
156186
m_session = session;
157187
m_host_migration_description = host_migration_description;
158188
m_context = _process_session_host_migrate;
159-
m_completion_routine = callback;
189+
m_completion_routine = completion_routine;
160190
m_result = false;
161191
m_return_result = 0;
162192

163193
if (!overlapped_task_start_internal(this, __FILE__, __LINE__))
164194
reset();
165195
}
166196

167-
//.text:00442CB0 ; virtual uns32 __cdecl c_managed_session_overlapped_task::start(void*);
168-
uns32 __thiscall c_managed_session_overlapped_task::start_(void* overlapped)
197+
uns32 c_managed_session_overlapped_task::start_(void* overlapped)
169198
{
199+
//return INVOKE_CLASS_MEMBER(0x00442CB0, c_managed_session_overlapped_task, start, overlapped);
200+
170201
uns32 result = 0;
171202

172203
e_overlapped_task context = m_context;

game/source/networking/session/network_managed_session.hpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ struct c_network_session_membership;
1212
struct c_managed_session_overlapped_task :
1313
public c_overlapped_task
1414
{
15-
void __thiscall process_add_players(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns64 const* a4, bool const* a5, bool const* a6, int32 a7);
16-
void __thiscall process_create(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns16 flags);
17-
void __thiscall process_delete(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session);
18-
void __thiscall process_game_end(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session);
19-
void __thiscall process_modify(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, s_online_session* desired_session, s_online_session* actual_session);
20-
void __thiscall process_game_start(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session);
21-
void __thiscall process_remove_players(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, uns64 const* a4, bool const* a5, int32 player_count);
22-
void __thiscall process_session_host_migrate(int32 managed_session_index, void(__cdecl* callback)(int32, bool, uns32), s_online_session* session, bool is_host, s_transport_session_description* host_migration_description);
15+
using t_completion_routine = void __cdecl(int32, bool, uns32);
16+
17+
void filter_local_users(int32 player_count, uns64 const* players, bool const* online_enabled, bool const* private_slots);
18+
void process_add_players(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, bool const* private_slots, int32 player_count);
19+
bool process_add_players_immediately(s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, bool const* private_slots, int32 player_count);
20+
void process_create(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns16 mask);
21+
void process_delete(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session);
22+
void process_game_end(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session);
23+
void process_modify(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, s_online_session* desired_session, s_online_session* actual_session);
24+
static bool __cdecl process_modify_immediately(s_online_session* desired_session, s_online_session* actual_session);
25+
void process_game_start(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session);
26+
void process_remove_players(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, int32 player_count);
27+
bool process_remove_players_immediately(s_online_session* session, uns64 const* player_xuids, bool const* online_enabled, int32 player_count);
28+
void process_session_host_migrate(int32 managed_session_index, t_completion_routine* completion_routine, s_online_session* session, bool is_host, s_transport_session_description* host_migration_description);
2329
uns32 __thiscall start_(void* overlapped);
2430

2531
void __thiscall complete_();
@@ -43,7 +49,7 @@ struct c_managed_session_overlapped_task :
4349
s_online_session* m_desired_session;
4450
s_online_session* m_actual_session;
4551
int32 m_managed_session_index;
46-
void(__cdecl* m_completion_routine)(int32, bool, uns32);
52+
t_completion_routine* m_completion_routine;
4753
bool m_result;
4854
uns32 m_return_result;
4955
uns16 m_mask;

0 commit comments

Comments
 (0)