[Scummvm-git-logs] scummvm-sites multiplayer -> 656ffec33c3ba1c9367d4a8ba0ec9b49711ec979

LittleToonCat noreply at scummvm.org
Tue Jan 23 08:29:53 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-sites' repo located at https://github.com/scummvm/scummvm-sites .

Summary:
656ffec33c MULTIPLAYER:Use own version number instead of ScummVM's.


Commit: 656ffec33c3ba1c9367d4a8ba0ec9b49711ec979
    https://github.com/scummvm/scummvm-sites/commit/656ffec33c3ba1c9367d4a8ba0ec9b49711ec979
Author: Little Cat (toontownlittlecat at gmail.com)
Date: 2024-01-23T04:29:42-04:00

Commit Message:
MULTIPLAYER:Use own version number instead of ScummVM's.

Changed paths:
    lobby/discord/Discord.js
    lobby/net/DatabaseMessages.js
    main.py


diff --git a/lobby/discord/Discord.js b/lobby/discord/Discord.js
index 5924c66..bb16b46 100644
--- a/lobby/discord/Discord.js
+++ b/lobby/discord/Discord.js
@@ -130,9 +130,9 @@ class Discord {
         area = `${user.inGame ? '(In-Game) ' : ''}(${Areas[user.area]}, ${groupName})`;
       }
       if (user.game == "baseball") {
-        baseballUsers += `${user.user} (${user.version}) ${area}\n`;
+        baseballUsers += `${user.user} (v${user.version}) ${area}\n`;
       } else {
-        footballUsers += `${user.user} (${user.version}) ${area}\n`;
+        footballUsers += `${user.user} (v${user.version}) ${area}\n`;
       }
     }
 
diff --git a/lobby/net/DatabaseMessages.js b/lobby/net/DatabaseMessages.js
index 9e81b89..3ec7b03 100644
--- a/lobby/net/DatabaseMessages.js
+++ b/lobby/net/DatabaseMessages.js
@@ -59,23 +59,10 @@ server.handleMessage("login", async (client, args) => {
                                    response: "Missing version paremeter!"});
         return;
     }
-
-    // This code parses the ScummVM version string sent by the client.
-    // e.g. ScummVM 2.8.0git-{revision} (Oct 21 2023 19:11:48)
-    const versionArray = version.split(" ").filter((str) => str !== '');
-    if (versionArray[0] != "ScummVM") {
-        client.send("login_resp", {error_code: 1,
-                                   id: 0,
-                                   sessionServer: "",
-                                   response: "Only ScummVM clients are supported."});
-        return;
-    }
-    client.versionNumber = versionArray[1]
-    if (client.versionNumber.includes("git")) {
-        // This is a development build, exclude the revision since it does not matter here.
-        const gitLocation = client.versionNumber.indexOf("git")
-        // This should result with "2.8.0git"
-        client.versionNumber = client.versionNumber.substr(0, gitLocation + 3)
+    client.versionNumber = version
+    if (version.startsWith("ScummVM")) {
+        // Set version to 1.0 to maintain compatibility.
+        client.versionNumber = "1.0"
     }
 
     for (const [keyVersion, versions] of Object.entries(server.mergeVersions)) {
@@ -94,7 +81,7 @@ server.handleMessage("login", async (client, args) => {
             client.send("login_resp", {error_code: 1,
                                        id: 0,
                                        sessionServer: "",
-                                       response: `ScummVM version ${client.versionNumber} is no longer being supported.  Please visit scummvm.org and update to the latest version to continue playing online.`})
+                                       response: `Network version ${client.versionNumber} is no longer being supported.  Please visit scummvm.org and update to the latest version to continue playing online.`})
             return;
         }
         // Parse version date and check against the timestamp in the config.
@@ -110,7 +97,7 @@ server.handleMessage("login", async (client, args) => {
             client.send("login_resp", {error_code: 1,
                                        id: 0,
                                        sessionServer: "",
-                                       response: `This build of ${client.versionNumber} is no longer being supported.  Please download the latest daily build or pull and build the latest changes to continue playing online.`});
+                                       response: `This build of network version ${client.versionNumber} is no longer being supported.  Please download the latest daily build or pull and build the latest changes to continue playing online.`});
             return;
         }
     }
diff --git a/main.py b/main.py
index 6b1fbd7..e65e9fa 100644
--- a/main.py
+++ b/main.py
@@ -94,7 +94,7 @@ if __name__ == "__main__":
         return None
 
     def create_session(
-        name: str, maxplayers: int, scummvm_version: str, map_data: dict, address: str
+        name: str, maxplayers: int, network_version: str, map_data: dict, address: str
     ):
         # Get our new session ID
         session_id = redis.incr(f"{game}:counter")
@@ -105,7 +105,7 @@ if __name__ == "__main__":
                 "name": name,
                 "players": 0,
                 "maxplayers": maxplayers,
-                "scummvm_version": scummvm_version,
+                "network_version": network_version,
                 "address": str(event.peer.address),
                 "map_data": json.dumps(map_data),
             },
@@ -351,22 +351,10 @@ if __name__ == "__main__":
                 # Update the game to contain the version
                 game = f"{game}:{version}"
 
-            scummvm_version = data.get("scummvm_version", "unknown")
-            if scummvm_version != "unknown":
-                # Parse the version string to only contain the version number (2.8.0[git])
-                # Only host_session and get_sessions messages has this currently.
-                if scummvm_version[:7] == "ScummVM":
-                    scummvm_version = scummvm_version.split(" ")[1]
-                    if "git" in scummvm_version:
-                        # Strip out the specific revision details, we only need the "git".
-                        index = scummvm_version.index("git")
-                        scummvm_version = scummvm_version[: index + 3]
-                else:
-                    # We don't know how to parse this string, revert back to unknown.
-                    logging.warning(
-                        f"Don't know how to parse scummvm_version string: {scummvm_version}"
-                    )
-                    scummvm_version = "unknown"
+            network_version = data.get("network_version", "unknown")
+            if data.get("scummvm_version"):
+                # Set version to 1.0 for backwards compatiblity
+                network_version = "1.0"
 
             if command == "host_session":
                 name = data.get("name")
@@ -375,7 +363,7 @@ if __name__ == "__main__":
                 map_data = data.get("map_data", {})
 
                 session_id = create_session(
-                    name, maxplayers, scummvm_version, map_data, event.peer.address
+                    name, maxplayers, network_version, map_data, event.peer.address
                 )
                 send(event.peer, {"cmd": "host_session_resp", "id": session_id})
 
@@ -395,16 +383,9 @@ if __name__ == "__main__":
                 session_ids = redis.lrange(f"{game}:sessions", 0, num_sessions)
                 for id in session_ids:
                     session = redis.hgetall(f"{game}:session:{id}")
-                    if (
-                        # Skipping if their playing football or
-                        # baseball because they might be
-                        # playing with merged versions
-                        # (e.g. 2.9.0git playing as 2.8.0git)
-                        game not in ("football", "baseball2001")
-                        and scummvm_version != session["scummvm_version"]
-                    ):
+                    if (network_version != session["network_version"]):
                         logging.debug(
-                            f"get_sessions: {scummvm_version} != {session['scummvm_version']}"
+                            f"get_sessions: {network_version} != {session['network_version']}"
                         )
                         # Mismatched version, skip.
                         continue




More information about the Scummvm-git-logs mailing list