Some work on variable type consistancy, and getting rid of 64 bit processor checks.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1214 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-17 21:57:24 +00:00
parent 1b012e9dd9
commit 1a53f45b2c
20 changed files with 230 additions and 513 deletions

View File

@ -24,13 +24,8 @@ AUTOMAKE_OPTIONS = foreign
noinst_HEADERS=AAFilter.h cpu_detect.h FIRFilter.h RateTransposer.h TDStretch.h cpu_detect_x86_gcc.cpp
noinst_LIBRARIES = libSoundTouch.a
if X86_64
libSoundTouch_a_CXXFLAGS = -fPIC
libSoundTouch_a_CFLAGS = -fPIC
else
libSoundTouch_a_CXXFLAGS = -msse -mmmx
libSoundTouch_a_CFLAGS = -msse -mmmx
endif
#lib_LTLIBRARIES=libSoundTouch.la
# the mmx_gcc.cpp and cpu_detect_x86_gcc.cpp may need to be conditionally included here from things discovered in configure.ac

View File

@ -21,34 +21,6 @@ CPPFLAGS+=" -m32 "
CXXFLAGS+=" -m32 "
CCASFLAGS+=" -m32 "
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
dnl then
AC_TRY_RUN([
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
],cpu64=yes,cpu64=no,)
dnl else
dnl cpu64=no
dnl fi
if test "x$cpu64" == xyes
then
AC_DEFINE(__x86_64__,1,[__x86_64__])
fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
# Checks for header files.
AC_CHECK_HEADERS([limits.h memory.h stdlib.h string.h])

View File

@ -169,28 +169,4 @@ namespace Threading
return result;
}
#ifdef __x86_64__
__forceinline void pcsx2_InterlockedExchange64(volatile s64* Target, s64 Value)
{
__asm__ __volatile__(
".intel_syntax noprefix\n"
"lock xchg [%0], rax\n"
".att_syntax\n" : : "r"(Target), "a"(Value) : "memory"
);
return 0;
}
__forceinline s64 pcsx2_InterlockedCompareExchange64(volatile s64* dest, s64 exch, s64 comp)
{
s64 old;
__asm__ __volatile__(
"lock; cmpxchgq %q2, %q1"
: "=a" (old)
: "r" (exch), "m" (*dest), "a" (comp)
);
return old;
}
#endif
}

View File

@ -23,10 +23,10 @@
#include <string>
using namespace std;
const unsigned char version = PS2E_SPU2_VERSION;
const unsigned char revision = 0;
const unsigned char build = 7; // increase that with each version
const unsigned int minor = 1; // increase that with each version
const u8 version = PS2E_SPU2_VERSION;
const u8 revision = 0;
const u8 build = 8; // increase that with each version
const u32 minor = 0; // increase that with each version
// ADSR constants
#define ATTACK_MS 494L
@ -50,16 +50,16 @@ ADMA Adma7;
u32 MemAddr[2];
u32 g_nSpuInit = 0;
unsigned short interrupt = 0;
u16 interrupt = 0;
s8 *spu2regs = NULL;
u16* spu2mem = NULL;
u16* pSpuIrq[2] = {NULL};
u32 dwEndChannel2[2] = {0}; // keeps track of what channels have ended
unsigned long dwNoiseVal = 1; // global noise generator
u32 dwNoiseVal = 1; // global noise generator
int SPUCycles = 0, SPUWorkerCycles = 0;
int SPUStartCycle[2];
int SPUTargetCycle[2];
s32 SPUCycles = 0, SPUWorkerCycles = 0;
s32 SPUStartCycle[2];
s32 SPUTargetCycle[2];
int ADMAS4Write();
int ADMAS7Write();
@ -70,7 +70,7 @@ void (*irqCallbackSPU2)(); // func of main emu, called on spu i
void (*irqCallbackDMA4)() = 0; // func of main emu, called on spu irq
void (*irqCallbackDMA7)() = 0; // func of main emu, called on spu irq
const int f[5][2] = {
const s32 f[5][2] = {
{ 0, 0 },
{ 60, 0 },
{ 115, -52 },
@ -221,9 +221,9 @@ EXPORT_C_(void) SPU2async(u32 cycle)
void InitADSR() // INIT ADSR
{
unsigned long r, rs, rd;
int i;
memset(RateTable, 0, sizeof(unsigned long)*160); // build the rate table according to Neill's rules (see at bottom of file)
u32 r, rs, rd;
s32 i;
memset(RateTable, 0, sizeof(u32)*160); // build the rate table according to Neill's rules (see at bottom of file)
r = 3;
rs = 1;
@ -678,9 +678,9 @@ int ADMAS4Write()
spuaddr = C0_SPUADDR;
// SPU2 Deinterleaves the Left and Right Channels
memcpy((short*)(spu2mem + spuaddr + 0x2000), (short*)Adma4.MemAddr, 512);
memcpy((s16*)(spu2mem + spuaddr + 0x2000), (s16*)Adma4.MemAddr, 512);
Adma4.MemAddr += 256;
memcpy((short*)(spu2mem + spuaddr + 0x2200), (short*)Adma4.MemAddr, 512);
memcpy((s16*)(spu2mem + spuaddr + 0x2200), (s16*)Adma4.MemAddr, 512);
Adma4.MemAddr += 256;
spuaddr = (spuaddr + 256) & 511;
C0_SPUADDR_SET(spuaddr);
@ -704,9 +704,9 @@ int ADMAS7Write()
spuaddr = C1_SPUADDR;
// SPU2 Deinterleaves the Left and Right Channels
memcpy((short*)(spu2mem + spuaddr + 0x2400), (short*)Adma7.MemAddr, 512);
memcpy((s16*)(spu2mem + spuaddr + 0x2400), (s16*)Adma7.MemAddr, 512);
Adma7.MemAddr += 256;
memcpy((short*)(spu2mem + spuaddr + 0x2600), (short*)Adma7.MemAddr, 512);
memcpy((s16*)(spu2mem + spuaddr + 0x2600), (s16*)Adma7.MemAddr, 512);
Adma7.MemAddr += 256;
spuaddr = (spuaddr + 256) & 511;
C1_SPUADDR_SET(spuaddr);
@ -740,7 +740,7 @@ EXPORT_C_(void) SPU2writeDMA4Mem(u16* pMem, int size)
}
spuaddr = C0_SPUADDR;
memcpy((unsigned char*)(spu2mem + spuaddr), (unsigned char*)pMem, size << 1);
memcpy((u8*)(spu2mem + spuaddr), (u8*)pMem, size << 1);
spuaddr += size;
C0_SPUADDR_SET(spuaddr);
@ -779,7 +779,7 @@ EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size)
}
spuaddr = C1_SPUADDR;
memcpy((unsigned char*)(spu2mem + spuaddr), (unsigned char*)pMem, size << 1);
memcpy((u8*)(spu2mem + spuaddr), (u8*)pMem, size << 1);
spuaddr += size;
C1_SPUADDR_SET(spuaddr);
@ -820,9 +820,9 @@ EXPORT_C_(void) SPU2interruptDMA7()
}
// turn channels on
void SoundOn(int start, int end, unsigned short val) // SOUND ON PSX COMAND
void SoundOn(s32 start, s32 end, u16 val) // SOUND ON PSX COMAND
{
for (int ch = start;ch < end;ch++, val >>= 1) // loop channels
for (s32 ch = start;ch < end;ch++, val >>= 1) // loop channels
{
if ((val&1) && voices[ch].pStart) // mmm... start has to be set before key on !?!
{
@ -833,16 +833,16 @@ void SoundOn(int start, int end, unsigned short val) // SOUND ON PSX COMAND
}
// turn channels off
void SoundOff(int start, int end, unsigned short val) // SOUND OFF PSX COMMAND
void SoundOff(s32 start, s32 end, u16 val) // SOUND OFF PSX COMMAND
{
for (int ch = start;ch < end;ch++, val >>= 1) // loop channels
for (s32 ch = start;ch < end;ch++, val >>= 1) // loop channels
{
if (val&1) // && s_chan[i].bOn) mmm...
voices[ch].bStop = true;
}
}
void FModOn(int start, int end, unsigned short val) // FMOD ON PSX COMMAND
void FModOn(s32 start, s32 end, u16 val) // FMOD ON PSX COMMAND
{
int ch;
@ -891,8 +891,10 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
case 4:
{
int NP;
if (value > 0x3fff) NP = 0x3fff; // get pitch val
else NP = value;
if (value > 0x3fff)
NP = 0x3fff; // get pitch val
else
NP = value;
pvoice->pvoice->pitch = NP;
@ -924,8 +926,8 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
// more channel info
if ((r >= 0x01c0 && r <= 0x02E0) || (r >= 0x05c0 && r <= 0x06E0))
{
int ch = 0;
unsigned long rx = r;
s32 ch = 0;
u32 rx = r;
if (rx >= 0x400)
{
ch = 24;
@ -939,7 +941,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
switch (rx)
{
case 0x1C0:
pvoice->iStartAddr = (((unsigned long)value & 0x3f) << 16) | (pvoice->iStartAddr & 0xFFFF);
pvoice->iStartAddr = (((u32)value & 0x3f) << 16) | (pvoice->iStartAddr & 0xFFFF);
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
break;
case 0x1C2:
@ -947,7 +949,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
break;
case 0x1C4:
pvoice->iLoopAddr = (((unsigned long)value & 0x3f) << 16) | (pvoice->iLoopAddr & 0xFFFF);
pvoice->iLoopAddr = (((u32)value & 0x3f) << 16) | (pvoice->iLoopAddr & 0xFFFF);
pvoice->pLoop = (u8*)(spu2mem + pvoice->iLoopAddr);
pvoice->bIgnoreLoop = pvoice->iLoopAddr > 0;
break;
@ -958,7 +960,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
break;
case 0x1C8:
// unused... check if it gets written as well
pvoice->iNextAddr = (((unsigned long)value & 0x3f) << 16) | (pvoice->iNextAddr & 0xFFFF);
pvoice->iNextAddr = (((u32)value & 0x3f) << 16) | (pvoice->iNextAddr & 0xFFFF);
break;
case 0x1CA:
// unused... check if it gets written as well
@ -982,8 +984,8 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
IRQINFO |= 4;
irqCallbackSPU2();
}
if (spuaddr > 0xFFFFE)
spuaddr = 0x2800;
if (spuaddr > 0xFFFFE) spuaddr = 0x2800;
C0_SPUADDR_SET(spuaddr);
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
spu2Ru16(REG_C0_CTRL) &= ~0x30;
@ -998,8 +1000,8 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
IRQINFO |= 8;
irqCallbackSPU2();
}
if (spuaddr > 0xFFFFE)
spuaddr = 0x2800;
if (spuaddr > 0xFFFFE) spuaddr = 0x2800;
C1_SPUADDR_SET(spuaddr);
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
spu2Ru16(REG_C1_CTRL) &= ~0x30;
@ -1082,23 +1084,27 @@ EXPORT_C_(u16) SPU2read(u32 mem)
if ((r >= 0x0000 && r <= 0x0180) || (r >= 0x0400 && r <= 0x0580)) // some channel info?
{
int ch = 0;
if (r >= 0x400) ch = ((r - 0x400) >> 4) + 24;
else ch = (r >> 4);
s32 ch = 0;
if (r >= 0x400)
ch = ((r - 0x400) >> 4) + 24;
else
ch = (r >> 4);
VOICE_PROCESSED* pvoice = &voices[ch];
switch (r&0x0f)
{
case 10:
return (unsigned short)(pvoice->ADSRX.EnvelopeVol >> 16);
return (u16)(pvoice->ADSRX.EnvelopeVol >> 16);
}
}
if ((r > 0x01c0 && r <= 0x02E0) || (r > 0x05c0 && r <= 0x06E0)) // some channel info?
{
int ch = 0;
unsigned long rx = r;
s32 ch = 0;
u32 rx = r;
if (rx >= 0x400)
{
ch = 24;
@ -1132,16 +1138,15 @@ EXPORT_C_(u16) SPU2read(u32 mem)
spuaddr = C0_SPUADDR;
ret = spu2mem[spuaddr];
spuaddr++;
if (spuaddr > 0xfffff)
spuaddr = 0;
if (spuaddr > 0xfffff) spuaddr = 0;
C0_SPUADDR_SET(spuaddr);
break;
case REG_C1_SPUDATA:
spuaddr = C1_SPUADDR;
ret = spu2mem[spuaddr];
spuaddr++;
if (spuaddr > 0xfffff)
spuaddr = 0;
if (spuaddr > 0xfffff) spuaddr = 0;
C1_SPUADDR_SET(spuaddr);
break;
@ -1196,7 +1201,7 @@ void VOICE_PROCESSED::SetVolume(int iProcessRight)
if (vol&0x8000) // sweep not working
{
short sInc = 1; // -> sweep up?
s16 sInc = 1; // -> sweep up?
if (vol&0x2000) sInc = -1; // -> or down?
if (vol&0x1000) vol ^= 0xffff; // -> mmm... phase inverted? have to investigate this
vol = ((vol & 0x7f) + 1) / 2; // -> sweep: 0..127 -> 0..64
@ -1270,7 +1275,10 @@ EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
{
memcpy(spu2regs, spud->spu2regs, 0x10000);
}
else printf("SPU2null wrong format\n");
else
{
printf("SPU2null wrong format\n");
}
}
else
if (mode == FREEZE_SAVE)

View File

@ -46,15 +46,15 @@ extern "C"
extern FILE *spu2Log;
#define SPU2_LOG __Log //debug mode
extern const unsigned char version;
extern const unsigned char revision;
extern const unsigned char build;
extern const unsigned int minor;
extern const u8 version;
extern const u8 revision;
extern const u8 build;
extern const u32 minor;
extern char *libraryName;
typedef struct
{
int Log;
s32 Log;
} Config;
extern Config conf;
@ -218,18 +218,18 @@ struct _SPU_VOICE
// ADSR INFOS PER CHANNEL
struct ADSRInfoEx
{
int State;
int AttackModeExp;
int AttackRate;
int DecayRate;
int SustainLevel;
int SustainModeExp;
int SustainIncrease;
int SustainRate;
int ReleaseModeExp;
int ReleaseRate;
int EnvelopeVol;
long lVolume;
s32 State;
s32 AttackModeExp;
s32 AttackRate;
s32 DecayRate;
s32 SustainLevel;
s32 SustainModeExp;
s32 SustainIncrease;
s32 SustainRate;
s32 ReleaseModeExp;
s32 ReleaseRate;
s32 EnvelopeVol;
s32 lVolume;
};
#define NSSIZE 48 // ~ 1 ms of data
@ -257,18 +257,18 @@ struct VOICE_PROCESSED
// start save state
int iSBPos; // mixing stuff
int spos;
int sinc;
s32 iSBPos; // mixing stuff
s32 spos;
s32 sinc;
int iActFreq; // current psx pitch
int iUsedFreq; // current pc pitch
s32 iActFreq; // current psx pitch
s32 iUsedFreq; // current pc pitch
int iStartAddr, iLoopAddr, iNextAddr;
s32 iStartAddr, iLoopAddr, iNextAddr;
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
int memoffset; // if first core, 0, if second, 0x400
s32 memoffset; // if first core, 0, if second, 0x400
// end save state
@ -283,11 +283,11 @@ struct VOICE_PROCESSED
struct ADMA
{
unsigned short * MemAddr;
long IntPointer;
int Index;
int AmountLeft;
int Enabled;
u16 * MemAddr;
s32 IntPointer;
s32 Index;
s32 AmountLeft;
s32 Enabled;
};
#endif /* __SPU2_H__ */

View File

@ -6,11 +6,6 @@ INCLUDES = -I@srcdir@/../../../common/include -I@srcdir@/3rdparty -I@srcdir@/..
libSPU2X_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0) -liconv
libSPU2X_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0) -liconv
if X86_64
libSPU2X_a_CXXFLAGS += -fPIC
libSPU2X_a_CFLAGS += -fPIC
endif
# Create a shared object by faking an exe (thanks to ODE makefiles)
traplibdir=$(prefix)

View File

@ -63,32 +63,6 @@ dnl gtk
AC_MSG_CHECKING(gtk2+)
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)
LIBS+=$(pkg-config --libs gtk+-2.0)
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
dnl then
AC_TRY_RUN([
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
],cpu64=yes,cpu64=no,)
dnl else
dnl cpu64=no
dnl fi
if test "x$cpu64" == xyes
then
AC_DEFINE(__x86_64__,1,[__x86_64__])
fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
dnl bindir = pcsx2exe

View File

@ -1,10 +1,4 @@
noinst_LIBRARIES = libZeroGSLinux.a
if X86_64
libZeroGSLinux_a_CPPFLAGS = -fPIC
libZeroGSLinux_a_CXXFLAGS = -fPIC
libZeroGSLinux_a_CFLAGS = -fPIC
endif
INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ -I@srcdir@/../common
libZeroGSLinux_a_SOURCES = callbacks.c Conf.cpp interface.c Linux.cpp support.c

View File

@ -6,16 +6,9 @@ INCLUDES = -I@srcdir@/../../../common/include -I@srcdir@/../../../3rdparty
libZeroGSogl_a_CPPFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libZeroGSogl_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
if X86_64
libZeroGSogl_a_CPPFLAGS += -fPIC
libZeroGSogl_a_CXXFLAGS += -fPIC
CCASFLAGS += -fPIC
endif
# Create a shared object by faking an exe (thanks to ODE makefiles)
traplibdir=$(prefix)
if RELEASE_TO_PUBLIC
preext=r
endif
@ -33,11 +26,7 @@ libZeroGSogl_a_SOURCES = \
GSmain.cpp memcpy_amd.cpp Regs.cpp x86.cpp zpipe.cpp \
Mem.cpp rasterfont.cpp targets.cpp zerogs.cpp
if X86_64
libZeroGSogl_a_SOURCES += x86-64.S
else
libZeroGSogl_a_SOURCES += x86-32.S
endif
if SSE2
CCASFLAGS+= -DZEROGS_SSE2

View File

@ -643,8 +643,6 @@ GREP
SHARED_LDFLAGS
so_ext
GTK_CONFIG
X86_64_FALSE
X86_64_TRUE
SSE2_FALSE
SSE2_TRUE
RELEASE_TO_PUBLIC_FALSE
@ -4627,92 +4625,6 @@ else
fi
{ $as_echo "$as_me:$LINENO: checking for a x86-64 CPU" >&5
$as_echo_n "checking for a x86-64 CPU... " >&6; }
if test "$cross_compiling" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cpu64=yes
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
cpu64=no
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
if test "x$cpu64" == xyes
then
cat >>confdefs.h <<\_ACEOF
#define __x86_64__ 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: result: $cpu64" >&5
$as_echo "$cpu64" >&6; }
if test x$cpu64 = xyes; then
X86_64_TRUE=
X86_64_FALSE='#'
else
X86_64_TRUE='#'
X86_64_FALSE=
fi
{ $as_echo "$as_me:$LINENO: checking gtk2+" >&5
$as_echo_n "checking gtk2+... " >&6; }
# Extract the first word of "pkg-config", so it can be a program name with args.
@ -6127,13 +6039,6 @@ $as_echo "$as_me: error: conditional \"SSE2\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"X86_64\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
$as_echo "$as_me: error: conditional \"X86_64\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0

View File

@ -68,33 +68,6 @@ fi
AC_MSG_RESULT($sse2)
AM_CONDITIONAL(SSE2, test x$sse2 = xyes)
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
dnl then
AC_TRY_RUN([
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
],cpu64=yes,cpu64=no,)
dnl else
dnl cpu64=no
dnl fi
if test "x$cpu64" == xyes
then
AC_DEFINE(__x86_64__,1,[__x86_64__])
fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
dnl gtk
AC_MSG_CHECKING(gtk2+)
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)

View File

@ -6,11 +6,6 @@ INCLUDES = -I@srcdir@/../../common/include
libZeroPAD_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libZeroPAD_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
if X86_64
libZeroPAD_a_CXXFLAGS += -fPIC
libZeroPAD_a_CFLAGS += -fPIC
endif
# Create a shared object by faking an exe (thanks to ODE makefiles)
traplibdir=$(prefix)

View File

@ -41,32 +41,6 @@ fi
AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes)
AC_MSG_RESULT($debug)
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
dnl then
AC_TRY_RUN([
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
],cpu64=yes,cpu64=no,)
dnl else
dnl cpu64=no
dnl fi
if test "x$cpu64" == xyes
then
AC_DEFINE(__x86_64__,1,[__x86_64__])
fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC))

