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

Added MemoryInterface variables to savestates #11125

Merged
merged 1 commit into from Oct 7, 2022
Merged

Added MemoryInterface variables to savestates #11125

merged 1 commit into from Oct 7, 2022

Conversation

Lobsterzelda
Copy link
Contributor

@Lobsterzelda Lobsterzelda commented Oct 6, 2022

This PR adds MemoryInterface variables to save states. Hopefully, this will reduce the frequency of desyncs in Dolphin - although it remains to be seen what effect this will have.

@@ -94,7 +94,7 @@ static size_t s_state_writes_in_queue;
static std::condition_variable s_state_write_queue_is_empty;

// Don't forget to increase this after doing changes on the savestate system
constexpr u32 STATE_VERSION = 149; // Last changed in PR 10781
constexpr u32 STATE_VERSION = 150; // Last changed in PR 11124 on October 6, 2022
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifying the date isin't particularly necessary given that the date is contained in the commit and the pr and so on, fwiw.

Also, wrong PR number btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I kind of got sniped there by Pokechu's PR, lol!

I just added the date because it was annoying me earlier when I wanted to figure out how long it had been since the savestate version was last modified by just looking at it in Visual Studio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either way, I fixed it.

Copy link
Member

@JosJuice JosJuice Oct 6, 2022

Choose a reason for hiding this comment

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

I don't see why knowing the date would be useful. And anyway, you can already enable the Blame view in Visual Studio if you want to see the date the line was last changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the perspective of TASers trying to look into the Savestate code (and who don't have very much experience looking through the Dolphin code/using visual studio), it seems like it would be a helpful add-on. However, if this PR won't get merged with the date in it, then I can remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the issue with the date is that it reflects when the PR was made, not when it was merged, making it a bit less useful.

I would say the PR number itself is not that useful too, but it does have a benefit: two PRs that both change the version from 149 to 150 would not create a merge conflict after the first PR is merged, but with the PR number you will get a merge conflict, which is good because the second PR would need to instead change the number from 150 to 151. Including the PR number thus forces you to update the state version if another PR changed it and was merged.

You can use the blame view in GitHub's web UI too: https://github.com/dolphin-emu/dolphin/blame/master/Source/Core/Core/State.cpp#L96

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, I'd better finish this PR up and get it merged tonight so that the date will be accurate in any event!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR to include initializer + shutdown method for MemoryInterface, and fixed the savestate version number (also removed the date).

@CasualPokePlayer
Copy link
Contributor

CasualPokePlayer commented Oct 6, 2022

Could you add in Init and Shutdown functions to MemoryInterface (and add calls to those?) The lack of any Init itself can theoretically cause non-determinism here.

@Lobsterzelda
Copy link
Contributor Author

I'll add in those 2 functions later tonight.

@Lobsterzelda
Copy link
Contributor Author

Could you add in Init and Shutdown functions to MemoryInterface (and add calls to those?) The lack of any Init itself can theoretically cause non-determinism here.

Done.

@Lobsterzelda Lobsterzelda requested review from Pokechu22, JosJuice and Zopolis4 and removed request for Zopolis4, Pokechu22 and JosJuice October 6, 2022 22:10
@Pokechu22
Copy link
Contributor

Please use git fetch origin master and git rebase -i origin/master to squash together the earlier commits (afterwards, use git push --force-with-lease to sync the pull request branch).

@@ -70,6 +72,7 @@ void Shutdown()
DSP::Shutdown();
AddressSpace::Shutdown();
Memory::Shutdown();
MemoryInterface::Shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

The order is inconsistent between Init and Shutdown here. Please Shutdown in the reverse order as Init, so put this one between DSP and AddressSpace.

@AdmiralCurtiss AdmiralCurtiss merged commit 6e3d140 into dolphin-emu:master Oct 7, 2022
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants