flyinghead / flycast

Flycast is a multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator
GNU General Public License v2.0
1.5k stars 176 forks source link

[gdrom] Unexpected CDDA restart in King of Fighters Dream Match 1999 #690

Open dezraj opened 2 years ago

dezraj commented 2 years ago

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

Github hash: c77c3ab0

Hardware: i5-10400 16gb RAM GTX 1660 Ti

Description of the Issue

Hello! I'm experiencing two issues with King of Fighters Dream Match 1999 (a.k.a. KOF98 for the Dreamcast).

The first is that the audio track in the character select screen and order select screen is restarting inappropriately. I've recorded a short video-clip in which I reproduce the issue. Take a look: https://drive.google.com/file/d/1H0_1arcttPIHhSudklOcQyDeqK5KWoIM/view?usp=sharing

The track was supposed to continue playing when I switched from the character select screen to the next competitor/order select screen, but a loop is being triggered incorrectly. The track was supposed to loop only after its duration time finished. For comparison, this doesn't happen in the Re-dream emulator.

The second issue is with the character sprites. The emulator is showing some black lines around them either before and after the fight. It affects all the characters in the stage, even those in the background not currently fighting. I've also made a short video-clip showing the issue. Here: https://drive.google.com/file/d/1HVKMk-YDuQnyvWLKAmLaGdrZKMMresDg/view?usp=sharing

It's a little difficult to see in the video but much more noticeable in real time and in full screen play.

Except this, the game seems to be running perfectly.

Thank you so much for your work and any help with these issues.

flyinghead commented 2 years ago

I committed two fixes for these issues on the dev branch.

Note that the black lines artifacts around the characters still happen when upscaling (x1.5 and up). But it should no longer happen at native resolution (x1). These upscaling artifacts are due to a poor usage of texture filtering and texture coordinates by the game.

dezraj commented 2 years ago

Thank you so much. I will wait for a new binary so I can test the changes.

BloodRaynare commented 2 years ago

I just tested it as well. While the graphic problems are no more (On native res at least), the audio side is still bit incorrect though. It's true that the BGM during character select should keep playing until the gameplay enters, but the ingame BGMs should restart after each rounds instead of pausing then resume playing (I already confirms it by checking the footage of the real hardware captures on YT though it was much better this way :p).

dezraj commented 2 years ago

I just tested it as well. While the graphic problems are no more (On native res at least), the audio side is still bit incorrect though. It's true that the BGM during character select should keep playing until the gameplay enters, but the ingame BGMs should restart after each rounds instead of pausing then resume playing (I already confirms it by checking the footage of the real hardware captures on YT though it was much better this way :p).

Yes, the accurate behavior (that is, the way SNK implemented it) was to restart the track after every round. They didn't use the full potential of the Dreamcast hardware, which allowed the track to continue playing even after changing rounds. The developers only did this for the following titles (KOF99 Evolution and so on). It would be great if Flycast could offer a hack to simulate this feature from the later SNK ports, but if it's not possible I suppose it would be better to just reproduce the accurate behavior, anyway.

Thank you so much for your testing and feedback on this issue.

flyinghead commented 2 years ago

Thanks for testing and reporting.

I updated the previous change to only ignore CD_PLAY if already playing, and not when paused. This should reset the audio track at the beginning of each round.

flyinghead commented 2 years ago

Yet another change, hopefully final. And it should also fix the problem when using HLE BIOS.

dezraj commented 2 years ago

I'm sorry for not reporting back earlier. I didn't know the dev branch was also available for download because my monitor resolution is 1600x900 so the dev builds don't show easily in the builds page if you don't scroll down.

So I went and tried the latest dev build and everything seems to be fixed. I wonder how Redream emulator can upscale this game without showing the lines in the sprites. Perhaps it uses some kind of hack to avoid that?

Anyway, thank you so much again for your work.

flyinghead commented 1 year ago

gdrom changes were causing regressions in several other games so they were reverted.

After investigating it looks like the 2nd CD_PLAY call (after the character selection) shouldn't be sent by the game. It wrongly thinks that the gdrom isn't playing because it uses an outdated drive status. Pretending the drive is always playing fixes the issue but is obviously wrong as well.

Immersion95 commented 8 months ago

Regarding the black lines, you can Force Nearest Neighbor in texture filtering when you upscale.

kihato commented 8 months ago

It seems to work well if you explicitly specify SecNumber.Status = GD_PLAY as follows. "Reel Fishing - Wild" does not appear to be affected by this change.

gdromv3.cpp

case SPI_GET_SCD:
    {
        printf_spicmd("SPI_GET_SCD");
        SecNumber.Status = GD_PLAY;
kihato commented 4 months ago

SecNumber.Status = GD_PLAY can be replaced with SecNumber.Status = GD_BUSY. However, I'm not sure if this code or this location is appropriate.