Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug in W3GS_INCOMING_ACTION handler #7

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 0 comments
Open

A bug in W3GS_INCOMING_ACTION handler #7

GoogleCodeExporter opened this issue Mar 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

take a look at the code blow:

else if( Packet->GetID( ) == CGameProtocol :: W3GS_INCOMING_ACTION )
{
    if( m_GameIsReliable )
    {
        // we received a game update which means we can reset the number of empty actions we have to work with
        // we also must send any remaining empty actions now
        // note: the lag screen can't be up right now otherwise the server made a big mistake, so we don't need to check for it

        BYTEARRAY EmptyAction;
        EmptyAction.push_back( 0xF7 );
        EmptyAction.push_back( 0x0C );
        EmptyAction.push_back( 0x06 );
        EmptyAction.push_back( 0x00 );
        EmptyAction.push_back( 0x00 );
        EmptyAction.push_back( 0x00 );

        for( unsigned char i = m_NumEmptyActionsUsed; i < m_NumEmptyActions; i++ )
            m_LocalSocket->PutBytes( EmptyAction );

        m_NumEmptyActionsUsed = 0;
    }

    m_ActionReceived = true;
    m_LastActionTime = GetTime( );
}

GProxy sends a couple (m_NumEmptyActions) of empty actions on EACH 
W3GS_INCOMING_ACTION packet, and this issue cause non-gproxy players to desync 
with others.

W3GS_INCOMING_ACTION2 handler doesn't have this issue, it does send required 
number of emty actions only once after reconnect happens:

else if( Packet->GetID( ) == CGameProtocol :: W3GS_INCOMING_ACTION2 )
{
    if( m_GameIsReliable )
    {
        // we received a fractured game update which means we cannot use any empty actions until we receive the subsequent game update
        // we also must send any remaining empty actions now
        // note: this means if we get disconnected right now we can't use any of our buffer time, which would be very unlucky
        // it still gives us 60 seconds total to reconnect though
        // note: the lag screen can't be up right now otherwise the server made a big mistake, so we don't need to check for it

        BYTEARRAY EmptyAction;
        EmptyAction.push_back( 0xF7 );
        EmptyAction.push_back( 0x0C );
        EmptyAction.push_back( 0x06 );
        EmptyAction.push_back( 0x00 );
        EmptyAction.push_back( 0x00 );
        EmptyAction.push_back( 0x00 );

        for( unsigned char i = m_NumEmptyActionsUsed; i < m_NumEmptyActions; i++ )
            m_LocalSocket->PutBytes( EmptyAction );

        m_NumEmptyActionsUsed = m_NumEmptyActions;
    }
}


diff:
m_NumEmptyActionsUsed = 0;
m_NumEmptyActionsUsed = m_NumEmptyActions;


Original issue reported on code.google.com by [email protected] on 29 Apr 2014 at 6:40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant