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

IOS/WiiSockMan: Move instance to IOS Kernel. #11767

Merged
merged 2 commits into from Apr 23, 2023

Conversation

AdmiralCurtiss
Copy link
Contributor

This was a global instance previously due to what seems to be legacy reasons.

I originally wanted to put this into one of the Network-related devices but there didn't seem to be a good single spot for it, so it just ended up in Kernel. I'm also not entirely sure why the Kernel uses shared_ptr for its device instances, can any of them actually outlive the Kernel itself? I've replicated this for the socket manager but I actually don't see any reason why it can't just be a unique_ptr instead.

@leoetlino Please review.

(As a side-note, I think I've noticed a logic error in the IOS savestating logic; nothing guarantees that devices in m_device_map are synced correctly with the ones in the savestate. You'd have to load a state from an IOS version than has different devices than the currently running one, which is unlikely in regular play, but I see nothing that actually prevents this...?)

@@ -77,7 +77,6 @@ NetIPTopDevice::NetIPTopDevice(Kernel& ios, const std::string& device_name)
void NetIPTopDevice::DoState(PointerWrap& p)
{
Device::DoState(p);
WiiSockMan::GetInstance().DoState(p);
Copy link
Member

Choose a reason for hiding this comment

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

lol, this was just being done in some random network device

@leoetlino
Copy link
Member

Re devices being shared_ptrs and not unique_ptrs, I think that's because the same device can be added to the map at different paths? I don't remember if that's something we do at the moment (maybe for FS or USB,) but that's the one reason I can think of as devices can't outlive the kernel. Might just be yet another historical quirk.

And yeah uh I think the deviced map savestate logic is broken.

@AdmiralCurtiss AdmiralCurtiss merged commit ffbbd72 into dolphin-emu:master Apr 23, 2023
14 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the wii-sock-man branch April 23, 2023 18:07
@AdmiralCurtiss
Copy link
Contributor Author

The savestate situation is still sketchy btw, this PR doesn't change that situation really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants