Skip to content

Commit

Permalink
Updated c_network_configuration_globals
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Nov 20, 2024
1 parent 4f53428 commit 556484d
Show file tree
Hide file tree
Showing 19 changed files with 1,056 additions and 1,066 deletions.
2 changes: 1 addition & 1 deletion game/source/game/game_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void __cdecl game_engine_interface_update(real world_seconds_elapsed)
if (c_load_boot_betrayer_screen_message* message = new c_load_boot_betrayer_screen_message(controller_index, window_index, STRING_ID(gui, top_most), &player->player_identifier, &griefer->player_identifier))
{
user_interface_messaging_post(message);
sub_6790A0(controller_index, true);
game_grief_set_ui_active_for_local_user(controller_index, true);
}
}
}
Expand Down
42 changes: 21 additions & 21 deletions game/source/game/game_grief.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void __cdecl game_grief_record_reprieve()
//if (game_is_playback())
// return;
//
//game_grief_globals.reprieve_time = system_milliseconds();
//game_grief_globals.time_of_last_forgiveness_ms = system_milliseconds();
//generate_event(_event_status, "betrayal forgiveness granted");
}

Expand All @@ -23,8 +23,8 @@ bool __cdecl game_grief_can_eject(long player_index)
// return;
//
//return (!current_game_variant() || current_game_variant()->get_active_variant()->get_social_options()->get_betrayal_booting_enabled())
// && global_preferences_get_eviction_count() <= g_network_configuration.maximum_griefer_eviction_count
// && game_grief_globals.reprieve_time <= 0;
// && global_preferences_get_eviction_count() <= g_network_configuration.griefer_config.ejection_cutoff
// && game_grief_globals.time_of_last_forgiveness_ms <= 0;
}

void __cdecl game_grief_dispose()
Expand All @@ -44,7 +44,7 @@ bool __cdecl game_grief_get_ui_active_for_local_user(e_controller_index controll
//if (game_is_playback())
// return false;
//
//return game_grief_globals.ui_active[controller_index];
//return game_grief_globals.betrayal_boot_ui_active_for_user[controller_index];
}

void __cdecl game_grief_initialize()
Expand All @@ -58,8 +58,8 @@ void __cdecl game_grief_initialize_for_new_map()
{
INVOKE(0x00678FF0, game_grief_initialize_for_new_map);

//long constexpr k_size = sizeof(game_grief_globals) - OFFSETOF(s_game_grief_globals, reprieve_time);
//csmemset(&game_grief_globals.reprieve_time, 0, k_size);
//long constexpr k_size = sizeof(game_grief_globals) - OFFSETOF(s_game_grief_globals, time_of_last_forgiveness_ms);
//csmemset(&game_grief_globals.time_of_last_forgiveness_ms, 0, k_size);
}

void __cdecl game_grief_record_betrayal(long player_index)
Expand All @@ -72,8 +72,8 @@ void __cdecl game_grief_record_betrayal(long player_index)
//e_controller_index controller = player_mapping_get_input_controller(player_index);
//bool is_griefer = false;
//real betrayal_count = global_preferences_get_betrayal_count() + 1;
//game_grief_globals.betrayal_time = system_milliseconds();
//if (betrayal_count >= g_network_configuration.maximum_griefer_betrayal_count && controller != k_no_controller)
//game_grief_globals.grief_user.time_of_last_betrayal_ms = system_milliseconds();
//if (betrayal_count >= g_network_configuration.griefer_config.betrayal_cutoff && controller != k_no_controller)
//{
// user_interface_controller_set_griefer(controller, true);
// user_interface_controller_update_network_properties(controller);
Expand All @@ -97,25 +97,25 @@ void __cdecl game_grief_record_ejection(long player_index)
// return;
//
//long eviction_count = global_preferences_get_eviction_count();
//game_grief_globals.ejection_time = system_milliseconds();
//game_grief_globals.grief_user.time_of_last_ejection_ms = system_milliseconds();
//
//generate_event(_event_status, "ejection recorded for player %d", player_index);
//
//global_preferences_set_eviction_count(eviction_count + 1);
}

void __cdecl sub_6790A0(e_controller_index controller_index, bool ui_active)
void __cdecl game_grief_set_ui_active_for_local_user(e_controller_index controller_index, bool ui_active_for_local_user)
{
INVOKE(0x006790A0, sub_6790A0, controller_index, ui_active);
INVOKE(0x006790A0, game_grief_set_ui_active_for_local_user, controller_index, ui_active_for_local_user);

//if (game_is_playback())
// return;
//
//ASSERT(VALID_INDEX(controller_index, k_number_of_controllers));
//
//game_grief_globals.ui_active[controller_index] = ui_active;
//if (ui_active)
// game_grief_globals.reprieve_time = 0;
//game_grief_globals.betrayal_boot_ui_active_for_user[controller_index] = ui_active_for_local_user;
//if (ui_active_for_local_user)
// game_grief_globals.time_of_last_forgiveness_ms = 0;
}

void __cdecl game_grief_update()
Expand All @@ -128,14 +128,14 @@ void __cdecl game_grief_update()
//unsigned long time = system_milliseconds();
//
//real betrayal_count = global_preferences_get_betrayal_count();
//if (betrayal_count > 0.0f && (time - game_grief_globals.betrayal_time) > g_network_configuration.griefer_betrayal_timeout)
//if (betrayal_count > 0.0f && (time - game_grief_globals.grief_user.time_of_last_betrayal_ms) > g_network_configuration.griefer_config.betrayal_decrement_time)
//{
// generate_event(_event_status, "ejection count decremented!");
//
// game_grief_globals.ejection_time = time;
// game_grief_globals.grief_user.time_of_last_ejection_ms = time;
// global_preferences_set_betrayal_count(MAX(betrayal_count - 1.0f, 0.0f));
//
// if (g_network_configuration.maximum_griefer_betrayal_count > betrayal_count)
// if (g_network_configuration.griefer_config.betrayal_cutoff > betrayal_count)
// {
// for (long controller_index = first_controller(); controller_index != k_no_controller; controller_index = next_controller(controller_index))
// {
Expand All @@ -146,19 +146,19 @@ void __cdecl game_grief_update()
//}
//
//long eviction_count = global_preferences_get_eviction_count();
//if (eviction_count > 0 && (time - game_grief_globals.ejection_time) > g_network_configuration.griefer_ejection_timeout)
//if (eviction_count > 0 && (time - game_grief_globals.grief_user.time_of_last_ejection_ms) > g_network_configuration.griefer_config.eject_decrement_time)
//{
// generate_event(_event_status, "ejection count decremented!");
//
// game_grief_globals.ejection_time = time;
// game_grief_globals.grief_user.time_of_last_ejection_ms = time;
// global_preferences_set_eviction_count(MAX(eviction_count - 1, 0));
//}
//
//if (game_grief_globals.reprieve_time > 0 && time - game_grief_globals.reprieve_time >= 10000)
//if (game_grief_globals.time_of_last_forgiveness_ms > 0 && time - game_grief_globals.time_of_last_forgiveness_ms >= 10000)
//{
// generate_event(_event_status, "forgiveness grace period expired");
//
// game_grief_globals.reprieve_time = 0;
// game_grief_globals.time_of_last_forgiveness_ms = 0;
//}
//
//game_grief_globals.update_time = time;
Expand Down
18 changes: 12 additions & 6 deletions game/source/game/game_grief.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#pragma once

struct s_game_grief_user
{
long time_of_last_betrayal_ms;
long time_of_last_ejection_ms;
long last_update_time_ms;
};
static_assert(sizeof(s_game_grief_user) == 0xC);

struct s_game_grief_globals
{
unsigned long betrayal_time;
unsigned long ejection_time;
unsigned long update_time;
unsigned long reprieve_time;
bool ui_active[4];
s_game_grief_user grief_user;
long time_of_last_forgiveness_ms;
bool betrayal_boot_ui_active_for_user[4];
};
static_assert(sizeof(s_game_grief_globals) == 0x14);

Expand All @@ -23,6 +29,6 @@ extern void __cdecl game_grief_initialize();
extern void __cdecl game_grief_initialize_for_new_map();
extern void __cdecl game_grief_record_betrayal(long player_index);
extern void __cdecl game_grief_record_ejection(long player_index);
extern void __cdecl sub_6790A0(e_controller_index controller_index, bool ui_active);
extern void __cdecl game_grief_set_ui_active_for_local_user(e_controller_index controller_index, bool ui_active_for_local_user);
extern void __cdecl game_grief_update();

50 changes: 25 additions & 25 deletions game/source/game/multiplayer_game_hopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ e_hopper_load_status multiplayer_file_load::get_load_status()
if (force_hopper_load_status_complete)
return _hopper_load_complete;

if (__unknown1)
if (had_load_failure)
return _hopper_load_failed;

if (request_cookie)
return _hopper_load_pending;

if (__unknown0)
if (is_valid)
return _hopper_load_complete;

return _hopper_load_none;
Expand All @@ -108,22 +108,22 @@ void __cdecl multiplayer_game_hopper_load_retried_file_helper(e_multiplayer_file
if (!multiplayer_file->request_cookie)
{
dword time = network_time_get();
if (time >= dword(multiplayer_file->__time1C + multiplayer_file->__time20))
if (time >= dword(multiplayer_file->time_of_last_load + multiplayer_file->retry_interval))
{
c_network_http_request_queue* request_queue = c_network_http_request_queue::get(_network_http_request_queue_type_unknown0);
c_network_http_request_description request_description(url, _http_request_type_get, &multiplayer_file->hash);
if (multiplayer_file->__unknown1)
c_network_http_request_description request_description(url, _http_request_type_get, &multiplayer_file->configuration_hash);
if (multiplayer_file->had_load_failure)
{
multiplayer_file->request_cookie = request_queue->start_request_into_buffer(_online_lsp_service_type_title_files, &request_description, (char*)buffer, buffer_length);
}
else if (request_queue->has_file_changed(&request_description))
{
multiplayer_file->__time20 = 0;
multiplayer_file->retry_interval = 0;
multiplayer_file->request_cookie = request_queue->start_request_into_buffer(_online_lsp_service_type_title_files, &request_description, (char*)buffer, buffer_length);
}
else
{
multiplayer_file->__time1C = time;
multiplayer_file->time_of_last_load = time;
}
}
}
Expand Down Expand Up @@ -519,11 +519,11 @@ void __cdecl multiplayer_game_hopper_request_game_variant(word hopper_identifier
c_network_http_request_queue::get(_network_http_request_queue_type_unknown0)->cancel_request(multiplayer_file.request_cookie);
multiplayer_file.request_cookie = 0;
}
multiplayer_file.__time1C = 0;
multiplayer_file.__time20 = 0;
multiplayer_file.time_of_last_load = 0;
multiplayer_file.retry_interval = 0;
online_url_make_matchmaking_game_variant(&url, hopper_identifier, variant_name);
MULTIPLAYER_GAME_HOPPER_LOAD_RETRIED_FILE(_multiplayer_file_game_variant, url.get_string(), multiplayer_game_hopper_globals.game_variant_download_buffer);
multiplayer_file.__unknown1 = false;
multiplayer_file.had_load_failure = false;
}

