From 69e351575732afe074e659f498f3ec16e11a861a Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 30 Jun 2023 06:09:42 -0500 Subject: [PATCH] SegaPCM: real limit is 2MB --- src/engine/platform/segapcm.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 47411496..9376bb0c 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -423,7 +423,7 @@ const void* DivPlatformSegaPCM::getSampleMem(int index) { } size_t DivPlatformSegaPCM::getSampleMemCapacity(int index) { - return index == 0 ? 16777216 : 0; + return index == 0 ? 2097152 : 0; } size_t DivPlatformSegaPCM::getSampleMemUsage(int index) { @@ -465,7 +465,7 @@ void DivPlatformSegaPCM::reset() { void DivPlatformSegaPCM::renderSamples(int sysID) { size_t memPos=0; - memset(sampleMem,0,16777216); + memset(sampleMem,0,2097152); memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleOffSegaPCM,0,256*sizeof(unsigned int)); memset(sampleEndSegaPCM,0,256); @@ -482,7 +482,7 @@ void DivPlatformSegaPCM::renderSamples(int sysID) { } logV("- sample %d will be at %x with length %x",i,memPos,alignedSize); sampleLoaded[i]=true; - if (memPos>=16777216) break; + if (memPos>=2097152) break; sampleOffSegaPCM[i]=memPos; for (unsigned int j=0; j=sample->samples) { @@ -491,10 +491,10 @@ void DivPlatformSegaPCM::renderSamples(int sysID) { sampleMem[memPos++]=((unsigned char)sample->data8[j]+0x80); } sampleEndSegaPCM[i]=((memPos+0xff)>>8)-1; - if (memPos>=16777216) break; + if (memPos>=2097152) break; } logV(" and it ends in %d",sampleEndSegaPCM[i]); - if (memPos>=16777216) break; + if (memPos>=2097152) break; } sampleMemLen=memPos; } @@ -522,10 +522,10 @@ int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, const DivC isMuted[i]=false; oscBuf[i]=new DivDispatchOscBuffer; } - sampleMem=new unsigned char[16777216]; + sampleMem=new unsigned char[2097152]; pcm.set_bank(segapcm_device::BANK_12M|segapcm_device::BANK_MASKF8); pcm.set_read([this](unsigned int addr) -> unsigned char { - return sampleMem[addr&0xffffff]; + return sampleMem[addr&0x1fffff]; }); setFlags(flags); reset();