Skip to content

Commit

Permalink
Add PSG debug screens to PCFX ( #157 )
Browse files Browse the repository at this point in the history
  • Loading branch information
dshadoff committed Jun 17, 2024
1 parent 3a78525 commit 751caeb
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mednafen/src/pcfx/pcfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,16 +644,16 @@ static MDFN_COLD void LoadCommon(std::vector<CDInterface*> *CDInterfaces)
//fx_vdc_chips[1] = FXVDC_Init(PCFXIRQ_SOURCE_VDCB, MDFN_GetSettingB("pcfx.nospritelimit"));
}

RAINBOW_Init(MDFN_GetSettingB("pcfx.rainbow.chromaip"));
SoundBox_Init(MDFN_GetSettingB("pcfx.adpcm.emulate_buggy_codec"), MDFN_GetSettingB("pcfx.adpcm.suppress_channel_reset_clicks"));
FXINPUT_Init();
FXTIMER_Init();

if(WantHuC6273)
HuC6273_Init();

KING_Init();

RAINBOW_Init(MDFN_GetSettingB("pcfx.rainbow.chromaip"));
SoundBox_Init(MDFN_GetSettingB("pcfx.adpcm.emulate_buggy_codec"), MDFN_GetSettingB("pcfx.adpcm.suppress_channel_reset_clicks"));
FXINPUT_Init();
FXTIMER_Init();

SCSICD_SetDisc(true, NULL, true);

#ifdef WANT_DEBUGGER
Expand Down
49 changes: 49 additions & 0 deletions mednafen/src/pcfx/soundbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "pcfx.h"
#include "soundbox.h"
#include "king.h"
#include "debug.h"
#include <mednafen/cdrom/scsicd.h>
#include <mednafen/hw_sound/pce_psg/pce_psg.h>
#include <mednafen/sound/OwlResampler.h>
Expand Down Expand Up @@ -308,6 +309,26 @@ static void Cleanup(void)
}
}

static void GetAddressSpaceBytes(const char *name, uint32 Address, uint32 Length, uint8 *Buffer)
{
// PCE_InDebug++;

if(!strncmp(name, "psgram", 6))
pce_psg->PeekWave(name[6] - '0', Address, Length, Buffer);

// PCE_InDebug--;
}

static void PutAddressSpaceBytes(const char *name, uint32 Address, uint32 Length, uint32 Granularity, bool hl, const uint8 *Buffer)
{
// PCE_InDebug++;

if(!strncmp(name, "psgram", 6))
pce_psg->PokeWave(name[6] - '0', Address, Length, Buffer);

// PCE_InDebug--;
}

void SoundBox_Init(bool arg_EmulateBuggyCodec, bool arg_ResetAntiClickEnabled)
{
try
Expand All @@ -326,6 +347,34 @@ void SoundBox_Init(bool arg_EmulateBuggyCodec, bool arg_ResetAntiClickEnabled)

pce_psg = new PCE_PSG(FXsbuf[0]->Buf(), FXsbuf[1]->Buf(), PCE_PSG::REVISION_HUC6280A);

for (int x = 0; x < 6; x++)
{
AddressSpaceType newt;
char tmpname[128], tmpinfo[128];
trio_snprintf(tmpname, 128, "psgram%d", x);
trio_snprintf(tmpinfo, 128, "PSG Ch %d RAM", x);

newt.GetAddressSpaceBytes = GetAddressSpaceBytes;
newt.PutAddressSpaceBytes = PutAddressSpaceBytes;

newt.name = std::string(tmpname);
newt.long_name = std::string(tmpinfo);
newt.TotalBits = 5;
newt.NP2Size = 0;
newt.PossibleSATB = false;

newt.Wordbytes = 1;
newt.Endianness = ENDIAN_LITTLE;
newt.MaxDigit = 1;
newt.IsPalette = false;

newt.IsWave = true;
newt.WaveFormat = ASPACE_WFMT_UNSIGNED;
newt.WaveBits = 5;

ASpace_Add(newt); //PSG_GetAddressSpaceBytes, PSG_PutAddressSpaceBytes, tmpname, tmpinfo, 5);
}

#ifdef WANT_DEBUGGER
MDFNDBG_AddRegGroup(&SBoxRegsGroup);
#endif
Expand Down

0 comments on commit 751caeb

Please sign in to comment.