View File

@ -6,11 +6,6 @@ INCLUDES = -I@srcdir@/../../common/include -I@srcdir@/../../3rdparty
libZeroSPU2_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libZeroSPU2_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
if X86_64
libZeroSPU2_a_CXXFLAGS += -fPIC
libZeroSPU2_a_CFLAGS += -fPIC
endif
# Create a shared object by faking an exe (thanks to ODE makefiles)
traplibdir=$(prefix)

View File

@ -55,33 +55,6 @@ fi
AC_MSG_RESULT($devbuild)
AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno)
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
dnl then
AC_TRY_RUN([
int main()
{
int a = 0;
int*pa = &a;
asm(".intel_syntax\n"
"mov %%rax, %0\n"
"mov %%eax, [%%rax]\n"
".att_syntax\n"
: : "r"(pa) : "%rax");
return 0;
}
],cpu64=yes,cpu64=no,)
dnl else
dnl cpu64=no
dnl fi
if test "x$cpu64" == xyes
then
AC_DEFINE(__x86_64__,1,[__x86_64__])
fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC))
dnl gtk

View File

@ -23,7 +23,7 @@
#define Sleep(ms) usleep(1000*ms)
inline unsigned long timeGetTime()
inline u32 timeGetTime()
{
#ifdef _WIN32
_timeb t;
@ -33,7 +33,7 @@ inline unsigned long timeGetTime()
ftime(&t);
#endif
return (unsigned long)(t.time*1000+t.millitm);
return (u32)(t.time*1000+t.millitm);
}
#include <sys/time.h>

View File

@ -31,7 +31,7 @@ SPU_CONTROL_* VOICE_PROCESSED::GetCtrl()
return ((SPU_CONTROL_*)(spu2regs+memoffset+REG_C0_CTRL));
}
void VOICE_PROCESSED::SetVolume(int iProcessRight)
void VOICE_PROCESSED::SetVolume(s32 iProcessRight)
{
u16 vol = iProcessRight ? pvoice->right.word : pvoice->left.word;
@ -101,8 +101,8 @@ void VOICE_PROCESSED::InterpolateUp()
{
if (SB[32]==1) // flag == 1? calc step and set flag... and don't change the value in this pass
{
const int id1=SB[30]-SB[29]; // curr delta to next val
const int id2=SB[31]-SB[30]; // and next delta to next-next val :)
const s32 id1=SB[30]-SB[29]; // curr delta to next val
const s32 id2=SB[31]-SB[30]; // and next delta to next-next val :)
SB[32]=0;
@ -159,9 +159,9 @@ void VOICE_PROCESSED::InterpolateDown()
}
}
void VOICE_PROCESSED::FModChangeFrequency(int ns)
void VOICE_PROCESSED::FModChangeFrequency(s32 ns)
{
int NP=pvoice->pitch;
s32 NP=pvoice->pitch;
NP=((32768L+iFMod[ns])*NP)/32768L;
@ -173,8 +173,7 @@ void VOICE_PROCESSED::FModChangeFrequency(int ns)
iActFreq=NP;
iUsedFreq=NP;
sinc=(((NP/10)<<16)/4800);
if (!sinc)
sinc=1;
if (!sinc) sinc=1;
// freq change in simple interpolation mode
SB[32]=1;
@ -188,7 +187,7 @@ static void __forceinline GetNoiseValues(s32& VD)
if(Seed&0x100)
VD = (s32)((Seed&0xff)<<8);
else if(!(Seed&0xffff))
else if (!(Seed&0xffff))
VD = (s32)0x8000;
else
VD = (s32)0x7fff;
@ -226,7 +225,7 @@ static void __forceinline GetNoiseValues(s32& VD)
// and sometimes the noise will be used as fmod modulation... pfff
int VOICE_PROCESSED::iGetNoiseVal()
{
int fa;
s32 fa;
/*if ((dwNoiseVal<<=1)&0x80000000L)
{
@ -248,7 +247,7 @@ int VOICE_PROCESSED::iGetNoiseVal()
return fa;
}
void VOICE_PROCESSED::StoreInterpolationVal(int fa)
void VOICE_PROCESSED::StoreInterpolationVal(s32 fa)
{
if (bFMod==2) // fmod freq channel
SB[29]=fa;
@ -269,9 +268,9 @@ void VOICE_PROCESSED::StoreInterpolationVal(int fa)
}
}
int VOICE_PROCESSED::iGetInterpolationVal()
s32 VOICE_PROCESSED::iGetInterpolationVal()
{
int fa;
s32 fa;
if (bFMod==2) return SB[29];

View File

@ -27,7 +27,7 @@
void CALLBACK SPU2readDMAMem(u16 *pMem, int size, int core)
{
u32 spuaddr;
int i, dma, offset;
s32 i, dma, offset;
if ( core == 0)
{
@ -44,7 +44,7 @@ void CALLBACK SPU2readDMAMem(u16 *pMem, int size, int core)
SPU2_LOG("SPU2 readDMA%dMem size %x, addr: %x\n", dma, size, pMem);
for (i=0; i < size; i++)
for (i = 0; i < size; i++)
{
*pMem++ = *(u16*)(spu2mem + spuaddr);
if ((spu2Rs16(REG_C0_CTRL + offset) & 0x40) && (C_IRQA(core) == spuaddr))
@ -94,7 +94,7 @@ int ADMASWrite(int core)
{
u32 spuaddr;
ADMA *Adma;
int dma, offset;
s32 dma, offset;
if (core == 0)
{
@ -159,7 +159,7 @@ void CALLBACK SPU2writeDMAMem(u16* pMem, int size, int core)
{
u32 spuaddr;
ADMA *Adma;
int dma, offset;
s32 dma, offset;
if (core == 0)
{
@ -240,7 +240,7 @@ void CALLBACK SPU2writeDMA7Mem(u16* pMem, int size)
void CALLBACK SPU2interruptDMA(int core)
{
int dma, offset;
s32 dma, offset;
if (core == 0)
{

View File

@ -44,14 +44,14 @@ u16* spu2mem = NULL;
u16* pSpuIrq[2] = {NULL};
u32 dwNewChannel2[2] = {0}; // keeps track of what channels that have been turned on
u32 dwEndChannel2[2] = {0}; // keeps track of what channels have ended
unsigned long dwNoiseVal=1; // global noise generator
u32 dwNoiseVal=1; // global noise generator
bool g_bPlaySound = true; // if true, will output sound, otherwise no
int iFMod[NSSIZE];
int s_buffers[NSSIZE][2]; // left and right buffers
s32 iFMod[NSSIZE];
s32 s_buffers[NSSIZE][2]; // left and right buffers
// mixer thread variables
static bool s_bThreadExit = true;
static int s_nDropPacket = 0;
static s32 s_nDropPacket = 0;
string s_strIniPath="inis/zerospu2.ini";
#ifdef _WIN32
@ -66,7 +66,7 @@ void* SPU2ThreadProc(void*);
#endif
static AUDIOBUFFER s_pAudioBuffers[NSPACKETS];
static int s_nCurBuffer = 0, s_nQueuedBuffers = 0;
static s32 s_nCurBuffer = 0, s_nQueuedBuffers = 0;
static s16* s_pCurOutput = NULL;
static u32 g_startcount=0xffffffff;
static u32 g_packetcount=0;
@ -76,15 +76,15 @@ soundtouch::SoundTouch* pSoundTouch=NULL;
WavOutFile* g_pWavRecord=NULL; // used for recording
static u64 s_GlobalTimeStamp = 0;
static int s_nDurations[64]={0};
static int s_nCurDuration=0;
static int s_nTotalDuration=0;
static s32 s_nDurations[64]={0};
static s32 s_nCurDuration=0;
static s32 s_nTotalDuration=0;
int SPUCycles = 0, SPUWorkerCycles = 0;
int SPUStartCycle[2];
int SPUTargetCycle[2];
s32 SPUCycles = 0, SPUWorkerCycles = 0;
s32 SPUStartCycle[2];
s32 SPUTargetCycle[2];
int g_logsound=0;
s32 g_logsound=0;
int ADMASWrite(int c);
@ -97,7 +97,7 @@ void (*irqCallbackDMA7)()=0;
uptr g_pDMABaseAddr=0;
const int f[5][2] = {
const s32 f[5][2] = {
{ 0, 0 },
{ 60, 0 },
{ 115, -52 },
@ -239,7 +239,7 @@ s32 CALLBACK SPU2init()
memset(voices, 0, sizeof(voices));
// last 24 channels have higher mem offset
for (int i = 0; i < 24; ++i)
for (s32 i = 0; i < 24; ++i)
voices[i+24].memoffset = 0x400;
// init each channel
@ -305,7 +305,7 @@ s32 CALLBACK SPU2open(void *pDsp)
s_pCurOutput = (s16*)s_pAudioBuffers[0].pbuf;
assert( s_pCurOutput != NULL);
for (int i = 0; i < ArraySize(s_nDurations); ++i)
for (s32 i = 0; i < ArraySize(s_nDurations); ++i)
{
s_nDurations[i] = NSFRAMES*1000;
}
@ -410,7 +410,7 @@ void CALLBACK SPU2async(u32 cycle)
void InitADSR() // INIT ADSR
{
u32 r,rs,rd;
int i;
s32 i;
memset(RateTable,0,sizeof(u32)*160); // build the rate table according to Neill's rules (see at bottom of file)
r=3;rs=1;rd=0;
@ -434,7 +434,7 @@ void InitADSR() // INIT ADSR
}
}
int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
{
u32 rateadd[8] = { 0, 4, 6, 8, 9, 10, 11, 12 };
@ -536,11 +536,11 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
return 0;
}
void MixChannels(int core)
void MixChannels(s32 core)
{
// mix all channels
int c_offset = 0x0400 * core;
int dma, left_vol, right_vol;
s32 c_offset = 0x0400 * core;
s32 dma, left_vol, right_vol;
ADMA *Adma;
if (core == 0)
@ -560,12 +560,12 @@ void MixChannels(int core)
if ((spu2Ru16(REG_C0_MMIX + c_offset) & 0xF0) && (spu2Ru16(REG_C0_ADMAS + c_offset) & (0x1 + core)))
{
for (int ns=0;ns<NSSIZE;ns++)
for (s32 ns=0;ns<NSSIZE;ns++)
{
if ((spu2Ru16(REG_C0_MMIX + c_offset) & 0x80))
s_buffers[ns][0] += (((short*)spu2mem)[0x2000 + c_offset +Adma->Index]*(int)spu2Ru16(left_vol))>>16;
s_buffers[ns][0] += (((s16*)spu2mem)[0x2000 + c_offset +Adma->Index]*(s32)spu2Ru16(left_vol))>>16;
if ((spu2Ru16(REG_C0_MMIX + c_offset) & 0x40))
s_buffers[ns][1] += (((short*)spu2mem)[0x2200 + c_offset +Adma->Index]*(int)spu2Ru16(right_vol))>>16;
s_buffers[ns][1] += (((s16*)spu2mem)[0x2200 + c_offset +Adma->Index]*(s32)spu2Ru16(right_vol))>>16;
Adma->Index +=1;
MemAddr[core] += 4;
@ -602,7 +602,7 @@ void SPU2Worker()
{
u8* start;
u32 nSample;
int ch, predict_nr, shift_factor, flags;
s32 ch, predict_nr, shift_factor, flags;
// assume s_buffers are zeroed out
if ( dwNewChannel2[0] || dwNewChannel2[1] )
@ -624,11 +624,11 @@ void SPU2Worker()
pChannel->VoiceChangeFrequency();
// loop until 1 ms of data is reached
int ns = 0;
s32 ns = 0;
while(ns<NSSIZE)
{
int s_1, s_2, fa;
s32 s_1, s_2, fa;
// fmod freq channel
if (pChannel->bFMod==1 && iFMod[ns]) pChannel->FModChangeFrequency(ns);
@ -662,8 +662,8 @@ void SPU2Worker()
for (nSample=0; nSample<28; ++start)
{
int s;
int d = (int)*start;
s32 s;
s32 d = (s32)*start;
s = ((d & 0xf)<<12);
if (s & 0x8000) s |= 0xffff0000;
@ -685,7 +685,7 @@ void SPU2Worker()
}
// irq occurs no matter what core access the address
for (int core = 0; core < 2; ++core)
for (s32 core = 0; core < 2; ++core)
{
if (((SPU_CONTROL_*)(spu2regs + (0x400 * core) + REG_C0_CTRL))->irq) // some callback and irq active?
{
@ -736,7 +736,7 @@ void SPU2Worker()
else
fa=pChannel->iGetInterpolationVal(); // get sample val
int sval = (MixADSR(pChannel) * fa) / 1023; // mix adsr
s32 sval = (MixADSR(pChannel) * fa) / 1023; // mix adsr
if (pChannel->bFMod == 2) // fmod freq channel
{
@ -767,7 +767,7 @@ ENDX:
{
assert( s_pCurOutput != NULL);
for (int ns=0; ns<NSSIZE; ns++)
for (s32 ns=0; ns<NSSIZE; ns++)
{
// clamp and write
clampandwrite16(s_pCurOutput[0],s_buffers[ns][0]);
@ -784,7 +784,7 @@ ENDX:
if ( conf.options & OPTION_RECORDING )
{
static int lastrectime = 0;
static s32 lastrectime = 0;
if (timeGetTime() - lastrectime > 5000)
{
WARN_LOG("ZeroSPU2: recording\n");
@ -840,17 +840,17 @@ ENDX:
}
// resamples pStereoSamples
void ResampleLinear(s16* pStereoSamples, int oldsamples, s16* pNewSamples, int newsamples)
void ResampleLinear(s16* pStereoSamples, s32 oldsamples, s16* pNewSamples, s32 newsamples)
{
for (int i = 0; i < newsamples; ++i)
for (s32 i = 0; i < newsamples; ++i)
{
int io = i * oldsamples;
int old = io / newsamples;
int rem = io - old * newsamples;
s32 io = i * oldsamples;
s32 old = io / newsamples;
s32 rem = io - old * newsamples;
old *= 2;
int newsampL = pStereoSamples[old] * (newsamples - rem) + pStereoSamples[old+2] * rem;
int newsampR = pStereoSamples[old+1] * (newsamples - rem) + pStereoSamples[old+3] * rem;
s32 newsampL = pStereoSamples[old] * (newsamples - rem) + pStereoSamples[old+2] * rem;
s32 newsampR = pStereoSamples[old+1] * (newsamples - rem) + pStereoSamples[old+3] * rem;
pNewSamples[2 * i] = newsampL / newsamples;
pNewSamples[2 * i + 1] = newsampR / newsamples;
}
@ -868,7 +868,7 @@ DWORD WINAPI SPU2ThreadProc(LPVOID)
void* SPU2ThreadProc(void* lpParam)
#endif
{
int nReadBuf = 0;
s32 nReadBuf = 0;
while (!s_bThreadExit)
{
@ -901,13 +901,13 @@ void* SPU2ThreadProc(void* lpParam)
}
//int ps2delay = timeGetTime() - s_pAudioBuffers[nReadBuf].timestamp;
int NewSamples = s_pAudioBuffers[nReadBuf].avgtime;
//s32 ps2delay = timeGetTime() - s_pAudioBuffers[nReadBuf].timestamp;
s32 NewSamples = s_pAudioBuffers[nReadBuf].avgtime;
if ( (conf.options & OPTION_TIMESTRETCH) )
{
int bytesbuf = SoundGetBytesBuffered();
s32 bytesbuf = SoundGetBytesBuffered();
if ( bytesbuf < 8000 )
NewSamples += 1000;
// check the current timestamp, if too far apart, speed up audio
@ -928,25 +928,25 @@ void* SPU2ThreadProc(void* lpParam)
NewSamples = min(NewSamples, NSFRAMES * NSSIZE * 3);
int oldsamples = s_pAudioBuffers[nReadBuf].len / 4;
s32 oldsamples = s_pAudioBuffers[nReadBuf].len / 4;
if ((nReadBuf & 3) == 0) // wow, this if statement makes the whole difference
pSoundTouch->setTempoChange(100.0f*(float)oldsamples/(float)NewSamples - 100.0f);
for( int sx=0; sx<oldsamples*2; sx++ )
for( s32 sx=0; sx<oldsamples*2; sx++ )
s_floatBuffer[sx] = ((s16*)s_pAudioBuffers[nReadBuf].pbuf)[sx]/65536.0f;
pSoundTouch->putSamples(s_floatBuffer, oldsamples);
// extract 2*NSFRAMES ms at a time
int nOutSamples;
s32 nOutSamples;
do
{
nOutSamples = pSoundTouch->receiveSamples(s_floatBuffer, NSSIZE * NSFRAMES * 5);
if ( nOutSamples > 0 )
{
for( int sx=0; sx<nOutSamples*2; sx++ )
for( s32 sx=0; sx<nOutSamples*2; sx++ )
s_ThreadBuffer[sx] = (s16)(s_floatBuffer[sx]*65536.0f);
SoundFeedVoiceData((u8*)s_ThreadBuffer, nOutSamples * 4);
@ -969,9 +969,9 @@ void* SPU2ThreadProc(void* lpParam)
}
// turn channels on
void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND
void SoundOn(s32 start,s32 end,u16 val) // SOUND ON PSX COMAND
{
for (int ch=start;ch<end;ch++,val>>=1) // loop channels
for (s32 ch=start;ch<end;ch++,val>>=1) // loop channels
{
if ((val&1) && voices[ch].pStart) // mmm... start has to be set before key on !?!
{
@ -983,17 +983,17 @@ void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND
}
// turn channels off
void SoundOff(int start,int end,unsigned short val) // SOUND OFF PSX COMMAND
void SoundOff(s32 start,s32 end,u16 val) // SOUND OFF PSX COMMAND
{
for (int ch=start;ch<end;ch++,val>>=1) // loop channels
for (s32 ch=start;ch<end;ch++,val>>=1) // loop channels
{
if (val&1) voices[ch].bStop=true; // && s_chan[i].bOn) mmm...
}
}
void FModOn(int start,int end,unsigned short val) // FMOD ON PSX COMMAND
void FModOn(s32 start,s32 end,u16 val) // FMOD ON PSX COMMAND
{
int ch;
s32 ch;
for (ch=start;ch<end;ch++,val>>=1) // loop channels
{
@ -1010,9 +1010,9 @@ void FModOn(int start,int end,unsigned short val) // FMOD ON PSX COMMAND
}
}
void VolumeOn(int start,int end,unsigned short val,int iRight) // VOLUME ON PSX COMMAND
void VolumeOn(s32 start,s32 end,u16 val,s32 iRight) // VOLUME ON PSX COMMAND
{
int ch;
s32 ch;
for (ch=start;ch<end;ch++,val>>=1) // loop channels
{
@ -1048,7 +1048,7 @@ void CALLBACK SPU2write(u32 mem, u16 value)
// channel info
if ((r<0x0180) || (r>=0x0400 && r<0x0580)) // u32s are always >= 0.
{
int ch=0;
s32 ch=0;
if (r >= 0x400)
ch = ((r - 0x400) >> 4) + 24;
else
@ -1064,7 +1064,7 @@ void CALLBACK SPU2write(u32 mem, u16 value)
break;
case 4:
{
int NP;
s32 NP;
if (value> 0x3fff)
NP=0x3fff; // get pitch val
else
@ -1100,8 +1100,8 @@ void CALLBACK SPU2write(u32 mem, u16 value)
// more channel info
if ((r>=0x01c0 && r<0x02E0)||(r>=0x05c0 && r<0x06E0))
{
int ch=0;
unsigned long rx=r;
s32 ch=0;
u32 rx=r;
if (rx>=0x400)
{
ch=24;
@ -1257,7 +1257,7 @@ u16 CALLBACK SPU2read(u32 mem)
// if the register is any of the regs before core 0, or is somewhere between core 0 and 1...
if ((r < 0x0180) || (r >= 0x0400 && r < 0x0580)) // u32s are always >= 0.
{
int ch = 0;
s32 ch = 0;
if (r >= 0x400)
ch=((r - 0x400) >> 4) + 24;
@ -1272,8 +1272,8 @@ u16 CALLBACK SPU2read(u32 mem)
if ((r>=REG_VA_SSA && r<REG_A_ESA) || (r>=0x05c0 && r<0x06E0)) // some channel info?
{
int ch=0;
unsigned long rx = r;
s32 ch=0;
u32 rx = r;
if (rx >=0x400)
{
@ -1390,24 +1390,24 @@ s32 CALLBACK SPU2test()
}
// size is in bytes
void LogPacketSound(void* packet, int memsize)
void LogPacketSound(void* packet, s32 memsize)
{
u16 buf[28];
u8* pstart = (u8*)packet;
int s_1 = 0, s_2=0;
s32 s_1 = 0, s_2=0;
for (int i = 0; i < memsize; i += 16)
for (s32 i = 0; i < memsize; i += 16)
{
int predict_nr=(int)pstart[0];
int shift_factor=predict_nr&0xf;
s32 predict_nr=(s32)pstart[0];
s32 shift_factor=predict_nr&0xf;
predict_nr >>= 4;
pstart += 2;
for (int nSample=0;nSample<28; ++pstart)
for (s32 nSample=0;nSample<28; ++pstart)
{
int d=(int)*pstart;
int s, fa;
s32 d=(s32)*pstart;
s32 s, fa;
s =((d & 0xf) << 12);
SetPacket(s);
@ -1420,7 +1420,7 @@ void LogPacketSound(void* packet, int memsize)
}
}
void LogRawSound(void* pleft, int leftstride, void* pright, int rightstride, int numsamples)
void LogRawSound(void* pleft, s32 leftstride, void* pright, s32 rightstride, s32 numsamples)
{
if (g_pWavRecord == NULL )
g_pWavRecord = new WavOutFile(RECORD_FILENAME, SAMPLE_RATE, 16, 2);
@ -1431,7 +1431,7 @@ void LogRawSound(void* pleft, int leftstride, void* pright, int rightstride, int
tempbuf.resize(2 * numsamples);
for (int i = 0; i < numsamples; ++i)
for (s32 i = 0; i < numsamples; ++i)
{
tempbuf[2*i+0] = *(s16*)left;
tempbuf[2*i+1] = *(s16*)right;
@ -1462,7 +1462,7 @@ int CALLBACK SPU2setupRecording(int start, void* pData)
void save_data(freezeData *data)
{
SPU2freezeData *spud;
int i;
s32 i;
spud = (SPU2freezeData*)data->data;
spud->version = 0x70000001;
@ -1470,8 +1470,8 @@ void save_data(freezeData *data)
memcpy(spud->spu2regs, spu2regs, 0x10000);
memcpy(spud->spu2mem, spu2mem, 0x200000);
spud->nSpuIrq[0] = (int)(pSpuIrq[0] - spu2mem);
spud->nSpuIrq[1] = (int)(pSpuIrq[1] - spu2mem);
spud->nSpuIrq[0] = (s32)(pSpuIrq[0] - spu2mem);
spud->nSpuIrq[1] = (s32)(pSpuIrq[1] - spu2mem);
memcpy(spud->dwNewChannel2, dwNewChannel2, 4*2);
memcpy(spud->dwEndChannel2, dwEndChannel2, 4*2);
@ -1518,7 +1518,7 @@ void save_data(freezeData *data)
void load_data(freezeData *data)
{
SPU2freezeData *spud;
int i;
s32 i;
spud = (SPU2freezeData*)data->data;
@ -1556,7 +1556,7 @@ void load_data(freezeData *data)
for (i = 0; i < ArraySize(voices); ++i)
{
memcpy(&voices[i], &spud->voices[i], min((int)SPU_VOICE_STATE_SIZE, spud->voicesize));
memcpy(&voices[i], &spud->voices[i], min((s32)SPU_VOICE_STATE_SIZE, spud->voicesize));
voices[i].pStart = (u8*)((uptr)spud->voices[i].pStart+(uptr)spu2mem);
voices[i].pLoop = (u8*)((uptr)spud->voices[i].pLoop+(uptr)spu2mem);
voices[i].pCurr = (u8*)((uptr)spud->voices[i].pCurr+(uptr)spu2mem);
@ -1565,7 +1565,7 @@ void load_data(freezeData *data)
s_GlobalTimeStamp = 0;
g_startcount = 0xffffffff;
for (int i = 0; i < ArraySize(s_nDurations); ++i)
for (s32 i = 0; i < ArraySize(s_nDurations); ++i)
{
s_nDurations[i] = NSFRAMES*1000;
}

View File

@ -88,24 +88,24 @@ extern FILE *spu2Log;
extern s8 *spu2regs;
extern u16* spu2mem;
extern int iFMod[NSSIZE];
extern s32 iFMod[NSSIZE];
extern u32 MemAddr[2];
extern unsigned long dwNoiseVal; // global noise generator
extern u32 dwNoiseVal; // global noise generator
// functions of main emu, called on spu irq
extern void (*irqCallbackSPU2)();
extern void (*irqCallbackDMA4)();
extern void (*irqCallbackDMA7)();
extern int SPUCycles, SPUWorkerCycles;
extern int SPUStartCycle[2];
extern int SPUTargetCycle[2];
extern s32 SPUCycles, SPUWorkerCycles;
extern s32 SPUStartCycle[2];
extern s32 SPUTargetCycle[2];
extern u16 interrupt;
typedef struct {
int Log;
int options;
s32 Log;
s32 options;
} Config;
extern Config conf;
@ -173,7 +173,7 @@ static __forceinline u32 C1_IRQA()
return SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI);
}
static __forceinline u32 C_IRQA(int c)
static __forceinline u32 C_IRQA(s32 c)
{
if (c == 0)
return C0_IRQA();
@ -191,7 +191,7 @@ static __forceinline u32 C1_SPUADDR()
return SPU2_GET32BIT(REG_C1_SPUADDR_LO, REG_C1_SPUADDR_HI);
}
static __forceinline u32 C_SPUADDR(int c)
static __forceinline u32 C_SPUADDR(s32 c)
{
if (c == 0)
return C0_SPUADDR();
@ -209,7 +209,7 @@ static __forceinline void C1_SPUADDR_SET(u32 value)
SPU2_SET32BIT(value, REG_C1_SPUADDR_LO, REG_C1_SPUADDR_HI);
}
static __forceinline void C_SPUADDR_SET(u32 value, int c)
static __forceinline void C_SPUADDR_SET(u32 value, s32 c)
{
if (c == 0)
C0_SPUADDR_SET(value);
@ -282,18 +282,18 @@ struct _SPU_VOICE
// ADSR INFOS PER CHANNEL
struct ADSRInfoEx
{
int State;
int AttackModeExp;
int AttackRate;
int DecayRate;
int SustainLevel;
int SustainModeExp;
int SustainIncrease;
int SustainRate;
int ReleaseModeExp;
int ReleaseRate;
int EnvelopeVol;
long lVolume;
s32 State;
s32 AttackModeExp;
s32 AttackRate;
s32 DecayRate;
s32 SustainLevel;
s32 SustainModeExp;
s32 SustainIncrease;
s32 SustainRate;
s32 ReleaseModeExp;
s32 ReleaseRate;
s32 EnvelopeVol;
s32 lVolume;
};
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED)-4*sizeof(void*))
@ -311,34 +311,34 @@ struct VOICE_PROCESSED
void InterpolateUp();
void InterpolateDown();
void FModChangeFrequency(int ns);
int iGetNoiseVal();
s32 iGetNoiseVal();
void StoreInterpolationVal(int fa);
int iGetInterpolationVal();
s32 iGetInterpolationVal();
void Stop();
SPU_CONTROL_* GetCtrl();
// start save state
int leftvol, rightvol; // left right volumes
s32 leftvol, rightvol; // left right volumes
int iSBPos; // mixing stuff
int SB[32+32];
int spos;
int sinc;
s32 iSBPos; // mixing stuff
s32 SB[32+32];
s32 spos;
s32 sinc;
int iIrqDone; // debug irq done flag
int s_1; // last decoding infos
int s_2;
int iOldNoise; // old noise val for this channel
int iActFreq; // current psx pitch
int iUsedFreq; // current pc pitch
s32 iIrqDone; // debug irq done flag
s32 s_1; // last decoding infos
s32 s_2;
s32 iOldNoise; // old noise val for this channel
s32 iActFreq; // current psx pitch
s32 iUsedFreq; // current pc pitch
int iStartAddr, iLoopAddr, iNextAddr;
int bFMod;
s32 iStartAddr, iLoopAddr, iNextAddr;
s32 bFMod;
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
int memoffset; // if first core, 0, if second, 0x400
int chanid; // channel id
s32 memoffset; // if first core, 0, if second, 0x400
s32 chanid; // channel id
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
bool bVolumeR, bVolumeL;
@ -363,15 +363,15 @@ struct AUDIOBUFFER
// Variable used to smooth out sound by concentrating on new voices
u32 timestamp; // in microseconds, only used for time stretching
u32 avgtime;
int newchannels;
s32 newchannels;
};
struct ADMA
{
unsigned short * MemAddr;
int Index;
int AmountLeft;
int Enabled;
u16* MemAddr;
s32 Index;
s32 AmountLeft;
s32 Enabled;
// used to make sure that ADMA doesn't get interrupted with a writeDMA call
};
@ -384,19 +384,19 @@ struct SPU2freezeData
u8 spu2regs[0x10000];
u8 spu2mem[0x200000];
u16 interrupt;
int nSpuIrq[2];
s32 nSpuIrq[2];
u32 dwNewChannel2[2], dwEndChannel2[2];
u32 dwNoiseVal;
int iFMod[NSSIZE];
s32 iFMod[NSSIZE];
u32 MemAddr[2];
ADMA adma[2];
u32 Adma4MemAddr, Adma7MemAddr;
int SPUCycles, SPUWorkerCycles;
int SPUStartCycle[2];
int SPUTargetCycle[2];
s32 SPUCycles, SPUWorkerCycles;
s32 SPUStartCycle[2];
s32 SPUTargetCycle[2];
int voicesize;
s32 voicesize;
VOICE_PROCESSED voices[SPU_NUMBER_VOICES+1];
};