flycast icon indicating copy to clipboard operation
flycast copied to clipboard

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

Open dezraj opened this issue 1 year ago • 10 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

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.

dezraj avatar Jul 11 '22 04:07 dezraj

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.

flyinghead avatar Jul 12 '22 14:07 flyinghead

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

dezraj avatar Jul 12 '22 19:07 dezraj

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).

BloodRaynare avatar Jul 13 '22 00:07 BloodRaynare

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.

dezraj avatar Jul 13 '22 02:07 dezraj

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 avatar Jul 13 '22 12:07 flyinghead

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

flyinghead avatar Jul 14 '22 15:07 flyinghead

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.

dezraj avatar Aug 22 '22 21:08 dezraj

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.

flyinghead avatar May 16 '23 12:05 flyinghead

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

Immersion95 avatar Mar 03 '24 20:03 Immersion95

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 avatar Mar 17 '24 15:03 kihato