From 85657682dad1740b52460419341a5061a4a51d78 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Mon, 21 Jun 2010 12:03:14 +0000 Subject: [PATCH] zzogl-pg: Printing to the console now works. Fixed AA+/-. Misc. pcsx2: Took care of two non-POD safe objects. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3259 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/Dialogs/ImportSettingsDialog.cpp | 2 +- plugins/spu2-x/src/PS2E-spu2.cpp | 9 +++ plugins/zzogl-pg/opengl/GSmain.cpp | 84 +++++++++++++--------- plugins/zzogl-pg/opengl/GifTransfer.cpp | 2 +- plugins/zzogl-pg/opengl/Regs.cpp | 5 +- plugins/zzogl-pg/opengl/Util.h | 5 +- plugins/zzogl-pg/opengl/ZZoglCRTC.cpp | 2 +- plugins/zzogl-pg/opengl/ZZoglCreate.cpp | 12 ++-- plugins/zzogl-pg/opengl/ZZoglFlush.cpp | 14 ++-- plugins/zzogl-pg/opengl/ZZoglVB.cpp | 2 +- plugins/zzogl-pg/opengl/targets.cpp | 6 +- plugins/zzogl-pg/opengl/x86.cpp | 9 ++- plugins/zzogl-pg/opengl/zerogs.cpp | 11 ++- 13 files changed, 98 insertions(+), 65 deletions(-) diff --git a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp index ba9d06495f..bda14a45ad 100644 --- a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp +++ b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp @@ -30,7 +30,7 @@ Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) L"Existing %s settings have been found in the configured settings folder. " L"Would you like to import these settings or overwrite them with %s default values?" L"\n\n(or press Cancel to select a different settings folder)" - ), pxGetAppName(), pxGetAppName() + ), pxGetAppName().c_str(), pxGetAppName().c_str() ))); wxBoxSizer& s_buttons = *new wxBoxSizer( wxHORIZONTAL ); diff --git a/plugins/spu2-x/src/PS2E-spu2.cpp b/plugins/spu2-x/src/PS2E-spu2.cpp index c1b59a901a..07f37b7704 100644 --- a/plugins/spu2-x/src/PS2E-spu2.cpp +++ b/plugins/spu2-x/src/PS2E-spu2.cpp @@ -459,6 +459,7 @@ EXPORT_C_(void) SPU2close() #ifndef __LINUX__ DspCloseLibrary(); #endif + spdif_shutdown(); SndBuffer::Cleanup(); } @@ -477,6 +478,7 @@ EXPORT_C_(void) SPU2shutdown() s2r_close(); #endif + FileLog("DoFullDump();\n"); DoFullDump(); #ifdef STREAM_DUMP fclose(il0); @@ -486,14 +488,21 @@ EXPORT_C_(void) SPU2shutdown() fclose(el0); fclose(el1); #endif + FileLog("WaveDump::Close();\n"); WaveDump::Close(); + FileLog("DMALogClose();\n"); DMALogClose(); + FileLog("safe_free(spu2regs);\n"); safe_free(spu2regs); + FileLog("safe_free(_spu2mem);\n"); safe_free(_spu2mem); + FileLog("safe_free( pcm_cache_data );\n"); safe_free( pcm_cache_data ); + + FileLog("Closing log.\n"); #ifdef SPU2_LOG if(!AccessLog()) return; FileLog("[%10d] SPU2shutdown\n",Cycles); diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index 055faca129..262a43da94 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -156,12 +156,12 @@ void _Log(const char *str) void _WriteToConsole(const char *str) { - printf("ZZogl-PG: %s", str); + fprintf(stderr,"ZZogl-PG: %s", str); } void _Print(const char *str) { - printf("ZZogl-PG: %s", str); + fprintf(stderr,"ZZogl-PG: %s", str); if (IsLogging()) fprintf(gsLog, str); } @@ -195,8 +195,8 @@ void WriteToConsole(const char *fmt, ...) va_start(list, fmt); - printf("ZZogl-PG: "); - vprintf(fmt, list); + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); va_end(list); } @@ -207,14 +207,28 @@ void Print(const char *fmt, ...) va_start(list, fmt); if (IsLogging()) vfprintf(gsLog, fmt, list); - - printf("ZZogl-PG: "); - - vprintf(fmt, list); + + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); va_end(list); } + +void WriteLn(const char *fmt, ...) +{ + va_list list; + + va_start(list, fmt); + + if (IsLogging()) vfprintf(gsLog, fmt, list); + + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); + va_end(list); + fprintf(stderr,"\n"); +} + void Greg_Log(const char *fmt, ...) { // Not currently used @@ -243,12 +257,14 @@ void Prim_Log(const char *fmt, ...) { if (IsLogging()) vfprintf(gsLog, fmt, list); - printf("ZZogl-PG(PRIM): "); + fprintf(stderr, "ZZogl-PG(PRIM): "); + vfprintf(stderr, fmt, list); vprintf(fmt, list); } va_end(list); + fprintf(stderr,"\n"); #endif } @@ -265,11 +281,11 @@ void GS_Log(const char *fmt, ...) vfprintf(gsLog, fmt, list); fprintf(gsLog, "\n"); } - - printf("ZZogl-PG(GS): "); - - vprintf(fmt, list); - printf("\n"); + + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); + fprintf(stderr, "\n"); + va_end(list); #endif } @@ -287,11 +303,11 @@ void Warn_Log(const char *fmt, ...) fprintf(gsLog, "\n"); } - printf("ZZogl-PG(Warning): "); - - vprintf(fmt, list); + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); + fprintf(stderr, "\n"); + va_end(list); - printf("\n"); #endif } @@ -308,13 +324,11 @@ void Debug_Log(const char *fmt, ...) fprintf(gsLog, "\n"); } - printf("ZZogl-PG(Debug): "); - - vprintf(fmt, list); - printf("\n"); + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); + fprintf(stderr, "\n"); + va_end(list); - - #endif } @@ -330,10 +344,10 @@ void Error_Log(const char *fmt, ...) fprintf(gsLog, "\n"); } - printf("ZZogl-PG(Error): "); - - vprintf(fmt, list); - printf("\n"); + fprintf(stderr, "ZZogl-PG: "); + vfprintf(stderr, fmt, list); + fprintf(stderr, "\n"); + va_end(list); } }; @@ -488,10 +502,10 @@ s32 CALLBACK GSinit() if (ZZLog::OpenLog() == false) return -1; - ZZLog::GS_Log("Calling GSinit."); + ZZLog::WriteLn("Calling GSinit."); GSreset(); - ZZLog::GS_Log("GSinit finished."); + ZZLog::WriteLn("GSinit finished."); return 0; } @@ -707,7 +721,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) g_GSMultiThreaded = multithread; - ZZLog::GS_Log("Calling GSopen."); + ZZLog::WriteLn("Calling GSopen."); #ifdef _WIN32 #ifdef _DEBUG @@ -721,16 +735,16 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) err = GLWin.CreateWindow(pDsp); if (!err) { - ZZLog::GS_Log("Failed to create window. Exiting..."); + ZZLog::Error_Log("Failed to create window. Exiting..."); return -1; } - ZZLog::Error_Log("Using %s:%d.%d.%d.", libraryName, zgsrevision, zgsbuild, zgsminor); - ZZLog::Error_Log("Creating ZZOgl window."); + ZZLog::GS_Log("Using %s:%d.%d.%d.", libraryName, zgsrevision, zgsbuild, zgsminor); + ZZLog::WriteLn("Creating ZZOgl window."); if (!ZeroGS::Create(conf.width, conf.height)) return -1; - ZZLog::Error_Log("Initialization successful."); + ZZLog::WriteLn("Initialization successful."); switch (conf.bilinear) { diff --git a/plugins/zzogl-pg/opengl/GifTransfer.cpp b/plugins/zzogl-pg/opengl/GifTransfer.cpp index 4105ee7e3a..052bde33c4 100644 --- a/plugins/zzogl-pg/opengl/GifTransfer.cpp +++ b/plugins/zzogl-pg/opengl/GifTransfer.cpp @@ -506,7 +506,7 @@ void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr) { assert((addr&0xf) == 0); //BUG path->nloop = 0; - ZZLog::Error_Log("Transfer1 - 2."); + ZZLog::Debug_Log("Transfer1 - 2."); return; } } diff --git a/plugins/zzogl-pg/opengl/Regs.cpp b/plugins/zzogl-pg/opengl/Regs.cpp index 99db0f7d30..903fa33960 100644 --- a/plugins/zzogl-pg/opengl/Regs.cpp +++ b/plugins/zzogl-pg/opengl/Regs.cpp @@ -374,7 +374,10 @@ __forceinline void testWrite(int i, u32 *data) // test.ztst = (data[0] >> 17) & 0x3; } -__forceinline void clampWrite(int i, u32 *data) +#ifndef __LINUX__ +__forceinline +#endif +void clampWrite(int i, u32 *data) { FUNCLOG clampInfo& clamp = ZeroGS::vb[i].clamp; diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index b0b1828eca..dc071f39ca 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -209,8 +209,8 @@ typedef struct bool isWideScreen; // Widescreen support u32 log; - void incAA() { aa++; if (aa > 4) aa = 4; } - void decAA() { aa--; if (aa > 4) aa = 0; } // u8 is unsigned, so negative value is 255. + void incAA() { aa++; if (aa > 4) aa = 0; } + void decAA() { aa--; if (aa > 4) aa = 4; } // u8 is unsigned, so negative value is 255. gameHacks settings() { @@ -388,6 +388,7 @@ extern void Message(const char *fmt, ...); extern void Log(const char *fmt, ...); extern void WriteToConsole(const char *fmt, ...); extern void Print(const char *fmt, ...); +extern void WriteLn(const char *fmt, ...); extern void Greg_Log(const char *fmt, ...); extern void Prim_Log(const char *fmt, ...); diff --git a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp index 5a2fe5d745..30bbb038b8 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp @@ -435,7 +435,7 @@ inline void RenderUpdateStencil(int i, bool* bUsingStencil) // CRTC24 could not be rendered inline void RenderCRTC24helper(u32 bInterlace, int interlace, int psm) { - ZZLog::Error_Log("ZZogl: CRTC24!!! I'm trying to show something."); + ZZLog::Debug_Log("ZZogl: CRTC24!!! I'm trying to show something."); SetShaderCaller("RenderCRTC24helper"); // assume that data is already in ptexMem (do Resolve?) RenderGetForClip(bInterlace, interlace, psm, &ppsCRTC24[bInterlace]); diff --git a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp index 19ebc0cd32..8ab4b17dc8 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp @@ -653,7 +653,7 @@ bool ZeroGS::Create(int _width, int _height) return false; } - ZZLog::Error_Log("Using non-bilinear fill."); + ZZLog::GS_Log("Using non-bilinear fill."); } else { @@ -667,7 +667,7 @@ bool ZeroGS::Create(int _width, int _height) g_internalRGBAFloatFmt = GL_FLOAT_RGBA32_NV; g_internalRGBAFloat16Fmt = GL_FLOAT_RGBA16_NV; Texture2D(g_internalRGBAFloatFmt, GL_RGBA, GL_FLOAT, &vBilinearData[0]); - ZZLog::Error_Log("ZZogl Fill bilinear blocks."); + ZZLog::Debug_Log("ZZogl Fill bilinear blocks. "); B_G(glGetError() == GL_NO_ERROR, return false); } else @@ -807,7 +807,7 @@ bool ZeroGS::Create(int _width, int _height) g_vparamPosXY[0] = cgCreateParameter(g_cgcontext, CG_FLOAT4); g_vparamPosXY[1] = cgCreateParameter(g_cgcontext, CG_FLOAT4); - ZZLog::Error_Log("Creating effects."); + ZZLog::GS_Log("Creating effects."); B_G(LoadEffects(), return false); @@ -849,11 +849,11 @@ bool ZeroGS::Create(int _width, int _height) if (g_nPixelShaderVer & SHADER_REDUCED) conf.bilinear = 0; - ZZLog::Error_Log("Creating extra effects."); + ZZLog::GS_Log("Creating extra effects."); B_G(LoadExtraEffects(), return false); - ZZLog::Error_Log("Using %s shaders.", g_pShaders[g_nPixelShaderVer]); + ZZLog::GS_Log("Using %s shaders.", g_pShaders[g_nPixelShaderVer]); GL_REPORT_ERROR(); @@ -892,7 +892,7 @@ bool ZeroGS::Create(int _width, int _height) } else { - ZZLog::Error_Log("In final init!"); + ZZLog::Debug_Log("In final init!"); return false; } } diff --git a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp index 8c421cbe1c..b8e7361e4d 100644 --- a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp @@ -315,13 +315,13 @@ inline void VisualBufferMessage(int context) static const char* patst[8] = { "NEVER", "ALWAYS", "LESS", "LEQUAL", "EQUAL", "GEQUAL", "GREATER", "NOTEQUAL"}; static const char* pztst[4] = { "NEVER", "ALWAYS", "GEQUAL", "GREATER" }; static const char* pafail[4] = { "KEEP", "FB_ONLY", "ZB_ONLY", "RGB_ONLY" }; - ZZLog::Error_Log("**Drawing ctx %d, num %d, fbp: 0x%x, zbp: 0x%x, fpsm: %d, zpsm: %d, fbw: %d", context, vb[context].nCount, curvb.prndr->fbp, curvb.zbuf.zbp, curvb.prndr->psm, curvb.zbuf.psm, curvb.prndr->fbw); - ZZLog::Error_Log("prim: prim=%x iip=%x tme=%x fge=%x abe=%x aa1=%x fst=%x ctxt=%x fix=%x", + ZZLog::Debug_Log("**Drawing ctx %d, num %d, fbp: 0x%x, zbp: 0x%x, fpsm: %d, zpsm: %d, fbw: %d", context, vb[context].nCount, curvb.prndr->fbp, curvb.zbuf.zbp, curvb.prndr->psm, curvb.zbuf.psm, curvb.prndr->fbw); + ZZLog::Debug_Log("prim: prim=%x iip=%x tme=%x fge=%x abe=%x aa1=%x fst=%x ctxt=%x fix=%x", curvb.curprim.prim, curvb.curprim.iip, curvb.curprim.tme, curvb.curprim.fge, curvb.curprim.abe, curvb.curprim.aa1, curvb.curprim.fst, curvb.curprim.ctxt, curvb.curprim.fix); - ZZLog::Error_Log("test: ate:%d, atst: %s, aref: %d, afail: %s, date: %d, datm: %d, zte: %d, ztst: %s, fba: %d", + ZZLog::Debug_Log("test: ate:%d, atst: %s, aref: %d, afail: %s, date: %d, datm: %d, zte: %d, ztst: %s, fba: %d", curvb.test.ate, patst[curvb.test.atst], curvb.test.aref, pafail[curvb.test.afail], curvb.test.date, curvb.test.datm, curvb.test.zte, pztst[curvb.test.ztst], curvb.fba.fba); - ZZLog::Error_Log("alpha: A%d B%d C%d D%d FIX:%d pabe: %d; aem: %d, ta0: %d, ta1: %d\n", curvb.alpha.a, curvb.alpha.b, curvb.alpha.c, curvb.alpha.d, curvb.alpha.fix, gs.pabe, gs.texa.aem, gs.texa.ta[0], gs.texa.ta[1]); - ZZLog::Error_Log("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d", + ZZLog::Debug_Log("alpha: A%d B%d C%d D%d FIX:%d pabe: %d; aem: %d, ta0: %d, ta1: %d\n", curvb.alpha.a, curvb.alpha.b, curvb.alpha.c, curvb.alpha.d, curvb.alpha.fix, gs.pabe, gs.texa.aem, gs.texa.ta[0], gs.texa.ta[1]); + ZZLog::Debug_Log("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d", curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, curvb.tex0.th, curvb.tex0.tcc, curvb.tex0.tfx, curvb.tex0.cbp, curvb.tex0.cpsm, curvb.tex0.csm, curvb.tex0.csa, curvb.tex0.cld); @@ -334,7 +334,7 @@ inline void VisualBufferMessage(int context) ZZLog::Error_Log("TGA name '%s'.", Name); free(Name); // } - ZZLog::Error_Log("frame: %d, buffer %ld.\n", g_SaveFrameNum, BufferNumber); + ZZLog::Debug_Log("frame: %d, buffer %ld.\n", g_SaveFrameNum, BufferNumber); #endif } @@ -345,7 +345,7 @@ inline void SaveRendererTarget(VB& curvb) if (g_bSaveFlushedFrame & 0x80000000) { char str[255]; - sprintf(str, "rndr.tga", g_SaveFrameNum); + sprintf(str, "rndr%d.tga", g_SaveFrameNum); SaveRenderTarget(str, curvb.prndr->fbw, curvb.prndr->fbh, 0); } diff --git a/plugins/zzogl-pg/opengl/ZZoglVB.cpp b/plugins/zzogl-pg/opengl/ZZoglVB.cpp index fe5e50deb0..25f69d5eee 100644 --- a/plugins/zzogl-pg/opengl/ZZoglVB.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglVB.cpp @@ -252,7 +252,7 @@ inline int ZeroGS::VB::CheckFrameAddConstraints(int tbp) #ifdef DEVBUILD if (frame.fbh == 0xe2) - ZZLog::Error_Log("Const: %x %x %d| %x %d %x %x", frame.fbh, frame.fbw, ConstraintReason, noscissorpos, ConstrainR1, tbp, frame.fbp); + ZZLog::Debug_Log("Const: %x %x %d| %x %d %x %x", frame.fbh, frame.fbw, ConstraintReason, noscissorpos, ConstrainR1, tbp, frame.fbp); #endif // Fixme: Reserved psm for framebuffers diff --git a/plugins/zzogl-pg/opengl/targets.cpp b/plugins/zzogl-pg/opengl/targets.cpp index 7f9243df7c..9a5cf5f576 100644 --- a/plugins/zzogl-pg/opengl/targets.cpp +++ b/plugins/zzogl-pg/opengl/targets.cpp @@ -430,13 +430,13 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) nUpdateTarg = 0; else if (ittarg->second == this) { - ZZLog::Error_Log("Updating self."); + ZZLog::Debug_Log("Updating self."); nUpdateTarg = 0; } } else if (ittarg->second == this) { - ZZLog::Error_Log("Updating self."); + ZZLog::Debug_Log("Updating self."); nUpdateTarg = 0; } } @@ -2790,7 +2790,7 @@ void ResolveInRange(int start, int end) if ((*it)->created == 123) (*it)->Resolve(); else - ZZLog::Error_Log("Resolving non-existing object! Destroy code %d.", (*it)->created); + ZZLog::Debug_Log("Resolving non-existing object! Destroy code %d.", (*it)->created); } } } diff --git a/plugins/zzogl-pg/opengl/x86.cpp b/plugins/zzogl-pg/opengl/x86.cpp index a094412381..18ef026739 100644 --- a/plugins/zzogl-pg/opengl/x86.cpp +++ b/plugins/zzogl-pg/opengl/x86.cpp @@ -462,7 +462,7 @@ End: "test edx, 15\n" "jnz WriteUnaligned\n" - "movdqa xmm7, [%[s_clut16mask]]\n" // saves upper 16 bits + "movdqa xmm7, [s_clut16mask]\n" // saves upper 16 bits // have to save interlaced with the old data "movdqa xmm4, [edx]\n" @@ -503,7 +503,7 @@ End: // %edx is offset by 2 "sub edx, 2\n" - "movdqa xmm7, [%[s_clut16mask2]]\n" // saves lower 16 bits + "movdqa xmm7, [[s_clut16mask2]]\n" // saves lower 16 bits // have to save interlaced with the old data "movdqa xmm4, [edx]\n" @@ -543,9 +543,8 @@ End: "movdqa [edx+16], xmm2\n" "movdqa [edx+48], xmm3\n" "WriteCLUT_T16_I4_CSM1_End:\n" - ".att_syntax\n" - -: [s_clut16mask]"=m"(s_clut16mask), [s_clut16mask2]"=m"(s_clut16mask2) + "\n" + ".att_syntax\n" : [s_clut16mask] "=m" (s_clut16mask), [s_clut16mask2] "=m" (s_clut16mask2) ); #endif // _MSC_VER } diff --git a/plugins/zzogl-pg/opengl/zerogs.cpp b/plugins/zzogl-pg/opengl/zerogs.cpp index 710a49a9be..cdc006ca07 100644 --- a/plugins/zzogl-pg/opengl/zerogs.cpp +++ b/plugins/zzogl-pg/opengl/zerogs.cpp @@ -595,7 +595,11 @@ __forceinline void MOVFOG(VertexGPU *p, Vertex gsf) int Values[100] = {0, }; -__forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) + +#ifndef __LINUX__ +__forceinline +#endif +void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) { int index = Index; p->x = ((((int)gs.gsvertex[index].x - curvb.offset.x) >> 1) & 0xffff); @@ -767,7 +771,10 @@ void ZeroGS::KickTriangleFan() OUTPUT_VERT(p[2], 2); } -__forceinline void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) +#ifndef __LINUX__ +__forceinline +#endif +void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) { SET_VERTEX(p, next, curvb); MOVZ(p, v.z, curvb);