libretro / beetle-ngp-libretro

Standalone port of Mednafen NGP to the libretro API, itself a fork of Neopop.
GNU General Public License v2.0
11 stars 44 forks source link

Ogre Battle Gaiden: Zenobia no Ouji. No sound when meet a enemy. #48

Closed leoxxx closed 5 years ago

leoxxx commented 5 years ago

It's no problem in NGP.EMU. When meet a enemy, play a nosie sound till battale beginning in NEOPOP.

stellarporter commented 5 years ago

On NGP.EMU, it plays the entire digitized speech correctly?

With NEOPOP, I get partial speech and then glitched until battle tune starts.

Latest Mednafen gets broken speech + no battle music / sfx either (same with Beetle core). Guess I'll ping Mednafen author again if I get somewhere.

stellarporter commented 5 years ago

NGP.EMU = incorrect. No DAC speech: Fight it out, Liberation, Lucky, Boo Boo, Thank you, etc.

This looks to be a hard one.

DIS  366DF3: DEC 1,XDE               "EA 69"
DIS  366DF5: LD (0x6E90),XDE         "F1 90 6E 62"  ==  DAC counter  [1a34]

DIS  366DF9: LD W,A                  "C9 88"
DIS  366DFB: LD (0xA2),WA            "F0 A2 50"
DIS  366DFE: LD (0x6E8C),XHL         "F1 8C 6E 63"  ==  DAC src  [2b0e88]

DAC src and/or counter gets reset to new values in the middle of playback, causing static and garble. It's random but very likely to trigger. At best, you'll hear most of the speech sample or some of it. Usually you get trash. And if unlucky, it never stops trashing and carries over everywhere.

Created a dirty, ugly Ogre Battle hack for NEOPOP that will pretty often play speech correctly. Inside TLCS900h_interpret, we can save those 2 ram values before executing opcode. If opcode changes it to bad values, we rewind ram values back again.

Not so likely I'll find cause of this error, maybe ever. And not too interested in figuring it out given difficulty. But I will try merging this into beetle core. Leave it to core maintainers whether to accept such hack.

edit: Better idea. Do checks in storeL.

leoxxx commented 5 years ago

@stellarporter I don't understand these assemble. Maybe you're right. I‘m sure you're right. Because Neo Geo World Cup 98 Plus no speech in NGP.EMU.

stellarporter commented 5 years ago

@leoxxx Don't worry. Just writing up everything for documentation. When someone smarter comes around and picks up the notes.

You can test the Windows fix here. (edit: new link) https://ci.appveyor.com/project/stellarporter/beetle-ngp-libretro/builds/23469499

I'll add it later for the Android tester kits.

ghost commented 5 years ago

While the hack works, this is the fix we need:

void interrupt(uint8_t index, uint8_t level)
{
   push32(pc);
   push16(sr);

   //Up the IFF
   if (level < 7) level++;
   setStatusIFF(level);

   //Access the interrupt vector table to find the jump destination
   pc = loadL(0x6FB8 + index * 4);
}

We are supposed to raise the firing interrupt by 1, not the actual current IFF. This will prevent game from firing IRQs inside the DAC IRQ routine, which breaks the speech.

As I do not know the interrupt levels, I am hesitant to submit an actual fix to the repo.