7.3 Broken PlaySoundFile()/PlaySound()
Hi,
I did a taint log to find what was the main cause of these lua errors(I'm aware of the logout/quit functions are now protected in 7.3), and apparently it's on the 4/9th line of my small addon. This was an addon created for me by Afterafterlife @ https://www.reddit.com/r/wowaddons/c..._addon_sounds/ which i have shown below; Code:
-- This file is loaded from "!Play_Addon_Sounds.toc" Code:
function PlaySoundFile(fileName, track) Code:
function PlaySound(fileName, track) |
What you're doing is not safe. Any time the default UI calls your replacement functions the execution path becomes tainted afterwards. If the call to PlaySound is eventually followed by some protected function call from signed code down the path, then it's going to break.
In cases where you want to replace an API function, you need to make sure that the function isn't used in any execution path that ultimately does something protected. |
Quote:
|
Unless Blizzard provides some CVar to disable PlaySound or add a dedicated UI sound channel, you can't really do much except replace sound files, if that still works. Replacing PlaySound with a tainted function will cause a ton of problems because it's used indiscriminately across the UI. As of 7.3, you probably can't even log out with this "fix" in place because of the sound played on the logout popup.
|
And as mentioned in your other thread, you can't alter the SOUNKIT table.
|
Quote:
Quote:
So again with another question; Can I use Ace3 Libraries to overcome this issue? Specifically "AceHook-3.0 Including AceHook functionality" |
No, Ace uses exactly the same API as all other addons and as noted previously, hooking is used for calling one functon after another, not instead of.
|
Quote:
Just had an idea; What about allowing the blizzard ui sounds to go through except spell and music? Or would that be futile? |
Actually, now that we're talking about sound kits, I remembered that PlaySound was replaced by PlaySoundkitID in 7.2(?) so you can actually mute sounds with a filthy little hack. PlaySoundkitID (and PlaySoundFile) both return handles in the form of an integer ID that increments on every call. So by hooking into PlaySound and playing another sound immediately after it you can figure out the sound handle ID and cancel it.
Lua Code:
This should effectively do what you asked for, without replacing the function and without spreading taint. |
That's sneaky and clever. Well done.
|
It was a shame PlaySoundKitID was removed. I used this hack to silence some UI sounds and the UI never, as far as I knew, didn't even use KitID, so I hooked PlaySound and then used PlaySoundKitID to generate the handle+1. Instead of the variable switch you have, I went with adding an extra argument to PlaySound.
Lua Code:
I also have a framepool I left out that skips a frame then checks for a block variable and plays the sound anyways if the block variable is false. The sound names in the table were left in from when PlaySound used those, I kept them for history's sake. |
Quote:
So before I go an further, is that example above a working revision? |
If you want to mute all sounds, use this:
Lua Code:
If you want to allow unique sounds, like the talking head monologues or any other uncommon sound, but not UI sounds, use this: Lua Code:
If you want to mute specific sounds use Kanegasi's solution. They all work the same way. |
Quote:
Here is a complete table with old names and IDs that you can play with PlaySound: https://github.com/Resike/BlizzardIn...ndKitNames.lua |
Hey MunkDev,
Thanks for the suggestion. I'll get back to you on that! Hey Resike, Thanks aswell for your contribution of the soundkit table xD! To everyone who wants to know what my results are, I will be sure to get back to you later! |
Quote:
|
Quote:
https://docs.google.com/spreadsheets...gid=1243506593 |
Quote:
One of the specifications was to allow addons to play sounds, and a lot of addons will likely use sounds (alerts etc) that are not in the soundkit table. |
Quote:
You can open the soundkitentry.db2 from the DBCFiles with WDBX then you can get the FileDataID for every SoundKitID, which would eventually point to a file name, if you crosscheck it with the lastly updated FileDataID. From there you need another table conversion from an older DBCFiles which helps with the Sound FilePath - SoundKit Name conversion, and tada. Or you could just use the soundkitname.db2 and write the values out raw. But that's for non-masochists. |
Quote:
Or would it be easier to change this addon(http://www.wowinterface.com/download...erts.html#info) to play through the "Master" channel whilst SFX are disabled under system>>>sounds in-game? |
All times are GMT -6. The time now is 12:20 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI