a-blondel / mohh2-server

Server for Medal Of Honor Heroes 2
0 stars 0 forks source link

Disconnection when starting a game (multiplayer without "serverless" patch) #6

Open a-blondel opened 9 months ago

a-blondel commented 9 months ago

For the game to start, we had two things to do :

I summarize how we got to that step 2 :

Based on this, when the request was :

00 00 00 05 75 53 16 c0 00 00 00 02

we replied :

00 00 00 02 75 53 16 c0 00 00 00 02

After that, the UDP exchange starts, but the game disconnects after the map has loaded.

game-disconnect

Based on the Webkit, we hit a timeout here, but we don't know yet how to avoid it.

Information gathered by reverse engineering :

sub_8025BC64 called at 0x8025BC64 is a loop designed to continue executing until a specific condition is met, but currently, that condition is not being satisfied.
During each iteration of this loop, it calls sub_80153BFC which performs a tick comparison.
After some time, this function modifies the memory address at 0x8073A854, setting it to the value 2 by calling sub_8015B544. This will terminate the loop (by calling sub_8015B558) and trigger an error message, resulting in a disconnection.
The loop also branches to 0x805a4f64 which sends a UDP packet.

Callstack from the loop to the function for sending the packet:
SocketSendto sub_800407C0 
_CommUDPWrite sub_800164E8 0x80016544
CommUDPSend sub_80017BD0 0x80017d28
_NetGameLinkSendPacket sub_8001ADF8 0x8001af34
NetGameLinkSend sub_8001ADF8 0x8001b904
sub_805A4960 0x805a4a38
sub_805A48F4 0x805a4944
sub_8059ED40 0x8059f08c
sub_805A3E20 0x805a40e8
sub_805A1224 0x805a12a8
sub_805A1CF8 0x805a1d20
sub_80146DE4 0x80146e20

It is surely related to specific UDP packets that we can't understand yet, see the wiki.

As the game is based on the EAGL and uses the EA Webkit/Dirty SDK, we can hope that the Burnout/Need For Speed modding community have some knowledge on that (very unlikely because these games are P2P, so they don't need to understand UDP packets).

To better understand the similarities between this game and Burnout Paradise, packet capture links are given in the wiki.

Edit : I used Burnout Paradise as host, but as packets aren't fully identical MoHH2 don't understand them and still disconnect.

a-blondel commented 2 days ago

Now we have the UHS (user hosted server) for MoHH on PSP and are able to host games and play on them, we will be able to test the UHS for MoHH2 and try to adjust anything necessary