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

State: Avoid Global System Accessor #12606

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

mitaclaw
Copy link
Contributor

@mitaclaw mitaclaw commented Mar 1, 2024

No description provided.

@AdmiralCurtiss
Copy link
Contributor

This isn't really deglobalizing anything, State.cpp still has global state that multiple instances of System would fight over.

@mitaclaw
Copy link
Contributor Author

I see that PowerPC::Cache is accessing System through the global accessor, and can address that in another PR. Wiimote::DoState and Gecko::DoState I'm less confident I would know how to refactor those. Of course, the elephant in the room is g_video_backend participating in DoState. Still, isn't it a step in the right direction? I'm trying to bubble as many Core::System::GetInstance() uses up through functions until they reach the source of the problem, usually MainWindow.cpp, MainAndroid.cpp, or DolphinNoGUI.

@mitaclaw
Copy link
Contributor Author

I just realized this PR conflicts with #12619 also authored by me. How I did that without noticing is beyond me. I think I will combine them under this PR.

@mitaclaw
Copy link
Contributor Author

On closer inspection, I am unsure about simply copying the changes from #12619 because the s_load_or_save_in_progress_mutex currently is being locked before Core::RunOnCPUThread is called in SaveAs and LoadAs. I will be marking #12619 as a draft and leaving this PR as-is.

@AdmiralCurtiss AdmiralCurtiss merged commit 3948ac9 into dolphin-emu:master Mar 22, 2024
11 checks passed
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.

2 participants