From 9bde4de02acd7626b94d472f3d25b712901fe4b6 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 17 Oct 2010 09:07:16 +0000 Subject: [PATCH] GregMiscellaneous: zzogl-pg: Add a new header. More work on zerogs.h. git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3928 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/CMakeLists.txt | 1 + plugins/zzogl-pg/opengl/GS.h | 2 ++ plugins/zzogl-pg/opengl/GSmain.cpp | 4 +++ .../opengl/Linux/zzogl-pg/zzogl-pg.cbp | 1 + plugins/zzogl-pg/opengl/NewRegs.h | 5 ++- plugins/zzogl-pg/opengl/Regs.h | 2 ++ plugins/zzogl-pg/opengl/ZZoglCRTC.cpp | 1 + plugins/zzogl-pg/opengl/ZZoglCreate.cpp | 4 ++- plugins/zzogl-pg/opengl/ZZoglFlush.cpp | 8 ++--- plugins/zzogl-pg/opengl/ZZoglShoots.cpp | 1 + plugins/zzogl-pg/opengl/ZZoglShoots.h | 35 +++++++++++++++++++ plugins/zzogl-pg/opengl/ZZoglVB.cpp | 2 +- plugins/zzogl-pg/opengl/targets.cpp | 5 ++- plugins/zzogl-pg/opengl/zerogs.h | 21 ----------- 14 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 plugins/zzogl-pg/opengl/ZZoglShoots.h diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index 701371c634..d91c4b6f41 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -96,6 +96,7 @@ set(zzoglHeaders ZZoglCRTC.h ZZoglMath.h ZZoglShaders.h + ZZoglShoots.h ZZGl.h ZZLog.h) diff --git a/plugins/zzogl-pg/opengl/GS.h b/plugins/zzogl-pg/opengl/GS.h index e27e4e3625..b4d7aec7df 100644 --- a/plugins/zzogl-pg/opengl/GS.h +++ b/plugins/zzogl-pg/opengl/GS.h @@ -385,6 +385,8 @@ union tex_0_info #define TEX_HIGHLIGHT 2 #define TEX_HIGHLIGHT2 3 +bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); + typedef struct { int lcm; diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index 999392c865..9da51abac4 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -38,6 +38,7 @@ using namespace std; #include "targets.h" #include "ZZoglShaders.h" #include "ZZoglFlushHack.h" +#include "ZZoglShoots.h" #ifdef _MSC_VER #pragma warning(disable:4244) @@ -594,6 +595,9 @@ int CALLBACK GSsetupRecording(int start, void* pData) return 1; } +int ZZSave(s8* pbydata); +bool ZZLoad(s8* pbydata); + s32 CALLBACK GSfreeze(int mode, freezeData *data) { FUNCLOG diff --git a/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp b/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp index c9cef870be..5ba0163c81 100644 --- a/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp +++ b/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp @@ -157,6 +157,7 @@ + diff --git a/plugins/zzogl-pg/opengl/NewRegs.h b/plugins/zzogl-pg/opengl/NewRegs.h index 29a124c70d..d87bdcacd6 100644 --- a/plugins/zzogl-pg/opengl/NewRegs.h +++ b/plugins/zzogl-pg/opengl/NewRegs.h @@ -22,7 +22,10 @@ #ifdef USE_OLD_REGS #include "Regs.h" -#else +#else + +bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op + enum GIF_REG { GIF_REG_PRIM = 0x00, diff --git a/plugins/zzogl-pg/opengl/Regs.h b/plugins/zzogl-pg/opengl/Regs.h index a3578b635d..fa1d53855d 100644 --- a/plugins/zzogl-pg/opengl/Regs.h +++ b/plugins/zzogl-pg/opengl/Regs.h @@ -23,6 +23,8 @@ #ifdef USE_OLD_REGS +bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op + enum GIF_REG { GIF_REG_PRIM = 0x00, diff --git a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp index b3eaf4fd34..db46e958ee 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp @@ -24,6 +24,7 @@ #include "ZZoglCRTC.h" #include "GLWin.h" #include "ZZoglShaders.h" +#include "ZZoglShoots.h" #include "rasterfont.h" // simple font //------------------ Defines diff --git a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp index 67550c3857..40507b6e15 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp @@ -24,8 +24,8 @@ #include "Mem.h" #include "zerogs.h" #include "GLWin.h" - #include "ZZoglShaders.h" + #include "targets.h" #include "rasterfont.h" // simple font @@ -163,6 +163,8 @@ u32 ptexBilinearBlocks = 0; u32 ptexConv32to16 = 0; int g_nDepthBias = 0; +extern void Delete_Avi_Capture(); + //------------------ Code bool IsGLExt(const char* szTargetExtension) diff --git a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp index 9e9c11dbee..c2a01abf84 100644 --- a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp @@ -205,7 +205,7 @@ void FlushTransferRanges(const tex0Info* ptex); //zz void SetTexVariables(int context, FRAGMENTSHADER* pfragment); // zz void SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint); // zz void SetAlphaVariables(const alphaInfo& ainfo); // zzz -void ResetAlphaVariables(); +//void ResetAlphaVariables(); inline void SetAlphaTestInt(pixTest curtest); @@ -2360,9 +2360,9 @@ void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool Ch // } \ // else { \ -void ResetAlphaVariables() { - FUNCLOG -} +//void ResetAlphaVariables() { +// FUNCLOG +//} inline void NeedFactor(int w) { diff --git a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp index 1a04261486..42be08ec99 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp @@ -30,6 +30,7 @@ #include "zerogs.h" #include "targets.h" #include "Mem.h" +#include "ZZoglShoots.h" // AVI Capture int s_avicapturing = 0; diff --git a/plugins/zzogl-pg/opengl/ZZoglShoots.h b/plugins/zzogl-pg/opengl/ZZoglShoots.h new file mode 100644 index 0000000000..7876fe2692 --- /dev/null +++ b/plugins/zzogl-pg/opengl/ZZoglShoots.h @@ -0,0 +1,35 @@ +/* ZZ Open GL graphics plugin + * Copyright (c)2009-2010 zeydlitz@gmail.com, arcum42@gmail.com + * Based on Zerofrog's ZeroGS KOSMOS (c)2005-2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef ZZOGLSHOOTS_H_INCLUDED +#define ZZOGLSHOOTS_H_INCLUDED + +void SaveSnapshot(const char* filename); +bool SaveRenderTarget(const char* filename, int width, int height, int jpeg); +bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); +bool SaveJPEG(const char* filename, int width, int height, const void* pdata, int quality); +bool SaveTGA(const char* filename, int width, int height, void* pdata); +void Stop_Avi(); +void Delete_Avi_Capture(); + +void StartCapture(); +void StopCapture(); +void CaptureFrame(); + +#endif // ZZOGLSHOOTS_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/ZZoglVB.cpp b/plugins/zzogl-pg/opengl/ZZoglVB.cpp index bf9904ba33..7206329227 100644 --- a/plugins/zzogl-pg/opengl/ZZoglVB.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglVB.cpp @@ -389,7 +389,7 @@ void VB::CheckFrame(int tbp) if ((prndr != NULL) && (prndr->psm != gsfb.psm)) { // behavior for dest alpha varies - ResetAlphaVariables(); +// ResetAlphaVariables(); } bChanged = CheckFrameResolveRender(tbp); diff --git a/plugins/zzogl-pg/opengl/targets.cpp b/plugins/zzogl-pg/opengl/targets.cpp index c06d5bf8c4..7ebca98465 100644 --- a/plugins/zzogl-pg/opengl/targets.cpp +++ b/plugins/zzogl-pg/opengl/targets.cpp @@ -26,6 +26,7 @@ #include "zerogs.h" #include "targets.h" #include "ZZoglShaders.h" + #ifdef ZEROGS_SSE2 #include #endif @@ -57,6 +58,8 @@ bool g_bSaveZUpdate = 0; int VALIDATE_THRESH = 8; u32 TEXDESTROY_THRESH = 16; +void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode); + // ------------------------- Useful inlines ------------------------------------ // memory size for one row of texture. It depends on width of texture and number of bytes @@ -514,7 +517,7 @@ void CRenderTarget::Update(int context, CRenderTarget* pdepth) // reset since settings changed vb[0].bVarsTexSync = 0; - ResetAlphaVariables(); +// ResetAlphaVariables(); } void CRenderTarget::ConvertTo32() diff --git a/plugins/zzogl-pg/opengl/zerogs.h b/plugins/zzogl-pg/opengl/zerogs.h index 4ebd3e2de5..ed1c03cb4d 100644 --- a/plugins/zzogl-pg/opengl/zerogs.h +++ b/plugins/zzogl-pg/opengl/zerogs.h @@ -119,32 +119,11 @@ void TransferLocalLocal(); void RenderCRTC(int interlace); void ResetRenderTarget(int index); -bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op - -int ZZSave(s8* pbydata); -bool ZZLoad(s8* pbydata); - -void SaveSnapshot(const char* filename); -bool SaveRenderTarget(const char* filename, int width, int height, int jpeg); -bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); -bool SaveJPEG(const char* filename, int width, int height, const void* pdata, int quality); -bool SaveTGA(const char* filename, int width, int height, void* pdata); -void Stop_Avi(); -void Delete_Avi_Capture(); // private methods -void FlushSysMem(const RECT* prc); -void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode); // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); - -void NeedFactor(int w); -void ResetAlphaVariables(); - -void StartCapture(); -void StopCapture(); -void CaptureFrame(); // The size in bytes of x strings (of texture). inline int MemorySize(int x)