ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.59k stars 598 forks source link

Server browser History and Favorite tabs are cleared out every now and then #2645

Open CS-PRO1 opened 4 years ago

CS-PRO1 commented 4 years ago

As per title. I only experienced it in CS 1.6 and HLDM but not quite sure about the rest of games. moved from https://github.com/ValveSoftware/halflife/issues/2620 to a new issue in response to @mikela-valve 's request:

@basuritashka @Maxi605 @CS-PRO1 We should open another issue if there isn't one already to see about addressing the server browser clearing or reloading incorrectly.

Maxi605 commented 4 years ago

I experience this on CS 1.6 only on the History Tab, the rest (Tabs) work fine for me, even if there's no servers to show it freezes the game for 1 to 3 seconds, if necessary i can record a video with background gameplay so the freeze can be heard

CS-PRO1 commented 4 years ago

@kisak-valve I meant Half-life's deathmatch not DMC. @Maxi605 Yea it's known but keep it in a separate issue report for easier tracking.

RauliTop commented 4 years ago

Previously, that happened when you joined a malicious server.

I'm not really sure. To test it you can add your trusted servers and only play on them, when they have been removed, come here to notify it. And check how many time passed.

SamVanheer commented 4 years ago

For reference, this is the API function used to add favorites: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/steam/isteammatchmaking.h#L73-L74

I checked my favorites history file (Steam\userdata\<account id>\7\remote\serverbrowser_hist.vdf) and all the servers listed have app id 0. When i added one through the server browser using CS public release it added one with app id 10.

Note that all of the servers that were listed are no longer responding, so it's possible that Steam is pinging the servers and changing the app id to 0 if they no longer respond.

Additionally, when i started HL public release and created a new lan server, adding the server to favorites updated the history file and changed the CS server to app id 0, and added the new one with app id 0 as well:

"19"
{
    "name"      "192.168.56.1:27015"
    "address"       "192.168.56.1:27015"
    "LastPlayed"        "1564404758"
    "appid"     "0"
    "accountid"     "0"
}
"40"
{
    "name"      "1.56.168.192:27015"
    "address"       "1.56.168.192:27015"
    "LastPlayed"        "1564404757"
    "appid"     "0"
    "accountid"     "0"
}

As you can see it adds the same IP twice, once normally and once as a reversed IP. The reversed IP is added when i click Add Current Server while hosting a listen server. I believe this happens because of a missing byte swap operation, see #508 for details.

Also the number used for this VDF block is not a linearly increased number. The file starts at 1 and counts up to 7, then jumps to 19 and then to 40. Removing and adding the current listen server using Add Current Server reliably uses 40 as the number, and adding it using Add Server and pasting the IP:port address from the LAN tab uses 19.

The app id for servers added to favorites is set to 0 in CDialogAddServer::OnOK, so that might be what's causing the problem. I can't see any code that filters on app id but that might be involved.

@mikela-valve This information and the information i provided previously in #508 should be sufficient to solve a few issues at least.

CS-PRO1 commented 4 years ago

I recently got DOD and tested it as well. Last week I played some games and saved 2 servers in the Favorites. Today I opened up the game and never found any servers in neither Favorites nor History tabs. I'm starting to feel this is happening in all MP Goldsrc games. @kisak-valve Add DOD label please. Also Fix proposed for Sam's comment.

SamVanheer commented 4 years ago

We don't know what exactly is causing the problem so don't mark it as fix proposed yet.