Skip to content

Commit fa9345a

Browse files
authored
feat(gui): Add replay dates to replay list in Replay Menu (TheSuperHackers#2255)
1 parent 5b0b01d commit fa9345a

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ void PopulateReplayFileListbox(GameWindow *listbox)
290290
// name
291291
UnicodeString replayNameToShow = createReplayName(asciistr);
292292

293-
UnicodeString displayTimeBuffer = getUnicodeTimeBuffer(header.timeVal);
294-
295-
//displayTimeBuffer.format( L"%ls", timeBuffer);
293+
// TheSuperHackers @tweak Caball009 07/02/2025 Display both time and date instead of only time.
294+
UnicodeString displayDateTimeBuffer;
295+
displayDateTimeBuffer.format(L"%s %s", getUnicodeTimeBuffer(header.timeVal).str(), getUnicodeDateBuffer(header.timeVal).str());
296296

297297
// version (no-op)
298298

@@ -353,7 +353,7 @@ void PopulateReplayFileListbox(GameWindow *listbox)
353353

354354
const Int insertionIndex = GadgetListBoxAddEntryText(listbox, replayNameToShow, color, -1, 0);
355355
DEBUG_ASSERTCRASH(insertionIndex >= 0, ("Expects valid index"));
356-
GadgetListBoxAddEntryText(listbox, displayTimeBuffer, color, insertionIndex, 1);
356+
GadgetListBoxAddEntryText(listbox, displayDateTimeBuffer, color, insertionIndex, 1);
357357
GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 2);
358358
GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 3);
359359

@@ -388,6 +388,15 @@ void ReplayMenuInit( WindowLayout *layout, void *userData )
388388
buttonDelete = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonDeleteID );
389389
buttonCopy = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonCopyID );
390390

391+
#if ENABLE_GUI_HACKS
392+
// TheSuperHackers @tweak Caball009 07/02/2025 The version column is wider than the time / date column.
393+
// Switch them so that there's enough space to show both time and date without a line break.
394+
ListboxData* list = static_cast<ListboxData*>(listboxReplayFiles->winGetUserData());
395+
396+
if (list->columns == 4 && list->columnWidth[1] < list->columnWidth[2])
397+
std::swap(list->columnWidth[1], list->columnWidth[2]);
398+
#endif
399+
391400
//Load the listbox shiznit
392401
GadgetListBoxReset(listboxReplayFiles);
393402
PopulateReplayFileListbox(listboxReplayFiles);

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ void PopulateReplayFileListbox(GameWindow *listbox)
290290
// name
291291
UnicodeString replayNameToShow = createReplayName(asciistr);
292292

293-
UnicodeString displayTimeBuffer = getUnicodeTimeBuffer(header.timeVal);
294-
295-
//displayTimeBuffer.format( L"%ls", timeBuffer);
293+
// TheSuperHackers @tweak Caball009 07/02/2025 Display both time and date instead of only time.
294+
UnicodeString displayDateTimeBuffer;
295+
displayDateTimeBuffer.format(L"%s %s", getUnicodeTimeBuffer(header.timeVal).str(), getUnicodeDateBuffer(header.timeVal).str());
296296

297297
// version (no-op)
298298

@@ -353,7 +353,7 @@ void PopulateReplayFileListbox(GameWindow *listbox)
353353

354354
const Int insertionIndex = GadgetListBoxAddEntryText(listbox, replayNameToShow, color, -1, 0);
355355
DEBUG_ASSERTCRASH(insertionIndex >= 0, ("Expects valid index"));
356-
GadgetListBoxAddEntryText(listbox, displayTimeBuffer, color, insertionIndex, 1);
356+
GadgetListBoxAddEntryText(listbox, displayDateTimeBuffer, color, insertionIndex, 1);
357357
GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 2);
358358
GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 3);
359359

@@ -388,6 +388,15 @@ void ReplayMenuInit( WindowLayout *layout, void *userData )
388388
buttonDelete = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonDeleteID );
389389
buttonCopy = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonCopyID );
390390

391+
#if ENABLE_GUI_HACKS
392+
// TheSuperHackers @tweak Caball009 07/02/2025 The version column is wider than the time / date column.
393+
// Switch them so that there's enough space to show both time and date without a line break.
394+
ListboxData* list = static_cast<ListboxData*>(listboxReplayFiles->winGetUserData());
395+
396+
if (list->columns == 4 && list->columnWidth[1] < list->columnWidth[2])
397+
std::swap(list->columnWidth[1], list->columnWidth[2]);
398+
#endif
399+
391400
//Load the listbox shiznit
392401
GadgetListBoxReset(listboxReplayFiles);
393402
PopulateReplayFileListbox(listboxReplayFiles);

0 commit comments

Comments
 (0)