Skip to content

[GEN][ZH] Prevent duplicate replays from being shown in the Replay Menu #1208

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

Merged
merged 1 commit into from
Jun 28, 2025

Conversation

Caball009
Copy link

@Caball009 Caball009 commented Jun 27, 2025

TheFileSystem->getFileListInDirectory(TheRecorder->getReplayDir(), asciisearch, replayFilenames, TRUE);
TheMapCache->updateCache();
for (it = replayFilenames.begin(); it != replayFilenames.end(); ++it)
{
// just want the filename
asciistr.set((*it).reverseFind('\\') + 1);
RecorderClass::ReplayHeader header;
ReplayGameInfo info;
const MapMetaData *mapData;
if (readReplayMapInfo(asciistr, header, info, mapData))

The current logic to show the list of replay files is divided into two parts. First it collects all replay files, and then it attempts to open any found replay files. The former searches all sub directories, but the latter uses only the replay file name and tries to open the file from the base directory.

Considering the following directory layout, GR2 isn't shown but GR1 is shown twice even if the second file is different or empty:

  • GoldenReplay1.rep
  • SubDirectory:
    • GoldenReplay1.rep
    • GoldenReplay2.rep

This PR disables the search in sub directories.

@Caball009 Caball009 added Bug Something is not working right, typically is user facing Gen Relates to Generals ZH Relates to Zero Hour labels Jun 27, 2025
@Caball009
Copy link
Author

Caball009 commented Jun 27, 2025

Related to and perhaps introduced by #992

Issue was not introduced by 992.

@Caball009 Caball009 added the Minor Severity: Minor < Major < Critical < Blocker label Jun 27, 2025
@xezon
Copy link

xezon commented Jun 28, 2025

Related to and perhaps introduced by #992

Can you please check this? I do not think #992 has introduced this behavior. If this is not an original game bug, then we need to label this accordingly.

@xezon
Copy link

xezon commented Jun 28, 2025

Considering the following directory layout, GR2 isn't shown but GR1 is shown twice even if the second file is different or empty:

  • GoldenReplay1.rep

  • SubDirectory:

    • GoldenReplay1.rep
    • GoldenReplay2.rep

What happens when that duplicate invalid entry is clicked?

@Caball009
Copy link
Author

Can you please check this? I do not think #992 has introduced this behavior. If this is not an original game bug, then we need to label this accordingly.

I'll verify.

What happens when that duplicate invalid entry is clicked?

It always opens the one in the base directory.

@Caball009
Copy link
Author

Caball009 commented Jun 28, 2025

Can you please check this? I do not think #992 has introduced this behavior. If this is not an original game bug, then we need to label this accordingly.

I checked with a build from last month, just before 992, and the issue is still there so I was wrong about that.

I just checked with our 2025-04-01 branch and it's there as well.

Copy link

@helmutbuhler helmutbuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That issue exists in retail. Thanks for fixing!

@xezon xezon added the GUI For graphical user interface label Jun 28, 2025
@xezon xezon changed the title [GEN][ZH] Prevent duplicate replays from being shown in menu [GEN][ZH] Prevent duplicate replays from being shown in the Replay Menu Jun 28, 2025
@xezon xezon merged commit cac806a into TheSuperHackers:main Jun 28, 2025
18 checks passed
@Caball009 Caball009 deleted the fix_replay_duplicates branch June 28, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants