Fix crash if disconnected while connecting
This commit is contained in:
parent
9792a40b33
commit
11067ceeed
@ -131,6 +131,20 @@ namespace network
|
|||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils::hook::detour clear_client_state_hook;
|
||||||
|
void clear_client_state_stub(int a1)
|
||||||
|
{
|
||||||
|
// Kinda shit but it works
|
||||||
|
// does a bunch of memset on bad pointers if called while connecting
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
clear_client_state_hook.invoke<void>(a1);
|
||||||
|
}
|
||||||
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on(const std::string& command, const callback& callback)
|
void on(const std::string& command, const callback& callback)
|
||||||
@ -313,6 +327,9 @@ namespace network
|
|||||||
// Use our own socket since the game's socket doesn't work with non localhost addresses
|
// Use our own socket since the game's socket doesn't work with non localhost addresses
|
||||||
// why? no idea
|
// why? no idea
|
||||||
utils::hook::jump(0x5BD210_b, create_socket, true);
|
utils::hook::jump(0x5BD210_b, create_socket, true);
|
||||||
|
|
||||||
|
// Prevent client from crashing if disconnected while connecting
|
||||||
|
clear_client_state_hook.create(0x12D950_b, clear_client_state_stub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user