void __cdecl multiplayer_game_hopper_request_map_variant(word hopper_identifier, char const* variant_name, s_network_http_request_hash const* hash)
Expand All @@ -537,11 +537,11 @@ void __cdecl multiplayer_game_hopper_request_map_variant(word hopper_identifier,
c_network_http_request_queue::get(_network_http_request_queue_type_unknown0)->cancel_request(multiplayer_file.request_cookie);
multiplayer_file.request_cookie = 0;
}
multiplayer_file.__time1C = 0;
multiplayer_file.__time20 = 0;
multiplayer_file.time_of_last_load = 0;
multiplayer_file.retry_interval = 0;
online_url_make_matchmaking_map_variant(&url, hopper_identifier, variant_name);
MULTIPLAYER_GAME_HOPPER_LOAD_RETRIED_FILE(_multiplayer_file_map_variant, url.get_string(), multiplayer_game_hopper_globals.game_variant_download_buffer);
multiplayer_file.__unknown1 = false;
multiplayer_file.had_load_failure = false;
}

// called in `c_life_cycle_state_handler_pre_game::update`
Expand Down Expand Up @@ -603,8 +603,8 @@ bool __cdecl multiplayer_game_hopper_set_active_hopper_and_request_game_set(word
game_set_file.request_cookie = 0;
}

game_set_file.__time1C = 0;
game_set_file.__time20 = 0;
game_set_file.time_of_last_load = 0;
game_set_file.retry_interval = 0;

result = true;
}
Expand Down Expand Up @@ -733,7 +733,7 @@ void __cdecl multiplayer_game_hopper_update()
bool failed = false;

