mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-25 23:25:40 +00:00
- Changes to let SCSP.cpp compile under Visual Studio 64-bit
- Fixed unsigned int overflow bug in SCSP.cpp that was causing VF3 to crash on selection screen when running 64-bit
This commit is contained in:
parent
9f6a01eb55
commit
c6e1c9a2ad
|
@ -1004,22 +1004,16 @@ void SCSP_w32(unsigned int addr,unsigned int val)
|
|||
addr&=0x1f;
|
||||
//DebugLog("Slot %02X Reg %02X write dword %08X\n",slot,addr,val);
|
||||
//printf("Slot %02X Reg %02X write dword %08X\n",slot,addr,val);
|
||||
#ifdef _MSC_VER // MS VisualC++
|
||||
_asm rol val,16
|
||||
#else
|
||||
val = (val>>16)|(val<<16);
|
||||
#endif
|
||||
rotl(val, 16);
|
||||
|
||||
*(unsigned int *) &(SCSP->Slots[slot].datab[addr]) = val;
|
||||
SCSP_UpdateSlotReg(slot,addr&0x1f);
|
||||
SCSP_UpdateSlotReg(slot,(addr&0x1f)+2);
|
||||
}
|
||||
else if(addr<0x600)
|
||||
{
|
||||
#ifdef _MSC_VER // MS VisualC++
|
||||
_asm rol val,16
|
||||
#else
|
||||
val = (val>>16)|(val<<16);
|
||||
#endif
|
||||
rotl(val, 16);
|
||||
|
||||
*(unsigned int *) &(SCSP->datab[addr&0xff]) = val;
|
||||
SCSP_UpdateReg(addr&0xff);
|
||||
SCSP_UpdateReg((addr&0xff)+2);
|
||||
|
@ -1030,11 +1024,7 @@ void SCSP_w32(unsigned int addr,unsigned int val)
|
|||
{
|
||||
#ifdef USEDSP
|
||||
//DSP
|
||||
#ifdef _MSC_VER // MS VisualC++
|
||||
_asm rol val,16
|
||||
#else
|
||||
val = (val>>16)|(val<<16);
|
||||
#endif
|
||||
rotl(val, 16);
|
||||
if(addr<0x780) //COEF
|
||||
*(unsigned int *) &(SCSP->DSP.COEF[(addr-0x700)/2])=val;
|
||||
else if(addr<0x800)
|
||||
|
@ -1606,7 +1596,11 @@ signed int inline SCSP_UpdateSlot(_SLOT *slot)
|
|||
signed int smp=(SCSP->RINGBUF[(SCSP->BUFPTR+MDXSL(slot))&63]+SCSP->RINGBUF[(SCSP->BUFPTR+MDYSL(slot))&63])/2;
|
||||
|
||||
smp>>=11;
|
||||
addr+=smp;
|
||||
// Check for underflow before adding to addr
|
||||
if (smp >= 0 || (DWORD)(-smp) < addr)
|
||||
addr+=smp;
|
||||
else
|
||||
addr = 0;
|
||||
if(!PCM8B(slot))
|
||||
addr&=~1;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,12 @@
|
|||
#define stricmp strcasecmp
|
||||
#endif
|
||||
|
||||
// 32-bit rotate left
|
||||
#ifdef _MSC_VER // MS VisualC++ - use VS intrinsic function _rotl
|
||||
#define rotl(val, shift) val = _rotl(val, shift)
|
||||
#else // Otherwise assume GCC which should optimise following to asm
|
||||
#define rotl(val, shift) val = (val>>shift)|(val<<(32-shift))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fundamental Data Types:
|
||||
|
|
Loading…
Reference in a new issue