forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 229
feat(network): Send product information to distinguish clients #1404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Caball009
wants to merge
19
commits into
TheSuperHackers:main
Choose a base branch
from
Caball009:show_clients_with_sh_patch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
296c768
feat(network): Send product information to distinguish clients.
Caball009 7a7775e
Added color and status code.
Caball009 f2651b9
Revert "Added color and status code."
Caball009 765e5fa
Merge branch 'main' into show_clients_with_sh_patch
Caball009 8c71c3a
Addressed feedback (part 1).
Caball009 e834604
Updated comment for improved accuracy.
Caball009 7a86f43
Removed temporary flags variable.
Caball009 51636b6
Improved comment.
Caball009 fd39ae4
Added assertion for game slot transition.
Caball009 391bdf7
Added parentheses around assertion comment.
Caball009 4302707
Synchronized comment with comment in PR description.
Caball009 7feddc7
Merge branch 'main' into show_clients_with_sh_patch
Caball009 ae11852
Simplified return logic for 'setProductInfoStrings'.
Caball009 1900b24
Set null-terminated flag.
Caball009 870bfd3
Simplified return logic for 'getProductInfoStrings'.
Caball009 759efbc
Changed 'createProductInfoMessage' to 'buildProductInfoMessage'.
Caball009 d53d412
Set math crc field.
Caball009 a8e1aa2
Switched back from launch time to up time.
Caball009 c4a34ce
Fixed return logic for 'getProductInfoStrings'.
Caball009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,25 @@ struct LANMessage | |
| MSG_INACTIVE, ///< I've alt-tabbed out. Unaccept me cause I'm a poo-flinging monkey. | ||
|
|
||
| MSG_REQUEST_GAME_INFO, ///< For direct connect, get the game info from a specific IP Address | ||
|
|
||
| // TheSuperHackers @feature Caball009 05/02/2026 Product information is exchanged on demand and never broadcast. | ||
| // A client is considered 'patched' if it responds to a product info request (or, in pre-match, if it sends one). | ||
| // The implementation consists of three parts. | ||
| // 1. player - player in lobby: | ||
| // - When a player detects a new player in the lobby, it sends a product info request. | ||
|
Caball009 marked this conversation as resolved.
Outdated
|
||
| // - If the other player responds with an acknowledgement, they are considered patched. | ||
| // 2. player - host in lobby: | ||
| // - When a player detects a new game host in the lobby, it sends a product info request. | ||
| // - If the host responds with an acknowledgement, it is considered patched. | ||
| // 3. players in pre-match: | ||
| // - When a player joins a match, it sends a product info request to all existing players. | ||
| // - Existing players treat this request as confirmation that the joining player is patched (no explicit acknowledgement required). | ||
| MSG_GAME_REQUEST_PRODUCT_INFO = 1000, | ||
| MSG_GAME_RESPONSE_PRODUCT_INFO, | ||
| MSG_LOBBY_REQUEST_PRODUCT_INFO, | ||
| MSG_LOBBY_RESPONSE_PRODUCT_INFO, | ||
| MSG_MATCH_REQUEST_PRODUCT_INFO, | ||
| MSG_MATCH_RESPONSE_PRODUCT_INFO, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in the other file, perhaps a better terminology for these are: GAME to LOBBY_ROOM aka a Game Room in the Lobby |
||
| } messageType; | ||
|
|
||
| WideChar name[g_lanPlayerNameLength+1]; ///< My name, for convenience | ||
|
|
@@ -267,6 +286,17 @@ struct LANMessage | |
| char options[m_lanMaxOptionsLength+1]; | ||
| } GameOptions; | ||
|
|
||
| // ProductInfo is sent with REQUEST_PRODUCT_INFO and RESPONSE_PRODUCT_INFO | ||
|
xezon marked this conversation as resolved.
|
||
| struct | ||
| { | ||
| UnsignedInt flags; | ||
| UnsignedInt uptime; | ||
| UnsignedInt exeCRC; | ||
| UnsignedInt iniCRC; | ||
| UnsignedInt fpMathCRC; | ||
| WideChar data[201]; | ||
|
xezon marked this conversation as resolved.
|
||
| Byte padding[20]; | ||
|
Caball009 marked this conversation as resolved.
Outdated
|
||
| } ProductInfo; | ||
|
Caball009 marked this conversation as resolved.
xezon marked this conversation as resolved.
|
||
| }; | ||
| }; | ||
|
Caball009 marked this conversation as resolved.
|
||
| #pragma pack(pop) | ||
|
|
@@ -394,6 +424,12 @@ class LANAPI : public LANAPIInterface | |
| void addGame(LANGameInfo *game); | ||
| AsciiString createSlotString( void ); | ||
|
|
||
| static UnsignedInt getProductInfoFlags(); | ||
| static void setProductInfoFromLocalData(GameSlot *slot); | ||
| static void setProductInfoFromMessage(LANMessage *msg, GameSlot *slot); | ||
| static Bool setProductInfoStrings(const UnicodeString(&input)[4], WideChar(&output)[201]); | ||
| static Bool getProductInfoStrings(WideChar(&input)[201], UnicodeString*(&output)[4]); | ||
|
|
||
| // Functions to handle incoming messages ----------------------------------- | ||
| void handleRequestLocations( LANMessage *msg, UnsignedInt senderIP ); | ||
| void handleGameAnnounce( LANMessage *msg, UnsignedInt senderIP ); | ||
|
|
@@ -412,4 +448,11 @@ class LANAPI : public LANAPIInterface | |
| void handleGameOptions( LANMessage *msg, UnsignedInt senderIP ); | ||
| void handleInActive( LANMessage *msg, UnsignedInt senderIP ); | ||
|
|
||
| void sendProductInfoMessage(LANMessage::Type messageType, UnsignedInt senderIP); | ||
| void handleGameProductInfoRequest(LANMessage *msg, UnsignedInt senderIP); | ||
| void handleGameProductInfoResponse(LANMessage *msg, UnsignedInt senderIP); | ||
| void handleLobbyProductInfoRequest(LANMessage *msg, UnsignedInt senderIP); | ||
| void handleLobbyProductInfoResponse(LANMessage *msg, UnsignedInt senderIP); | ||
| void handleMatchProductInfoRequest(LANMessage *msg, UnsignedInt senderIP); | ||
| void handleMatchProductInfoResponse(LANMessage *msg, UnsignedInt senderIP); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.