PCem

changeset 36:3150e4f3c1a3

Workaround for bad AWE32 ROM dumps created by AWE-DUMP - Win95 AWE32 drivers now work with these dumps. EMU8000 now updates CVCF/VTFT with current/target volume - Win95 AWE32 drivers now no longer cut off notes early. Set SB DSP version for AWE32 to v4.13.
author TomW
date Sun Nov 10 16:40:52 2013 +0000
parents 7f9686ece79d
children bea391e61690
files src/sound_emu8k.c src/sound_sb.c src/sound_sb_dsp.c
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/src/sound_emu8k.c	Fri Nov 08 22:32:34 2013 +0000
     1.2 +++ b/src/sound_emu8k.c	Sun Nov 10 16:40:52 2013 +0000
     1.3 @@ -554,6 +554,7 @@
     1.4                  {
     1.5                          case ENV_ATTACK:
     1.6                          emu8k->voice[c].env_vol += emu8k->voice[c].env_attack;
     1.7 +                        emu8k->voice[c].vtft |= 0xffff0000;
     1.8                          if (emu8k->voice[c].env_vol >= (1 << 21))
     1.9                          {
    1.10                                  emu8k->voice[c].env_vol = 1 << 21;
    1.11 @@ -563,6 +564,7 @@
    1.12                          
    1.13                          case ENV_DECAY:
    1.14                          emu8k->voice[c].env_vol -= emu8k->voice[c].env_decay;
    1.15 +                        emu8k->voice[c].vtft = (emu8k->voice[c].vtft & ~0xffff0000) | ((emu8k->voice[c].env_sustain >> 5) << 16);
    1.16                          if (emu8k->voice[c].env_vol <= emu8k->voice[c].env_sustain)
    1.17                          {
    1.18                                  emu8k->voice[c].env_vol = emu8k->voice[c].env_sustain;
    1.19 @@ -572,6 +574,7 @@
    1.20  
    1.21                          case ENV_RELEASE:
    1.22                          emu8k->voice[c].env_vol -= emu8k->voice[c].env_release;
    1.23 +                        emu8k->voice[c].vtft &= ~0xffff0000;
    1.24                          if (emu8k->voice[c].env_vol <= 0)
    1.25                          {
    1.26                                  emu8k->voice[c].env_vol = 0;
    1.27 @@ -580,6 +583,11 @@
    1.28                          break;
    1.29                  }
    1.30  
    1.31 +                if (emu8k->voice[c].env_vol >= (1 << 21))
    1.32 +                        emu8k->voice[c].cvcf &= ~0xffff0000;
    1.33 +                else
    1.34 +                        emu8k->voice[c].cvcf = (emu8k->voice[c].cvcf & ~0xffff0000) | ((emu8k->voice[c].env_vol >> 5) << 16);
    1.35 +
    1.36                  switch (emu8k->voice[c].menv_state)
    1.37                  {
    1.38                          case ENV_ATTACK:
    1.39 @@ -649,6 +657,13 @@
    1.40          fread(emu8k->rom, 1024 * 1024, 1, f);
    1.41          fclose(f);
    1.42          
    1.43 +        /*AWE-DUMP creates ROM images offset by 2 bytes, so if we detect this
    1.44 +          then correct it*/
    1.45 +        if (emu8k->rom[3] == 0x314d && emu8k->rom[4] == 0x474d)
    1.46 +        {
    1.47 +                memcpy(&emu8k->rom[0], &emu8k->rom[1], (1024 * 1024) - 2);
    1.48 +                emu8k->rom[0x7ffff] = 0;
    1.49 +        }
    1.50          io_sethandler(0x0620, 0x0004, emu8k_inb, emu8k_inw, NULL, emu8k_outb, emu8k_outw, NULL, emu8k);
    1.51          io_sethandler(0x0a20, 0x0004, emu8k_inb, emu8k_inw, NULL, emu8k_outb, emu8k_outw, NULL, emu8k);
    1.52          io_sethandler(0x0e20, 0x0004, emu8k_inb, emu8k_inw, NULL, emu8k_outb, emu8k_outw, NULL, emu8k);
     2.1 --- a/src/sound_sb.c	Fri Nov 08 22:32:34 2013 +0000
     2.2 +++ b/src/sound_sb.c	Sun Nov 10 16:40:52 2013 +0000
     2.3 @@ -387,7 +387,7 @@
     2.4          memset(sb, 0, sizeof(sb_t));
     2.5  
     2.6          opl3_init(&sb->opl);
     2.7 -        sb_dsp_init(&sb->dsp, SB16);
     2.8 +        sb_dsp_init(&sb->dsp, SB16 + 1);
     2.9          sb_dsp_setaddr(&sb->dsp, 0x0220);
    2.10          sb_mixer_init(&sb->mixer);
    2.11          io_sethandler(0x0220, 0x0004, opl3_read,   NULL, NULL, opl3_write,   NULL, NULL, &sb->opl);
     3.1 --- a/src/sound_sb_dsp.c	Fri Nov 08 22:32:34 2013 +0000
     3.2 +++ b/src/sound_sb_dsp.c	Sun Nov 10 16:40:52 2013 +0000
     3.3 @@ -49,7 +49,7 @@
     3.4  };
     3.5  
     3.6  char sb16_copyright[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
     3.7 -uint16_t sb_dsp_versions[] = {0, 0, 0x105, 0x200, 0x201, 0x300, 0x302, 0x405};
     3.8 +uint16_t sb_dsp_versions[] = {0, 0, 0x105, 0x200, 0x201, 0x300, 0x302, 0x405, 0x40d};
     3.9  
    3.10  /*These tables were 'borrowed' from DOSBox*/
    3.11  	int8_t scaleMap4[64] = {