Plugins: Devbuild and Debug should be separate, and let's use ZEROGS_DEVBUILD and not RELEASE_TO_PUBLIC in ZeroGS.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@544 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-02-20 03:22:19 +00:00
parent 32a8bef206
commit f412c38547
17 changed files with 157 additions and 98 deletions

View File

@ -20,6 +20,9 @@ export ZEROGSOPTIONS="--enable-sse2"
#ZeroGS Debug mode #ZeroGS Debug mode
#export ZEROGSOPTIONS="--enable-debug --enable-devbuild --enable-sse2" #export ZEROGSOPTIONS="--enable-debug --enable-devbuild --enable-sse2"
#ZeroSPU2 Debug mode (Don't enable right now)
#export ZEROSPU2OPTIONS="--enable-debug --enable-devbuild"
option=$@ option=$@
export PCSX2PLUGINS="`pwd`/bin/plugins" export PCSX2PLUGINS="`pwd`/bin/plugins"
curdir=`pwd` curdir=`pwd`

View File

@ -143,12 +143,6 @@ struct Vector_16F
}; };
///////////////////// /////////////////////
// define when releasing
// The only code that uses it is commented out!
//#define ZEROGS_CACHEDCLEAR // much better performance
//#define RELEASE_TO_PUBLIC
// fixme - We should use ZEROGS_DEVBUILD to determine devel/debug builds from "public release" builds.
// Means a lot of search-and-replace though. (air)
#ifdef ZEROGS_DEVBUILD #ifdef ZEROGS_DEVBUILD
#define GS_LOG __Log #define GS_LOG __Log
@ -159,7 +153,7 @@ struct Vector_16F
#define ERROR_LOG __LogToConsole #define ERROR_LOG __LogToConsole
#define DEBUG_LOG printf #define DEBUG_LOG printf
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#define WARN_LOG 0&& #define WARN_LOG 0&&
#define PRIM_LOG 0&& #define PRIM_LOG 0&&
#else #else

View File

@ -70,7 +70,7 @@ unsigned char zgsminor = 7;
#ifdef _DEBUG #ifdef _DEBUG
char *libraryName = "ZeroGS-Pg OpenGL (Debug) "; char *libraryName = "ZeroGS-Pg OpenGL (Debug) ";
#elif defined(RELEASE_TO_PUBLIC) #elif !defined(ZEROGS_DEVBUILD)
char *libraryName = "ZeroGS Playground OpenGL "; char *libraryName = "ZeroGS Playground OpenGL ";
#else #else
char *libraryName = "ZeroGS-Pg OpenGL (Dev) "; char *libraryName = "ZeroGS-Pg OpenGL (Dev) ";
@ -86,7 +86,7 @@ extern int g_nPixelShaderVer;
extern int g_nFrameRender; extern int g_nFrameRender;
extern int g_nFramesSkipped; extern int g_nFramesSkipped;
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#define g_bWriteProfile 0 #define g_bWriteProfile 0
#else #else
BOOL g_bWriteProfile = 0; BOOL g_bWriteProfile = 0;
@ -767,7 +767,7 @@ void CALLBACK GSvsync(int interlace)
dwTime = d; dwTime = d;
g_nFrame += UPDATE_FRAMES; g_nFrame += UPDATE_FRAMES;
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
const char* g_pShaders[4] = { "full", "reduced", "accurate", "accurate-reduced" }; const char* g_pShaders[4] = { "full", "reduced", "accurate", "accurate-reduced" };
sprintf(strtitle, "ZeroGS KOSMOS 0.%d.%d %.1f fps | %s%s%s%s %s (%.1f)", zgsbuild, zgsminor, fFPS, sprintf(strtitle, "ZeroGS KOSMOS 0.%d.%d %.1f fps | %s%s%s%s %s (%.1f)", zgsbuild, zgsminor, fFPS,
@ -818,7 +818,7 @@ void CALLBACK GSvsync(int interlace)
g_nFramesSkipped = 0; g_nFramesSkipped = 0;
} }
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
if( g_bWriteProfile ) { if( g_bWriteProfile ) {
//g_bWriteProfile = 0; //g_bWriteProfile = 0;
DVProfWrite("prof.txt", UPDATE_FRAMES); DVProfWrite("prof.txt", UPDATE_FRAMES);

View File

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

View File

@ -937,7 +937,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data)
} }
} }
else { else {
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
WARN_LOG("ZeroGS: dummy transfer\n"); WARN_LOG("ZeroGS: dummy transfer\n");
#endif #endif
gs.imageTransfer = -1; gs.imageTransfer = -1;
@ -951,7 +951,7 @@ void __fastcall GIFRegHandlerHWREG(u32* data)
ZeroGS::TransferHostLocal(data, 2); ZeroGS::TransferHostLocal(data, 2);
} }
else { else {
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
ERROR_LOG("ZeroGS: HWREG!? %8.8x_%8.8x\n", data[0], data[1]); ERROR_LOG("ZeroGS: HWREG!? %8.8x_%8.8x\n", data[0], data[1]);
//assert(0); //assert(0);
#endif #endif

View File

@ -4419,7 +4419,7 @@ _ACEOF
CFLAGS+="-O3 -fomit-frame-pointer " CFLAGS+="-O3 -fomit-frame-pointer "
CPPFLAGS+="-O3 -fomit-frame-pointer " CPPFLAGS+="-O3 -fomit-frame-pointer "
CXXFLAGS+="-O3 -fomit-frame-pointer " CXXFLAGS+="-O3 -fomit-frame-pointer -fpermissive "
fi fi
{ $as_echo "$as_me:$LINENO: result: $debug" >&5 { $as_echo "$as_me:$LINENO: result: $debug" >&5
$as_echo "$debug" >&6; } $as_echo "$debug" >&6; }
@ -4540,11 +4540,11 @@ else
devbuild=no devbuild=no
fi fi
if test "x$devbuild" == xno if test "x$devbuild" == xyes
then then
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define RELEASE_TO_PUBLIC 1 #define ZEROGS_DEVBUILD 1
_ACEOF _ACEOF
fi fi

View File

@ -43,7 +43,7 @@ else
AC_DEFINE(NDEBUG,1,[NDEBUG]) AC_DEFINE(NDEBUG,1,[NDEBUG])
CFLAGS+="-O3 -fomit-frame-pointer " CFLAGS+="-O3 -fomit-frame-pointer "
CPPFLAGS+="-O3 -fomit-frame-pointer " CPPFLAGS+="-O3 -fomit-frame-pointer "
CXXFLAGS+="-O3 -fomit-frame-pointer " CXXFLAGS+="-O3 -fomit-frame-pointer -fpermissive "
fi fi
AC_MSG_RESULT($debug) AC_MSG_RESULT($debug)
@ -53,9 +53,9 @@ dnl Check for dev build
AC_MSG_CHECKING(for development build...) AC_MSG_CHECKING(for development build...)
AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]), AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]),
devbuild=$enableval,devbuild=no) devbuild=$enableval,devbuild=no)
if test "x$devbuild" == xno if test "x$devbuild" == xyes
then then
AC_DEFINE(RELEASE_TO_PUBLIC,1,[RELEASE_TO_PUBLIC]) AC_DEFINE(ZEROGS_DEVBUILD,1,[ZEROGS_DEVBUILD])
fi fi
AC_MSG_RESULT($devbuild) AC_MSG_RESULT($devbuild)
AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno) AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno)

View File

