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

Dの冒険Ⅶ: Hang after investigating the grave #2106

Closed
Ghabry opened this issue Apr 4, 2020 · 3 comments · Fixed by #2118
Closed

Dの冒険Ⅶ: Hang after investigating the grave #2106

Ghabry opened this issue Apr 4, 2020 · 3 comments · Fixed by #2118

Comments

@Ghabry
Copy link
Member

Ghabry commented Apr 4, 2020

Name of the game:

Dの冒険Ⅶ

https://viprpgkohaku2016.wixsite.com/kohaku2016/no-20
Direct DL link

Attach files (as a .zip archive or link them)

Save07.zip

Describe the issue in detail and how to reproduce it:

Investigate the grave directly above you. It fades to a scene where it says "Chapter 8" and then it hangs with "Event 2 reached execution limit"

Good news: Not a regression. Hangs in 0.5.4 and newer

@Ghabry
Copy link
Member Author

Ghabry commented Apr 4, 2020

Same as #1733 : Needs proper MIDI Ticks support

@Ghabry
Copy link
Member Author

Ghabry commented Apr 5, 2020

This game only uses a ">=" measurement to decide if enough time has past. So implementing a not precise version of midi ticks would be enough to fix it. I was already able to implement a sloppy version of GetTicks for fmmidi. In my test it has around the same value as harmony, with an error of +-100. Will also try to get it working for Wildmidi.

There is another more interesting bug here: I'm lucky that I used SdlAudio instead of SdlMixerAudio otherwise wouldn't have noticed it:

The game quickly does 2 "BgmPlay" event calls after each other. Somehow the 2nd BgmPlay event is lost. When BgmStop is called we synchronize on a mutex with SDL_Lock/UnlockAudio and wait until it is safe to delete the bgm decoder.
It seems SDL_Lock/Unlock doesn't behave really like a mutex (maybe allows multiple locks?): It doesn't wait on the Lock, the Bgm is not destroyed and BgmPlay fails because there is no free channel and the Midi never starts playback.

tl;dr: std::mutex fixes this.

@Ghabry
Copy link
Member Author

Ghabry commented Apr 7, 2020

The observation was incorrect, SDL_Lock/UnlockAudio works as expected. Was another bug in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants