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/Network/KD: Minor tidy-up changes #10053

Merged
merged 11 commits into from Aug 30, 2021
Merged

Conversation

lioncash
Copy link
Member

@lioncash lioncash commented Aug 24, 2021

Initially this was only intended to change the maps in NetKDRequest's getter functions, but snowballed into this overall set of changes as possible improvements were noticed.

Each commit is relatively self-isolated from the surrounding changes to make for ease of piece-by-piece review.

- Make use of std::array
- Move helper functions inside it as lambdas
- Eliminate sign-conversions that were occurring (promotion of u8 to int)
These functions don't touch any class state, so they can be turned into
internal helper functions.

While we're at it, we can move the enumerations as well.
Makes it a distinct type instead of decaying to an ambiguous u8.
Copy link
Member

@BhaaLseN BhaaLseN left a comment

Choose a reason for hiding this comment

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

Code LGTM (aside from that one remark, which seems like IWYU), untested.

…f maps

Currently we were using heap allocating maps that last for the entire
duration of the emulator running.

Given the size N of both of these maps are very small (< 20 elements),
we can just make use of an array of pairs and perform linear scans. This
is also fine, given this code isn't particularly "hot" either, so this
won't be run often.
Makes the enum strongly typed instead of interacting with a raw u32
value. While we're at it, we can add helpers to the NWC24Config to make
using code poke at the internals of the class a little bit less and also
make the querying a little nicer to read.
… class

These are only used internally and not intended to be used outside of
the class itself.
According to WiiBrew this is a version number (thanks to Awesomebing1
for documenting this!)
These are only ever used here, so they can be turned into an internal
implementation detail.
Silences compiler warnings and also makes the conversions here explicit
to the reader.
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 1 of 1 files at r1, 2 of 2 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, 1 of 1 files at r5, 1 of 1 files at r6, 3 of 3 files at r7, 1 of 1 files at r8, 2 of 2 files at r9, 2 of 2 files at r10, 1 of 1 files at r11, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lioncash)

@leoetlino leoetlino merged commit 95fcede into dolphin-emu:master Aug 30, 2021
11 checks passed
@lioncash lioncash deleted the kdreq branch August 31, 2021 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants