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

DSPHLE: Support EDuke32 Wii libaesnd uCode #10892

Merged

Conversation

Pokechu22
Copy link
Contributor

The first version is exclusive to EDuke32 Wii (see https://bugs.dolphin-emu.org/issues/12990). The second version fixes a bug with MAIL_TERMINATE (that hasn't been merged into libogc, and currently only exists in Extrems' libogc2). Like with #10793, I did some checking to confirm that the source and binaries matched, and also checked padding behavior (see aesnd_ucode_versions_extra.zip).

Hashes of various possible versions for search purposes
Hashes of EDuke32/compiled.bin: ector cd6b5364 crc 09f1147b adler f50b2b12 fletcher 5bc2a588; 03de bytes (01ef words)
Hashes of EDuke32/compiled_pad.bin: ector 5ad4d933 crc 97c86f4e adler 4b3e2b12 fletcher 014ba588; 03e0 bytes (01f0 words)
Hashes of EDuke32/dspmixer.bin: ector 5ad4d933 crc 97c86f4e adler 4b3e2b12 fletcher 014ba588; 03e0 bytes (01f0 words)
Hashes of EDuke32/dspmixer_nopad.bin: ector cd6b5364 crc 09f1147b adler f50b2b12 fletcher 5bc2a588; 03de bytes (01ef words)
Hashes of Extrems/compiled.bin: ector 002e5e41 crc 5ba4fb19 adler 2dca2d5e fletcher 37a6ee8d; 03e8 bytes (01f4 words)
Hashes of Extrems/compiled_pad.bin: ector 2e5e4100 crc 8e2da39f adler 6ed62d5e fletcher 664dee8d; 0400 bytes (0200 words)

@JMC47
Copy link
Contributor

JMC47 commented Jul 26, 2022

Tested to work in eduke32.

inline bool SwapLeftRight() const;
inline bool UseNewFlagMasks() const;

Copy link
Contributor

Choose a reason for hiding this comment

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

inline is useless here, you're telling the compiler that these methods may be defined in multiple translation units but not actually providing the implementation in the header so it never will be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does inline in AESnd.cpp have meaning, and if so, does using inline in AESnd.cpp require also using it AESnd.h? I know I've done it in the cpp file before and I did it in the header as well, but I'm not 100% confident I understand the rules surrounding 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'm not actually sure what a conforming C++ compiler/linker does when you use different linkage declarations across multiple declarations/definitions on the same function (MSVC appears to use the one in the declaration rather than the definition), but to clear up a likely misunderstanding here: inline does not mean that the function will be inlined (or considered for inlining), it just affects linkage. (See the first two answers here for details.) The way you've used it here doesn't do anything in practice because there's no possible second compilation unit that could contain a definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. In particular this was useful:

Generally, the compiler will be able to do this better than you. However, the compiler doesn't have the option to inline code if it doesn't have the function definition. In maximally optimized code usually all private methods are inlined whether you ask for it or not.

I made a similar mistake in #10826; I'll change it locally there too. (I have a few other ideas for changes I want to make to that now that I've read the ppc 750cl manual further, to better support dcache emulation later on. So I've made it a draft for now.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(We do also have DOLPHIN_FORCE_INLINE in Common/Inline.h, but I think that's overkill here.)

@Pokechu22 Pokechu22 force-pushed the dsp-hle-aesnd-more-versions branch from 565e2e9 to 6c9b24c Compare July 26, 2022 01:21
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss left a comment

Choose a reason for hiding this comment

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

Code looks sensible. I assume the fifoci changes are unrelated.

@Pokechu22 Pokechu22 force-pushed the dsp-hle-aesnd-more-versions branch from 6c9b24c to 9315706 Compare July 26, 2022 02:30
@Pokechu22 Pokechu22 changed the title DSPHLE: Support more versions of libaesnd uCode DSPHLE: Support EDuke32 Wii libaesnd uCode Jul 26, 2022
@Pokechu22 Pokechu22 force-pushed the dsp-hle-aesnd-more-versions branch from 9315706 to 5de6734 Compare July 26, 2022 02:36
@@ -293,6 +293,7 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)

case 0x008366af:
case 0x078066ab:
case 0x5ad4d933:
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, is there a reason these aren't using constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there's any reason not to other than that there aren't super obvious names for them (I've got constants in ASnd.cpp and AESnd.cpp, but AX.cpp/AXWii.cpp and Zelda.cpp don't have them and there isn't any easy way to get more information about them either).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I didn't know if it'd be helpful to put the constant here instead. But this function is mostly non-constants with comments. So maybe just a comment instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to try out the constants, and it ended up being fairly easy to move these ones to the header file, so I've switched to using them. That should make it easier to find the more detailed comments associated with the constants. (I don't think it'd be useful to change the other ones, apart from maybe card and GBA - note that UCODE_ROM and UCODE_INIT_AUDIO_SYSTEM are magic values that aren't actual hashes, which is kinda jank.)

@Pokechu22 Pokechu22 force-pushed the dsp-hle-aesnd-more-versions branch from 5de6734 to 1dcccb1 Compare July 26, 2022 03:36
@AdmiralCurtiss AdmiralCurtiss merged commit c7752f8 into dolphin-emu:master Jul 26, 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
4 participants