mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 14:50:41 -07:00
21f469b260
## Link to GitHub Issue, if one exists #477 ## Description of change Arena cab has two sound cards and it uses `WrappedIMMDeviceCollection` to set the volume to 100% on boot on both, instead of the typical `GetDefaultAudioEndpoint`. ## Testing Testing Delta, testing other games as well as they are affected.
28 lines
778 B
C++
28 lines
778 B
C++
#include "mme.h"
|
|
#include <mmeapi.h>
|
|
|
|
#include "util/detour.h"
|
|
#include "util/logging.h"
|
|
|
|
namespace hooks::audio::mme {
|
|
|
|
static decltype(mixerSetControlDetails) *mixerSetControlDetails_orig = nullptr;
|
|
|
|
MMRESULT
|
|
WINAPI
|
|
mixerSetControlDetails_hook(
|
|
HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails) {
|
|
log_misc("audio::mme", "mixerSetControlDetails_hook called; ignoring volume change");
|
|
return MMSYSERR_NOERROR;
|
|
}
|
|
|
|
void init(HINSTANCE module) {
|
|
mixerSetControlDetails_orig =
|
|
detour::iat_try("mixerSetControlDetails", mixerSetControlDetails_hook, module);
|
|
|
|
if (mixerSetControlDetails_orig != nullptr) {
|
|
log_misc("audio::mme", "mixerSetControlDetails hooked");
|
|
}
|
|
}
|
|
}
|