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

Identify music and sound raws; plotinfo.unk23c8_flags.caverns_opened #689

Merged
merged 13 commits into from
Dec 28, 2023
Merged

Identify music and sound raws; plotinfo.unk23c8_flags.caverns_opened #689

merged 13 commits into from
Dec 28, 2023

Conversation

Bumber64
Copy link
Contributor

world.raws.unk_v50_2 seems to be raws for music tracks, based on some conditions tested in a function (0x14030df60 win64 Steam) that references it. One of those conditions tested (at 0x14030f92e) was (plotinfo.unk23c8_flags >> 7) & 1, which is caverns_opened via process of elimination (confirmed ingame.)

world.raws.unk_v50_3 seems to be raws for sounds, based on use in make_announcement function (0x1400574e0 win64 Steam.)

@Bumber64
Copy link
Contributor Author

Bumber64 commented Dec 16, 2023

For research purposes, in the sound raw struct:
Offset 0x58 is an index (int32_t?) into an array of FMOD Sound * somewhere.
Offset 0x60 is a sorted vector<df::announcement_type> that defines the announcement types the sound can play for.

df.raws.xml Outdated Show resolved Hide resolved
@ab9rf
Copy link
Member

ab9rf commented Dec 17, 2023

unk_v50_2 is actually music_handlerst music and unk_v50_3 is actually sound_handlerst sound

music_handlerst contains a single field, svector<musicst *> music and sound_handlerst contains a single field, svector<soundst *> sound. both of these classes have class-specific methods, although none of them are virtual

while we're at it, unk_v50_1 is actually text_set_handlerst text_set

@ab9rf
Copy link
Member

ab9rf commented Dec 17, 2023

For research purposes, in the sound raw struct:
Offset 0x58 is an index (int32_t?) into an array of FMOD Sound * somewhere.
Offset 0x60 is a sorted vector<df::announcement_type> that defines the announcement types the sound can play for.

soundst is something fairly close to the following (note: not tested, could have errors)

<stl-string name='token'/>
<int32_t name='index'/>
<stl-vector name='current_definition'> <stl-string/> </stl-vector>
<int32_t name='source_hfid'/>
<int32_t name='source_enid'/>
<int32_t name='sound'/>
<stl-vector name='announcement'> <enum type-name='announcement_type'> </stl-vector>

df.ui.xml Outdated Show resolved Hide resolved
Update df.ui.xml
Update df.raws.xml
* Update df.raws.xml

* Update df.ui.xml
df.raws.xml Outdated Show resolved Hide resolved
df.raws.xml Outdated Show resolved Hide resolved
@Bumber64
Copy link
Contributor Author

Bumber64 commented Dec 17, 2023

Additional stuff (v50.11 win64 Steam):
There's a bool at 0x142172148 that determines if sounds will be played.

There's FUN_1408192c0 for playing sounds. Might request this from Bay12 if we don't have a better way of doing so.
1st param is a class/struct pointer located at 0x142172128.
2nd param is the sound index from soundst.
3rd and 4th params involve volume.

Stuff in the 1st param's struct:
Offset 0x0 is an FMOD System *
Offset 0x58 is an FMOD ChannelControl *
Offset 0x3f7 is a static array of FMOD Sound * using the sound index
Offset 0x5e38 stores an FMOD_RESULT from FMOD::ChannelControl::isPlaying (see at 0x14030dfc8.)

@quietust
Copy link
Member

That sounds a lot like the musicsound_info class defined in g_src/music_and_sound_g.h.

@Bumber64
Copy link
Contributor Author

Bumber64 commented Dec 18, 2023

That sounds a lot like the musicsound_info class defined in g_src/music_and_sound_g.h.

So the function is void play_sound(int s, int32_t vol, bool use_media_sound_volume);

The definition in g_src/music_and_sound.cpp makes use of the SoundType enum to compare s to SOUND_ALERT. Can the value of s go beyond the enum if mods are used? I might consider using the enum instead of <int32_t name='sound'/> in soundst otherwise. Edit: Got it up to 30 with an announcement sounds mod, which is well beyond the enum.

changelog.txt Outdated Show resolved Hide resolved
@myk002
Copy link
Member

myk002 commented Dec 20, 2023

@ab9rf @quietust it looks like all your comments were addressed, but could you check one last time before we merge?

@myk002 myk002 merged commit 080547f into DFHack:master Dec 28, 2023
17 checks passed
@Bumber64 Bumber64 deleted the patch-1 branch December 28, 2023 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants