Skip to content
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

Movie: Make checking for existing GC saves more reliable #8535

Merged
merged 1 commit into from
Mar 15, 2020

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Dec 27, 2019

The old code only handled a raw memory card in slot A, not taking GCI folders into account at all.

@JosJuice JosJuice force-pushed the movie-save-detection branch 2 times, most recently from 4a57e17 to b9439d3 Compare December 27, 2019 19:30
@@ -158,10 +158,39 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder) : card_index(ind
SetCardFlashID(header.data(), card_index);
}

void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
std::string CEXIMemoryCard::GetGCIFolderPath(int card_index, bool allow_movie_folder, bool* migrate)

Choose a reason for hiding this comment

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

Can this return a std::pair<std::string, bool> to avoid the out-param?

Copy link
Member Author

Choose a reason for hiding this comment

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

It could, but then there would be nothing in the function declaration that tells you what the bool means, so I think it's better the way it is right now.

Choose a reason for hiding this comment

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

That is not necessarily a problem.
std::pair<std::string /* ... */, bool /* migrate */> is a common way to define a pair, then you can use structured bindings to unpack the pair on assignment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just one question about structured bindings before I change this. Calling the modified function like this works:

const auto [strDirectoryName, migrate] = GetGCIFolderPath(card_index, true);

But is there a way to specify the type of the two variables separately, so that I don't have to use auto? That way you wouldn't have to look up the function to be able to know what types the two variables are.

Copy link
Member

@Tilka Tilka Jan 25, 2020

Choose a reason for hiding this comment

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

But is there a way to specify the type of the two variables separately, so that I don't have to use auto?

No :(

What you could do is this:

std::string strDirectoryName;
bool migrate;
std::tie(strDirectoryName, migrate) = GetGCIFolderPath(card_index, true);

but then the variables are not const -.-

Copy link
Member Author

Choose a reason for hiding this comment

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

I've made it use a structured binding.

@JosJuice JosJuice force-pushed the movie-save-detection branch 2 times, most recently from fdf79fb to 29bcfbf Compare March 2, 2020 12:52
@JosJuice JosJuice force-pushed the movie-save-detection branch from 29bcfbf to ca38a81 Compare March 2, 2020 12:58
@JosJuice JosJuice force-pushed the movie-save-detection branch from ca38a81 to 5041cf1 Compare March 15, 2020 22:13
The old code only handled a raw memory card in slot A, not taking
GCI folders into account at all.
@JosJuice JosJuice force-pushed the movie-save-detection branch from 5041cf1 to cb0fe3f Compare March 15, 2020 22:56
@leoetlino leoetlino merged commit c868328 into dolphin-emu:master Mar 15, 2020
@JosJuice JosJuice deleted the movie-save-detection branch March 15, 2020 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants