@@ -48,17 +48,56 @@ s_network_life_cycle_globals::s_network_life_cycle_globals() :
4848}
4949
5050// .text:00454830 ; void __cdecl network_life_cycle_abort_matchmaking()
51- // .text:004548E0 ; bool __cdecl network_life_cycle_can_change_network_files()
51+
52+ bool __cdecl network_life_cycle_can_change_network_files ()
53+ {
54+ // return INVOKE(0x004548E0, network_life_cycle_can_change_network_files);
55+
56+ bool result = false ;
57+ switch (network_life_cycle_get_state ())
58+ {
59+ case _life_cycle_state_none:
60+ case _life_cycle_state_pre_game:
61+ case _life_cycle_state_in_game:
62+ case _life_cycle_state_end_game_write_stats:
63+ case _life_cycle_state_in_match:
64+ case _life_cycle_state_post_match:
65+ {
66+ result = true ;
67+ }
68+ break ;
69+ }
70+ return result;
71+ }
72+
5273// .text:00454930 ; bool __cdecl network_life_cycle_create_local_squad(e_network_session_class)
5374
5475bool __cdecl network_life_cycle_desires_qos_reply_block_for_group ()
5576{
56- return INVOKE (0x00454A10 , network_life_cycle_desires_qos_reply_block_for_group);
77+ // return INVOKE(0x00454A10, network_life_cycle_desires_qos_reply_block_for_group);
78+
79+ bool result = false ;
80+ switch (network_life_cycle_get_state ())
81+ {
82+ case _life_cycle_state_matchmaking_find_and_assemble_match:
83+ case _life_cycle_state_matchmaking_assemble_match:
84+ {
85+ result = true ;
86+ }
87+ break ;
88+ }
89+ return result;
5790}
5891
5992void __cdecl network_life_cycle_disconnect_sessions ()
6093{
61- INVOKE (0x00454A30 , network_life_cycle_disconnect_sessions);
94+ // INVOKE(0x00454A30, network_life_cycle_disconnect_sessions);
95+
96+ event (_event_message, " networking:lifecycle: FORCE-DISCONNECTING SQUAD" );
97+ life_cycle_globals.life_cycle_state_manager .get_active_squad_session ()->force_disconnect ();
98+
99+ event (_event_message, " networking:lifecycle: FORCE-DISCONNECTING GROUP" );
100+ life_cycle_globals.life_cycle_state_manager .get_group_session ()->force_disconnect ();
62101}
63102
64103void __cdecl network_life_cycle_display_state_strings ()
@@ -107,23 +146,85 @@ void __cdecl network_life_cycle_end()
107146 life_cycle_globals.life_cycle_state_manager .terminate ();
108147}
109148
110- // .text:00454B90 ; bool __cdecl network_life_cycle_game_ending()
111- // .text:00454BB0 ; bool __cdecl network_life_cycle_game_is_in_progress()
112- // .text:00454BD0 ; c_network_session* __cdecl network_life_cycle_get_group_session_for_join()
113- // .text:00454BE0 ; bool __cdecl network_life_cycle_get_matchmaking_gather_party_properties(s_matchmaking_gather_party_properties*)
149+ bool __cdecl network_life_cycle_game_ending ()
150+ {
151+ // return INVOKE(0x00454B90, network_life_cycle_game_ending);
152+
153+ bool result = false ;
154+ switch (network_life_cycle_get_state ())
155+ {
156+ case _life_cycle_state_end_game_write_stats:
157+ case _life_cycle_state_end_match_write_stats:
158+ {
159+ result = true ;
160+ }
161+ break ;
162+ }
163+ return result;
164+ }
165+
166+ bool __cdecl network_life_cycle_game_is_in_progress ()
167+ {
168+ // return INVOKE(0x00454BB0, network_life_cycle_game_is_in_progress);
169+
170+ bool result = false ;
171+ switch (network_life_cycle_get_state ())
172+ {
173+ case _life_cycle_state_in_game:
174+ case _life_cycle_state_in_match:
175+ {
176+ result = true ;
177+ }
178+ break ;
179+ }
180+ return result;
181+ }
182+
183+ c_network_session* __cdecl network_life_cycle_get_group_session_for_join ()
184+ {
185+ // return INVOKE(0x00454BD0, network_life_cycle_get_group_session_for_join);
186+
187+ if (!life_cycle_globals.initialized )
188+ {
189+ return NULL ;
190+ }
191+
192+ return life_cycle_globals.life_cycle_state_manager .get_group_session ();
193+ }
194+
195+ bool __cdecl network_life_cycle_get_matchmaking_gather_party_properties (s_matchmaking_gather_party_properties* gather_party_properties_out)
196+ {
197+ // return INVOKE(0x00454BE0, network_life_cycle_get_matchmaking_gather_party_properties, gather_party_properties_out);
198+
199+ bool result = false ;
200+ switch (network_life_cycle_get_state ())
201+ {
202+ case _life_cycle_state_matchmaking_find_and_assemble_match:
203+ {
204+ result = life_cycle_globals.life_cycle_state_handler_matchmaking_find_and_assemble_match .get_gather_party_properties (gather_party_properties_out);
205+ }
206+ break ;
207+ case _life_cycle_state_matchmaking_assemble_match:
208+ {
209+ result = life_cycle_globals.life_cycle_state_handler_matchmaking_assemble_match .get_gather_party_properties (gather_party_properties_out);
210+ }
211+ break ;
212+ }
213+ return result;
214+ }
114215
115216void __cdecl network_life_cycle_get_matchmaking_progress (s_life_cycle_matchmaking_progress* progress_out)
116217{
117218 // INVOKE(0x00454C20, network_life_cycle_get_matchmaking_progress, progress_out);
118219
119220 csmemset (progress_out, 0 , sizeof (s_life_cycle_matchmaking_progress));
120221 progress_out->progress_type = _life_cycle_matchmaking_progress_none;
121-
222+
122223 if (!life_cycle_globals.life_cycle_state_manager .current_state_ready_for_state_transition_or_query ())
123224 {
124225 return ;
125226 }
126-
227+
127228 switch (network_life_cycle_get_state ())
128229 {
129230 case _life_cycle_state_matchmaking_start:
@@ -174,7 +275,26 @@ void __cdecl network_life_cycle_get_matchmaking_progress(s_life_cycle_matchmakin
174275 }
175276}
176277
177- // .text:00454D30 ; bool __cdecl network_life_cycle_get_matchmaking_search_party_properties(s_matchmaking_search_party_properties*)
278+ bool __cdecl network_life_cycle_get_matchmaking_search_party_properties (s_matchmaking_search_party_properties* search_party_properties_out)
279+ {
280+ // return INVOKE(0x00454D30, network_life_cycle_get_matchmaking_search_party_properties, search_party_properties_out);
281+
282+ bool result = false ;
283+ switch (network_life_cycle_get_state ())
284+ {
285+ case _life_cycle_state_matchmaking_find_match:
286+ {
287+ result = life_cycle_globals.life_cycle_state_handler_matchmaking_find_match .get_search_party_properties (search_party_properties_out);
288+ }
289+ break ;
290+ case _life_cycle_state_matchmaking_find_and_assemble_match:
291+ {
292+ result = life_cycle_globals.life_cycle_state_handler_matchmaking_find_and_assemble_match .get_search_party_properties (search_party_properties_out);
293+ }
294+ break ;
295+ }
296+ return result;
297+ }
178298
179299bool __cdecl network_life_cycle_get_observer (c_network_observer** observer)
180300{
@@ -262,6 +382,7 @@ bool __cdecl network_life_cycle_in_interactive_session(c_network_session** sessi
262382{
263383 // return INVOKE(0x00454E20, network_life_cycle_in_interactive_session, session);
264384
385+ bool result = false ;
265386 switch (network_life_cycle_get_state ())
266387 {
267388 case _life_cycle_state_pre_game:
@@ -276,24 +397,26 @@ bool __cdecl network_life_cycle_in_interactive_session(c_network_session** sessi
276397 case _life_cycle_state_matchmaking_arbitration:
277398 case _life_cycle_state_matchmaking_select_host:
278399 {
279- return network_life_cycle_in_squad_session (session);
400+ result = network_life_cycle_in_squad_session (session);
280401 }
402+ break ;
281403 case _life_cycle_state_matchmaking_prepare_map:
282404 case _life_cycle_state_in_match:
283405 case _life_cycle_state_end_match_write_stats:
284406 case _life_cycle_state_post_match:
285407 {
286- return network_life_cycle_in_group_session (session);
408+ result = network_life_cycle_in_group_session (session);
287409 }
410+ break ;
288411 }
289-
290- return false ;
412+ return result;
291413}
292414
293415bool __cdecl network_life_cycle_in_session (c_network_session** session)
294416{
295417 // return INVOKE(0x00454EA0, network_life_cycle_in_session, session);
296418
419+ bool result = false ;
297420 switch (network_life_cycle_get_state ())
298421 {
299422 case _life_cycle_state_pre_game:
@@ -308,20 +431,21 @@ bool __cdecl network_life_cycle_in_session(c_network_session** session)
308431 case _life_cycle_state_matchmaking_find_and_assemble_match:
309432 case _life_cycle_state_matchmaking_assemble_match:
310433 {
311- return network_life_cycle_in_squad_session (session);
434+ result = network_life_cycle_in_squad_session (session);
312435 }
436+ break ;
313437 case _life_cycle_state_matchmaking_arbitration:
314438 case _life_cycle_state_matchmaking_select_host:
315439 case _life_cycle_state_matchmaking_prepare_map:
316440 case _life_cycle_state_in_match:
317441 case _life_cycle_state_end_match_write_stats:
318442 case _life_cycle_state_post_match:
319443 {
320- return network_life_cycle_in_group_session (session);
444+ result = network_life_cycle_in_group_session (session);
321445 }
446+ break ;
322447 }
323-
324- return false ;
448+ return result;
325449}
326450
327451bool __cdecl network_life_cycle_in_squad_session (c_network_session** session)
@@ -435,23 +559,23 @@ bool __cdecl network_life_cycle_map_load_pending()
435559{
436560 // return INVOKE(0x00455110, network_life_cycle_map_load_pending);
437561
562+ bool result = false ;
438563 switch (network_life_cycle_get_state ())
439564 {
440565 case _life_cycle_state_in_game:
441566 {
442- return ((c_life_cycle_state_handler_in_game*)life_cycle_globals.life_cycle_state_manager .get_current_state_handler ())->is_map_load_pending ();
443- // return life_cycle_globals.life_cycle_state_handler_in_game.is_map_load_pending();
567+ result = ((c_life_cycle_state_handler_in_game*)life_cycle_globals.life_cycle_state_manager .get_current_state_handler ())->is_map_load_pending ();
568+ // result = life_cycle_globals.life_cycle_state_handler_in_game.is_map_load_pending();
444569 }
445570 break ;
446571 case _life_cycle_state_in_match:
447572 {
448- return ((c_life_cycle_state_handler_in_match*)life_cycle_globals.life_cycle_state_manager .get_current_state_handler ())->is_map_load_pending ();
449- // return life_cycle_globals.life_cycle_state_handler_in_match.is_map_load_pending();
573+ result = ((c_life_cycle_state_handler_in_match*)life_cycle_globals.life_cycle_state_manager .get_current_state_handler ())->is_map_load_pending ();
574+ // result = life_cycle_globals.life_cycle_state_handler_in_match.is_map_load_pending();
450575 }
451576 break ;
452577 }
453-
454- return false ;
578+ return result;
455579}
456580
457581void __cdecl network_life_cycle_notify_core_load ()
@@ -531,21 +655,21 @@ bool __cdecl network_life_cycle_post_match_rematch_join_in_progress()
531655 return false ;
532656 }
533657
658+ bool result = false ;
534659 switch (network_life_cycle_get_state ())
535660 {
536661 case _life_cycle_state_joining:
537662 {
538- return life_cycle_globals.life_cycle_state_handler_joining .rematch_join_in_progress ();
663+ result = life_cycle_globals.life_cycle_state_handler_joining .rematch_join_in_progress ();
539664 }
540665 break ;
541666 case _life_cycle_state_post_match:
542667 {
543- return life_cycle_globals.life_cycle_state_handler_post_match .rematch_join_in_progress ();
668+ result = life_cycle_globals.life_cycle_state_handler_post_match .rematch_join_in_progress ();
544669 }
545670 break ;
546671 }
547-
548- return false ;
672+ return result;
549673}
550674
551675void __cdecl network_life_cycle_prepare_for_squad_join ()
@@ -593,11 +717,67 @@ bool __cdecl network_life_cycle_set_pre_game_state()
593717 return true ;
594718}
595719
596- // .text:004552D0 ; bool __cdecl network_life_cycle_squad_is_offline()
597- // .text:004552F0 ; bool __cdecl network_life_cycle_squad_local_peer_is_host()
598- // .text:00455320 ; bool __cdecl network_life_cycle_squad_local_peer_is_leader()
599- // .text:00455350 ; void __cdecl network_life_cycle_swap_squad_sessions()
600- // .text:00455370 ; void __cdecl network_life_cycle_swap_target_and_group_sessions()
720+ bool __cdecl network_life_cycle_squad_is_offline ()
721+ {
722+ // return INVOKE(0x004552D0, network_life_cycle_squad_is_offline);
723+
724+ ASSERT (life_cycle_globals.initialized );
725+
726+ c_network_session* squad_session = life_cycle_globals.life_cycle_state_manager .get_active_squad_session ();
727+ return squad_session->established () && squad_session->session_class () == _network_session_class_offline;
728+ }
729+
730+ bool __cdecl network_life_cycle_squad_local_peer_is_host ()
731+ {
732+ // return INVOKE(0x004552F0, network_life_cycle_squad_local_peer_is_host);
733+
734+ c_network_session* squad_session = NULL ;
735+ if (!network_life_cycle_in_squad_session (&squad_session))
736+ {
737+ return false ;
738+ }
739+
740+ ASSERT (squad_session);
741+ return squad_session->is_host ();
742+ }
743+
744+ bool __cdecl network_life_cycle_squad_local_peer_is_leader ()
745+ {
746+ // return INVOKE(0x00455320, network_life_cycle_squad_local_peer_is_leader);
747+
748+ c_network_session* squad_session = NULL ;
749+ if (!network_life_cycle_in_squad_session (&squad_session))
750+ {
751+ return false ;
752+ }
753+
754+ ASSERT (squad_session);
755+ return squad_session->is_leader ();
756+ }
757+
758+ void __cdecl network_life_cycle_swap_squad_sessions ()
759+ {
760+ // INVOKE(0x00455350, network_life_cycle_swap_squad_sessions);
761+
762+ if (!life_cycle_globals.initialized )
763+ {
764+ return ;
765+ }
766+
767+ life_cycle_globals.life_cycle_state_manager .swap_squad_sessions ();
768+ }
769+
770+ void __cdecl network_life_cycle_swap_target_and_group_sessions ()
771+ {
772+ // INVOKE(0x00455370, network_life_cycle_swap_target_and_group_sessions);
773+
774+ if (!life_cycle_globals.initialized )
775+ {
776+ return ;
777+ }
778+
779+ life_cycle_globals.life_cycle_state_manager .swap_target_and_group_sessions ();
780+ }
601781
602782void __cdecl network_life_cycle_update ()
603783{
0 commit comments