long bytes_read = 0;
e_network_http_request_result request_result = request_queue->is_fill_buffer_complete(multiplayer_file->request_cookie, &bytes_read, &multiplayer_file->hash, NULL);
e_network_http_request_result request_result = request_queue->is_fill_buffer_complete(multiplayer_file->request_cookie, &bytes_read, &multiplayer_file->configuration_hash, NULL);
if (request_result == _network_http_request_result_success)
{
switch (multiplayer_game_file)
Expand All @@ -753,8 +753,8 @@ void __cdecl multiplayer_game_hopper_update()
{
request_queue->cancel_request(game_set_file.request_cookie);
game_set_file.request_cookie = 0;
game_set_file.__time1C = 0;
game_set_file.__time20 = 0;
game_set_file.time_of_last_load = 0;
game_set_file.retry_interval = 0;
}
}
}
Expand Down Expand Up @@ -807,10 +807,10 @@ void __cdecl multiplayer_game_hopper_update()
if (!failed)
{
multiplayer_file->request_cookie = 0;
multiplayer_file->__unknown0 = true;
multiplayer_file->__unknown1 = false;
multiplayer_file->__time1C = network_time_get();
multiplayer_file->__time20 = g_network_configuration.config_download.__unknown4;
multiplayer_file->is_valid = true;
multiplayer_file->had_load_failure = false;
multiplayer_file->time_of_last_load = network_time_get();
multiplayer_file->retry_interval = g_network_configuration.config_download.required_file_invalidation_check_interval_msec;
}
}
else if (request_result == _network_http_request_result_failure)
Expand All @@ -821,9 +821,9 @@ void __cdecl multiplayer_game_hopper_update()
if (failed)
{
multiplayer_file->request_cookie = 0;
multiplayer_file->__unknown1 = true;
multiplayer_file->__time1C = network_time_get();
multiplayer_file->__time20 = network_configuration_calculate_next_retry_interval(multiplayer_file->__time20, g_network_configuration.config_download.__unknown8);
multiplayer_file->is_valid = true;
multiplayer_file->time_of_last_load = network_time_get();
multiplayer_file->retry_interval = network_configuration_calculate_next_retry_interval(multiplayer_file->retry_interval, g_network_configuration.config_download.required_file_download_retry_interval_msec);

generate_event(_event_message, "networking:configuration: could not retrieve multiplayer game file [%d]",
multiplayer_game_file);
Expand Down
11 changes: 5 additions & 6 deletions game/source/game/multiplayer_game_hopper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,12 @@ struct multiplayer_file_load
{
e_hopper_load_status get_load_status();

bool __unknown0;
bool __unknown1;
byte __data2[0x2];
bool is_valid;
bool had_load_failure;
long request_cookie;
s_network_http_request_hash hash;
long __time1C;
long __time20;
s_network_http_request_hash configuration_hash;
dword time_of_last_load;
dword retry_interval;
};
static_assert(sizeof(multiplayer_file_load) == 0x24);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "networking/logic/storage/network_http_buffer_downloader.hpp"
#include "memory/module.hpp"

using t_motd_popup_data_downloader = c_http_blf_simple_downloader<s_motd_popup_data>;
using t_motd_popup_data_downloader = c_http_blf_simple_downloader<s_motd_popup_data, 4665>;
e_download_status __thiscall t_motd_popup_data_downloader::get_data(s_motd_popup_data const** data, long* data_size)
{
static s_motd_popup_data static_data{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ struct c_gui_screen_pregame_lobby :
void __thiscall initialize_();

protected:
long __unknown1AA0;
bool __unknown1AA4;
bool __unknown1AA5;
bool __unknown1AA6;
bool __unknown1AA7;

struct //c_http_blf_simple_downloader<s_motd_struct> m_motd_popup_downloader;
{
c_http_stored_buffer_downloader<4665> downloader;
long __unknown_index_or_count;
char const* m_chunk_buffer;
long m_chunk_buffer_size;

} m_motd_popup_downloader;
long m_last_countdown_value;
bool m_is_fading;
bool m_advanced_options_visible;
bool m_change_teams_visible;
bool m_postgame_stats_visible;
c_http_blf_simple_downloader<s_motd_struct, 4665> m_motd_popup_downloader;
bool m_motd_popup_downloaded;

long __unknown338C;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "networking/logic/storage/network_http_buffer_downloader.hpp"
#include "memory/module.hpp"

using t_motd_data_downloader = c_http_blf_simple_downloader<s_motd_data>;
using t_motd_data_downloader = c_http_blf_simple_downloader<s_motd_data, 2721>;
e_download_status __thiscall t_motd_data_downloader::get_data(s_motd_data const** data, long* data_size)
{
static s_motd_data static_data{};
Expand Down
2 changes: 1 addition & 1 deletion game/source/memory/secure_signature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ static_assert(sizeof(s_network_http_request_hash) == 0x14);

struct s_rsa_signature
{
qword data[32];
byte signature[0x100];
};
static_assert(sizeof(s_rsa_signature) == 0x100);
4 changes: 2 additions & 2 deletions game/source/networking/logic/logic_session_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ bool c_session_tracker::allocate_storage(long tracker_sort_method, long qos_stat
m_matchmaking_quality = matchmaking_quality;

m_expected_qos_data_type = qos_status_data_type;
m_qos_attempt_count = MIN(MAX(QOS_ATTEMPT_MIN_COUNT, g_network_configuration.logic_qos_attempt_count), QOS_ATTEMPT_MAX_COUNT);
m_qos_attempt_count = MIN(MAX(QOS_ATTEMPT_MIN_COUNT, g_network_configuration.logic.session_tracker.maximum_qos_tasks), QOS_ATTEMPT_MAX_COUNT);

// logic-session-array
m_session_storage_size = sizeof(s_network_session_tracker_session) * SESSION_STORAGE_COUNT;
m_sessions = (s_network_session_tracker_session*)network_heap_allocate_block(m_session_storage_size);

// logic-unsuitable-session-array
m_unsuitable_session_maximum_count = g_network_configuration.logic_unsuitable_session_count;
m_unsuitable_session_maximum_count = g_network_configuration.logic.session_tracker.unsuitable_session_cache_count;
m_unsuitable_session_storage_size = sizeof(s_session_tracker_unsuitable_session) * m_unsuitable_session_maximum_count;
m_unsuitable_sessions = (s_session_tracker_unsuitable_session*)network_heap_allocate_block(sizeof(s_session_tracker_unsuitable_session) * m_unsuitable_session_maximum_count);

Expand Down
Loading

0 comments on commit 556484d

Please sign in to comment.