Skip to content
Permalink
Browse files

Improved LIVE list download speed by far.

Force QoS dummy data in-game.
Totally disable XHV GFWL voice engine with startup flag.
  • Loading branch information...
NukeULater
NukeULater committed Mar 31, 2019
1 parent f5b912a commit 1d14f0d21a240ddc15517e2ab37ec171ceef017f
@@ -1420,8 +1420,8 @@ on_custom_map_change on_custom_map_change_method;

void __cdecl onCustomMapChange(const void* a1) {
on_custom_map_change_method(a1);
//map changed, send update
mapManager->sendMapInfoPacket();
//map changed, send update to all players
mapManager->sendMapInfoPacket(-1);
}

typedef char(__stdcall *intercept_map_load)(LPCRITICAL_SECTION* thisx, const void *a2);
@@ -540,7 +540,7 @@ int WINAPI XLiveRender()
}
}
DWORD GameGlobals = *(DWORD*)((BYTE*)h2mod->GetBase() + ((h2mod->Server) ? 0x4CB520 : 0x482D3C));
DWORD& GameEngine = *(DWORD*)(GameGlobals + 0x8);
DWORD GameEngine = *(DWORD*)(GameGlobals + 0x8);
bool paused_or_in_menus = *((BYTE*)h2mod->GetBase() + 0x47A568) != 0;
if (GameEngine == 3 || StatusCheater || (GameEngine != 3 && paused_or_in_menus)) {
drawText(0, 0, COLOR_WHITE, BuildText, smallFont);
@@ -93,7 +93,7 @@ bool H2Config_disable_ingame_keyboard = false;
bool H2Config_hide_ingame_chat = false;
bool H2Config_xDelay = true;
//bool H2Config_hitmarker_sound = false;
bool H2Config_voice_chat = true;
bool H2Config_voice_chat = false;
int H2Config_custom_resolution_x = 0;
int H2Config_custom_resolution_y = 0;
char H2Config_dedi_server_name[32] = { "" };
@@ -48,11 +48,6 @@ std::string EMPTY_STR("");

int downloadPercentage = 0;

/**
* Constructs the map manager for client/servers
*/
MapManager::MapManager() {}

/**
* Download map callback
*/
@@ -92,7 +87,6 @@ char __cdecl handle_map_download_callback()
};

std::thread(mapDownload).detach();

return 1;
}

@@ -114,14 +108,16 @@ int __cdecl get_total_map_downloading_percentage()
return downloadPercentage;
}

wchar_t receiving_map_wstr[] = L"You are receiving the map from %s. \r\nPlease wait...%i%%";
wchar_t* receiving_map_wstr[] = {
L"You are receiving the map from %s. \r\nPlease wait...%i%%" ,
};
wchar_t* get_receiving_map_string()
{
int(__cdecl* get_default_game_language)() = (int(__cdecl*)())((char*)H2BaseAddr + 0x381fd);
wchar_t** str_array = (wchar_t**)(h2mod->GetBase() + 0x46575C);

if (get_default_game_language() == 0) // check if english
return receiving_map_wstr;
return receiving_map_wstr[0];

return str_array[get_default_game_language()];
}
@@ -366,7 +362,8 @@ void MapManager::cleanup() {
this->downloadedMaps.clear();
}

