pvpgn / pvpgn-server

Next generation of PvPGN server
https://pvpgn.pro
GNU General Public License v2.0
546 stars 155 forks source link

Diablo 2 1.14d version check failed #377

Open martimarkov opened 5 years ago

martimarkov commented 5 years ago

I’m having an issue with clients using the latest Diablo 2 LoD client for MacOS not being able to connect due to version check failure. But the ABC values are 2 digit numbers in the bnetd.log file.

I’m using the latest master branch. Maybe I’ve missed a step in the setup.

martimarkov commented 5 years ago

This is the log:


Feb 17 17:47:50 [debug] ipbanlist_check: lastcheck: 1550354396, now: 1550422070, now-lc: 67674.
Feb 17 17:47:50 [debug] ipbanlist_check: checking IP_ADDRESS
Feb 17 17:47:50 [info ] sd_accept: [24] accepted connection from IP_ADDRESS:52789 on 0.0.0.0:6112
Feb 17 17:47:50 [debug] conn_create: [24][22] sessionkey=0x1926818276 sessionnum=0x00000006
Feb 17 17:47:50 [debug] sd_accept: [24] client connected to a bnet listening address
Feb 17 17:47:50 [info ] handle_init_packet: [24] client initiated bnet connection
Feb 17 17:47:50 [trace] conn_shutdown: [24] connection already closed
Feb 17 17:47:50 [debug] conn_set_class: added latency check timer
Feb 17 17:47:50 [debug] _client_auth_info: [24] AUTH_INFO packet { protocol=0x0, platform=XMAC, product=D2XP, versionid=0xe, language=enUS, localip=0x9303a8c0, tzbias=0000, locale=1033, language=1033, country=USA.United States }
Feb 17 17:47:50 [info ] conn_set_gamelang: [24] setting client gamelang to "enUS"
Feb 17 17:47:50 [debug] select_checkrevision: Could not find corresponding CheckRevision entry, returning default CheckRevision
Feb 17 17:47:50 [debug] _client_auth_info: [24] selected "ver-IX86-1.mpq" "A=42 B=42 C=42 4 A=A^S B=B^B C=C^C A=A^S"
Feb 17 17:47:50 [debug] sd_tcpinput: [24] read returned -1 (closing connection)
Feb 17 17:47:50 [info ] conn_destroy: [24] closed bnet connection```
RElesgoe commented 5 years ago

PvPGN is not set up to handle Mac clients for most game client and version combinations. You would need to either disable versioncheck altogether in bnetd.conf or create a versioncheck entry in versioncheck.json.

martimarkov commented 5 years ago

Yeah I don’t know how to do it in versioncheck.json thou

— MM

On 1 Mar 2019, at 03:04, RElesgoe notifications@github.com wrote:

PvPGN is not set up to handle Mac clients for most game client and version combinations. You would need to either disable versioncheck altogether in bnetd.conf or create a versioncheck entry in versioncheck.json.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

martimarkov commented 5 years ago

I did manage to get pass the mac identification but I'm wondering now what the .mpq file contains and that maybe i need to create a new one or the equations is wrong. How do you find what the correct equation should be?

Mar 01 16:41:02 [debug] _client_auth_info: [24] AUTH_INFO packet { protocol=0x0, platform=XMAC, product=D2XP, versionid=0xe, language=enUS, localip=IP_ADDRESS, tzbias=0000, locale=1033, language=1033, country=USA.United States }
Mar 01 16:41:02 [info ] conn_set_gamelang: [24] setting client gamelang to "enUS"
Mar 01 16:41:02 [debug] _client_auth_info: [24] selected "XMACver1.mpq" "A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B"
Mar 01 16:41:02 [debug] ipbanlist_check: lastcheck: 1551454862, now: 1551454862, now-lc: 0.
Mar 01 16:41:02 [debug] ipbanlist_check: checking IP_ADDRESS
Mar 01 16:41:02 [info ] sd_accept: [25] accepted connection from IP_ADDRESS:56585 on 0.0.0.0:6112
Mar 01 16:41:02 [debug] conn_create: [25][22] sessionkey=0x944108039 sessionnum=0x00000001
Mar 01 16:41:02 [debug] sd_accept: [25] client connected to a bnet listening address
Mar 01 16:41:02 [info ] handle_init_packet: [25] client initiated file download connection
Mar 01 16:41:02 [trace] conn_shutdown: [25] connection already closed
Mar 01 16:41:02 [info ] file_send: [25] sending file "XMACver1.mpq" ("/usr/local/pvpgn/var/pvpgn/files/XMACver1.mpq") of length 17344
Mar 01 16:41:02 [debug] sd_tcpinput: [25] read returned -1 (closing connection)
Mar 01 16:41:02 [info ] conn_destroy: [25] closed file connection
Mar 01 16:41:02 [debug] sd_tcpinput: [24] read returned -1 (closing connection)
Mar 01 16:41:02 [info ] conn_destroy: [24] closed bnet connection
hiroferreira commented 4 years ago

Hey, @martimarkov! Did you manage to solve this? what does your version check for 0xe looks like? i can't even send back the XMACver1.mpq to the Mac Client... Mine looks like this:

"D2XP": {
        "XMAC": {
            "0x0e": {
                "checkRevisionFile": "XMACver1.mpq",
                "equation": "A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B",
                "entries": [
                    {
                        "title": "Diablo II - LoD (Expansion) 1.14d",
                        "version": "1.14.3.0",
                        "hash": "0x43f51a83",
                        "fileMetadata": "Diablo II (Carbon) 05/31/16 19:02:24 17344",
                        "versionTag": "D2XP_114D"
                    }
]
...

I read somewhere that starting from 1.14d there always have to be version check... I my case: Windows clients connect fine on open battle net, but mac clients receive the version check issue that looks like the output you sent on your second comment to this thread (bnetd.log output).

martimarkov commented 4 years ago

So the main issue is not the MPQ file. It’s the equation that’s is being sent back. I couldn’t get the encoding to work to return the correct hex.

I’ll look for the .pcap files of the bnet connection and the pvpgn

I’m sure it’s solveable but I never got around to it. But basically the equation should be a hex string and the MPQ file is already available on bnetdocs so it can be obtained.

martimarkov commented 4 years ago

So a quick update that I forgot to post before. I have managed to get the D2 client to connect to the server.

Added to versioncheck.json:

    "XMAC": {

      "0x0e": {

        "checkRevisionFile": "psistorm-XMAC-15.mpq",

        "equation": "ÄLŽÄågb·›8-zÝú\\x1f[",

        "entries": [

          {

            "title": "Diablo II - LoD (Expansion) 1.14d",

            "version": "0.0.0.0",

            "hash": "0x0",

            "fileMetadata": "Diablo II ??/??/?? ??:??:?? ???????",

            "versionTag": "D2XP_114D"

          }

        ]

      }

    },

As for the equation, I think there is an encoding problem:

In file handle_bnet.cpp#L605: packet_append_string(rpacket, std::get<1>(checkrevision).c_str()); // CheckRevision equation

If you substitute it with:

            std::string x;
            x.push_back((char)0xC4);
            x.push_back((char)0x4C);
            x.push_back((char)0x8E);
            x.push_back((char)0xC4);
            x.push_back((char)0xE5);
            x.push_back((char)0x67);
            x.push_back((char)0x62);
            x.push_back((char)0xB7);
            x.push_back((char)0x9B);
            x.push_back((char)0x38);
            x.push_back((char)0x2D);
            x.push_back((char)0x7A);
            x.push_back((char)0xDD);
            x.push_back((char)0xFA);
            x.push_back((char)0x1F);
            x.push_back((char)0x5B);
            x.push_back((char)0x00);
            packet_append_string(rpacket, x.c_str()); // CheckRevision equation

it wil work.

The new mpq files can be found here: https://files.bnetdocs.org/Battle.net/CheckRevision/XMAC/

martimarkov commented 4 years ago

@RElesgoe Any ideas on the above^?

RElesgoe commented 4 years ago

@martimarkov I guess the psistorm files are the Mac equivalent of the lockdown CheckRevision files on Windows. In this case, the equation's format is merely a sequence of bytes that game clients will use to run their calculations. Since it's not in plain ascii anymore, PvPGN's code will need to be updated to handle this situation.

finalsecond commented 3 years ago

Guys, can you help me with adding the entry for 1.14d for XMAC? Don’t have too much experience with this :/

finalsecond commented 3 years ago

can you comment on the above please? really can't have anyone playing from a mac yet

martimarkov commented 3 years ago

The library reading the document needs to be updated to read the new version check correctly:

https://github.com/pvpgn/pvpgn-server/blob/d05a714e3925b603fa6f5aa0b3e2247e92d49656/src/bnetd/versioncheck.cpp#L73

This is the function you'd need to look into ^

Or find a way to encode the

            x.push_back((char)0xC4);
            x.push_back((char)0x4C);
            x.push_back((char)0x8E);
            x.push_back((char)0xC4);
            x.push_back((char)0xE5);
            x.push_back((char)0x67);
            x.push_back((char)0x62);
            x.push_back((char)0xB7);
            x.push_back((char)0x9B);
            x.push_back((char)0x38);
            x.push_back((char)0x2D);
            x.push_back((char)0x7A);
            x.push_back((char)0xDD);
            x.push_back((char)0xFA);
            x.push_back((char)0x1F);
            x.push_back((char)0x5B);
            x.push_back((char)0x00);

correctly

martimarkov commented 3 years ago

Oh forgot to mention. When I was thinking of this before. Basically, we want the field equation to be a different format. For example an encoded version of the string. As currently, I'm not sure even if the encoding is handled correctly if x.push_back((char)0x00); will be appendable.

RElesgoe commented 3 years ago

@martimarkov @finalsecond could you guys try to do the following:

  1. Add this to versioncheck.json:

        "XMAC": {
            "0x0e": {
                "checkRevisionFile": "psistorm-XMAC-00.mpq",
                "equation": "\u00c4\u004c\u008e\u00c4\u00e5\u0067\u0062\u00b7\u009b\u0038\u002d\u007a\u00dd\u00fa\u001f\u005b\u0000",
                "entries": [
                    {
                        "title": "Diablo II - LoD (Expansion) 1.14d",
                        "version": "1.14.3.0",
                        "hash": "0x00",
                        "fileMetadata": "Game.exe 05/31/16 19:02:24 3618792",
                        "versionTag": "D2XP_114D"
                    }
                ]
            }
        }
  2. Add psistorm-XMAC-00.mpq to your files directory so that PvPGN can serve it.

  3. Connect to PvPGN

  4. Look in bnetd.log so that you can update the hash and fileMetadata values.

martimarkov commented 3 years ago

@RElesgoe hahaha my C++ skills are so rusty from high school. :D I should have been able to figure this simple utf-8 encoding...

I think that should work, I'll deploy on a server today and will report tonight.