@ -42,7 +42,7 @@ extern BOOL g_bIsLost;
extern BOOL g_bUpdateStencil; extern BOOL g_bUpdateStencil;
extern u32 s_uFramebuffer; extern u32 s_uFramebuffer;
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#define INC_RESOLVE() #define INC_RESOLVE()
#else #else
#define INC_RESOLVE() ++g_nResolve #define INC_RESOLVE() ++g_nResolve
@ -204,7 +204,7 @@ void ZeroGS::CRenderTarget::Resolve()
glGetTexImage(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, GL_UNSIGNED_BYTE, psys); glGetTexImage(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, GL_UNSIGNED_BYTE, psys);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) #if defined(ZEROGS_DEVBUILD) && defined(_DEBUG)
if( g_bSaveResolved ) { if( g_bSaveResolved ) {
SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, fbw<<s_AAx, fbh<<s_AAy); SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, fbw<<s_AAx, fbh<<s_AAy);
g_bSaveResolved = 0; g_bSaveResolved = 0;
@ -227,7 +227,7 @@ void ZeroGS::CRenderTarget::Resolve(int startrange, int endrange)
if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0); if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0);
if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1); if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1);
#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) #if defined(ZEROGS_DEVBUILD) && defined(_DEBUG)
if( g_bSaveResolved ) { if( g_bSaveResolved ) {
SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, fbw<<s_AAx, fbh<<s_AAy); SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, fbw<<s_AAx, fbh<<s_AAy);
g_bSaveResolved = 0; g_bSaveResolved = 0;
@ -1149,7 +1149,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
else { else {
// certain variables have to be reset every time // certain variables have to be reset every time
if( (it->second->psm&~1) != (frame.psm&~1) ) { if( (it->second->psm&~1) != (frame.psm&~1) ) {
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
WARN_LOG("bad formats 2: %d %d\n", frame.psm, it->second->psm); WARN_LOG("bad formats 2: %d %d\n", frame.psm, it->second->psm);
#endif #endif
it->second->psm = frame.psm; it->second->psm = frame.psm;
@ -1847,7 +1847,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info
targ->ptex->ref = 1; targ->ptex->ref = 1;
} }
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
g_TransferredToGPU += GPU_TEXWIDTH * channels * 4 * targ->height; g_TransferredToGPU += GPU_TEXWIDTH * channels * 4 * targ->height;
#endif #endif
@ -2518,7 +2518,7 @@ void InitTransferHostLocal()
if( g_bIsLost ) if( g_bIsLost )
return; return;
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
if( gs.trxpos.dx+gs.imageWnew > gs.dstbuf.bw ) if( gs.trxpos.dx+gs.imageWnew > gs.dstbuf.bw )
WARN_LOG("Transfer error, width exceeds\n"); WARN_LOG("Transfer error, width exceeds\n");
#endif #endif
@ -2649,7 +2649,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
} }
else s_vTransferCache.resize(0); else s_vTransferCache.resize(0);
#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) #if defined(ZEROGS_DEVBUILD) && defined(_DEBUG)
if( g_bSaveTrans ) { if( g_bSaveTrans ) {
tex0Info t; tex0Info t;
t.tbp0 = gs.dstbuf.bp; t.tbp0 = gs.dstbuf.bp;
@ -2789,7 +2789,7 @@ void InitTransferLocalHost()
{ {
assert( gs.trxpos.sx+gs.imageWnew <= 2048 && gs.trxpos.sy+gs.imageHnew <= 2048 ); assert( gs.trxpos.sx+gs.imageWnew <= 2048 && gs.trxpos.sy+gs.imageHnew <= 2048 );
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
if( gs.trxpos.sx+gs.imageWnew > gs.srcbuf.bw ) if( gs.trxpos.sx+gs.imageWnew > gs.srcbuf.bw )
WARN_LOG("Transfer error, width exceeds\n"); WARN_LOG("Transfer error, width exceeds\n");
#endif #endif
@ -3082,7 +3082,7 @@ void TransferLocalLocal()
g_MemTargs.ClearRange(dststart, dstend); g_MemTargs.ClearRange(dststart, dstend);
#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) #if defined(ZEROGS_DEVBUILD) && defined(_DEBUG)
if( g_bSaveTrans ) { if( g_bSaveTrans ) {
tex0Info t; tex0Info t;
t.tbp0 = gs.dstbuf.bp; t.tbp0 = gs.dstbuf.bp;

View File

@ -79,7 +79,7 @@ BOOL g_bIsLost = 0;
int g_nFrameRender = 10; int g_nFrameRender = 10;
int g_nFramesSkipped = 0; int g_nFramesSkipped = 0;
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#define INC_GENVARS() #define INC_GENVARS()
#define INC_TEXVARS() #define INC_TEXVARS()
@ -1307,7 +1307,7 @@ bool ZeroGS::Create(int _width, int _height)
GPU_TEXWIDTH = g_MaxTexWidth/8; GPU_TEXWIDTH = g_MaxTexWidth/8;
g_fiGPU_TEXWIDTH = 1.0f / GPU_TEXWIDTH; g_fiGPU_TEXWIDTH = 1.0f / GPU_TEXWIDTH;
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#ifdef _WIN32 #ifdef _WIN32
HRSRC hShaderSrc = FindResource(hInst, MAKEINTRESOURCE(IDR_SHADERS), RT_RCDATA); HRSRC hShaderSrc = FindResource(hInst, MAKEINTRESOURCE(IDR_SHADERS), RT_RCDATA);
assert( hShaderSrc != NULL ); assert( hShaderSrc != NULL );
@ -1359,7 +1359,7 @@ bool ZeroGS::Create(int _width, int _height)
sprintf(EFFECT_NAME, "%sps2hw.fx", EFFECT_DIR); sprintf(EFFECT_NAME, "%sps2hw.fx", EFFECT_DIR);
#endif #endif
#endif // RELEASE_TO_PUBLIC #endif // ZEROGS_DEVBUILD
// load the effect, find the best profiles (if any) // load the effect, find the best profiles (if any)
if( cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE ) { if( cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE ) {
@ -2097,7 +2097,7 @@ void SetupVertexProgramParameters(CGprogram prog, int context)
cgGLSetParameter4fv(p, Vector(0,1, 0.001f, 0.5f)); cgGLSetParameter4fv(p, Vector(0,1, 0.001f, 0.5f));
} }
#ifdef RELEASE_TO_PUBLIC #ifndef ZEROGS_DEVBUILD
#define LOAD_VS(Index, prog) { \ #define LOAD_VS(Index, prog) { \
assert( mapShaderResources.find(Index) != mapShaderResources.end() ); \ assert( mapShaderResources.find(Index) != mapShaderResources.end() ); \
@ -2300,7 +2300,7 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te
return NULL; return NULL;
} }
#else // not RELEASE_TO_PUBLIC #else // ZEROGS_DEVBUILD
#define LOAD_VS(name, prog, shaderver) { \ #define LOAD_VS(name, prog, shaderver) { \
prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, EFFECT_NAME, shaderver, name, args); \ prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, EFFECT_NAME, shaderver, name, args); \
@ -2498,7 +2498,7 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te
return NULL; return NULL;
} }
#endif // RELEASE_TO_PUBLIC #endif // ZEROGS_DEVBUILD
void ZeroGS::Prim() void ZeroGS::Prim()
{ {
@ -2540,7 +2540,7 @@ int GetTexFilter(const tex1Info& tex1)
void ZeroGS::ReloadEffects() void ZeroGS::ReloadEffects()
{ {
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
for(int i = 0; i < ARRAY_SIZE(ppsTexture); ++i) { for(int i = 0; i < ARRAY_SIZE(ppsTexture); ++i) {
SAFE_RELEASE_PROG(ppsTexture[i].prog); SAFE_RELEASE_PROG(ppsTexture[i].prog);
} }
@ -2555,7 +2555,7 @@ void ZeroGS::Flush(int context)
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
assert( context >= 0 && context <= 1 ); assert( context >= 0 && context <= 1 );
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
if( g_bUpdateEffect ) { if( g_bUpdateEffect ) {
ReloadEffects(); ReloadEffects();
g_bUpdateEffect = 0; g_bUpdateEffect = 0;
@ -3387,7 +3387,7 @@ void ZeroGS::Flush(int context)
if( dwFilterOpts & 2 ) glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); if( dwFilterOpts & 2 ) glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} }
//#ifndef RELEASE_TO_PUBLIC //#ifdef ZEROGS_DEVBUILD
ppf += curvb.nCount+0x100000; ppf += curvb.nCount+0x100000;
//#endif //#endif
@ -3537,7 +3537,7 @@ void ZeroGS::RenderCRTC(int interlace)
if( g_bIsLost ) return; if( g_bIsLost ) return;
// Crashes Final Fantasy X at startup if uncommented. --arcum42 // Crashes Final Fantasy X at startup if uncommented. --arcum42
//#ifdef RELEASE_TO_PUBLIC //#ifndef ZEROGS_DEVBUILD
// if(g_nRealFrame < 80 ) { // if(g_nRealFrame < 80 ) {
// RenderCustom( min(1.0f, 2.0f - (float)g_nRealFrame / 40.0f) ); // RenderCustom( min(1.0f, 2.0f - (float)g_nRealFrame / 40.0f) );
// //
@ -5425,7 +5425,7 @@ Return:
"jmp Start\n" "jmp Start\n"
"Return:\n" "Return:\n"
"emms\n" "emms\n"
".att_syntax\n" : "=m"(bRet) : "c"(dst), "d"(src), "b"(entries) : "rax", "memory"); ".att_syntax\n" : "=m"(bRet) : "c"(dst), "d"(src), "b"(entries) : "rax", "memory");// Breaks -fPIC
#else #else
// do a fast test with MMX // do a fast test with MMX
__asm__( __asm__(
@ -5478,7 +5478,7 @@ Return:
"jmp Start\n" "jmp Start\n"
"Return:\n" "Return:\n"
"emms\n" "emms\n"
".att_syntax\n" : "=m"(bRet) : "c"(dst), "d"(src), "b"(entries) : "eax", "memory"); ".att_syntax\n" : "=m"(bRet) : "c"(dst), "d"(src), "b"(entries) : "eax", "memory"); // Breaks -fPIC
#endif // __x86_64__ #endif // __x86_64__
#endif // _WIN32 #endif // _WIN32
@ -5577,7 +5577,7 @@ void ZeroGS::texClutWrite(int ctx)
default: default:
{ {
#ifndef RELEASE_TO_PUBLIC #ifdef ZEROGS_DEVBUILD
//DEBUG_LOG("unknown cpsm: %x (%x)\n", tex0.cpsm, tex0.psm); //DEBUG_LOG("unknown cpsm: %x (%x)\n", tex0.cpsm, tex0.psm);
#endif #endif
break; break;

View File

@ -42,14 +42,16 @@ int AlsaSetupSound()
int err; int err;
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
if(err < 0) { if(err < 0)
printf("Audio open error: %s\n", snd_strerror(err)); {
ERROR_LOG("Audio open error: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_nonblock(handle, 0); err = snd_pcm_nonblock(handle, 0);
if(err < 0) { if(err < 0)
printf("Can't set blocking moded: %s\n", snd_strerror(err)); {
ERROR_LOG("Can't set blocking mode: %s\n", snd_strerror(err));
return -1; return -1;
} }
@ -57,56 +59,64 @@ int AlsaSetupSound()
snd_pcm_sw_params_alloca(&swparams); snd_pcm_sw_params_alloca(&swparams);
err = snd_pcm_hw_params_any(handle, hwparams); err = snd_pcm_hw_params_any(handle, hwparams);
if (err < 0) { if (err < 0)
printf("Broken configuration for this PCM: %s\n", snd_strerror(err)); {
ERROR_LOG("Broken configuration for this PCM: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) { if (err < 0)
printf("Access type not available: %s\n", snd_strerror(err)); {
ERROR_LOG("Access type not available: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_format(handle, hwparams, format); err = snd_pcm_hw_params_set_format(handle, hwparams, format);
if (err < 0) { if (err < 0)
printf("Sample format not available: %s\n", snd_strerror(err)); {
ERROR_LOG("Sample format not available: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_channels(handle, hwparams, pchannels); err = snd_pcm_hw_params_set_channels(handle, hwparams, pchannels);
if (err < 0) { if (err < 0)
printf("Channels count not available: %s\n", snd_strerror(err)); {
ERROR_LOG("Channels count not available: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0); err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0);
if (err < 0) { if (err < 0)
printf("Rate not available: %s\n", snd_strerror(err)); {
ERROR_LOG("Rate not available: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0); err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0);
if(err < 0) { if(err < 0) {
printf("Buffer time error: %s\n", snd_strerror(err)); ERROR_LOG("Buffer time error: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0); err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0);
if (err < 0) { if (err < 0)
printf("Period time error: %s\n", snd_strerror(err)); {
ERROR_LOG("Period time error: %s\n", snd_strerror(err));
return -1; return -1;
} }
err = snd_pcm_hw_params(handle, hwparams); err = snd_pcm_hw_params(handle, hwparams);
if (err < 0) { if (err < 0)
printf("Unable to install hw params: %s\n", snd_strerror(err)); {
ERROR_LOG("Unable to install hw params: %s\n", snd_strerror(err));
return -1; return -1;
} }
snd_pcm_status_alloca(&status); snd_pcm_status_alloca(&status);
err = snd_pcm_status(handle, status); err = snd_pcm_status(handle, status);
if(err < 0) { if(err < 0)
printf("Unable to get status: %s\n", snd_strerror(err)); {
ERROR_LOG("Unable to get status: %s\n", snd_strerror(err));
return -1; return -1;
} }

View File

@ -162,14 +162,16 @@ void CALLBACK SPU2about()
SysMessage("%s %d.%d\ndeveloper: zerofrog", libraryName, SPU2_VERSION, SPU2_BUILD); SysMessage("%s %d.%d\ndeveloper: zerofrog", libraryName, SPU2_VERSION, SPU2_BUILD);
} }
void SaveConfig() { void SaveConfig()
{
FILE *f; FILE *f;
char cfg[255]; char cfg[255];
strcpy(cfg, s_strIniPath.c_str()); strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg,"w"); f = fopen(cfg,"w");
if (f == NULL) { if (f == NULL)
printf("Failed to open %s\n", s_strIniPath.c_str()); {
ERROR_LOG("Failed to open %s\n", s_strIniPath.c_str());
return; return;
} }
fprintf(f, "log = %d\n", conf.Log); fprintf(f, "log = %d\n", conf.Log);
@ -177,7 +179,8 @@ void SaveConfig() {
fclose(f); fclose(f);
} }
void LoadConfig() { void LoadConfig()
{
FILE *f; FILE *f;
char cfg[255]; char cfg[255];
@ -185,8 +188,9 @@ void LoadConfig() {
strcpy(cfg, s_strIniPath.c_str()); strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r"); f = fopen(cfg, "r");
if (f == NULL) { if (f == NULL)
printf("Failed to open %s\n", s_strIniPath.c_str()); {
ERROR_LOG("Failed to open %s\n", s_strIniPath.c_str());
conf.Log = 0; conf.Log = 0;
conf.options = 0; conf.options = 0;
SaveConfig();//save and return SaveConfig();//save and return

View File

@ -42,14 +42,16 @@ int OSSSetupSound()
oss_stereo = pstereo; oss_stereo = pstereo;
oss_audio_fd=open("/dev/dsp",O_WRONLY,0); oss_audio_fd=open("/dev/dsp",O_WRONLY,0);
if (oss_audio_fd == -1) { if (oss_audio_fd == -1)
printf("Sound device not available!\n"); {
ERROR_LOG("Sound device not available!\n");
return -1; return -1;
} }
err= ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0); err= ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0);
if (err == -1) { if (err == -1)
printf("Sound reset failed\n"); {
ERROR_LOG("Sound reset failed\n");
return -1; return -1;
} }
@ -57,27 +59,31 @@ int OSSSetupSound()
fragsize = 10; fragsize = 10;
myfrag = (63 << 16) | fragsize; myfrag = (63 << 16) | fragsize;
err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag); err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag);
if (err == -1) { if (err == -1)
printf("Sound set fragment failed!\n"); {
ERROR_LOG("Sound set fragment failed!\n");
return -1; return -1;
} }
format = AFMT_S16_LE; format = AFMT_S16_LE;
err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format); err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format);
if ((err == -1) || (format!=AFMT_S16_LE)) { if ((err == -1) || (format!=AFMT_S16_LE))
printf("Sound format not supported!\n"); {
ERROR_LOG("Sound format not supported!\n");
return -1; return -1;
} }
err = ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo); err = ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo);
if (err == -1) { if (err == -1)
printf("Stereo mode not supported!\n"); {
ERROR_LOG("Stereo mode not supported!\n");
return -1; return -1;
} }
err = ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed); err = ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed);
if ((err == -1) || (oss_speed!=pspeed) { if ((err == -1) || (oss_speed!=pspeed)
printf("Sound frequency not supported\n"); {
ERROR_LOG("Sound frequency not supported\n");
return -1; return -1;
} }

View File

@ -6,13 +6,17 @@ echo -----------------
echo Building ZeroSPU2 echo Building ZeroSPU2
echo ----------------- echo -----------------
if test "${ZEROSPU2OPTIONS+set}" != set ; then
export ZEROSPU2OPTIONS=""
fi
if [ $# -gt 0 ] && [ $1 = "all" ] if [ $# -gt 0 ] && [ $1 = "all" ]
then then
aclocal aclocal
automake -a automake -a
autoconf autoconf
./configure --prefix=${PCSX2PLUGINS} ./configure ${ZEROSPU2OPTIONS} --prefix=${PCSX2PLUGINS}
make clean make clean
make install make install

View File

@ -31,11 +31,11 @@ CXXFLAGS=
dnl Check for debug build dnl Check for debug build
AC_MSG_CHECKING(debug build) AC_MSG_CHECKING(debug build)
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]), AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]),
debug=$enableval,debug=no) debug=$enableval,debug=no)
if test "x$debug" == xyes if test "x$debug" == xyes
then then
AC_DEFINE(_DEBUG,1,[_DEBUG]) AC_DEFINE(_DEBUG,1,[_DEBUG])
CFLAGS+="-g -fPIC Wall -Wno-unused-value " CFLAGS+="-g -fPIC -Wall -Wno-unused-value "
CPPFLAGS+="-g -fPIC -Wall -Wno-unused-value " CPPFLAGS+="-g -fPIC -Wall -Wno-unused-value "
CXXFLAGS+="-g -fPIC -Wall -Wno-unused-value " CXXFLAGS+="-g -fPIC -Wall -Wno-unused-value "
else else
@ -47,6 +47,17 @@ fi
AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes) AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes)
AC_MSG_RESULT($debug) AC_MSG_RESULT($debug)
dnl Check for dev build
AC_MSG_CHECKING(for development build...)
AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]),
devbuild=$enableval,devbuild=no)
if test "x$devbuild" == xyes
then
AC_DEFINE(ZEROSPU2_DEVBUILD,1,[ZEROSPU2_DEVBUILD])
fi
AC_MSG_RESULT($devbuild)
AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno)
dnl Check for 64bit CPU dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU) AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os" dnl if test "$build_os" == "target_os"
@ -100,4 +111,5 @@ AC_OUTPUT([
echo "Configuration:" echo "Configuration:"
echo " Debug build? $debug" echo " Debug build? $debug"
echo " Dev build? $devbuild"
echo " x86-64 build? $cpu64" echo " x86-64 build? $cpu64"

View File

@ -112,12 +112,12 @@ int ADMASWrite(int core)
if (interrupt & 0x2) if (interrupt & 0x2)
{ {
printf("%d returning for interrupt\n", dma); WARN_LOG("%d returning for interrupt\n", dma);
return 0; return 0;
} }
if (Adma->AmountLeft <= 0) if (Adma->AmountLeft <= 0)
{ {
printf("%d amount left is 0\n", dma); WARN_LOG("%d amount left is 0\n", dma);
return 1; return 1;
} }
@ -133,14 +133,14 @@ int ADMASWrite(int core)
if ((spu2Ru16(REG_C0_CTRL + offset) & 0x40) && ((spuaddr + 0x2400) <= C_IRQA(core) && (spuaddr + 0x2400 + 256) >= C_IRQA(core))) if ((spu2Ru16(REG_C0_CTRL + offset) & 0x40) && ((spuaddr + 0x2400) <= C_IRQA(core) && (spuaddr + 0x2400 + 256) >= C_IRQA(core)))
{ {
IRQINFO |= (4 * (core + 1)); IRQINFO |= (4 * (core + 1));
printf("ADMA %d Mem access:interrupt\n", dma); WARN_LOG("ADMA %d Mem access:interrupt\n", dma);
irqCallbackSPU2(); irqCallbackSPU2();
} }
if ((spu2Ru16(REG_C0_CTRL + offset) & 0x40) && ((spuaddr + 0x2600) <= C_IRQA(core) && (spuaddr + 0x2600 + 256) >= C_IRQA(core))) if ((spu2Ru16(REG_C0_CTRL + offset) & 0x40) && ((spuaddr + 0x2600) <= C_IRQA(core) && (spuaddr + 0x2600 + 256) >= C_IRQA(core)))
{ {
IRQINFO |= (4 * (core + 1)); IRQINFO |= (4 * (core + 1));
printf("ADMA %d Mem access:interrupt\n", dma); WARN_LOG("ADMA %d Mem access:interrupt\n", dma);
irqCallbackSPU2(); irqCallbackSPU2();
} }
@ -199,7 +199,7 @@ void CALLBACK SPU2writeDMAMem(u16* pMem, int size, int core)
return; return;
} }
#ifdef _DEBUG #ifdef ZEROSPU2_DEVBUILD
if ((conf.Log && conf.options & OPTION_RECORDING) && (core == 1)) if ((conf.Log && conf.options & OPTION_RECORDING) && (core == 1))
LogPacketSound(pMem, 0x8000); LogPacketSound(pMem, 0x8000);
#endif #endif

View File

@ -128,6 +128,8 @@ static void InitLibraryName()
strcpy( libraryName, "ZeroSPU2" strcpy( libraryName, "ZeroSPU2"
# ifdef _DEBUG # ifdef _DEBUG
"-Debug" "-Debug"
# elseif ZEROSPU2_DEVBUILD
"-Dev"
# endif # endif
); );
#else #else
@ -138,7 +140,7 @@ static void InitLibraryName()
sprintf_s( libraryName, "ZeroSPU2 r%d%s" sprintf_s( libraryName, "ZeroSPU2 r%d%s"
# ifdef _DEBUG # ifdef _DEBUG
"-Debug" "-Debug"
# else # elif ZEROSPU2_DEVBUILD
"-Dev" "-Dev"
# endif # endif
,SVN_REV, ,SVN_REV,
@ -151,6 +153,8 @@ static void InitLibraryName()
strcpy( libraryName, "ZeroSPU2 Playground" strcpy( libraryName, "ZeroSPU2 Playground"
# ifdef _DEBUG # ifdef _DEBUG
"-Debug" "-Debug"
# elif ZEROSPU2_DEVBUILD
"-Dev"
# endif # endif
); );
# endif # endif
@ -184,6 +188,20 @@ void __Log(char *fmt, ...)
va_end(list); va_end(list);
} }
void __LogToConsole(const char *fmt, ...)
{
va_list list;
va_start(list, fmt);
if (!conf.Log || spu2Log == NULL)
vfprintf(spu2Log, fmt, list);
printf("ZeroSPU2: ");
vprintf(fmt, list);
va_end(list);
}
s32 CALLBACK SPU2init() s32 CALLBACK SPU2init()
{ {
LOG_CALLBACK("SPU2init()\n"); LOG_CALLBACK("SPU2init()\n");
@ -559,7 +577,7 @@ void MixChannels(int core)
if (interrupt & (0x2 * (core + 1))) if (interrupt & (0x2 * (core + 1)))
{ {
interrupt &= ~(0x2 * (core + 1)); interrupt &= ~(0x2 * (core + 1));
printf("Stopping double interrupt DMA7\n"); WARN_LOG("Stopping double interrupt DMA7\n");
} }
if (core == 0) if (core == 0)
irqCallbackDMA4(); irqCallbackDMA4();
@ -767,7 +785,7 @@ ENDX:
static int lastrectime = 0; static int lastrectime = 0;
if (timeGetTime() - lastrectime > 5000) if (timeGetTime() - lastrectime > 5000)
{ {
printf("ZeroSPU2: recording\n"); WARN_LOG("ZeroSPU2: recording\n");
lastrectime = timeGetTime(); lastrectime = timeGetTime();
} }
LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES); LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES);
@ -781,7 +799,7 @@ ENDX:
} }
else { else {
// submit to final mixer // submit to final mixer
#ifdef _DEBUG #ifdef ZEROSPU2_DEVBUILD
if ( g_logsound ) if ( g_logsound )
LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES); LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES);
#endif #endif
@ -893,7 +911,7 @@ void* SPU2ThreadProc(void* lpParam)
// check the current timestamp, if too far apart, speed up audio // check the current timestamp, if too far apart, speed up audio
else if ( bytesbuf > 40000 ) else if ( bytesbuf > 40000 )
{ {
//printf("making faster %d\n", timeGetTime() - s_pAudioBuffers[nReadBuf].timestamp); //WARN_LOG("making faster %d\n", timeGetTime() - s_pAudioBuffers[nReadBuf].timestamp);
NewSamples -= (bytesbuf-40000)/10;//*(ps2delay-NewSamples*8/1000); NewSamples -= (bytesbuf-40000)/10;//*(ps2delay-NewSamples*8/1000);
} }
@ -1428,12 +1446,12 @@ int CALLBACK SPU2setupRecording(int start, void* pData)
if ( start ) if ( start )
{ {
conf.options |= OPTION_RECORDING; conf.options |= OPTION_RECORDING;
printf("ZeroSPU2: started recording at %s\n", RECORD_FILENAME); WARN_LOG("ZeroSPU2: started recording at %s\n", RECORD_FILENAME);
} }
else else
{ {
conf.options &= ~OPTION_RECORDING; conf.options &= ~OPTION_RECORDING;
printf("ZeroSPU2: stopped recording\n"); WARN_LOG("ZeroSPU2: stopped recording\n");
} }
return 1; return 1;
@ -1451,7 +1469,7 @@ s32 CALLBACK SPU2freeze(int mode, freezeData *data)
spud = (SPU2freezeData*)data->data; spud = (SPU2freezeData*)data->data;
if (spud->version != 0x70000001) if (spud->version != 0x70000001)
{ {
printf("zerospu2: data wrong format\n"); ERROR_LOG("zerospu2: data wrong format\n");
return 0; return 0;
} }

View File

@ -47,12 +47,15 @@ extern FILE *spu2Log;
#define LOG_CALLBACK 0&& #define LOG_CALLBACK 0&&
#endif #endif
#ifdef _DEBUG #ifdef ZEROSPU2_DEVBUILD
#define SPU2_LOG __Log //debug mode #define SPU2_LOG __Log //dev mode
#else #else
#define SPU2_LOG 0&& #define SPU2_LOG 0&&
#endif #endif
#define ERROR_LOG printf
#define WARN_LOG printf
#define SPU2_VERSION PS2E_SPU2_VERSION #define SPU2_VERSION PS2E_SPU2_VERSION
#define SPU2_REVISION 0 #define SPU2_REVISION 0
#define SPU2_BUILD 4 // increase that with each version #define SPU2_BUILD 4 // increase that with each version
@ -108,6 +111,7 @@ typedef struct {
extern Config conf; extern Config conf;
void __Log(char *fmt, ...); void __Log(char *fmt, ...);
void __LogToConsole(const char *fmt, ...);
void SaveConfig(); void SaveConfig();
void LoadConfig(); void LoadConfig();
void SysMessage(char *fmt, ...); void SysMessage(char *fmt, ...);