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

NetPlayProto: Remove lots of casts to MessageId when inserting enum values into packets #10118

Merged
merged 6 commits into from Oct 13, 2021

Conversation

lioncash
Copy link
Member

MessageId is kind of used as a wildcard type to insert identifiers into packets. Ideally, sf::Packet would just automatically handle attempted insertions of enum types by converting given identifiers into their underlying primitive type and then insert their values into the packet. This would get rid of the need to have the MessageId type alias and allow enums to be self-describing in terms of how they'll be stored.

Unfortunately sf::Packet doesn't handle enum values out-of-the-box, so we can make our own wrappers to make working with them a little more convenient and also a little bit less verbose

Will be used in future changes to eliminate the need to cast when
inserting various message IDs
Now we can leverage our helper to insert enum values without the need to
cast.
Continues the migration off the MessageId type alias
Now that we have enum helpers for inserting values into packets and have
migrated all other enumerations over, there's no need to keep this alias
around any longer.
Now that we have the enum helpers in place, quite a few casts on their
own can be removed.
Copy link
Member

@leoetlino leoetlino left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lioncash)

@leoetlino leoetlino merged commit f19da1c into dolphin-emu:master Oct 13, 2021
10 checks passed
@lioncash lioncash deleted the messageid branch October 13, 2021 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants