diff --git a/mml2vgm/CHANGE.txt b/mml2vgm/CHANGE.txt index af384922..01bdf94b 100644 --- a/mml2vgm/CHANGE.txt +++ b/mml2vgm/CHANGE.txt @@ -1,4 +1,7 @@ 更新履歴 +TAG719 2024/02/04 + Core:OPNA,OPNA2,OPNB,OPN2,OPN2X:効果音モード中にTTON(タイトーリリースモード)を使用するとFM4-6のRR/SLの値が破壊されるバグを修正 + TAG718 2024/01/26 IDE:NiseC86ctlに対応。本物が読み込めない時に使用します。 diff --git a/mml2vgm/Core/chips/YM2608.cs b/mml2vgm/Core/chips/YM2608.cs index faf913f8..87b79b05 100644 --- a/mml2vgm/Core/chips/YM2608.cs +++ b/mml2vgm/Core/chips/YM2608.cs @@ -1158,5 +1158,12 @@ public override string DispRegion(Tuple pcm) , pcm.Item2.status.ToString() ); } + + protected override void GetPortVch(partPage page, out byte[] port, out int vch) + { + port = (page.ch > 2 && page.ch < 6) ? page.port[1] : page.port[0]; + vch = (byte)((page.ch > 2 && page.ch < 6) ? page.ch - 3 : (page.ch < 3 ? page.ch : 2)); + } + } } \ No newline at end of file diff --git a/mml2vgm/Core/chips/YM2609.cs b/mml2vgm/Core/chips/YM2609.cs index af0de3d2..f262684e 100644 --- a/mml2vgm/Core/chips/YM2609.cs +++ b/mml2vgm/Core/chips/YM2609.cs @@ -3119,5 +3119,41 @@ public override void CmdLoopExtProc(partPage page, MML mml) } } + protected override void GetPortVch(partPage page, out byte[] port, out int vch) + { + port = + page.ch < 3 ? + page.port[0] : + (page.ch < 6 ? + page.port[1] : + (page.ch < 9 ? + page.port[2] : + (page.ch < 12 ? + page.port[3] : + (page.ch < 15 ? + page.port[0] : + page.port[2] + ) + ) + ) + ); + vch = (byte)( + page.ch < 3 ? + page.ch : + (page.ch < 6 ? + (page.ch - 3) : + (page.ch < 9 ? + (page.ch - 6) : + (page.ch < 12 ? + (page.ch - 9) : + (page.ch < 15 ? + 2 : + 2 + ) + ) + ) + ) + ); + } } } diff --git a/mml2vgm/Core/chips/YM2610B.cs b/mml2vgm/Core/chips/YM2610B.cs index 98ccf336..2837b8fd 100644 --- a/mml2vgm/Core/chips/YM2610B.cs +++ b/mml2vgm/Core/chips/YM2610B.cs @@ -1311,5 +1311,11 @@ public override string DispRegion(Tuple pcm) ); } + protected override void GetPortVch(partPage page, out byte[] port, out int vch) + { + port = (page.ch > 2 && page.ch < 6) ? page.port[1] : page.port[0]; + vch = (byte)((page.ch > 2 && page.ch < 6) ? page.ch - 3 : (page.ch < 3 ? page.ch : 2)); + } + } } \ No newline at end of file diff --git a/mml2vgm/Core/chips/YM2612.cs b/mml2vgm/Core/chips/YM2612.cs index c44358b3..34d549d7 100644 --- a/mml2vgm/Core/chips/YM2612.cs +++ b/mml2vgm/Core/chips/YM2612.cs @@ -625,6 +625,11 @@ public override void MultiChannelCommand(MML mml) } + protected override void GetPortVch(partPage page, out byte[] port, out int vch) + { + port = (page.ch > 2 && page.ch < 6) ? page.port[1] : page.port[0]; + vch = (byte)((page.ch > 2 && page.ch < 6) ? page.ch - 3 : (page.ch < 3 ? page.ch : 2)); + } } } diff --git a/mml2vgm/Core/chips/clsOPN.cs b/mml2vgm/Core/chips/clsOPN.cs index 9a39bef9..c7ce5b11 100644 --- a/mml2vgm/Core/chips/clsOPN.cs +++ b/mml2vgm/Core/chips/clsOPN.cs @@ -752,49 +752,11 @@ public void OutFmSetSlRr(MML mml, partPage page, int ope, int sl, int rr) SOutData(page, mml, port, (byte)(0x80 + vch + ope * 4), (byte)((sl << 4) + rr)); } - protected void GetPortVch(partPage page, out byte[] port, out int vch) + protected virtual void GetPortVch(partPage page, out byte[] port, out int vch) { - if (!(page.chip is YM2609)) - { - port = page.ch > 2 ? page.port[1] : page.port[0]; - vch = (byte)(page.ch > 2 ? page.ch - 3 : page.ch); - } - else - { - port = - page.ch < 3 ? - page.port[0] : - (page.ch < 6 ? - page.port[1] : - (page.ch < 9 ? - page.port[2] : - (page.ch < 12 ? - page.port[3] : - (page.ch < 15 ? - page.port[0] : - page.port[2] - ) - ) - ) - ); - vch = (byte)( - page.ch < 3 ? - page.ch : - (page.ch < 6 ? - (page.ch - 3) : - (page.ch < 9 ? - (page.ch - 6) : - (page.ch < 12 ? - (page.ch - 9) : - (page.ch < 15 ? - 2 : - 2 - ) - ) - ) - ) - ); - } + //YM2203 + port = page.port[0]; + vch = (byte)(page.ch > 2 ? page.ch - 3 : page.ch); } protected void GetPortVchSsg(partPage page, out int port, out int adr, out int vch) @@ -1227,8 +1189,52 @@ public void OutFmSetInstrument(partPage page, MML mml, int n, int vol, char type ((ClsOPN)page.chip).OutFmSetSSGEG(mml, vpg, ope, parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 11]); for (int i = 0; i < Const.INSTRUMENT_M_OPERATOR_SIZE; i++) + { vpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + if (isDef) + { + if (!(page.chip is YM2609)) + { + if (page.ch == 2 || page.ch == m + 3 || page.ch == m + 4 || page.ch == m + 5) + { + page.chip.lstPartWork[2].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[m + 3].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[m + 4].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[m + 5].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + } + } + else + { + if (page.chip.lstPartWork[2].cpg.Ch3SpecialMode && page.ch >= 12 && page.ch < 15) + { + page.chip.lstPartWork[2].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[12].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[13].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[14].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + } + if (page.chip.lstPartWork[8].cpg.Ch3SpecialMode && page.ch >= 15 && page.ch < 18) + { + page.chip.lstPartWork[8].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[15].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[16].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + page.chip.lstPartWork[17].cpg.voice[partPage.voiceWidth + ope * partPage.voiceWidth + i] + = parent.instFM[n].Item2[ope * Const.INSTRUMENT_M_OPERATOR_SIZE + 1 + i]; + } + } + } + } } if ((page.slots & 1) != 0) page.op1ml = parent.instFM[n].Item2[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8]; diff --git a/mml2vgm/makeZip.bat b/mml2vgm/makeZip.bat index 7a8845be..c918e698 100644 --- a/mml2vgm/makeZip.bat +++ b/mml2vgm/makeZip.bat @@ -7,7 +7,7 @@ del /Q .\output\mml2vgm\*.pdb xcopy .\mvc\bin\Release\*.* .\output\mml2vgm /E /R /Y /I /K rem xcopy .\mml2vgmIDE\bin\Release\*.* .\output\mml2vgmIDE /E /R /Y /I /K -xcopy .\mml2vgmIDEx64\bin\x64\Release\net6.0-windows\*.* .\output\mml2vgmIDEx64 /E /R /Y /I /K +xcopy .\mml2vgmIDEx64\bin\x64\Release\net8.0-windows7.0\*.* .\output\mml2vgmIDEx64 /E /R /Y /I /K copy /Y .\CHANGE.txt .\output copy /Y .\IDE.txt .\output copy /Y .\Script.txt .\output diff --git a/mml2vgm/mml2vgmIDE/ChipRegister.cs b/mml2vgm/mml2vgmIDE/ChipRegister.cs index 0d19894f..5ac3efb8 100644 --- a/mml2vgm/mml2vgmIDE/ChipRegister.cs +++ b/mml2vgm/mml2vgmIDE/ChipRegister.cs @@ -8939,7 +8939,7 @@ private void SN76489WriteRegisterControl(Chip Chip, EnmDataType type, int addres if (ctSN76489[Chip.Number].UseEmu) { - if (address != 0x100) + if (address != 0x1) { mds.WriteSN76489(Chip.Index, (byte)Chip.Number, (byte)data); } @@ -8950,7 +8950,7 @@ private void SN76489WriteRegisterControl(Chip Chip, EnmDataType type, int addres } else if (ctSN76489[Chip.Number].UseEmu2) { - if (address != 0x100) + if (address != 0x1) { mds.WriteSN76496(Chip.Index, (byte)Chip.Number, (byte)data); } @@ -8985,7 +8985,7 @@ private void SN76489WriteRegisterControl(Chip Chip, EnmDataType type, int addres { if (ctSN76489[dat.Chip.Number].UseEmu) { - if (dat.Address != 0x100) + if (dat.Address != 0x1) { mds.WriteSN76489(dat.Chip.Index, (byte)dat.Chip.Number, (byte)dat.Data); } @@ -8996,7 +8996,7 @@ private void SN76489WriteRegisterControl(Chip Chip, EnmDataType type, int addres } else if (ctSN76489[dat.Chip.Number].UseEmu2) { - if (dat.Address != 0x100) + if (dat.Address != 0x1) { mds.WriteSN76496(dat.Chip.Index, (byte)dat.Chip.Number, (byte)dat.Data); } @@ -9025,7 +9025,7 @@ private void SN76489WriteRegisterControl(Chip Chip, EnmDataType type, int addres public void SN76489SetRegisterGGpanning(outDatum od, long Counter, int ChipID, int dData) { - enq(od, Counter, SN76489[ChipID], EnmDataType.Normal, 0x100, dData, null); + enq(od, Counter, SN76489[ChipID], EnmDataType.Normal, 0x1, dData, null); //EnmModel model = EnmModel.VirtualModel; //if (ctSN76489 == null) return; @@ -9058,7 +9058,7 @@ public void SN76489SetRegisterProcessing(ref long Counter, ref Chip Chip, ref En if (Chip.Number == 0) chipLED.PriDCSG = 2; else chipLED.SecDCSG = 2; - if (Address == 0x100) + if (Address == 0x1) { SN76489RegisterGGPan[Chip.Number] = dData; return; @@ -9150,6 +9150,17 @@ public List SN76489MakeSoftReset(int chipID) data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xbf, null)); data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xdf, null)); data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xff, null)); + //freq 0 + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0x80, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0x00, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xa0, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0x00, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xc0, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0x00, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0xe0, null)); + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 0, 0x00, null)); + //pan reset + data.Add(new PackData(null, SN76489[chipID], EnmDataType.Normal, 1, 0xff, null)); return data; }