/[pcsx2_0.9.7]/branch/debug/0.X/0.9.X/0.9.7/ramdump-lateset/plugins/zzogl-pg/opengl/GifTransfer.h
ViewVC logotype

Contents of /branch/debug/0.X/0.9.X/0.9.7/ramdump-lateset/plugins/zzogl-pg/opengl/GifTransfer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 314 - (show annotations) (download)
Sun Dec 26 18:56:19 2010 UTC (9 years, 1 month ago) by william
File MIME type: text/plain
File size: 2741 byte(s)
** merged upstream r4049 (re-integration of GregMiscellaneous branch)
** applied patched to GigTranser.cpp in ZZOgl from r4140 to change 'static int count = 0;' to 'static int path1_count = 0;')
1 /* ZZ Open GL graphics plugin
2 * Copyright (c)2009-2010 zeydlitz@gmail.com, arcum42@gmail.com
3 * Based on Zerofrog's ZeroGS KOSMOS (c)2005-2008
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #ifndef GIFTRANSFER_H_INCLUDED
21 #define GIFTRANSFER_H_INCLUDED
22
23 #include "Util.h"
24 #include "GS.h"
25 #include "Regs.h"
26
27 enum GIF_FLG
28 {
29 GIF_FLG_PACKED = 0,
30 GIF_FLG_REGLIST = 1,
31 GIF_FLG_IMAGE = 2,
32 GIF_FLG_IMAGE2 = 3
33 };
34
35 //
36 // GIFTag
37 union GIFTag
38 {
39 u64 ai64[2];
40 u32 ai32[4];
41
42 struct
43 {
44 u32 NLOOP : 15;
45 u32 EOP : 1;
46 u32 _PAD1 : 16;
47 u32 _PAD2 : 14;
48 u32 PRE : 1;
49 u32 PRIM : 11;
50 u32 FLG : 2; // enum GIF_FLG
51 u32 NREG : 4;
52 u64 REGS : 64;
53 };
54
55 void set(const u32 *data)
56 {
57 for (int i = 0; i <= 3; i++)
58 {
59 ai32[i] = data[i];
60 }
61 }
62
63 GIFTag(u32 *data)
64 {
65 set(data);
66 }
67
68 GIFTag(){ ai64[0] = 0; ai64[1] = 0; }
69 };
70
71 // EE part. Data transfer packet description
72
73 typedef struct
74 {
75 u32 mode;
76 int reg;
77 u64 regs;
78 u32 nloop;
79 int eop;
80 int nreg;
81 u32 adonly;
82 GIFTag tag;
83
84 void setTag(const u32 *data)
85 {
86 tag.set(data);
87
88 nloop = tag.NLOOP;
89 eop = tag.EOP;
90 mode = tag.FLG;
91 adonly = false;
92
93 // Hmm....
94 nreg = tag.NREG << 2;
95 if (nreg == 0) nreg = 64;
96 regs = tag.REGS;
97 reg = 0;
98 if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly = true;
99
100 // ZZLog::GS_Log("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d",
101 // data[3], data[2], data[1], data[0],
102 // path->eop, path->nloop, mode, path->nreg, tag.PRE);
103 }
104
105 u32 GetReg()
106 {
107 return (regs >> reg) & 0xf;
108 }
109
110 bool StepReg()
111 {
112 reg += 4;
113
114 if (reg == nreg)
115 {
116 reg = 0;
117 nloop--;
118
119 if (nloop == 0) return false;
120 }
121
122 return true;
123 }
124
125 } pathInfo;
126
127 extern void _GSgifPacket(pathInfo *path, const u32 *pMem);
128 extern void _GSgifRegList(pathInfo *path, const u32 *pMem);
129 extern void _GSgifTransfer(pathInfo *path, const u32 *pMem, u32 size);
130
131 extern GIFRegHandler g_GIFPackedRegHandlers[];
132 extern GIFRegHandler g_GIFRegHandlers[];
133 extern void InitPath();
134 #endif // GIFTRANSFER_H_INCLUDED

  ViewVC Help
Powered by ViewVC 1.1.22