SPU2-X: Prevent volume check from altering volume

Fixes issue in Tokyo Xtreme Racer Zero where checking the left master
volume would alter it.
This commit is contained in:
FlatOutPS2 2017-01-18 13:31:19 +01:00
parent fe27d3b25a
commit 57cbc901b7
1 changed files with 21 additions and 8 deletions

View File

@ -1021,18 +1021,21 @@ static void __fastcall RegWrite_VoiceParams(u16 value)
thisvoice.ADSR.regADSR2 = value; thisvoice.ADSR.regADSR2 = value;
break; break;
// REG_VP_ENVX, REG_VP_VOLXL and REG_VP_VOLXR have been confirmed to not be allowed to be written to, so code has been commented out.
// Colin McRae Rally 2005 triggers case 5 (ADSR), but it doesn't produce issues enabled or disabled.
case 5: case 5:
// [Air] : Mysterious ADSR set code. Too bad none of my games ever use it. // [Air] : Mysterious ADSR set code. Too bad none of my games ever use it.
// (as usual... ) // (as usual... )
thisvoice.ADSR.Value = (value << 16) | value; //thisvoice.ADSR.Value = (value << 16) | value;
ConLog("* SPU2: Mysterious ADSR Volume Set to 0x%x\n", value); //ConLog("* SPU2: Mysterious ADSR Volume Set to 0x%x\n", value);
break; break;
case 6: case 6:
thisvoice.Volume.Left.RegSet(value); //thisvoice.Volume.Left.RegSet(value);
break; break;
case 7: case 7:
thisvoice.Volume.Right.RegSet(value); //thisvoice.Volume.Right.RegSet(value);
break; break;
jNO_DEFAULT; jNO_DEFAULT;
@ -1075,14 +1078,17 @@ static void __fastcall RegWrite_VoiceAddr(u16 value)
// for example). Tests should be done to find games that write to this // for example). Tests should be done to find games that write to this
// reg, and see if they're buggy or not. --air // reg, and see if they're buggy or not. --air
// NextA has been confirmed to not be allowed to be written to, so code has been commented out.
// FlatOut & Soul Reaver 2 trigger these cases, but don't produce issues enabled or disabled.
case 4: case 4:
thisvoice.NextA = ((value & 0x0F) << 16) | (thisvoice.NextA & 0xFFF8) | 1; //thisvoice.NextA = ((value & 0x0F) << 16) | (thisvoice.NextA & 0xFFF8) | 1;
thisvoice.SCurrent = 28; //thisvoice.SCurrent = 28;
break; break;
case 5: case 5:
thisvoice.NextA = (thisvoice.NextA & 0x0F0000) | (value & 0xFFF8) | 1; //thisvoice.NextA = (thisvoice.NextA & 0x0F0000) | (value & 0xFFF8) | 1;
thisvoice.SCurrent = 28; //thisvoice.SCurrent = 28;
break; break;
} }
} }
@ -1430,6 +1436,13 @@ static void __fastcall RegWrite_CoreExt(u16 value)
thiscore.InpVol.Right = GetVol32(value); thiscore.InpVol.Right = GetVol32(value);
break; break;
// MVOLX has been confirmed to not be allowed to be written to, so cases have been added as a no-op.
// Tokyo Xtreme Racer Zero triggers this code, caused left side volume to be reduced.
case REG_P_MVOLXL:
case REG_P_MVOLXR:
break;
default: { default: {
const int raddr = addr + ((core == 1) ? 0x28 : 0); const int raddr = addr + ((core == 1) ? 0x28 : 0);
*(regtable[raddr >> 1]) = value; *(regtable[raddr >> 1]) = value;