From 4287e22c8bc769ec374d6112ed96ea335abccf32 Mon Sep 17 00:00:00 2001 From: kumatan Date: Sun, 31 Jul 2022 08:56:56 +0900 Subject: [PATCH] =?UTF-8?q?TAG187=202022/07/31=20=20=20Driver=20=20=20=20?= =?UTF-8?q?=20MT=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=82=B0=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGE.txt | 4 + mucomDotNETDriver/music2.cs | 240 ++++++++++++------ .../Properties/launchSettings.json | 2 +- 3 files changed, 167 insertions(+), 79 deletions(-) diff --git a/CHANGE.txt b/CHANGE.txt index 33b9bfd..114b133 100644 --- a/CHANGE.txt +++ b/CHANGE.txt @@ -1,4 +1,8 @@ 更新履歴 +TAG187 2022/07/31 + Driver + MTコマンドのバグ修正。 + TAG186 2022/07/27 2nd Compiler 警告の件元に戻したが、1度のみ出力されるように修正。 diff --git a/mucomDotNETDriver/music2.cs b/mucomDotNETDriver/music2.cs index ed57f2d..83d52f0 100644 --- a/mucomDotNETDriver/music2.cs +++ b/mucomDotNETDriver/music2.cs @@ -1207,6 +1207,21 @@ public void STV2(byte c) c = work.soundWork.CRYDAT[work.pg.algo]; + STV3(c, d, e); + + //繝代Λ繝。繝シ繧ソ陦ィ遉コ蜷代¢ + List args = new List(); + if (work.isDotNET && (work.cd.FMVolMode == 2 || work.cd.FMVolMode == 3)) + args.Add(work.pg.volume); + else + args.Add(work.pg.volume - 4); + args.Add(work.cd.FMVolMode); + + DummyOUT(enmMMLType.Volume, args); + } + + public void STV3(byte c,byte d,byte e) + { if (CheckCh3SpecialMode()) { if ((work.pg.useSlot & 1) != 0) @@ -1214,74 +1229,43 @@ public void STV2(byte c) if ((c & (1 << 0)) != 0)//slot1 { byte v = e; - if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127); + if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127); PSGOUT((byte)(d + 0 * 4), v);// スキスャセ假スア セセ PSGOUT セ } } - if ((work.pg.useSlot & 4) != 0) { if ((c & (1 << 1)) != 0)//slot3 { byte v = e; - if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127); + if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127); PSGOUT((byte)(d + 1 * 4), v);// スキスャセ假スア セセ PSGOUT セ } } - if ((work.pg.useSlot & 2) != 0) { if ((c & (1 << 2)) != 0)//slot2 { byte v = e; - if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127); + if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127); PSGOUT((byte)(d + 2 * 4), v);// スキスャセ假スア セセ PSGOUT セ } } - if ((work.pg.useSlot & 8) != 0) { if ((c & (1 << 3)) != 0)//slot4 { byte v = e; - if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127); + if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127); PSGOUT((byte)(d + 3 * 4), v);// スキスャセ假スア セセ PSGOUT セ } } - } else { - for (int b = 0; b < 4; b++) - { - if ((c & (1 << b)) != 0) - { - byte v = e; - if (work.isDotNET) - { - if (e == 255) - { - v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[b] + work.pg.v_tl[b], 0), 127); - } - else - { - v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[b], 0), 127); - } - } - PSGOUT((byte)(d + b * 4), v);// スキスャセ假スア セセ PSGOUT セ - } - } + STV4(c, d, e, 4, work.header.CarrierCorrection); } - //繝代Λ繝。繝シ繧ソ陦ィ遉コ蜷代¢ - List args = new List(); - if (work.isDotNET && (work.cd.FMVolMode == 2 || work.cd.FMVolMode == 3)) - args.Add(work.pg.volume); - else - args.Add(work.pg.volume - 4); - args.Add(work.cd.FMVolMode); - - DummyOUT(enmMMLType.Volume, args); } public void STV2opm(byte c) @@ -1304,25 +1288,7 @@ public void STV2opm(byte c) c = work.soundWork.CRYDAT[work.pg.algo]; - for (int b = 0; b < 4; b++) - { - if ((c & (1 << b)) != 0) - { - byte v = e; - if (work.isDotNET) - { - if (e == 255) - { - v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[b] + work.pg.v_tl[b], 0), 127); - } - else - { - v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[b], 0), 127); - } - } - PSGOUT((byte)(d + b * 8), v);// スキスャセ假スア セセ PSGOUT セ - } - } + STV3opm(c, d, e); //繝代Λ繝。繝シ繧ソ陦ィ遉コ蜷代¢ List args = new List(); @@ -1335,6 +1301,78 @@ public void STV2opm(byte c) DummyOUT(enmMMLType.Volume, args); } + public void STV3opm(byte c, byte d, byte e) + { + STV4(c, d, e, 8, work.header.CarrierCorrection); + } + public void STV4(byte c, byte d, byte e,byte m,bool caryCor) + { + if ((work.pg.useSlot & 1) != 0) + { + if ((c & (1 << 0)) != 0) + { + byte v = e; + if (e == 255) + { + v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[0] + work.pg.v_tl[0], 0), 127); + } + else + { + if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127); + } + PSGOUT((byte)(d + 0 * m), v);// スキスャセ假スア セセ PSGOUT セ + } + } + if ((work.pg.useSlot & 4) != 0) + { + if ((c & (1 << 1)) != 0) + { + byte v = e; + if (e == 255) + { + v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[1] + work.pg.v_tl[1], 0), 127); + } + else + { + if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127); + } + PSGOUT((byte)(d + 1 * m), v);// スキスャセ假スア セセ PSGOUT セ + } + } + if ((work.pg.useSlot & 2) != 0) + { + if ((c & (1 << 2)) != 0) + { + byte v = e; + if (e == 255) + { + v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[2] + work.pg.v_tl[2], 0), 127); + } + else + { + if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127); + } + PSGOUT((byte)(d + 2 * m), v);// スキスャセ假スア セセ PSGOUT セ + } + } + if ((work.pg.useSlot & 8) != 0) + { + if ((c & (1 << 3)) != 0) + { + byte v = e; + if (e == 255) + { + v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[3] + work.pg.v_tl[3], 0), 127); + } + else + { + if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127); + } + PSGOUT((byte)(d + 3 * m), v);// スキスャセ假スア セセ PSGOUT セ + } + } + } + public void PSGOUT(byte d, byte e) { byte port = 0; @@ -2009,8 +2047,45 @@ public void LFORST2() { return; } - work.pg.fnum = work.pg.TLlfo; + + //volume縺ョ蜀崎ィュ螳 + byte c = (byte)(Math.Min(work.soundWork.TOTALV + work.pg.volume, 20));// INPUT VOLUME + byte e; + if (work.isDotNET) + { + if (work.cd.FMVolMode == 2) + e = (byte)(127 - Math.Min(Math.Max(work.pg.volume, 0), 127)); + else if (work.cd.FMVolMode == 3) + e = 255; + else + { + //if (work.cd.currentFMVolTable == null) + // work.cd.currentFMVolTable = work.soundWork.FMVDAT; + e = work.cd.currentFMVolTable[c];// GET VOLUME DATA + } + } + else + e = work.soundWork.FMVDAT[c];// GET VOLUME DATA + + work.pg.fnum = work.pg.TLlfo + e; work.pg.bfnum2 = 0; + STVOL(); + + //volume莉・螟悶ョTL蜀崎ィュ螳 + byte d; + byte m; + if (work.soundWork.currentChip != 4) + { + d = (byte)(0x40 + work.pg.channelNumber);// GET PORT No. + m = 4; + } + else { + d = (byte)(0x60 + work.pg.channelNumber);// GET PORT No. + m = 8; + } + + STV4((byte)~work.soundWork.CRYDAT[work.pg.algo], d, 0, m, true); + } // *** ADPCM PLAY *** @@ -2474,7 +2549,7 @@ public void STENV() //KUMA:tl縺ョ菫晏ュ - if (work.isDotNET && work.header.CarrierCorrection) + //if (work.isDotNET && work.header.CarrierCorrection) { work.pg.v_tl[0] = work.fmVoiceAtMusData[hl + 4 + 0]; work.pg.v_tl[1] = work.fmVoiceAtMusData[hl + 4 + 1]; @@ -2562,7 +2637,7 @@ public void STENVopm() //KUMA:tl縺ョ菫晏ュ - if (work.header.CarrierCorrection) + //if (work.header.CarrierCorrection) { work.pg.v_tl[0] = work.fmVoiceAtMusData[hl + 4 + 0]; work.pg.v_tl[1] = work.fmVoiceAtMusData[hl + 4 + 1]; @@ -4174,6 +4249,11 @@ public void LFOP5(int hl) { if (work.pg.tlLfoflg) { + if (work.soundWork.currentChip == 4) + { + LFOP6opm(hl); + return; + } LFOP6(hl); return; } @@ -4268,29 +4348,33 @@ public void LFOP6(int hl) d += (byte)work.pg.channelNumber; byte e = (byte)hl; - if ((c & 0x01) != 0) - { - PSGOUT(d, e); - d += 4; - } - if ((c & 0x04) != 0) - { - PSGOUT(d, e); - d += 4; - } - if ((c & 0x02) != 0) - { - PSGOUT(d, e); - d += 4; - } - if ((c & 0x08) == 0) - { - return; - } - PSGOUT(d, e); + if ((c & 0x01) != 0) PSGOUT(d, e); + d += 4; + if ((c & 0x04) != 0) PSGOUT(d, e); d += 4; + if ((c & 0x02) != 0) PSGOUT(d, e); + d += 4; + if ((c & 0x08) == 0) return; + PSGOUT(d, e); } + public void LFOP6opm(int hl) + { + byte c = work.pg.TLlfoSlot;//.soundWork.LFOP6_VAL; + + byte d = 0x60; + d += (byte)work.pg.channelNumber; + byte e = (byte)hl; + + if ((c & 0x01) != 0) PSGOUT(d, e); + d += 8; + if ((c & 0x04) != 0) PSGOUT(d, e); + d += 8; + if ((c & 0x02) != 0) PSGOUT(d, e); + d += 8; + if ((c & 0x08) == 0) return; + PSGOUT(d, e); + } public void prcLFO() diff --git a/mucomDotNETPlayer/Properties/launchSettings.json b/mucomDotNETPlayer/Properties/launchSettings.json index bff378d..c318431 100644 --- a/mucomDotNETPlayer/Properties/launchSettings.json +++ b/mucomDotNETPlayer/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Player": { "commandName": "Project", - "commandLineArgs": "\"D:\\bootcamp\\Source\\Repos\\mml2vgm\\mml2vgm\\mml2vgm\\sample\\mucomDotNET\\testSSGwave.mub\"" + "commandLineArgs": "\"D:\\bootcamp\\FM髻ウ貅申\data\\閾ェ菴彌\mamonoro\\LostWind\\testTemplate.mub\"" } } } \ No newline at end of file