From cf1d4e55cf826e6bec182679e7022b4d2a5beded Mon Sep 17 00:00:00 2001 From: cam900 Date: Fri, 23 Sep 2022 23:24:02 +0900 Subject: [PATCH] Fix ADPCM-A playback Add per-chip debug function Add YM2203, YM2608, YM2610/B debug window Extend YM2612 debug window Remove unnecessary values in YM2151, Sega PCM platform --- src/engine/platform/amiga.h | 1 + src/engine/platform/arcade.cpp | 5 - src/engine/platform/arcade.h | 4 +- src/engine/platform/ay.h | 3 +- src/engine/platform/ay8930.h | 3 +- src/engine/platform/bubsyswsg.h | 3 +- src/engine/platform/c64.h | 3 +- src/engine/platform/dummy.h | 3 +- src/engine/platform/fds.h | 3 +- src/engine/platform/gb.h | 3 +- src/engine/platform/genesis.h | 3 +- src/engine/platform/genesisext.h | 3 +- src/engine/platform/lynx.h | 3 +- src/engine/platform/mmc5.h | 3 +- src/engine/platform/msm6258.h | 1 + src/engine/platform/msm6295.h | 1 + src/engine/platform/n163.h | 1 + src/engine/platform/namcowsg.h | 1 + src/engine/platform/nes.h | 1 + src/engine/platform/opl.h | 1 + src/engine/platform/opll.h | 1 + src/engine/platform/pce.h | 1 + src/engine/platform/pcmdac.h | 1 + src/engine/platform/pcspkr.h | 1 + src/engine/platform/pet.h | 1 + src/engine/platform/qsound.h | 1 + src/engine/platform/rf5c68.h | 1 + src/engine/platform/saa.h | 1 + src/engine/platform/scc.h | 1 + src/engine/platform/segapcm.cpp | 4 - src/engine/platform/segapcm.h | 6 +- src/engine/platform/sms.h | 1 + src/engine/platform/su.h | 1 + src/engine/platform/swan.h | 1 + src/engine/platform/tia.h | 1 + src/engine/platform/tx81z.h | 1 + src/engine/platform/vera.h | 1 + src/engine/platform/vic20.h | 1 + src/engine/platform/vrc6.h | 1 + src/engine/platform/x1_010.h | 1 + src/engine/platform/ym2203.h | 1 + src/engine/platform/ym2203ext.cpp | 17 - src/engine/platform/ym2203ext.h | 22 +- src/engine/platform/ym2608.cpp | 27 +- src/engine/platform/ym2608.h | 1 + src/engine/platform/ym2608ext.cpp | 2 +- src/engine/platform/ym2608ext.h | 22 +- src/engine/platform/ym2610.cpp | 22 +- src/engine/platform/ym2610.h | 1 + src/engine/platform/ym2610b.cpp | 20 +- src/engine/platform/ym2610b.h | 1 + src/engine/platform/ym2610bext.h | 1 + src/engine/platform/ym2610ext.h | 1 + src/engine/platform/ymz280b.h | 1 + src/engine/platform/zxbeeper.h | 1 + src/gui/debug.cpp | 583 +++++++++++++++++++++++++++++- src/gui/debug.h | 1 + src/gui/debugWindow.cpp | 16 + 58 files changed, 726 insertions(+), 91 deletions(-) diff --git a/src/engine/platform/amiga.h b/src/engine/platform/amiga.h index 59617ec3..a0a80d6c 100644 --- a/src/engine/platform/amiga.h +++ b/src/engine/platform/amiga.h @@ -86,6 +86,7 @@ class DivPlatformAmiga: public DivDispatch { int sep1, sep2; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index c86f806e..47743099 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -833,9 +833,6 @@ void DivPlatformArcade::reset() { } lastBusy=60; - pcmCycles=0; - pcmL=0; - pcmR=0; delay=0; amDepth=0x7f; pmDepth=0x7f; @@ -846,8 +843,6 @@ void DivPlatformArcade::reset() { immWrite(0x19,amDepth); immWrite(0x19,0x80|pmDepth); //rWrite(0x1b,0x00); - - extMode=false; } void DivPlatformArcade::setFlags(unsigned int flags) { diff --git a/src/engine/platform/arcade.h b/src/engine/platform/arcade.h index 2a9c2b40..70265be3 100644 --- a/src/engine/platform/arcade.h +++ b/src/engine/platform/arcade.h @@ -79,14 +79,13 @@ class DivPlatformArcade: public DivPlatformOPM { DivDispatchOscBuffer* oscBuf[8]; opm_t fm; int baseFreqOff; - int pcmL, pcmR, pcmCycles; unsigned char amDepth, pmDepth; ymfm::ym2151* fm_ymfm; ymfm::ym2151::output_data out_ymfm; DivArcadeInterface iface; - bool extMode, useYMFM; + bool useYMFM; bool isMuted[8]; @@ -96,6 +95,7 @@ class DivPlatformArcade: public DivPlatformOPM { void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ay.h b/src/engine/platform/ay.h index e87430e2..4f77281d 100644 --- a/src/engine/platform/ay.h +++ b/src/engine/platform/ay.h @@ -146,7 +146,8 @@ class DivPlatformAY8910: public DivDispatch { size_t ayBufLen; void updateOutSel(bool immediate=false); - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ay8930.h b/src/engine/platform/ay8930.h index 3447f5d4..c1a50e7a 100644 --- a/src/engine/platform/ay8930.h +++ b/src/engine/platform/ay8930.h @@ -150,7 +150,8 @@ class DivPlatformAY8930: public DivDispatch { void updateOutSel(bool immediate=false); void immWrite(unsigned char a, unsigned char v); - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/bubsyswsg.h b/src/engine/platform/bubsyswsg.h index f14b94a7..34bdad3d 100644 --- a/src/engine/platform/bubsyswsg.h +++ b/src/engine/platform/bubsyswsg.h @@ -62,7 +62,8 @@ class DivPlatformBubSysWSG: public DivDispatch { k005289_core k005289; unsigned short regPool[4]; - void updateWave(int ch); + void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/c64.h b/src/engine/platform/c64.h index 7587730b..52685ce7 100644 --- a/src/engine/platform/c64.h +++ b/src/engine/platform/c64.h @@ -82,7 +82,8 @@ class DivPlatformC64: public DivDispatch { SID sid; reSIDfp::SID sid_fp; unsigned char regPool[32]; - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void acquire_classic(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/dummy.h b/src/engine/platform/dummy.h index b8601059..0b5181f0 100644 --- a/src/engine/platform/dummy.h +++ b/src/engine/platform/dummy.h @@ -33,7 +33,8 @@ class DivPlatformDummy: public DivDispatch { Channel chan[128]; DivDispatchOscBuffer* oscBuf[128]; bool isMuted[128]; - unsigned char chans; + unsigned char chans; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/fds.h b/src/engine/platform/fds.h index 2bd98329..2721876e 100644 --- a/src/engine/platform/fds.h +++ b/src/engine/platform/fds.h @@ -77,7 +77,8 @@ class DivPlatformFDS: public DivDispatch { unsigned char regPool[128]; void updateWave(); - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void doWrite(unsigned short addr, unsigned char data); diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index 516e7d9f..347f528b 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -92,7 +92,8 @@ class DivPlatformGB: public DivDispatch { unsigned char regPool[128]; unsigned char procMute(); - void updateWave(); + void updateWave(); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/genesis.h b/src/engine/platform/genesis.h index 8588b21d..6c6837c0 100644 --- a/src/engine/platform/genesis.h +++ b/src/engine/platform/genesis.h @@ -115,7 +115,8 @@ class DivPlatformGenesis: public DivPlatformOPN { bool ladder; unsigned char dacVolTable[128]; - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); inline void processDAC(); diff --git a/src/engine/platform/genesisext.h b/src/engine/platform/genesisext.h index d4dd93e7..352ebc29 100644 --- a/src/engine/platform/genesisext.h +++ b/src/engine/platform/genesisext.h @@ -51,7 +51,8 @@ class DivPlatformGenesisExt: public DivPlatformGenesis { pan(3) {} }; OpChannel opChan[4]; - bool isOpMuted[4]; + bool isOpMuted[4]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: int dispatch(DivCommand c); diff --git a/src/engine/platform/lynx.h b/src/engine/platform/lynx.h index f7fdb62e..a6c1c91c 100644 --- a/src/engine/platform/lynx.h +++ b/src/engine/platform/lynx.h @@ -84,7 +84,8 @@ class DivPlatformLynx: public DivDispatch { Channel chan[4]; DivDispatchOscBuffer* oscBuf[4]; bool isMuted[4]; - std::unique_ptr mikey; + std::unique_ptr mikey; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/mmc5.h b/src/engine/platform/mmc5.h index 90da3eaa..0da3da32 100644 --- a/src/engine/platform/mmc5.h +++ b/src/engine/platform/mmc5.h @@ -67,7 +67,8 @@ class DivPlatformMMC5: public DivDispatch { unsigned char writeOscBuf; struct _mmc5* mmc5; unsigned char regPool[128]; - + + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/msm6258.h b/src/engine/platform/msm6258.h index f6a351b5..f06bdc26 100644 --- a/src/engine/platform/msm6258.h +++ b/src/engine/platform/msm6258.h @@ -87,6 +87,7 @@ class DivPlatformMSM6258: public DivDispatch { int delay, updateOsc, sample, samplePos; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/msm6295.h b/src/engine/platform/msm6295.h index a3751468..5fc5ac7b 100644 --- a/src/engine/platform/msm6295.h +++ b/src/engine/platform/msm6295.h @@ -74,6 +74,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { bool rateSel=false, rateSelInit=false; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/n163.h b/src/engine/platform/n163.h index d4a9ee35..0ff969b6 100644 --- a/src/engine/platform/n163.h +++ b/src/engine/platform/n163.h @@ -89,6 +89,7 @@ class DivPlatformN163: public DivDispatch { unsigned char regPool[128]; void updateWave(int ch, int wave, int pos, int len); void updateWaveCh(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/namcowsg.h b/src/engine/platform/namcowsg.h index ede25e8e..56a8ba3c 100644 --- a/src/engine/platform/namcowsg.h +++ b/src/engine/platform/namcowsg.h @@ -74,6 +74,7 @@ class DivPlatformNamcoWSG: public DivDispatch { int devType, chans; unsigned char regPool[512]; void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index 85c14b0c..2a9923fa 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -79,6 +79,7 @@ class DivPlatformNES: public DivDispatch { xgm::NES_DMC* nes2_NP; unsigned char regPool[128]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void doWrite(unsigned short addr, unsigned char data); diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index 49ea3b72..43f02790 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -118,6 +118,7 @@ class DivPlatformOPL: public DivDispatch { int toFreq(int freq); double NOTE_ADPCMB(int note); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/opll.h b/src/engine/platform/opll.h index 21a77b4e..3f243057 100644 --- a/src/engine/platform/opll.h +++ b/src/engine/platform/opll.h @@ -93,6 +93,7 @@ class DivPlatformOPLL: public DivDispatch { int octave(int freq); int toFreq(int freq); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/pce.h b/src/engine/platform/pce.h index 6f35f179..ec030834 100644 --- a/src/engine/platform/pce.h +++ b/src/engine/platform/pce.h @@ -91,6 +91,7 @@ class DivPlatformPCE: public DivDispatch { PCE_PSG* pce; unsigned char regPool[128]; void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/pcmdac.h b/src/engine/platform/pcmdac.h index 127d39aa..7292f6dd 100644 --- a/src/engine/platform/pcmdac.h +++ b/src/engine/platform/pcmdac.h @@ -77,6 +77,7 @@ class DivPlatformPCMDAC: public DivDispatch { int outDepth; bool outStereo; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/pcspkr.h b/src/engine/platform/pcspkr.h index ba6275c3..48bf1bf5 100644 --- a/src/engine/platform/pcspkr.h +++ b/src/engine/platform/pcspkr.h @@ -84,6 +84,7 @@ class DivPlatformPCSpeaker: public DivDispatch { unsigned short freq, lastFreq; unsigned char regPool[2]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void beepFreq(int freq, int delay=0); diff --git a/src/engine/platform/pet.h b/src/engine/platform/pet.h index 8de21779..3046cc26 100644 --- a/src/engine/platform/pet.h +++ b/src/engine/platform/pet.h @@ -62,6 +62,7 @@ class DivPlatformPET: public DivDispatch { bool isMuted; unsigned char regPool[16]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/qsound.h b/src/engine/platform/qsound.h index 1d737de5..5e2a32fc 100644 --- a/src/engine/platform/qsound.h +++ b/src/engine/platform/qsound.h @@ -72,6 +72,7 @@ class DivPlatformQSound: public DivDispatch { struct qsound_chip chip; unsigned short regPool[512]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/rf5c68.h b/src/engine/platform/rf5c68.h index 50324fbf..bcbb3da2 100644 --- a/src/engine/platform/rf5c68.h +++ b/src/engine/platform/rf5c68.h @@ -71,6 +71,7 @@ class DivPlatformRF5C68: public DivDispatch { size_t sampleMemLen; rf5c68_device rf5c68; unsigned char regPool[144]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/saa.h b/src/engine/platform/saa.h index 92855be7..d2092efb 100644 --- a/src/engine/platform/saa.h +++ b/src/engine/platform/saa.h @@ -72,6 +72,7 @@ class DivPlatformSAA1099: public DivDispatch { size_t saaBufLen; unsigned char saaEnv[2]; unsigned char saaNoise[2]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/scc.h b/src/engine/platform/scc.h index b6117d4a..20dcf4a9 100644 --- a/src/engine/platform/scc.h +++ b/src/engine/platform/scc.h @@ -65,6 +65,7 @@ class DivPlatformSCC: public DivDispatch { unsigned char regBase; unsigned char regPool[225]; void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 53e844eb..650f54c9 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -441,8 +441,6 @@ void DivPlatformSegaPCM::reset() { pcmR=0; sampleBank=0; delay=0; - amDepth=0x7f; - pmDepth=0x7f; if (dumpWrites) { for (int i=0; i<16; i++) { @@ -451,8 +449,6 @@ void DivPlatformSegaPCM::reset() { addWrite(0x10003+(i<<3),0x7f); } } - - extMode=false; } void DivPlatformSegaPCM::setFlags(unsigned int flags) { diff --git a/src/engine/platform/segapcm.h b/src/engine/platform/segapcm.h index 01fd38c6..888a3384 100644 --- a/src/engine/platform/segapcm.h +++ b/src/engine/platform/segapcm.h @@ -80,21 +80,19 @@ class DivPlatformSegaPCM: public DivDispatch { QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {} }; std::queue writes; - int delay, baseFreqOff; + int delay; int pcmL, pcmR, pcmCycles; unsigned char sampleBank; unsigned char lastBusy; - unsigned char amDepth, pmDepth; unsigned char regPool[256]; - bool extMode, useYMFM; - bool isMuted[16]; short oldWrites[256]; short pendingWrites[256]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index eef54da1..b382d38d 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -78,6 +78,7 @@ class DivPlatformSMS: public DivDispatch { QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {} }; std::queue writes; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index d76d0722..d94df8ea 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -113,6 +113,7 @@ class DivPlatformSoundUnit: public DivDispatch { void writeControl(int ch); void writeControlUpper(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/swan.h b/src/engine/platform/swan.h index cf792638..473667a9 100644 --- a/src/engine/platform/swan.h +++ b/src/engine/platform/swan.h @@ -74,6 +74,7 @@ class DivPlatformSwan: public DivDispatch { std::queue writes; WSwan* ws; void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/tia.h b/src/engine/platform/tia.h index b838e068..3eb32b97 100644 --- a/src/engine/platform/tia.h +++ b/src/engine/platform/tia.h @@ -46,6 +46,7 @@ class DivPlatformTIA: public DivDispatch { unsigned char chanOscCounter; TIA::Audio tia; unsigned char regPool[16]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); unsigned char dealWithFreq(unsigned char shape, int base, int pitch); diff --git a/src/engine/platform/tx81z.h b/src/engine/platform/tx81z.h index d1e42728..b1d09db9 100644 --- a/src/engine/platform/tx81z.h +++ b/src/engine/platform/tx81z.h @@ -88,6 +88,7 @@ class DivPlatformTX81Z: public DivPlatformOPM { int octave(int freq); int toFreq(int freq); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/vera.h b/src/engine/platform/vera.h index 53e766dc..9cda0120 100644 --- a/src/engine/platform/vera.h +++ b/src/engine/platform/vera.h @@ -60,6 +60,7 @@ class DivPlatformVERA: public DivDispatch { struct VERA_PCM* pcm; int calcNoteFreq(int ch, int note); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/vic20.h b/src/engine/platform/vic20.h index d4b56028..834051dd 100644 --- a/src/engine/platform/vic20.h +++ b/src/engine/platform/vic20.h @@ -63,6 +63,7 @@ class DivPlatformVIC20: public DivDispatch { unsigned char regPool[16]; sound_vic20_t* vic; void updateWave(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/engine/platform/vrc6.h b/src/engine/platform/vrc6.h index 81c81016..4c56bc79 100644 --- a/src/engine/platform/vrc6.h +++ b/src/engine/platform/vrc6.h @@ -78,6 +78,7 @@ class DivPlatformVRC6: public DivDispatch, public vrcvi_intf { vrcvi_core vrc6; unsigned char regPool[13]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index 1844cf09..19fb9135 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -120,6 +120,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { double NoteX1_010(int ch, int note); void updateWave(int ch); void updateEnvelope(int ch); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: u8 read_byte(u32 address); diff --git a/src/engine/platform/ym2203.h b/src/engine/platform/ym2203.h index 75660365..7a4aa797 100644 --- a/src/engine/platform/ym2203.h +++ b/src/engine/platform/ym2203.h @@ -94,6 +94,7 @@ class DivPlatformYM2203: public DivPlatformOPN { bool extMode; unsigned char prescale; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ym2203ext.cpp b/src/engine/platform/ym2203ext.cpp index 527a8be6..f3b279c9 100644 --- a/src/engine/platform/ym2203ext.cpp +++ b/src/engine/platform/ym2203ext.cpp @@ -63,7 +63,6 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) { } if (opChan[ch].insChanged) { // TODO how does this work? rWrite(chanOffs[2]+0xb0,(ins->fm.alg&7)|(ins->fm.fb<<3)); - rWrite(chanOffs[2]+0xb4,(opChan[ch].pan<<6)|(ins->fm.fms&7)|((ins->fm.ams&3)<<4)); } opChan[ch].insChanged=false; @@ -103,22 +102,6 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) { } opChan[ch].ins=c.value; break; - case DIV_CMD_PANNING: { - if (c.value==0 && c.value2==0) { - opChan[ch].pan=3; - } else { - opChan[ch].pan=(c.value2>0)|((c.value>0)<<1); - } - DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM); - if (parent->song.sharedExtStat) { - for (int i=0; i<4; i++) { - if (ch==i) continue; - opChan[i].pan=opChan[ch].pan; - } - } - rWrite(chanOffs[2]+0xb4,(opChan[ch].pan<<6)|(ins->fm.fms&7)|((ins->fm.ams&3)<<4)); - break; - } case DIV_CMD_PITCH: { opChan[ch].pitch=c.value; opChan[ch].freqChanged=true; diff --git a/src/engine/platform/ym2203ext.h b/src/engine/platform/ym2203ext.h index d25ca45d..9bc460af 100644 --- a/src/engine/platform/ym2203ext.h +++ b/src/engine/platform/ym2203ext.h @@ -29,13 +29,29 @@ class DivPlatformYM2203Ext: public DivPlatformYM2203 { signed char konCycles; bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, mask; int vol; - unsigned char pan; // UGLY - OpChannel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), pitch2(0), portaPauseFreq(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), - inPorta(false), mask(true), vol(0), pan(3) {} + OpChannel(): + freqH(0), + freqL(0), + freq(0), + baseFreq(0), + pitch(0), + pitch2(0), + portaPauseFreq(0), + ins(-1), + active(false), + insChanged(true), + freqChanged(false), + keyOn(false), + keyOff(false), + portaPause(false), + inPorta(false), + mask(true), + vol(0) {} }; OpChannel opChan[4]; bool isOpMuted[4]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: int dispatch(DivCommand c); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index ff342eb7..b27f81ea 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -546,14 +546,14 @@ void DivPlatformYM2608::tick(bool sysTick) { if (!isMuted[i] && (chan[i].std.vol.had || chan[i].std.panL.had)) { immWrite(0x18+(i-9),isMuted[i]?0:((chan[i].pan<<6)|chan[i].outVol)); } - if (chan[i].keyOff) { - writeRSSOff|=(1<<(i-9)); - chan[i].keyOff=false; - } - if (chan[i].keyOn) { - writeRSSOn|=(1<<(i-9)); - chan[i].keyOn=false; - } + } + if (chan[i].keyOff) { + writeRSSOff|=(1<<(i-9)); + chan[i].keyOff=false; + } + if (chan[i].keyOn) { + writeRSSOn|=(1<<(i-9)); + chan[i].keyOn=false; } } // ADPCM-B @@ -854,6 +854,13 @@ int DivPlatformYM2608::dispatch(DivCommand c) { } break; } + case DIV_CMD_ADPCMA_GLOBAL_VOLUME: { + if (globalRSSVolume!=(c.value&0x3f)) { + globalRSSVolume=c.value&0x3f; + immWrite(0x11,globalRSSVolume&0x3f); + } + break; + } case DIV_CMD_GET_VOLUME: { return chan[c.chan].vol; break; @@ -1184,7 +1191,7 @@ void DivPlatformYM2608::forceIns() { if (i>14) { // ADPCM-B immWrite(0x10b,chan[i].outVol); } else { - immWrite(0x18+(i-9),isMuted[i]?0:((chan[i].pan<<6)|chan[i].vol)); + immWrite(0x18+(i-9),isMuted[i]?0:((chan[i].pan<<6)|chan[i].outVol)); } } @@ -1267,7 +1274,7 @@ void DivPlatformYM2608::reset() { immWrite(0x22,0x08); // PCM volume - immWrite(0x11,0x3f); // A + immWrite(0x11,globalRSSVolume); // A immWrite(0x10b,0xff); // B // ADPCM limit diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 8e2c4e40..073e381d 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -110,6 +110,7 @@ class DivPlatformYM2608: public DivPlatformOPN { double NOTE_OPNB(int ch, int note); double NOTE_ADPCMB(int note); + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ym2608ext.cpp b/src/engine/platform/ym2608ext.cpp index 7f49ed9d..66a4d252 100644 --- a/src/engine/platform/ym2608ext.cpp +++ b/src/engine/platform/ym2608ext.cpp @@ -477,7 +477,7 @@ void DivPlatformYM2608Ext::forceIns() { if (i>14) { // ADPCM-B immWrite(0x10b,chan[i].outVol); } else { - immWrite(0x18+(i-9),isMuted[i]?0:((chan[i].pan<<6)|chan[i].vol)); + immWrite(0x18+(i-9),isMuted[i]?0:((chan[i].pan<<6)|chan[i].outVol)); } } ay->forceIns(); diff --git a/src/engine/platform/ym2608ext.h b/src/engine/platform/ym2608ext.h index 21c8a35c..4792323c 100644 --- a/src/engine/platform/ym2608ext.h +++ b/src/engine/platform/ym2608ext.h @@ -31,11 +31,29 @@ class DivPlatformYM2608Ext: public DivPlatformYM2608 { int vol; unsigned char pan; // UGLY - OpChannel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), pitch2(0), portaPauseFreq(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), - inPorta(false), mask(true), vol(0), pan(3) {} + OpChannel(): + freqH(0), + freqL(0), + freq(0), + baseFreq(0), + pitch(0), + pitch2(0), + portaPauseFreq(0), + ins(-1), + active(false), + insChanged(true), + freqChanged(false), + keyOn(false), + keyOff(false), + portaPause(false), + inPorta(false), + mask(true), + vol(0), + pan(3) {} }; OpChannel opChan[4]; bool isOpMuted[4]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: int dispatch(DivCommand c); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index f80624f4..b8882304 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -484,16 +484,16 @@ void DivPlatformYM2610::tick(bool sysTick) { if (!isMuted[i] && (chan[i].std.vol.had || chan[i].std.panL.had)) { immWrite(0x108+(i-adpcmAChanOffs),isMuted[i]?0:((chan[i].pan<<6)|chan[i].outVol)); } - if (chan[i].keyOff) { - writeADPCMAOff|=(1<<(i-adpcmAChanOffs)); - chan[i].keyOff=false; - } - if (chan[i].keyOn) { - if (chan[i].sample>=0 && chan[i].samplesong.sampleLen) { - writeADPCMAOn|=(1<<(i-adpcmAChanOffs)); - } - chan[i].keyOn=false; + } + if (chan[i].keyOff) { + writeADPCMAOff|=(1<<(i-adpcmAChanOffs)); + chan[i].keyOff=false; + } + if (chan[i].keyOn) { + if (chan[i].sample>=0 && chan[i].samplesong.sampleLen) { + writeADPCMAOn|=(1<<(i-adpcmAChanOffs)); } + chan[i].keyOn=false; } } // ADPCM-B @@ -1246,7 +1246,7 @@ void DivPlatformYM2610::reset() { immWrite(0x22,0x08); // PCM volume - immWrite(0x101,0x3f); // A + immWrite(0x101,globalADPCMAVolume); // A immWrite(0x1b,0xff); // B } @@ -1259,7 +1259,7 @@ bool DivPlatformYM2610::keyOffAffectsArp(int ch) { } void DivPlatformYM2610::notifyInsChange(int ins) { - for (int i=0; i<14; i++) { + for (int i=0; i { 1, 2, 4, 5 }; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 4ee8dea7..9bcc4574 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -546,16 +546,16 @@ void DivPlatformYM2610B::tick(bool sysTick) { if (!isMuted[i] && (chan[i].std.vol.had || chan[i].std.panL.had)) { immWrite(0x108+(i-adpcmAChanOffs),isMuted[i]?0:((chan[i].pan<<6)|chan[i].outVol)); } - if (chan[i].keyOff) { - writeADPCMAOff|=(1<<(i-adpcmAChanOffs)); - chan[i].keyOff=false; - } - if (chan[i].keyOn) { - if (chan[i].sample>=0 && chan[i].samplesong.sampleLen) { - writeADPCMAOn|=(1<<(i-adpcmAChanOffs)); - } - chan[i].keyOn=false; + } + if (chan[i].keyOff) { + writeADPCMAOff|=(1<<(i-adpcmAChanOffs)); + chan[i].keyOff=false; + } + if (chan[i].keyOn) { + if (chan[i].sample>=0 && chan[i].samplesong.sampleLen) { + writeADPCMAOn|=(1<<(i-adpcmAChanOffs)); } + chan[i].keyOn=false; } } // ADPCM-B @@ -1325,7 +1325,7 @@ bool DivPlatformYM2610B::keyOffAffectsArp(int ch) { } void DivPlatformYM2610B::notifyInsChange(int ins) { - for (int i=0; i<16; i++) { + for (int i=0; i { 0, 1, 2, 4, 5, 6 }; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/ym2610bext.h b/src/engine/platform/ym2610bext.h index c54586d3..fcb5e2b0 100644 --- a/src/engine/platform/ym2610bext.h +++ b/src/engine/platform/ym2610bext.h @@ -24,6 +24,7 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B { DivPlatformYM2610Base::OpChannel opChan[4]; bool isOpMuted[4]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: int dispatch(DivCommand c); diff --git a/src/engine/platform/ym2610ext.h b/src/engine/platform/ym2610ext.h index ab7c060f..5cc4432c 100644 --- a/src/engine/platform/ym2610ext.h +++ b/src/engine/platform/ym2610ext.h @@ -24,6 +24,7 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 { DivPlatformYM2610Base::OpChannel opChan[4]; bool isOpMuted[4]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: int dispatch(DivCommand c); diff --git a/src/engine/platform/ymz280b.h b/src/engine/platform/ymz280b.h index cd04186c..72bf3791 100644 --- a/src/engine/platform/ymz280b.h +++ b/src/engine/platform/ymz280b.h @@ -71,6 +71,7 @@ class DivPlatformYMZ280B: public DivDispatch { size_t sampleMemLen; ymz280b_device ymz280b; unsigned char regPool[256]; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: diff --git a/src/engine/platform/zxbeeper.h b/src/engine/platform/zxbeeper.h index 226f556d..b02b1fb7 100644 --- a/src/engine/platform/zxbeeper.h +++ b/src/engine/platform/zxbeeper.h @@ -72,6 +72,7 @@ class DivPlatformZXBeeper: public DivDispatch { int tempR[32]; unsigned char regPool[128]; bool sampleOut; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: void acquire(short* bufL, short* bufR, size_t start, size_t len); diff --git a/src/gui/debug.cpp b/src/gui/debug.cpp index 641df4d3..aff82771 100644 --- a/src/gui/debug.cpp +++ b/src/gui/debug.cpp @@ -28,6 +28,10 @@ #include "../engine/platform/c64.h" #include "../engine/platform/arcade.h" #include "../engine/platform/segapcm.h" +#include "../engine/platform/ym2203.h" +#include "../engine/platform/ym2203ext.h" +#include "../engine/platform/ym2608.h" +#include "../engine/platform/ym2608ext.h" #include "../engine/platform/ym2610.h" #include "../engine/platform/ym2610ext.h" #include "../engine/platform/ym2610b.h" @@ -45,7 +49,82 @@ #include "../engine/platform/pcmdac.h" #include "../engine/platform/dummy.h" -#define GENESIS_DEBUG \ +#define COMMON_CHIP_DEBUG \ + ImGui::Text("- rate: %d",ch->rate); \ + ImGui::Text("- chipClock: %.f",ch->chipClock); + +#define FM_CHIP_DEBUG \ + COMMON_CHIP_DEBUG; \ + ImGui::Text("- lastBusy: %d",ch->lastBusy); \ + ImGui::Text("- delay: %d",ch->delay); + +#define FM_OPN_CHIP_DEBUG \ + FM_CHIP_DEBUG; \ + ImGui::Text("- fmFreqBase: %.f",ch->fmFreqBase); \ + ImGui::Text("- fmDivBase: %d",ch->fmDivBase); \ + ImGui::Text("- ayDiv: %d",ch->ayDiv); + +#define COMMON_CHIP_DEBUG_BOOL \ + ImGui::TextColored(ch->skipRegisterWrites?colorOn:colorOff,">> SkipRegisterWrites"); \ + ImGui::TextColored(ch->dumpWrites?colorOn:colorOff,">> DumpWrites"); + +#define FM_CHIP_DEBUG_BOOL \ + COMMON_CHIP_DEBUG_BOOL; \ + ImGui::TextColored(ch->lastBusy?colorOn:colorOff,">> LastBusy"); \ + +#define FM_OPN_CHIP_DEBUG_BOOL \ + FM_CHIP_DEBUG_BOOL; \ + ImGui::TextColored(ch->extSys?colorOn:colorOff,">> ExtSys"); \ + +#define GENESIS_CHIP_DEBUG \ + DivPlatformGenesis* ch=(DivPlatformGenesis*)data; \ + ImGui::Text("> YM2612"); \ + FM_OPN_CHIP_DEBUG; \ + ImGui::Text("- lfoValue: %d",ch->lfoValue); \ + ImGui::Text("- softPCMTimer: %d",ch->softPCMTimer); \ + FM_OPN_CHIP_DEBUG_BOOL; \ + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); \ + ImGui::TextColored(ch->softPCM?colorOn:colorOff,">> SoftPCM"); \ + ImGui::TextColored(ch->useYMFM?colorOn:colorOff,">> UseYMFM"); \ + ImGui::TextColored(ch->ladder?colorOn:colorOff,">> Ladder"); + +#define OPNB_CHIP_DEBUG \ + FM_OPN_CHIP_DEBUG; \ + ImGui::Text("- adpcmAMemLen: %d",ch->adpcmAMemLen); \ + ImGui::Text("- adpcmBMemLen: %d",ch->adpcmBMemLen); \ + ImGui::Text("- sampleBank: %d",ch->sampleBank); \ + ImGui::Text("- writeADPCMAOff: %d",ch->writeADPCMAOff); \ + ImGui::Text("- writeADPCMAOn: %d",ch->writeADPCMAOn); \ + ImGui::Text("- globalADPCMAVolume: %d",ch->globalADPCMAVolume); \ + ImGui::Text("- extChanOffs: %d",ch->extChanOffs); \ + ImGui::Text("- psgChanOffs: %d",ch->psgChanOffs); \ + ImGui::Text("- adpcmAChanOffs: %d",ch->adpcmAChanOffs); \ + ImGui::Text("- adpcmBChanOffs: %d",ch->adpcmBChanOffs); \ + ImGui::Text("- chanNum: %d",ch->chanNum); \ + FM_OPN_CHIP_DEBUG_BOOL; \ + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); + +#define SMS_CHIP_DEBUG \ + DivPlatformSMS* sms=(DivPlatformSMS*)data; \ + ImGui::Text("> SMS"); \ + ImGui::Text("- rate: %d",sms->rate); \ + ImGui::Text("- chipClock: %.f",sms->chipClock); \ + ImGui::Text("- lastPan: %d",sms->lastPan); \ + ImGui::Text("- oldValue: %d",sms->oldValue); \ + ImGui::Text("- snNoiseMode: %d",sms->snNoiseMode); \ + ImGui::Text("- divider: %d",sms->divider); \ + ImGui::Text("- toneDivider: %.f",sms->toneDivider); \ + ImGui::Text("- noiseDivider: %.f",sms->noiseDivider); \ + ImGui::TextColored(sms->skipRegisterWrites?colorOn:colorOff,">> SkipRegisterWrites"); \ + ImGui::TextColored(sms->dumpWrites?colorOn:colorOff,">> DumpWrites"); \ + ImGui::TextColored(sms->updateSNMode?colorOn:colorOff,">> UpdateSNMode"); \ + ImGui::TextColored(sms->resetPhase?colorOn:colorOff,">> ResetPhase"); \ + ImGui::TextColored(sms->isRealSN?colorOn:colorOff,">> IsRealSN"); \ + ImGui::TextColored(sms->stereo?colorOn:colorOff,">> Stereo"); \ + ImGui::TextColored(sms->nuked?colorOn:colorOff,">> Nuked"); + + +#define GENESIS_CHAN_DEBUG \ DivPlatformGenesis::Channel* ch=(DivPlatformGenesis::Channel*)data; \ ImGui::Text("> YM2612"); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ @@ -53,11 +132,21 @@ ImGui::Text(" - base: %d",ch->baseFreq); \ ImGui::Text(" - pitch: %d",ch->pitch); \ ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("* DAC:"); \ + ImGui::Text(" - period: %d",ch->dacPeriod); \ + ImGui::Text(" - rate: %d",ch->dacRate); \ + ImGui::Text(" - pos: %d",ch->dacPos); \ + ImGui::Text(" - sample: %d",ch->dacSample); \ + ImGui::Text(" - delay: %d",ch->dacDelay); \ + ImGui::Text(" - output: %d",ch->dacOutput); \ ImGui::Text("- note: %d",ch->note); \ ImGui::Text("- ins: %d",ch->ins); \ ImGui::Text("- vol: %.2x",ch->vol); \ ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- pan: %x",ch->pan); \ + ImGui::Text("- opMask: %x",ch->opMask); \ + ImGui::Text("- sampleBank: %d",ch->sampleBank); \ ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ @@ -65,9 +154,35 @@ ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ ImGui::TextColored(ch->furnaceDac?colorOn:colorOff,">> FurnaceDAC"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ + ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ + ImGui::TextColored(ch->dacMode?colorOn:colorOff,">> DACMode"); \ + ImGui::TextColored(ch->dacReady?colorOn:colorOff,">> DACReady"); \ + ImGui::TextColored(ch->dacDirection?colorOn:colorOff,">> DACDirection"); -#define SMS_DEBUG \ +#define GENESIS_OPCHAN_DEBUG \ + DivPlatformGenesisExt::OpChannel* ch=(DivPlatformGenesisExt::OpChannel*)data; \ + ImGui::Text("> YM2612 (per operator)"); \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + ImGui::Text("* freq: %d",ch->freq); \ + ImGui::Text(" - base: %d",ch->baseFreq); \ + ImGui::Text(" - pitch: %d",ch->pitch); \ + ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::Text("- pan: %x",ch->pan); \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); + +#define SMS_CHAN_DEBUG \ DivPlatformSMS::Channel* ch=(DivPlatformSMS::Channel*)data; \ ImGui::Text("> SMS"); \ ImGui::Text("* freq: %d",ch->freq); \ @@ -84,31 +199,477 @@ ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); +#define OPN_CHAN_DEBUG \ + DivPlatformYM2203::Channel* ch=(DivPlatformYM2203::Channel*)data; \ + ImGui::Text("> YM2203"); \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + ImGui::Text("* freq: %d",ch->freq); \ + ImGui::Text(" - base: %d",ch->baseFreq); \ + ImGui::Text(" - pitch: %d",ch->pitch); \ + ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("* PSG:"); \ + ImGui::Text(" - psgMode: %d",ch->psgMode); \ + ImGui::Text(" - autoEnvNum: %d",ch->autoEnvNum); \ + ImGui::Text(" - autoEnvDen: %d",ch->autoEnvDen); \ + ImGui::Text("- sample: %d",ch->sample); \ + ImGui::Text("- note: %d",ch->note); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::Text("- outVol: %.2x",ch->outVol); \ + ImGui::Text("- opMask: %x",ch->opMask); \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ + ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ + ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); + +#define OPN_OPCHAN_DEBUG \ + DivPlatformYM2203Ext::OpChannel* ch=(DivPlatformYM2203Ext::OpChannel*)data; \ + ImGui::Text("> YM2203 (per operator)"); \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + ImGui::Text("* freq: %d",ch->freq); \ + ImGui::Text(" - base: %d",ch->baseFreq); \ + ImGui::Text(" - pitch: %d",ch->pitch); \ + ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); + +#define OPNB_CHAN_DEBUG \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + ImGui::Text("* freq: %d",ch->freq); \ + ImGui::Text(" - base: %d",ch->baseFreq); \ + ImGui::Text(" - pitch: %d",ch->pitch); \ + ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("* PSG:"); \ + ImGui::Text(" - psgMode: %d",ch->psgMode); \ + ImGui::Text(" - autoEnvNum: %d",ch->autoEnvNum); \ + ImGui::Text(" - autoEnvDen: %d",ch->autoEnvDen); \ + ImGui::Text("- sample: %d",ch->sample); \ + ImGui::Text("- note: %d",ch->note); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::Text("- outVol: %.2x",ch->outVol); \ + ImGui::Text("- pan: %x",ch->pan); \ + ImGui::Text("- opMask: %x",ch->opMask); \ + ImGui::Text("- macroVolMul: %x",ch->macroVolMul); \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ + ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ + ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); + +#define OPNB_OPCHAN_DEBUG \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + ImGui::Text("* freq: %d",ch->freq); \ + ImGui::Text(" - base: %d",ch->baseFreq); \ + ImGui::Text(" - pitch: %d",ch->pitch); \ + ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::Text("- pan: %x",ch->pan); \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); + +void putDispatchChip(void* data, int type) { + ImVec4 colorOn=ImVec4(1.0f,1.0f,0.0f,1.0f); + ImVec4 colorOff=ImVec4(0.3f,0.3f,0.3f,1.0f); + switch (type) { + case DIV_SYSTEM_YM2612: + case DIV_SYSTEM_YM2612_EXT: + case DIV_SYSTEM_YM2612_FRAC: + case DIV_SYSTEM_YM2612_FRAC_EXT: { + GENESIS_CHIP_DEBUG; + break; + } + case DIV_SYSTEM_GENESIS: + case DIV_SYSTEM_GENESIS_EXT: { + GENESIS_CHIP_DEBUG; + SMS_CHIP_DEBUG; + break; + } + case DIV_SYSTEM_SMS: { + SMS_CHIP_DEBUG; + break; + } + case DIV_SYSTEM_OPN: + case DIV_SYSTEM_OPN_EXT: { + DivPlatformYM2203* ch=(DivPlatformYM2203*)data; + ImGui::Text("> YM2203"); + FM_OPN_CHIP_DEBUG; + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- prescale: %d",ch->prescale); + FM_OPN_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); + break; + } + case DIV_SYSTEM_PC98: + case DIV_SYSTEM_PC98_EXT: { + DivPlatformYM2608* ch=(DivPlatformYM2608*)data; + ImGui::Text("> YM2608"); + FM_OPN_CHIP_DEBUG; + ImGui::Text("- adpcmBMemLen: %d",ch->adpcmBMemLen); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- writeRSSOff: %d",ch->writeRSSOff); + ImGui::Text("- writeRSSOn: %d",ch->writeRSSOn); + ImGui::Text("- globalRSSVolume: %d",ch->globalRSSVolume); + ImGui::Text("- prescale: %d",ch->prescale); + FM_OPN_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); + break; + } + case DIV_SYSTEM_YM2610: + case DIV_SYSTEM_YM2610_EXT: + case DIV_SYSTEM_YM2610_FULL: + case DIV_SYSTEM_YM2610_FULL_EXT: { + DivPlatformYM2610* ch=(DivPlatformYM2610*)data; + ImGui::Text("> YM2610"); + OPNB_CHIP_DEBUG; + break; + } + case DIV_SYSTEM_YM2610B: + case DIV_SYSTEM_YM2610B_EXT: { + DivPlatformYM2610B* ch=(DivPlatformYM2610B*)data; + ImGui::Text("> YM2610B"); + OPNB_CHIP_DEBUG; + break; + } + case DIV_SYSTEM_GB: { + DivPlatformGB* ch=(DivPlatformGB*)data; + ImGui::Text("> GameBoy"); + COMMON_CHIP_DEBUG; + ImGui::Text("- lastPan: %d",ch->lastPan); + ImGui::Text("- antiClickPeriodCount: %d",ch->antiClickPeriodCount); + ImGui::Text("- antiClickWavePos: %d",ch->antiClickWavePos); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->antiClickEnabled?colorOn:colorOff,">> AntiClickEnabled"); + break; + } + case DIV_SYSTEM_PCE: { + DivPlatformPCE* ch=(DivPlatformPCE*)data; + ImGui::Text("> PCEngine"); + COMMON_CHIP_DEBUG; + ImGui::Text("- lastPan: %d",ch->lastPan); + ImGui::Text("- cycles: %d",ch->cycles); + ImGui::Text("- curChan: %d",ch->curChan); + ImGui::Text("- delay: %d",ch->delay); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- lfoMode: %d",ch->lfoMode); + ImGui::Text("- lfoSpeed: %d",ch->lfoSpeed); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->antiClickEnabled?colorOn:colorOff,">> AntiClickEnabled"); + break; + } + case DIV_SYSTEM_NES: { + DivPlatformNES* ch=(DivPlatformNES*)data; + ImGui::Text("> NES"); + COMMON_CHIP_DEBUG; + ImGui::Text("* DAC:"); + ImGui::Text(" - Period: %d",ch->dacPeriod); + ImGui::Text(" - Rate: %d",ch->dacRate); + ImGui::Text(" - Pos: %d",ch->dacPos); + ImGui::Text(" - AntiClick: %d",ch->dacAntiClick); + ImGui::Text(" - Sample: %d",ch->dacSample); + ImGui::Text("- dpcmMemLen: %d",ch->dpcmMemLen); + ImGui::Text("- dpcmBank: %d",ch->dpcmBank); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- writeOscBuf: %d",ch->writeOscBuf); + ImGui::Text("- apuType: %d",ch->apuType); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->dpcmMode?colorOn:colorOff,">> DPCMMode"); + ImGui::TextColored(ch->dacAntiClickOn?colorOn:colorOff,">> DACAntiClickOn"); + ImGui::TextColored(ch->useNP?colorOn:colorOff,">> UseNP"); + ImGui::TextColored(ch->goingToLoop?colorOn:colorOff,">> GoingToLoop"); + break; + } + case DIV_SYSTEM_C64_6581: case DIV_SYSTEM_C64_8580: { + DivPlatformC64* ch=(DivPlatformC64*)data; + ImGui::Text("> C64"); + COMMON_CHIP_DEBUG; + ImGui::Text("- filtControl: %d",ch->filtControl); + ImGui::Text("- filtRes: %d",ch->filtRes); + ImGui::Text("- vol: %d",ch->vol); + ImGui::Text("- writeOscBuf: %d",ch->writeOscBuf); + ImGui::Text("- filtCut: %d",ch->filtCut); + ImGui::Text("- resetTime: %d",ch->resetTime); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->isFP?colorOn:colorOff,">> IsFP"); + break; + } + case DIV_SYSTEM_ARCADE: + case DIV_SYSTEM_YM2151: { + DivPlatformArcade* ch=(DivPlatformArcade*)data; + ImGui::Text("> YM2151"); + FM_CHIP_DEBUG; + ImGui::Text("- baseFreqOff: %d",ch->baseFreqOff); + ImGui::Text("- amDepth: %d",ch->amDepth); + ImGui::Text("- pmDepth: %d",ch->pmDepth); + FM_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->useYMFM?colorOn:colorOff,">> UseYMFM"); + break; + } + case DIV_SYSTEM_SEGAPCM: + case DIV_SYSTEM_SEGAPCM_COMPAT: { + DivPlatformSegaPCM* ch=(DivPlatformSegaPCM*)data; + ImGui::Text("> SegaPCM"); + COMMON_CHIP_DEBUG; + ImGui::Text("- delay: %d",ch->delay); + ImGui::Text("- pcmL: %d",ch->pcmL); + ImGui::Text("- pcmR: %d",ch->pcmR); + ImGui::Text("- pcmCycles: %d",ch->pcmCycles); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- lastBusy: %d",ch->lastBusy); + COMMON_CHIP_DEBUG_BOOL; + break; + } + case DIV_SYSTEM_AY8910: { + DivPlatformAY8910* ch=(DivPlatformAY8910*)data; + ImGui::Text("> AY-3-8910"); + COMMON_CHIP_DEBUG; + ImGui::Text("- lastBusy: %d",ch->lastBusy); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- stereoSep: %d",ch->stereoSep); + ImGui::Text("- delay: %d",ch->delay); + ImGui::Text("- extClock: %d",ch->extClock); + ImGui::Text("- extDiv: %d",ch->extDiv); + ImGui::Text("- portAVal: %d",ch->portAVal); + ImGui::Text("- portBVal: %d",ch->portBVal); + ImGui::Text("* envelope:"); + ImGui::Text(" - mode: %d",ch->ayEnvMode); + ImGui::Text(" - period: %d",ch->ayEnvPeriod); + ImGui::Text(" * slide: %d",ch->ayEnvSlide); + ImGui::Text(" - slideLow: %d",ch->ayEnvSlideLow); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); + ImGui::TextColored(ch->stereo?colorOn:colorOff,">> Stereo"); + ImGui::TextColored(ch->sunsoft?colorOn:colorOff,">> Sunsoft"); + ImGui::TextColored(ch->intellivision?colorOn:colorOff,">> Intellivision"); + ImGui::TextColored(ch->clockSel?colorOn:colorOff,">> ClockSel"); + ImGui::TextColored(ch->ioPortA?colorOn:colorOff,">> IoPortA"); + ImGui::TextColored(ch->ioPortB?colorOn:colorOff,">> IoPortB"); + break; + } + case DIV_SYSTEM_AY8930: { + DivPlatformAY8930* ch=(DivPlatformAY8930*)data; + ImGui::Text("> AY8930"); + COMMON_CHIP_DEBUG; + ImGui::Text("* noise:"); + ImGui::Text(" - and: %d",ch->ayNoiseAnd); + ImGui::Text(" - or: %d",ch->ayNoiseOr); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- stereoSep: %d",ch->stereoSep); + ImGui::Text("- delay: %d",ch->delay); + ImGui::Text("- portAVal: %d",ch->portAVal); + ImGui::Text("- portBVal: %d",ch->portBVal); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->bank?colorOn:colorOff,">> Bank"); + ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); + ImGui::TextColored(ch->stereo?colorOn:colorOff,">> Stereo"); + ImGui::TextColored(ch->clockSel?colorOn:colorOff,">> ClockSel"); + ImGui::TextColored(ch->ioPortA?colorOn:colorOff,">> IoPortA"); + ImGui::TextColored(ch->ioPortB?colorOn:colorOff,">> IoPortB"); + break; + } + case DIV_SYSTEM_QSOUND: { + DivPlatformQSound* ch=(DivPlatformQSound*)data; + ImGui::Text("> QSound"); + COMMON_CHIP_DEBUG; + ImGui::Text("* echo:"); + ImGui::Text(" - delay: %d",ch->echoDelay); + ImGui::Text(" - feedback: %d",ch->echoFeedback); + ImGui::Text("- sampleMemLen: %d",ch->sampleMemLen); + COMMON_CHIP_DEBUG_BOOL; + break; + } + case DIV_SYSTEM_X1_010: { + DivPlatformX1_010* ch=(DivPlatformX1_010*)data; + ImGui::Text("> X1-010"); + COMMON_CHIP_DEBUG; + ImGui::Text("- sampleMemLen: %d",ch->sampleMemLen); + ImGui::Text("- sampleBank: %d",ch->sampleBank); + ImGui::Text("- bankSlot: [%d,%d,%d,%d,%d,%d,%d,%d]",ch->bankSlot[0],ch->bankSlot[1],ch->bankSlot[2],ch->bankSlot[3],ch->bankSlot[4],ch->bankSlot[5],ch->bankSlot[6],ch->bankSlot[7]); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->stereo?colorOn:colorOff,">> Stereo"); + ImGui::TextColored(ch->isBanked?colorOn:colorOff,">> IsBanked"); + break; + } + case DIV_SYSTEM_N163: { + DivPlatformN163* ch=(DivPlatformN163*)data; + ImGui::Text("> N163"); + COMMON_CHIP_DEBUG; + ImGui::Text("- initChanMax: %d",ch->initChanMax); + ImGui::Text("- chanMax: %d",ch->chanMax); + ImGui::Text("- loadWave: %d",ch->loadWave); + ImGui::Text("- loadPos: %d",ch->loadPos); + ImGui::Text("- loadLen: %d",ch->loadLen); + ImGui::Text("- loadMode: %d",ch->loadMode); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->multiplex?colorOn:colorOff,">> Multiplex"); + break; + } + case DIV_SYSTEM_VRC6: { + DivPlatformVRC6* ch=(DivPlatformVRC6*)data; + ImGui::Text("> VRC6"); + COMMON_CHIP_DEBUG; + ImGui::Text("- sampleBank: %.2x",ch->sampleBank); + ImGui::Text("- writeOscBuf: %.2x",ch->writeOscBuf); + COMMON_CHIP_DEBUG_BOOL; + break; + } + case DIV_SYSTEM_LYNX: { + DivPlatformLynx* ch=(DivPlatformLynx*)data; + ImGui::Text("> Lynx"); + COMMON_CHIP_DEBUG; + COMMON_CHIP_DEBUG_BOOL; + break; + } + case DIV_SYSTEM_PCM_DAC: { + DivPlatformPCMDAC* ch=(DivPlatformPCMDAC*)data; + ImGui::Text("> PCM DAC"); + COMMON_CHIP_DEBUG; + ImGui::Text("- outDepth: %d",ch->outDepth); + COMMON_CHIP_DEBUG_BOOL; + ImGui::TextColored(ch->outStereo?colorOn:colorOff,">> OutStereo"); + break; + } + default: + ImGui::Text("Unimplemented chip! Help!"); + break; + } +} void putDispatchChan(void* data, int chanNum, int type) { ImVec4 colorOn=ImVec4(1.0f,1.0f,0.0f,1.0f); ImVec4 colorOff=ImVec4(0.3f,0.3f,0.3f,1.0f); switch (type) { - case DIV_SYSTEM_GENESIS: - case DIV_SYSTEM_YM2612: { + case DIV_SYSTEM_GENESIS: { if (chanNum>5) { - SMS_DEBUG; + SMS_CHAN_DEBUG; } else { - GENESIS_DEBUG; + GENESIS_CHAN_DEBUG; } break; } case DIV_SYSTEM_GENESIS_EXT: { if (chanNum>8) { - SMS_DEBUG; + SMS_CHAN_DEBUG; } else if (chanNum>=2 && chanNum<=5) { - // TODO ext ch 3 debug + GENESIS_OPCHAN_DEBUG } else { - GENESIS_DEBUG; + GENESIS_CHAN_DEBUG; + } + break; + } + case DIV_SYSTEM_YM2612: + case DIV_SYSTEM_YM2612_FRAC: { + GENESIS_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_YM2612_EXT: + case DIV_SYSTEM_YM2612_FRAC_EXT: { + if (chanNum>=2 && chanNum<=5) { + GENESIS_OPCHAN_DEBUG + } else { + GENESIS_CHAN_DEBUG; } break; } case DIV_SYSTEM_SMS: { - SMS_DEBUG; + SMS_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_OPN: { + OPN_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_OPN_EXT: { + if (chanNum>=2 && chanNum<=5) { + OPN_OPCHAN_DEBUG; + } else { + OPN_CHAN_DEBUG; + } + break; + } + case DIV_SYSTEM_PC98: { + DivPlatformYM2608::Channel* ch=(DivPlatformYM2608::Channel*)data; + ImGui::Text("> YM2608"); + OPNB_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_PC98_EXT: { + if (chanNum>=2 && chanNum<=5) { + DivPlatformYM2608Ext::OpChannel* ch=(DivPlatformYM2608Ext::OpChannel*)data; + ImGui::Text("> YM2608 (per operator)"); + OPNB_OPCHAN_DEBUG; + } else { + DivPlatformYM2608Ext::Channel* ch=(DivPlatformYM2608Ext::Channel*)data; + ImGui::Text("> YM2608"); + OPNB_CHAN_DEBUG; + } + break; + } + case DIV_SYSTEM_YM2610: + case DIV_SYSTEM_YM2610_FULL: { + DivPlatformYM2610::Channel* ch=(DivPlatformYM2610::Channel*)data; + ImGui::Text("> YM2610"); + OPNB_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_YM2610B: { + DivPlatformYM2610B::Channel* ch=(DivPlatformYM2610B::Channel*)data; + ImGui::Text("> YM2610B"); + OPNB_CHAN_DEBUG; + break; + } + case DIV_SYSTEM_YM2610_EXT: + case DIV_SYSTEM_YM2610_FULL_EXT: { + if (chanNum>=1 && chanNum<=4) { + DivPlatformYM2610Ext::OpChannel* ch=(DivPlatformYM2610Ext::OpChannel*)data; + ImGui::Text("> YM2610 (per operator)"); + OPNB_OPCHAN_DEBUG; + } else { + DivPlatformYM2610Ext::Channel* ch=(DivPlatformYM2610Ext::Channel*)data; + ImGui::Text("> YM2610"); + OPNB_CHAN_DEBUG; + } + break; + } + case DIV_SYSTEM_YM2610B_EXT: { + if (chanNum>=2 && chanNum<=5) { + DivPlatformYM2610BExt::OpChannel* ch=(DivPlatformYM2610BExt::OpChannel*)data; + ImGui::Text("> YM2610B (per operator)"); + OPNB_OPCHAN_DEBUG; + } else { + DivPlatformYM2610BExt::Channel* ch=(DivPlatformYM2610BExt::Channel*)data; + ImGui::Text("> YM2610B"); + OPNB_CHAN_DEBUG; + } break; } case DIV_SYSTEM_GB: { diff --git a/src/gui/debug.h b/src/gui/debug.h index 1f22b485..e3c911a8 100644 --- a/src/gui/debug.h +++ b/src/gui/debug.h @@ -21,5 +21,6 @@ #define _GUI_DEBUG_H #include "../engine/song.h" +void putDispatchChip(void* data, int type); void putDispatchChan(void* data, int chanNum, int type); #endif \ No newline at end of file diff --git a/src/gui/debugWindow.cpp b/src/gui/debugWindow.cpp index eec6fefb..8033add4 100644 --- a/src/gui/debugWindow.cpp +++ b/src/gui/debugWindow.cpp @@ -66,6 +66,22 @@ void FurnaceGUI::drawDebug() { ImGui::Checkbox("Enable",&bpOn); ImGui::TreePop(); } + if (ImGui::TreeNode("Chip Status")) { + ImGui::Text("for best results set latency to minimum or use the Frame Advance button."); + ImGui::Columns(e->song.systemLen); + for (int i=0; isong.systemLen; i++) { + void* ch=e->getDispatch(i); + ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],"Chip %d: %s",i,getSystemName(e->song.system[i])); + if (e->song.system[i]==NULL) { + ImGui::Text("NULL"); + } else { + putDispatchChip(ch,e->song.system[i]); + } + ImGui::NextColumn(); + } + ImGui::Columns(); + ImGui::TreePop(); + } if (ImGui::TreeNode("Dispatch Status")) { ImGui::Text("for best results set latency to minimum or use the Frame Advance button."); ImGui::Columns(e->getTotalChannelCount());