void MapManager::sendMapInfoPacket()
// set peerIndex argument to -1 send the packet to every connected peer
void MapManager::sendMapInfoPacket(int peerIndex)
{
#ifdef _DEBUG
int tmpFlagOrig = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
@@ -390,7 +387,7 @@ void MapManager::sendMapInfoPacket()
//TODO: send over size so p2p can work easier
map_info->set_mapsize(0);

network->send_h2mod_packet(teampak);
peerIndex == -1 ? network->send_h2mod_packet(teampak) : network->send_h2mod_packet_player(peerIndex, teampak);

#ifdef _DEBUG
_CrtSetDbgFlag(tmpFlagOrig);
@@ -9,11 +9,10 @@
*/
class MapManager {
public:
MapManager();
//client and server functions below
void reloadMaps();
void cleanup();
void sendMapInfoPacket();
void sendMapInfoPacket(int peerIndex); // set peerIndex to -1 to send to all peers in the lobby
const char* getCustomLobbyMessage();
std::wstring getMapName();
bool hasCustomMap(std::string mapName);
@@ -16,6 +16,7 @@
extern unsigned short H2Config_base_port;
extern SOCKET game_network_data_gateway_socket_1000;
extern SOCKET game_network_message_gateway_socket_1001;
extern int __cdecl QoSLookUpImpl(int a1, signed int a2, int a3, int a4);

const char* getTextForEnum(int enumVal) {
return packet_type_strings[enumVal];
@@ -298,7 +299,7 @@ bool __cdecl deserializePlayerAdd(void* a1, int a2, int a3) {
auto p_deserialize_player_add = reinterpret_cast<deserialize_player_add>(h2mod->GetBase() + (h2mod->Server ? 0x1D110B : 0x1F0752));

//inform new players of the current map info
mapManager->sendMapInfoPacket();
mapManager->sendMapInfoPacket(-1);
//inform new players of the current advanced lobby settings
//advLobbySettings->sendLobbySettingsPacket();
// send server map checksums to client
@@ -687,7 +688,7 @@ void __cdecl serializeMembershipPacket(void* a1, int a2, int a3) {
v4 += 184;
} while (v3 < *(WORD*)(a3 + 32));
}*/
mapManager->sendMapInfoPacket();
mapManager->sendMapInfoPacket(-1);
//advLobbySettings->sendLobbySettingsPacket();
// send server map checksums to client
//MapChecksumSync::SendState();
@@ -747,7 +748,7 @@ typedef void(__cdecl *serialize_parameters_update_packet)(void* a1, int a2, int
serialize_parameters_update_packet serialize_parameters_update_packet_method;

void __cdecl serializeParametersUpdatePacket(void* a1, int a2, int a3) {
mapManager->sendMapInfoPacket();
mapManager->sendMapInfoPacket(-1);
//advLobbySettings->sendLobbySettingsPacket();
// send server map checksums to client
//MapChecksumSync::SendState();
@@ -815,18 +816,20 @@ void removeXNetSecurity()

}


void applyConnectionPatches()
{
DWORD dwBack;
//removeXNetSecurity();
WritePointer(h2mod->GetBase() + (h2mod->Server ? 0x1D20E4 : 0x1F172B), (void*)deserialize_join_request);

NopFill<9>(h2mod->GetBase() + (h2mod->Server ? 0x1B3CC3 : 0x1F1F94)); // check if secure/ipaddress != 127.0.0.1
// force hard-coded qos data in-lobby
PatchCall(h2mod->GetBase() + (h2mod->Server ? 0x1B7B8A : 0x1BDCB0), QoSLookUpImpl);

//NopFill<9>(h2mod->GetBase() + (h2mod->Server ? 0x1B3CC3 : 0x1F1F94)); // check if secure/ipaddress != 127.0.0.1
// disable network observer (broken on H2V)
WriteValue<BYTE>(h2mod->GetBase() + (h2mod->Server ? 0x1A92BA : 0x1B555C), (BYTE)0);
//WriteValue<BYTE>(h2mod->GetBase() + (h2mod->Server ? 0x1A92BA : 0x1B555C), (BYTE)0);
// also ping bars
WriteValue<BYTE>(h2mod->GetBase() + (h2mod->Server ? 0x1C1B7F : 0x1D4E35), 0xEB);
//WriteValue<BYTE>(h2mod->GetBase() + (h2mod->Server ? 0x1C1B7F : 0x1D4E35), 0xEB);

// makes Live network not as laggy
/*int data = 500;
@@ -249,7 +249,7 @@ void sound_initialize()
enum flags : int
{
windowed,
unk, // some network thing
disable_voice_chat,
nosound,
unk1, // disable vista needed version check?
disable_hardware_vertex_processing, // force hardware vertex processing off
@@ -359,6 +359,7 @@ bool engine_basic_init()
DWORD* flags_array = reinterpret_cast<DWORD*>(H2BaseAddr + 0x0046d820);
memset(flags_array, 0x00, flags::count); // should be zero initalized anyways but the game does it

flags_array[flags::disable_voice_chat] = 1; // disables voice chat (XHV engine)
flags_array[flags::nointro] = H2Config_skip_intro;

HANDLE(*fn_c000285fd)() = (HANDLE(*)())(GetAddress(0x000285fd));
@@ -412,6 +413,10 @@ bool engine_basic_init()
sub_671B02_orig = (sub_671B02_ptr)DetourFunc((BYTE*)H2BaseAddr + 0x271B02, (BYTE*)sub_671B02_hook, 5);
VirtualProtect(sub_671B02_orig, 4, PAGE_EXECUTE_READWRITE, &dwBack);
}
else if (_wcsicmp(cmd_line_arg, L"-voicechat") == 0)
{
flags_array[flags::disable_voice_chat] = 0;
}
#ifdef _DEBUG
else if (_wcsnicmp(cmd_line_arg, L"-dev_flag:", 10) == 0) {
int flag_id = _wtol(&cmd_line_arg[10]);

0 comments on commit 1d14f0d

Please sign in to comment.
You can’t perform that action at this time.