diff --git a/build.sh b/build.sh index 52444a06b8..0cef5ad602 100644 --- a/build.sh +++ b/build.sh @@ -20,6 +20,9 @@ export ZEROGSOPTIONS="--enable-sse2" #ZeroGS Debug mode #export ZEROGSOPTIONS="--enable-debug --enable-devbuild --enable-sse2" +#ZeroSPU2 Debug mode (Don't enable right now) +#export ZEROSPU2OPTIONS="--enable-debug --enable-devbuild" + option=$@ export PCSX2PLUGINS="`pwd`/bin/plugins" curdir=`pwd` diff --git a/plugins/zerogs/opengl/GS.h b/plugins/zerogs/opengl/GS.h index 61565d2804..900920505b 100644 --- a/plugins/zerogs/opengl/GS.h +++ b/plugins/zerogs/opengl/GS.h @@ -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 #define GS_LOG __Log @@ -159,7 +153,7 @@ struct Vector_16F #define ERROR_LOG __LogToConsole #define DEBUG_LOG printf -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #define WARN_LOG 0&& #define PRIM_LOG 0&& #else diff --git a/plugins/zerogs/opengl/GSmain.cpp b/plugins/zerogs/opengl/GSmain.cpp index 766ff20be3..baf928eda3 100644 --- a/plugins/zerogs/opengl/GSmain.cpp +++ b/plugins/zerogs/opengl/GSmain.cpp @@ -70,7 +70,7 @@ unsigned char zgsminor = 7; #ifdef _DEBUG char *libraryName = "ZeroGS-Pg OpenGL (Debug) "; -#elif defined(RELEASE_TO_PUBLIC) +#elif !defined(ZEROGS_DEVBUILD) char *libraryName = "ZeroGS Playground OpenGL "; #else char *libraryName = "ZeroGS-Pg OpenGL (Dev) "; @@ -86,7 +86,7 @@ extern int g_nPixelShaderVer; extern int g_nFrameRender; extern int g_nFramesSkipped; -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #define g_bWriteProfile 0 #else BOOL g_bWriteProfile = 0; @@ -767,7 +767,7 @@ void CALLBACK GSvsync(int interlace) dwTime = d; g_nFrame += UPDATE_FRAMES; -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD 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, @@ -818,7 +818,7 @@ void CALLBACK GSvsync(int interlace) g_nFramesSkipped = 0; } -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD if( g_bWriteProfile ) { //g_bWriteProfile = 0; DVProfWrite("prof.txt", UPDATE_FRAMES); diff --git a/plugins/zerogs/opengl/Linux/Makefile.am b/plugins/zerogs/opengl/Linux/Makefile.am index b95d86a02a..aa98f152c5 100644 --- a/plugins/zerogs/opengl/Linux/Makefile.am +++ b/plugins/zerogs/opengl/Linux/Makefile.am @@ -1,6 +1,10 @@ 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 diff --git a/plugins/zerogs/opengl/Regs.cpp b/plugins/zerogs/opengl/Regs.cpp index 09e9aa9221..041fc1a040 100644 --- a/plugins/zerogs/opengl/Regs.cpp +++ b/plugins/zerogs/opengl/Regs.cpp @@ -937,7 +937,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) } } else { -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD WARN_LOG("ZeroGS: dummy transfer\n"); #endif gs.imageTransfer = -1; @@ -951,7 +951,7 @@ void __fastcall GIFRegHandlerHWREG(u32* data) ZeroGS::TransferHostLocal(data, 2); } else { -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD ERROR_LOG("ZeroGS: HWREG!? %8.8x_%8.8x\n", data[0], data[1]); //assert(0); #endif diff --git a/plugins/zerogs/opengl/configure b/plugins/zerogs/opengl/configure index 8275f70213..ac6d6c88d4 100644 --- a/plugins/zerogs/opengl/configure +++ b/plugins/zerogs/opengl/configure @@ -4419,7 +4419,7 @@ _ACEOF CFLAGS+="-O3 -fomit-frame-pointer " CPPFLAGS+="-O3 -fomit-frame-pointer " - CXXFLAGS+="-O3 -fomit-frame-pointer " + CXXFLAGS+="-O3 -fomit-frame-pointer -fpermissive " fi { $as_echo "$as_me:$LINENO: result: $debug" >&5 $as_echo "$debug" >&6; } @@ -4540,11 +4540,11 @@ else devbuild=no fi -if test "x$devbuild" == xno +if test "x$devbuild" == xyes then cat >>confdefs.h <<\_ACEOF -#define RELEASE_TO_PUBLIC 1 +#define ZEROGS_DEVBUILD 1 _ACEOF fi diff --git a/plugins/zerogs/opengl/configure.ac b/plugins/zerogs/opengl/configure.ac index e249793a80..ac5e3a0cd7 100644 --- a/plugins/zerogs/opengl/configure.ac +++ b/plugins/zerogs/opengl/configure.ac @@ -43,7 +43,7 @@ else AC_DEFINE(NDEBUG,1,[NDEBUG]) CFLAGS+="-O3 -fomit-frame-pointer " CPPFLAGS+="-O3 -fomit-frame-pointer " - CXXFLAGS+="-O3 -fomit-frame-pointer " + CXXFLAGS+="-O3 -fomit-frame-pointer -fpermissive " fi AC_MSG_RESULT($debug) @@ -53,9 +53,9 @@ 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" == xno +if test "x$devbuild" == xyes then - AC_DEFINE(RELEASE_TO_PUBLIC,1,[RELEASE_TO_PUBLIC]) + AC_DEFINE(ZEROGS_DEVBUILD,1,[ZEROGS_DEVBUILD]) fi AC_MSG_RESULT($devbuild) AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno) diff --git a/plugins/zerogs/opengl/targets.cpp b/plugins/zerogs/opengl/targets.cpp index a73976eb5c..22284475a3 100644 --- a/plugins/zerogs/opengl/targets.cpp +++ b/plugins/zerogs/opengl/targets.cpp @@ -42,7 +42,7 @@ extern BOOL g_bIsLost; extern BOOL g_bUpdateStencil; extern u32 s_uFramebuffer; -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #define INC_RESOLVE() #else #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); GL_REPORT_ERRORD(); -#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) +#if defined(ZEROGS_DEVBUILD) && defined(_DEBUG) if( g_bSaveResolved ) { SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, fbw<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); #endif it->second->psm = frame.psm; @@ -1847,7 +1847,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->ptex->ref = 1; } -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD g_TransferredToGPU += GPU_TEXWIDTH * channels * 4 * targ->height; #endif @@ -2518,7 +2518,7 @@ void InitTransferHostLocal() if( g_bIsLost ) return; -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD if( gs.trxpos.dx+gs.imageWnew > gs.dstbuf.bw ) WARN_LOG("Transfer error, width exceeds\n"); #endif @@ -2649,7 +2649,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize) } else s_vTransferCache.resize(0); -#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) +#if defined(ZEROGS_DEVBUILD) && defined(_DEBUG) if( g_bSaveTrans ) { tex0Info t; t.tbp0 = gs.dstbuf.bp; @@ -2789,7 +2789,7 @@ void InitTransferLocalHost() { 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 ) WARN_LOG("Transfer error, width exceeds\n"); #endif @@ -3082,7 +3082,7 @@ void TransferLocalLocal() g_MemTargs.ClearRange(dststart, dstend); -#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) +#if defined(ZEROGS_DEVBUILD) && defined(_DEBUG) if( g_bSaveTrans ) { tex0Info t; t.tbp0 = gs.dstbuf.bp; diff --git a/plugins/zerogs/opengl/zerogs.cpp b/plugins/zerogs/opengl/zerogs.cpp index 48a2257545..3e2725f6af 100644 --- a/plugins/zerogs/opengl/zerogs.cpp +++ b/plugins/zerogs/opengl/zerogs.cpp @@ -79,7 +79,7 @@ BOOL g_bIsLost = 0; int g_nFrameRender = 10; int g_nFramesSkipped = 0; -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #define INC_GENVARS() #define INC_TEXVARS() @@ -1307,7 +1307,7 @@ bool ZeroGS::Create(int _width, int _height) GPU_TEXWIDTH = g_MaxTexWidth/8; g_fiGPU_TEXWIDTH = 1.0f / GPU_TEXWIDTH; -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #ifdef _WIN32 HRSRC hShaderSrc = FindResource(hInst, MAKEINTRESOURCE(IDR_SHADERS), RT_RCDATA); assert( hShaderSrc != NULL ); @@ -1359,7 +1359,7 @@ bool ZeroGS::Create(int _width, int _height) sprintf(EFFECT_NAME, "%sps2hw.fx", EFFECT_DIR); #endif -#endif // RELEASE_TO_PUBLIC +#endif // ZEROGS_DEVBUILD // load the effect, find the best profiles (if any) 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)); } -#ifdef RELEASE_TO_PUBLIC +#ifndef ZEROGS_DEVBUILD #define LOAD_VS(Index, prog) { \ assert( mapShaderResources.find(Index) != mapShaderResources.end() ); \ @@ -2300,7 +2300,7 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te return NULL; } -#else // not RELEASE_TO_PUBLIC +#else // ZEROGS_DEVBUILD #define LOAD_VS(name, prog, shaderver) { \ 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; } -#endif // RELEASE_TO_PUBLIC +#endif // ZEROGS_DEVBUILD void ZeroGS::Prim() { @@ -2540,7 +2540,7 @@ int GetTexFilter(const tex1Info& tex1) void ZeroGS::ReloadEffects() { -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD for(int i = 0; i < ARRAY_SIZE(ppsTexture); ++i) { SAFE_RELEASE_PROG(ppsTexture[i].prog); } @@ -2555,7 +2555,7 @@ void ZeroGS::Flush(int context) GL_REPORT_ERRORD(); assert( context >= 0 && context <= 1 ); -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD if( g_bUpdateEffect ) { ReloadEffects(); 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); } -//#ifndef RELEASE_TO_PUBLIC +//#ifdef ZEROGS_DEVBUILD ppf += curvb.nCount+0x100000; //#endif @@ -3537,7 +3537,7 @@ void ZeroGS::RenderCRTC(int interlace) if( g_bIsLost ) return; // Crashes Final Fantasy X at startup if uncommented. --arcum42 -//#ifdef RELEASE_TO_PUBLIC +//#ifndef ZEROGS_DEVBUILD // if(g_nRealFrame < 80 ) { // RenderCustom( min(1.0f, 2.0f - (float)g_nRealFrame / 40.0f) ); // @@ -5425,7 +5425,7 @@ Return: "jmp Start\n" "Return:\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 // do a fast test with MMX __asm__( @@ -5478,7 +5478,7 @@ Return: "jmp Start\n" "Return:\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 // _WIN32 @@ -5577,7 +5577,7 @@ void ZeroGS::texClutWrite(int ctx) default: { -#ifndef RELEASE_TO_PUBLIC +#ifdef ZEROGS_DEVBUILD //DEBUG_LOG("unknown cpsm: %x (%x)\n", tex0.cpsm, tex0.psm); #endif break; diff --git a/plugins/zerospu2/Linux/Alsa.cpp b/plugins/zerospu2/Linux/Alsa.cpp index c2d2321eed..8a72e98840 100644 --- a/plugins/zerospu2/Linux/Alsa.cpp +++ b/plugins/zerospu2/Linux/Alsa.cpp @@ -42,14 +42,16 @@ int AlsaSetupSound() int err; err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); - if(err < 0) { - printf("Audio open error: %s\n", snd_strerror(err)); + if(err < 0) + { + ERROR_LOG("Audio open error: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_nonblock(handle, 0); - if(err < 0) { - printf("Can't set blocking moded: %s\n", snd_strerror(err)); + if(err < 0) + { + ERROR_LOG("Can't set blocking mode: %s\n", snd_strerror(err)); return -1; } @@ -57,56 +59,64 @@ int AlsaSetupSound() snd_pcm_sw_params_alloca(&swparams); err = snd_pcm_hw_params_any(handle, hwparams); - if (err < 0) { - printf("Broken configuration for this PCM: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Broken configuration for this PCM: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); - if (err < 0) { - printf("Access type not available: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Access type not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_format(handle, hwparams, format); - if (err < 0) { - printf("Sample format not available: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Sample format not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_channels(handle, hwparams, pchannels); - if (err < 0) { - printf("Channels count not available: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Channels count not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0); - if (err < 0) { - printf("Rate not available: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Rate not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 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; } err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0); - if (err < 0) { - printf("Period time error: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Period time error: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params(handle, hwparams); - if (err < 0) { - printf("Unable to install hw params: %s\n", snd_strerror(err)); + if (err < 0) + { + ERROR_LOG("Unable to install hw params: %s\n", snd_strerror(err)); return -1; } snd_pcm_status_alloca(&status); err = snd_pcm_status(handle, status); - if(err < 0) { - printf("Unable to get status: %s\n", snd_strerror(err)); + if(err < 0) + { + ERROR_LOG("Unable to get status: %s\n", snd_strerror(err)); return -1; } diff --git a/plugins/zerospu2/Linux/Linux.cpp b/plugins/zerospu2/Linux/Linux.cpp index 51a44e04ac..2537c88d99 100644 --- a/plugins/zerospu2/Linux/Linux.cpp +++ b/plugins/zerospu2/Linux/Linux.cpp @@ -162,14 +162,16 @@ void CALLBACK SPU2about() SysMessage("%s %d.%d\ndeveloper: zerofrog", libraryName, SPU2_VERSION, SPU2_BUILD); } -void SaveConfig() { +void SaveConfig() +{ FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg,"w"); - if (f == NULL) { - printf("Failed to open %s\n", s_strIniPath.c_str()); + if (f == NULL) + { + ERROR_LOG("Failed to open %s\n", s_strIniPath.c_str()); return; } fprintf(f, "log = %d\n", conf.Log); @@ -177,7 +179,8 @@ void SaveConfig() { fclose(f); } -void LoadConfig() { +void LoadConfig() +{ FILE *f; char cfg[255]; @@ -185,8 +188,9 @@ void LoadConfig() { strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg, "r"); - if (f == NULL) { - printf("Failed to open %s\n", s_strIniPath.c_str()); + if (f == NULL) + { + ERROR_LOG("Failed to open %s\n", s_strIniPath.c_str()); conf.Log = 0; conf.options = 0; SaveConfig();//save and return diff --git a/plugins/zerospu2/Linux/OSS.cpp b/plugins/zerospu2/Linux/OSS.cpp index 34bcfece8e..aaa369d1a0 100644 --- a/plugins/zerospu2/Linux/OSS.cpp +++ b/plugins/zerospu2/Linux/OSS.cpp @@ -42,14 +42,16 @@ int OSSSetupSound() oss_stereo = pstereo; oss_audio_fd=open("/dev/dsp",O_WRONLY,0); - if (oss_audio_fd == -1) { - printf("Sound device not available!\n"); + if (oss_audio_fd == -1) + { + ERROR_LOG("Sound device not available!\n"); return -1; } err= ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0); - if (err == -1) { - printf("Sound reset failed\n"); + if (err == -1) + { + ERROR_LOG("Sound reset failed\n"); return -1; } @@ -57,27 +59,31 @@ int OSSSetupSound() fragsize = 10; myfrag = (63 << 16) | fragsize; err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag); - if (err == -1) { - printf("Sound set fragment failed!\n"); + if (err == -1) + { + ERROR_LOG("Sound set fragment failed!\n"); return -1; } format = AFMT_S16_LE; err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format); - if ((err == -1) || (format!=AFMT_S16_LE)) { - printf("Sound format not supported!\n"); + if ((err == -1) || (format!=AFMT_S16_LE)) + { + ERROR_LOG("Sound format not supported!\n"); return -1; } err = ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo); - if (err == -1) { - printf("Stereo mode not supported!\n"); + if (err == -1) + { + ERROR_LOG("Stereo mode not supported!\n"); return -1; } err = ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed); - if ((err == -1) || (oss_speed!=pspeed) { - printf("Sound frequency not supported\n"); + if ((err == -1) || (oss_speed!=pspeed) + { + ERROR_LOG("Sound frequency not supported\n"); return -1; } diff --git a/plugins/zerospu2/build.sh b/plugins/zerospu2/build.sh index 39a9ef1384..99777c1287 100644 --- a/plugins/zerospu2/build.sh +++ b/plugins/zerospu2/build.sh @@ -6,13 +6,17 @@ echo ----------------- echo Building ZeroSPU2 echo ----------------- +if test "${ZEROSPU2OPTIONS+set}" != set ; then +export ZEROSPU2OPTIONS="" +fi + if [ $# -gt 0 ] && [ $1 = "all" ] then aclocal automake -a autoconf -./configure --prefix=${PCSX2PLUGINS} +./configure ${ZEROSPU2OPTIONS} --prefix=${PCSX2PLUGINS} make clean make install diff --git a/plugins/zerospu2/configure.ac b/plugins/zerospu2/configure.ac index 057d76a261..a5d0134e16 100644 --- a/plugins/zerospu2/configure.ac +++ b/plugins/zerospu2/configure.ac @@ -31,11 +31,11 @@ CXXFLAGS= dnl Check for debug build AC_MSG_CHECKING(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 then 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 " CXXFLAGS+="-g -fPIC -Wall -Wno-unused-value " else @@ -47,6 +47,17 @@ fi AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes) 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 AC_MSG_CHECKING(for a x86-64 CPU) dnl if test "$build_os" == "target_os" @@ -100,4 +111,5 @@ AC_OUTPUT([ echo "Configuration:" echo " Debug build? $debug" +echo " Dev build? $devbuild" echo " x86-64 build? $cpu64" \ No newline at end of file diff --git a/plugins/zerospu2/zerodma.cpp b/plugins/zerospu2/zerodma.cpp index 9578e68520..85cc6a4a2c 100644 --- a/plugins/zerospu2/zerodma.cpp +++ b/plugins/zerospu2/zerodma.cpp @@ -112,12 +112,12 @@ int ADMASWrite(int core) if (interrupt & 0x2) { - printf("%d returning for interrupt\n", dma); + WARN_LOG("%d returning for interrupt\n", dma); return 0; } if (Adma->AmountLeft <= 0) { - printf("%d amount left is 0\n", dma); + WARN_LOG("%d amount left is 0\n", dma); 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))) { IRQINFO |= (4 * (core + 1)); - printf("ADMA %d Mem access:interrupt\n", dma); + WARN_LOG("ADMA %d Mem access:interrupt\n", dma); irqCallbackSPU2(); } if ((spu2Ru16(REG_C0_CTRL + offset) & 0x40) && ((spuaddr + 0x2600) <= C_IRQA(core) && (spuaddr + 0x2600 + 256) >= C_IRQA(core))) { IRQINFO |= (4 * (core + 1)); - printf("ADMA %d Mem access:interrupt\n", dma); + WARN_LOG("ADMA %d Mem access:interrupt\n", dma); irqCallbackSPU2(); } @@ -199,7 +199,7 @@ void CALLBACK SPU2writeDMAMem(u16* pMem, int size, int core) return; } -#ifdef _DEBUG +#ifdef ZEROSPU2_DEVBUILD if ((conf.Log && conf.options & OPTION_RECORDING) && (core == 1)) LogPacketSound(pMem, 0x8000); #endif diff --git a/plugins/zerospu2/zerospu2.cpp b/plugins/zerospu2/zerospu2.cpp index 4fe4e5e817..e5ffdbe292 100644 --- a/plugins/zerospu2/zerospu2.cpp +++ b/plugins/zerospu2/zerospu2.cpp @@ -128,6 +128,8 @@ static void InitLibraryName() strcpy( libraryName, "ZeroSPU2" # ifdef _DEBUG "-Debug" +# elseif ZEROSPU2_DEVBUILD + "-Dev" # endif ); #else @@ -138,7 +140,7 @@ static void InitLibraryName() sprintf_s( libraryName, "ZeroSPU2 r%d%s" # ifdef _DEBUG "-Debug" -# else +# elif ZEROSPU2_DEVBUILD "-Dev" # endif ,SVN_REV, @@ -151,6 +153,8 @@ static void InitLibraryName() strcpy( libraryName, "ZeroSPU2 Playground" # ifdef _DEBUG "-Debug" +# elif ZEROSPU2_DEVBUILD + "-Dev" # endif ); # endif @@ -184,6 +188,20 @@ void __Log(char *fmt, ...) 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() { LOG_CALLBACK("SPU2init()\n"); @@ -559,7 +577,7 @@ void MixChannels(int core) if (interrupt & (0x2 * (core + 1))) { interrupt &= ~(0x2 * (core + 1)); - printf("Stopping double interrupt DMA7\n"); + WARN_LOG("Stopping double interrupt DMA7\n"); } if (core == 0) irqCallbackDMA4(); @@ -767,7 +785,7 @@ ENDX: static int lastrectime = 0; if (timeGetTime() - lastrectime > 5000) { - printf("ZeroSPU2: recording\n"); + WARN_LOG("ZeroSPU2: recording\n"); lastrectime = timeGetTime(); } LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES); @@ -781,7 +799,7 @@ ENDX: } else { // submit to final mixer -#ifdef _DEBUG +#ifdef ZEROSPU2_DEVBUILD if ( g_logsound ) LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES); #endif @@ -893,7 +911,7 @@ void* SPU2ThreadProc(void* lpParam) // check the current timestamp, if too far apart, speed up audio 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); } @@ -1428,12 +1446,12 @@ int CALLBACK SPU2setupRecording(int start, void* pData) if ( start ) { conf.options |= OPTION_RECORDING; - printf("ZeroSPU2: started recording at %s\n", RECORD_FILENAME); + WARN_LOG("ZeroSPU2: started recording at %s\n", RECORD_FILENAME); } else { conf.options &= ~OPTION_RECORDING; - printf("ZeroSPU2: stopped recording\n"); + WARN_LOG("ZeroSPU2: stopped recording\n"); } return 1; @@ -1451,7 +1469,7 @@ s32 CALLBACK SPU2freeze(int mode, freezeData *data) spud = (SPU2freezeData*)data->data; if (spud->version != 0x70000001) { - printf("zerospu2: data wrong format\n"); + ERROR_LOG("zerospu2: data wrong format\n"); return 0; } diff --git a/plugins/zerospu2/zerospu2.h b/plugins/zerospu2/zerospu2.h index 087a416630..d97b9e112c 100644 --- a/plugins/zerospu2/zerospu2.h +++ b/plugins/zerospu2/zerospu2.h @@ -47,12 +47,15 @@ extern FILE *spu2Log; #define LOG_CALLBACK 0&& #endif -#ifdef _DEBUG -#define SPU2_LOG __Log //debug mode +#ifdef ZEROSPU2_DEVBUILD +#define SPU2_LOG __Log //dev mode #else #define SPU2_LOG 0&& #endif +#define ERROR_LOG printf +#define WARN_LOG printf + #define SPU2_VERSION PS2E_SPU2_VERSION #define SPU2_REVISION 0 #define SPU2_BUILD 4 // increase that with each version @@ -108,6 +111,7 @@ typedef struct { extern Config conf; void __Log(char *fmt, ...); +void __LogToConsole(const char *fmt, ...); void SaveConfig(); void LoadConfig(); void SysMessage(char *fmt, ...);