Wire SMSG_PLAY_MUSIC to MusicManager via SoundEntries.dbc lookup

Add PlayMusicCallback to GameHandler so SMSG_PLAY_MUSIC (and the
vanilla 0x0103 alias) dispatch a soundId to the registered handler
instead of being silently consumed. Application.cpp registers the
callback, loads SoundEntries.dbc, resolves the first non-empty
Name+DirectoryBase into an MPQ path, and passes it to MusicManager
for non-looping playback. Resolves the TODO in the SMSG_PLAY_MUSIC
handler.
This commit is contained in:
Kelsi 2026-03-09 15:46:19 -07:00
parent ab32ec8933
commit 4e3d50fc20
3 changed files with 37 additions and 2 deletions

View file

@ -1174,6 +1174,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
if (packet.getSize() - packet.getReadPos() == 4) {
uint32_t soundId = packet.readUInt32();
LOG_INFO("SMSG_PLAY_MUSIC (0x0103 alias): soundId=", soundId);
if (playMusicCallback_) playMusicCallback_(soundId);
return;
}
} else if (opcode == 0x0480) {
@ -4496,8 +4497,8 @@ void GameHandler::handlePacket(network::Packet& packet) {
// ---- Play music (WotLK standard opcode) ----
case Opcode::SMSG_PLAY_MUSIC: {
if (packet.getSize() - packet.getReadPos() >= 4) {
/*uint32_t soundId =*/ packet.readUInt32();
// TODO: hook into music manager when in-world music is reworked
uint32_t soundId = packet.readUInt32();
if (playMusicCallback_) playMusicCallback_(soundId);
}
break;
}