Skip to content

Commit

Permalink
TAG719 2024/02/04
Browse files Browse the repository at this point in the history
  Core:OPNA,OPNA2,OPNB,OPN2,OPN2X:効果音モード中にTTON(タイトーリリースモード)を使用するとFM4-6のRR/SLの値が破壊されるバグを修正
  • Loading branch information
kumatan committed Feb 4, 2024
1 parent 9bdf253 commit d2b5642
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 49 deletions.
3 changes: 3 additions & 0 deletions mml2vgm/CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
�X�V����
TAG719 2024/02/04
Core:OPNA,OPNA2,OPNB,OPN2,OPN2X:���ʉ����[�h����TTON(�^�C�g�[�����[�X���[�h)���g�p�����FM4-6��RR/SL�̒l���j�󂳂��o�O���C��

TAG718 2024/01/26
IDE:NiseC86ctl�ɑΉ��B�{�����ǂݍ��߂Ȃ����Ɏg�p���܂��B

Expand Down
7 changes: 7 additions & 0 deletions mml2vgm/Core/chips/YM2608.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,5 +1158,12 @@ public override string DispRegion(Tuple<string, clsPcm> 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));
}

}
}
36 changes: 36 additions & 0 deletions mml2vgm/Core/chips/YM2609.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
)
)
);
}
}
}
6 changes: 6 additions & 0 deletions mml2vgm/Core/chips/YM2610B.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1311,5 +1311,11 @@ public override string DispRegion(Tuple<string, clsPcm> 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));
}

}
}
5 changes: 5 additions & 0 deletions mml2vgm/Core/chips/YM2612.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}
}
90 changes: 48 additions & 42 deletions mml2vgm/Core/chips/clsOPN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion mml2vgm/makeZip.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 17 additions & 6 deletions mml2vgm/mml2vgmIDE/ChipRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -9150,6 +9150,17 @@ public List<PackData> 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;
}
Expand Down

0 comments on commit d2b5642

Please sign in to comment.