Skip to content

Commit c4e3f1d

Browse files
committed
feat(client): Distinguish clients based on patch identification
1 parent f066518 commit c4e3f1d

File tree

5 files changed

+56
-22
lines changed

5 files changed

+56
-22
lines changed

GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ extern const Color chatSystemColor;
6868
extern const Color chatSystemColor;
6969
extern const Color acceptTrueColor;
7070
extern const Color acceptFalseColor;
71+
extern const Color gameColorPatchVersion;
72+
extern const Color gameInProgressColorPatchVersion;
73+
extern const Color playerColorPatchVersion;
74+
extern const Color playerGrayedColorPatchVersion;
7175

7276

7377
void lanUpdateSlotList( void );

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Common/PlayerList.h"
3737
#include "Common/PlayerTemplate.h"
3838
#include "Common/Recorder.h"
39+
#include "Common/version.h"
3940
#include "GameClient/AnimateWindowManager.h"
4041
#include "GameClient/Diplomacy.h"
4142
#include "GameClient/DisconnectMenu.h"
@@ -532,24 +533,28 @@ void PopulateInGameDiplomacyPopup( void )
532533
if (staticTextStatus[rowNum])
533534
{
534535
staticTextStatus[rowNum]->winHide(FALSE);
536+
537+
Color frontColor = 0;
538+
UnicodeString text;
539+
535540
if (isInGame)
536541
{
537542
if (isAlive)
538543
{
539-
staticTextStatus[rowNum]->winSetEnabledTextColors( aliveColor, backColor );
540-
GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerAlive"));
544+
frontColor = aliveColor;
545+
text = TheGameText->fetch("GUI:PlayerAlive");
541546
}
542547
else
543548
{
544549
if (isObserver)
545550
{
546-
staticTextStatus[rowNum]->winSetEnabledTextColors( observerInGameColor, backColor );
547-
GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserver"));
551+
frontColor = observerInGameColor;
552+
text = TheGameText->fetch("GUI:PlayerObserver");
548553
}
549554
else
550555
{
551-
staticTextStatus[rowNum]->winSetEnabledTextColors( deadColor, backColor );
552-
GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerDead"));
556+
frontColor = deadColor;
557+
text = TheGameText->fetch("GUI:PlayerDead");
553558
}
554559
}
555560
}
@@ -558,15 +563,22 @@ void PopulateInGameDiplomacyPopup( void )
558563
// not in game
559564
if (isObserver)
560565
{
561-
staticTextStatus[rowNum]->winSetEnabledTextColors( observerGoneColor, backColor );
562-
GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserverGone"));
566+
frontColor = observerGoneColor;
567+
text = TheGameText->fetch("GUI:PlayerObserverGone");
563568
}
564569
else
565570
{
566-
staticTextStatus[rowNum]->winSetEnabledTextColors( goneColor, backColor );
567-
GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerGone"));
571+
frontColor = goneColor;
572+
text = TheGameText->fetch("GUI:PlayerGone");
568573
}
569574
}
575+
576+
// TheSuperHackers @feature Caball009 06/11/2025 Set special status for players that are using a patched client version.
577+
if (slot->isHuman() && (TheGameInfo->getLocalSlotNum() == slotNum || slot->getPatchVersion() > 0))
578+
text.format(L"%s [%s]", text.str(), TheVersion->getUnicodeGitTagOrHash().str());
579+
580+
staticTextStatus[rowNum]->winSetEnabledTextColors(frontColor, backColor);
581+
GadgetStaticTextSetText(staticTextStatus[rowNum], text);
570582
}
571583

572584
slotNumInRow[rowNum++] = slotNum;

GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ void UpdateSlotList( GameInfo *myGame, GameWindow *comboPlayer[],
423423
}
424424
if(slot->isHuman())
425425
{
426+
if (i == myGame->getLocalSlotNum() || myGame->getSlot(i)->getPatchVersion() > 0)
427+
{
428+
// TheSuperHackers @feature Caball009 06/11/2025 Set special color for players that are using a patched client version.
429+
GadgetComboBoxSetEnabledTextColors(comboPlayer[i], playerColorPatchVersion, GameMakeColor(0, 0, 0, 255));
430+
GadgetComboBoxSetDisabledTextColors(comboPlayer[i], playerGrayedColorPatchVersion, GameMakeColor(0, 0, 0, 255));
431+
}
432+
426433
UnicodeString newName = slot->getName();
427434
UnicodeString oldName = GadgetComboBoxGetText(comboPlayer[i]);
428435
if (comboPlayer[i] && newName.compare(oldName))

GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,20 @@ extern Bool LANbuttonPushed;
5252

5353

5454
//Colors used for the chat dialogs
55-
const Color playerColor = GameMakeColor(255,255,255,255);
56-
const Color gameColor = GameMakeColor(255,255,255,255);
57-
const Color gameInProgressColor = GameMakeColor(128,128,128,255);
58-
const Color chatNormalColor = GameMakeColor(50,215,230,255);
59-
const Color chatActionColor = GameMakeColor(255,0,255,255);
60-
const Color chatLocalNormalColor = GameMakeColor(255,128,0,255);
61-
const Color chatLocalActionColor = GameMakeColor(128,255,255,255);
62-
const Color chatSystemColor = GameMakeColor(255,255,255,255);
63-
const Color acceptTrueColor = GameMakeColor(0,255,0,255);
64-
const Color acceptFalseColor = GameMakeColor(255,0,0,255);
55+
const Color playerColor = GameMakeColor(255,255,255,255);
56+
const Color gameColor = GameMakeColor(255,255,255,255);
57+
const Color gameInProgressColor = GameMakeColor(128,128,0,255);
58+
const Color chatNormalColor = GameMakeColor(50,215,230,255);
59+
const Color chatActionColor = GameMakeColor(255,0,255,255);
60+
const Color chatLocalNormalColor = GameMakeColor(255,128,0,255);
61+
const Color chatLocalActionColor = GameMakeColor(128,255,255,255);
62+
const Color chatSystemColor = GameMakeColor(255,255,255,255);
63+
const Color acceptTrueColor = GameMakeColor(0,255,0,255);
64+
const Color acceptFalseColor = GameMakeColor(255,0,0,255);
65+
const Color gameColorPatchVersion = GameMakeColor(255,255,0,255);
66+
const Color gameInProgressColorPatchVersion = GameMakeColor(192,192,0,255);
67+
const Color playerColorPatchVersion = gameColorPatchVersion;
68+
const Color playerGrayedColorPatchVersion = gameInProgressColorPatchVersion;
6569

6670

6771
UnicodeString LANAPIInterface::getErrorStringFromReturnType( ReturnType ret )
@@ -640,7 +644,9 @@ void LANAPI::OnPlayerList( LANPlayer *playerList )
640644
LANPlayer *player = m_lobbyPlayers;
641645
while (player)
642646
{
643-
Int addedIndex = GadgetListBoxAddEntryText(listboxPlayers, player->getName(), playerColor, -1, -1);
647+
// TheSuperHackers @feature Caball009 06/11/2025 Set special color for players that are using a patched client version.
648+
const Color color = (player->getPatchVersion() > 0 || m_localIP == player->getIP()) ? playerColorPatchVersion : playerColor;
649+
const Int addedIndex = GadgetListBoxAddEntryText(listboxPlayers, player->getName(), color, -1, -1);
644650
GadgetListBoxSetItemData(listboxPlayers, (void *)player->getIP(),addedIndex, 0 );
645651

646652
if (selectedIP == player->getIP())

GeneralsMD/Code/GameEngine/Source/GameNetwork/LANGameInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,12 @@ void LANDisplayGameList( GameWindow *gameListbox, LANGameInfo *gameList )
226226
{
227227
txtGName.concat(L"]");
228228
}
229-
Int addedIndex = GadgetListBoxAddEntryText(gameListbox, txtGName, (gameList->isGameInProgress())?gameInProgressColor:gameColor, -1, -1);
229+
230+
// TheSuperHackers @feature Caball009 06/11/2025 Set special color for games that are using a patched client version.
231+
const Color color = (gameList->getSlot(0)->getPatchVersion() > 0)
232+
? ((gameList->isGameInProgress()) ? gameInProgressColorPatchVersion : gameColorPatchVersion)
233+
: ((gameList->isGameInProgress()) ? gameInProgressColor : gameColor);
234+
const Int addedIndex = GadgetListBoxAddEntryText(gameListbox, txtGName, color, -1, -1);
230235
GadgetListBoxSetItemData(gameListbox, (void *)gameList, addedIndex, 0 );
231236

232237
if (selectedPtr == gameList)

0 commit comments

Comments
 (0)