flycast icon indicating copy to clipboard operation
flycast copied to clipboard

Broken music emulation in Sakura Taisen 3

Open TheOpponent opened this issue 2 years ago • 6 comments

Please Note: This form is the minimum required information for submitting bugs.
Removing this form may lead to your issue being closed until it is completed.

Platform / OS / Hardware: Windows 10 2004

Github hash: c77c3ab

Hardware: Intel Core i9-10850K Nvidia GeForce RTX 3070Ti 32 GB RAM

Description of the Issue

At least one music track in Sakura Taisen 3 loads the incorrect music data, causing completely incorrect playback. In the below recording, the music appears to be the game's main theme but with the samples for this scene, resulting in a severely discordant sound.

Debugging Steps Tested

  • Play the game until the third portion of the first chapter, or load a save file starting from that point, and observe the incorrect music.
  • Problem occurs with and without DSP enabled.

Logs Gathered

n/a

Screenshots

https://user-images.githubusercontent.com/8432212/178606119-10edd57e-f8f4-4166-86ba-40191cd0c17b.mp4

Compare with recording from hardware: https://youtu.be/-eqyyL7YZQo?t=145

TheOpponent avatar Jul 12 '22 22:07 TheOpponent

This VMU contains save data for Sakura Taisen 3. The second file starts at the chapter in question.

vmu_save_A1.zip

TheOpponent avatar Jul 14 '22 14:07 TheOpponent

Thanks, this is very helpful. I tried several vmu saves I have but I'm a bit lost with this game.

flyinghead avatar Jul 14 '22 14:07 flyinghead

I should have uploaded this when I opened the issue. I apologize for not thinking to until this morning.

TheOpponent avatar Jul 14 '22 15:07 TheOpponent

I was able to reproduce it easily. Interestingly, it is an intermittent issue: in 10% of the cases the audio is fine. More investigation is needed to find the root cause.

flyinghead avatar Jul 20 '22 08:07 flyinghead

It's likely this issue would also affect Sakura Taisen 4, which is based on largely the same code.

TheOpponent avatar Jul 20 '22 14:07 TheOpponent

This particular case has been fixed in version 2.0 aa97a6d6, but further testing is needed later in the game.

TheOpponent avatar Aug 30 '22 19:08 TheOpponent

When I started and checked my past flycast, I found one bug-free version. It's very old from 2020-04-04. However, it was difficult to investigate the cause because the bug was sometimes reproduced in that version. Finally, I found a broadcast set in dc_flash.bin that is not normally set in Japanese games. Set broadcast to PAL. The answer was really simple.

Now the BGM of Ep.1-2 is played normally, but this time a bug occurs in Ep.2-4. This is because I changed the broadcast to PAL.

Ep.2-4 is the last file. (It takes a while until the BGM bugs.) vmu_save_A1.zip

kihato avatar Jul 05 '23 10:07 kihato

The source of the bug was found to be in a commit dated September 22, 2018.

6e017fd: Can be reproduced 0c575a5: Cannot reproduce

However, if you boot 0c575a5 with HLE BIOS, there will be a bug with NTSC, so realBIOS is required. If you boot with realBIOS, there seems to be no need for a specific broadcast. Also, dc_flash.bin is not required.

https://github.com/flyinghead/flycast/assets/14366233/e441ae0b-d508-417d-bf29-0d2b61111416

kihato avatar Nov 23 '23 03:11 kihato

Great find! Indeed increasing the GD-ROM wait time by 10% fixes the issue. Should be fixed in the next dev build.

flyinghead avatar Nov 23 '23 15:11 flyinghead