Skip to content

Commit

Permalink
compatibility fix on high DMA.
Browse files Browse the repository at this point in the history
  • Loading branch information
crazii committed Apr 30, 2024
1 parent e1de28d commit 9a318fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
9 changes: 8 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@ Currently the PSP's still resident in low memory, but that will be optimized lat
Q3: Some games aren't running with SBEMU, or SBEMU freezes on startup, or I ain't getting any sounds, where to report the issue?

Please create issues here: https://github.com/crazii/SBEMU/issues
It helps if you post additional details, i.e. the spec of your PC; what's the output of `SBEMU /SCL`; what's your command line options.
It helps if you post additional details:
the spec of your PC
the DOS edition & version
the build/release of SBEMU, if you don't know, you can check the startup message (the first line) of running SBEMU
what's the output of `SBEMU /SCL`
what's your command line options
the Game title and edition & version

Because SBEMU is a hobby project, there's no guarantee that the problem will be fixed immediately or very soon enough,
and the contributors might not response in time, please be patient.

Expand Down
9 changes: 3 additions & 6 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,7 @@ int main(int argc, char* argv[])
MAIN_CPrintf(RED, "Error: Invalid Sample rate.\n");
return 1;
}
if(MAIN_Options[OPT_TYPE].value != 6)
MAIN_Options[OPT_HDMA].value = MAIN_Options[OPT_DMA].value; //16 bit transfer through 8 bit dma
else if(MAIN_Options[OPT_HDMA].value < 5 && MAIN_Options[OPT_HDMA].value != MAIN_Options[OPT_DMA].value) //16 bit transfer through 8 bit dma
if(MAIN_Options[OPT_HDMA].value < 5 && MAIN_Options[OPT_HDMA].value != MAIN_Options[OPT_DMA].value) //16 bit transfer through 8 bit dma
{
printf("Warning: HDMA using 8 bit channel: H=%d, "
"using 5/6/7 is recommended.\n"
Expand Down Expand Up @@ -907,8 +905,7 @@ int main(int argc, char* argv[])
MAIN_Options[OPT_FIX_TC].value,
&MAIN_SbemuExtFun);
VDMA_Virtualize(MAIN_Options[OPT_DMA].value, TRUE);
if(MAIN_Options[OPT_TYPE].value == 6)
VDMA_Virtualize(MAIN_Options[OPT_HDMA].value, TRUE);
VDMA_Virtualize(MAIN_Options[OPT_HDMA].value, TRUE);
for(int i = 0; i < countof(MAIN_SB_IODT); ++i)
MAIN_SB_IODT[i].port += MAIN_Options[OPT_ADDR].value;
QEMM_IODT* SB_Iodt = MAIN_Options[OPT_OPL].value ? MAIN_SB_IODT : MAIN_SB_IODT+4;
Expand Down Expand Up @@ -1211,7 +1208,7 @@ static void MAIN_Interrupt()
return;

BOOL digital = SBEMU_HasStarted();
int dma = (SBEMU_GetBits() <= 8 || MAIN_Options[OPT_TYPE].value < 6) ? SBEMU_GetDMA() : SBEMU_GetHDMA();
int dma = (SBEMU_GetBits() <= 8 /*|| MAIN_Options[OPT_TYPE].value < 6*/) ? SBEMU_GetDMA() : SBEMU_GetHDMA();
int32_t DMA_Count = VDMA_GetCounter(dma); //count in bytes
if(!digital) MAIN_LastSBRate = 0;
if(digital)//&& DMA_Count != 0x10000) //-1(0xFFFF)+1=0
Expand Down
5 changes: 4 additions & 1 deletion sbemu/vdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ uint8_t VDMA_Read(uint16_t port)
_LOG("VDMA read: %x\n", port);
int channel = -1;
if(port <= VDMA_REG_CH3_COUNTER) channel = (port>>1);
else if(port >= VDMA_REG_CH4_ADDR && port <= VDMA_REG_CH7_COUNTER) channel = ((port-VDMA_REG_CH4_ADDR)>>2)+4;
else if(port >= VDMA_REG_CH4_ADDR && port <= VDMA_REG_CH7_COUNTER) channel = ((port-VDMA_REG_CH4_ADDR)/4)+4;
else if(port>=0x80 && port <= 0x8F) channel = VDMA_PortChannelMap[port-0x80];

if(VMDA_IS_CHANNEL_VIRTUALIZED(channel))
Expand Down Expand Up @@ -167,7 +167,10 @@ uint8_t VDMA_Read(uint16_t port)
void VDMA_Virtualize(int channel, int enable)
{
if(channel >= 0 && channel <= 7)
{
_LOG("VDMA channel: %d %s\n", channel, enable ? "enabled" : "disabled");
VDMA_VMask[channel] = enable ? 1: 0;
}
}

uint32_t VDMA_GetAddress(int channel)
Expand Down

0 comments on commit 9a318fc

Please sign in to comment.