Ares
Functions

Network.cpp File Reference

#include "Network.h"
#include "Debug.h"
#include "../Ares.h"
#include "../Ext/Building/Body.h"
#include "../Ext/House/Body.h"
#include <BuildingClass.h>
#include <HouseClass.h>
#include <NetworkEvents.h>

Functions

 DEFINE_HOOK (4C6CCD, Networking_RespondToEvent, 0)
 DEFINE_HOOK (64CCBF, DoList_ReplaceReconMessage, 6)

Function Documentation

DEFINE_HOOK ( 4C6CCD  ,
Networking_RespondToEvent  ,
 
)
{
        GET(DWORD, EventKind, EAX);
        GET(NetworkEvent *, Event, ESI);

        if(EventKind >= AresNetEvent::aev_First) {
                // Received Ares event, do something about it
                switch(EventKind) {
                        case AresNetEvent::aev_TrenchRedirectClick:
                                AresNetEvent::Handlers::RespondToTrenchRedirectClick(Event);
                                break;
                        case AresNetEvent::aev_FirewallToggle:
                                AresNetEvent::Handlers::RespondToFirewallToggle(Event);
                                break;
                }
        }

        --EventKind;
        R->EAX(EventKind);
        return (EventKind > 0x2D)
         ? 0x4C8109
         : 0x4C6CD7
        ;
}
DEFINE_HOOK ( 64CCBF  ,
DoList_ReplaceReconMessage  ,
 
)
{
        // mimic an increment because decrement happens in the middle of function cleanup and can't be erased nicely
        int &TempMutex = *(int *)(0xA8DAB4);
        ++TempMutex;

        Debug::Log("Reconnection error detected!");
        if(MessageBoxW(Game::hWnd, L"Yuri's Revenge has detected a desynchronization!\n"
                        L"Would you like to create a full error report for the developers?\n"
                        L"Be advised that reports from at least two players are needed.", L"Reconnection Error!", MB_YESNO | MB_ICONERROR) == IDYES) {
                HCURSOR loadCursor = LoadCursor(NULL, IDC_WAIT);
                SetClassLong(Game::hWnd, GCL_HCURSOR, (LONG)loadCursor);
                SetCursor(loadCursor);
                Debug::Log("Making a memory snapshot\n");

                Debug::FullDump(NULL);

                loadCursor = LoadCursor(NULL, IDC_ARROW);
                SetClassLong(Game::hWnd, GCL_HCURSOR, (LONG)loadCursor);
                SetCursor(loadCursor);
                Debug::FatalError("A desynchronization has occurred.\r\n"
                        "%s"
                        "A crash dump should have been created in your game's \\debug subfolder.\r\n"
                        "Please submit that to the developers along with SYNC*.txt, debug.txt and syringe.log."
                                , Debug::bParserErrorDetected ? "(One or more parser errors have been detected that might be responsible. Check the debug logs.)\r\n" : ""
                );
        }

        return 0x64CD11;
}
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines