foxygit / doom Log in
commit 6e4f6ab9626d81e4106d3ccc974a76d832fdff13
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu May 28 18:37:31 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu May 28 18:37:31 2009 +0000

    Set channel bits for OPL3 so that OPL2 traces will play back properly.

    Subversion-branch: /branches/opl-branch
    Subversion-revision: 1537
---
 opl/examples/droplay.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/opl/examples/droplay.c b/opl/examples/droplay.c
index af1a59d9..5f09fe11 100644
--- a/opl/examples/droplay.c
+++ b/opl/examples/droplay.c
@@ -39,6 +39,15 @@ void WriteReg(unsigned int reg, unsigned int val)
 {
     int i;

+    // This was recorded from an OPL2, but we are probably playing
+    // back on an OPL3, so we need to enable the original OPL2
+    // channels.  Doom does this already, but other games don't.
+
+    if ((reg & 0xf0) == OPL_REGS_FEEDBACK)
+    {
+        val |= 0x30;
+    }
+
     OPL_WritePort(OPL_REGISTER_PORT, reg);

     for (i=0; i<6; ++i)