-
Member
[1.12.1] Sound in background
The 1.12.1 client doesn't play sound in background and lacks the option to allow this, which kinda sucks. I've searched far and wide and found no pre-existing solutions, so I set out to work out my own. I'm not particularly good at game hacking and haven't done any real WoW hacking before, so I'm not 100% sure what I'm doing here :P
WoW uses FMod for sound, and within FMod.dll the most relevant function looked like _FSOUND_SetMute. I set some breakpoints and quickly found a function at 0x007a4860 that seems to get called every time the game window loses and gains focus, and mutes and unmutes sound accordingly, as well as changes a global to reflect the status. My best guess is that this is an event handler function for a window focus event.
It was then trivial to change this function so that it does not mute sound when the window loses focus. The way I did this was to change offset 0x007a4868 from JZ 14 to JZ 27 so that the code that marks the window as inactive and mutes the sound is skipped. This does have the side effect of making the global always think the client is in focus, but from what I can tell it seems to only be used by FSound-related code so this is probably alright. With this change the client appears to happily play sound in the background.
Would greatly appreciate it if someone who knows more about this could check my work, because I'm a little clueless when it comes to this stuff.
-
Post Thanks / Like - 1 Thanks
Corthezz (1 members gave Thanks to Hareturtle for this useful post)
-
Active Member
Originally Posted by
Hareturtle
The 1.12.1 client doesn't play sound in background and lacks the option to allow this, which kinda sucks. I've searched far and wide and found no pre-existing solutions, so I set out to work out my own. I'm not particularly good at game hacking and haven't done any real WoW hacking before, so I'm not 100% sure what I'm doing here :P
WoW uses FMod for sound, and within FMod.dll the most relevant function looked like _FSOUND_SetMute. I set some breakpoints and quickly found a function at 0x007a4860 that seems to get called every time the game window loses and gains focus, and mutes and unmutes sound accordingly, as well as changes a global to reflect the status. My best guess is that this is an event handler function for a window focus event.
It was then trivial to change this function so that it does not mute sound when the window loses focus. The way I did this was to change offset 0x007a4868 from JZ 14 to JZ 27 so that the code that marks the window as inactive and mutes the sound is skipped. This does have the side effect of making the global always think the client is in focus, but from what I can tell it seems to only be used by FSound-related code so this is probably alright. With this change the client appears to happily play sound in the background.
Would greatly appreciate it if someone who knows more about this could check my work, because I'm a little clueless when it comes to this stuff.
You could just NOP out all calls to FSOUND_SetMute instead and the internal state machine that manages whether or not the window is active will still work properly.
-
Member
I figured there may be legitimate calls to it, but looks like there aren't (stuff like the "Enable Music" checkboxes in the options do not appear to call the function). Either way, looks like that particular variable is only used by functions that check it before calling SetMute, so functionally there's probably no difference in disabling it like this and NOPing out all calls to SetMute.
-
Established Member
-
Member
Originally Posted by
oiramario
wow.exe -nosound
It seems that flag disables sound initialization altogether rather than messing with SetMute.