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

Contents of /branch/debug/0.X/0.9.X/0.9.7/ramdump-lateset/plugins/zzogl-pg/opengl/Util.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: 5709 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 UTIL_H_INCLUDED
21 #define UTIL_H_INCLUDED
22
23
24 #ifdef _WIN32
25
26 #include <io.h>
27 #include "Utilities/RedtapeWindows.h"
28
29 #include <windows.h>
30 #include <windowsx.h>
31
32 #include <GL/gl.h>
33 #include <GL/glext.h>
34 #include "glprocs.h"
35
36 #else // linux basic definitions
37
38 #include <sys/stat.h>
39
40 #include <GL/glew.h>
41 #include <GL/gl.h>
42 #include <GL/glext.h>
43 #include <GL/glx.h>
44 #include <gtk/gtk.h>
45
46 #endif
47
48 #define GSdefs
49
50 //Pcsx2Defs is included in Dependencies.h.
51 #include "Utilities/Dependencies.h"
52
53 #include "CRC.h"
54 #include "ZZLog.h"
55
56 // need C definitions -- no mangling please!
57 extern "C" u32 CALLBACK PS2EgetLibType(void);
58 extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type);
59 extern "C" char* CALLBACK PS2EgetLibName(void);
60
61 #include "ZZoglMath.h"
62 #include "Profile.h"
63
64 #include "Utilities/MemcpyFast.h"
65 #define memcpy_amd memcpy_fast
66
67 extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file path
68
69 typedef struct
70 {
71 int x, y, w, h;
72 } Rect;
73
74 typedef struct
75 {
76 int x, y;
77 } Point;
78
79 typedef struct
80 {
81 int w, h;
82 } Size;
83
84 typedef struct
85 {
86 int x0, y0;
87 int x1, y1;
88 } Rect2;
89
90 typedef struct
91 {
92 int x, y, c;
93 } PointC;
94
95 enum GSWindowDim
96 {
97
98 GSDim_640 = 0,
99 GSDim_800,
100 GSDim_1024,
101 GSDim_1280,
102 };
103
104 typedef union
105 {
106 struct
107 {
108 u32 fullscreen : 1;
109 u32 tga_snap : 1;
110 u32 capture_avi : 1;
111 u32 widescreen : 1;
112 u32 wireframe : 1;
113 u32 loaded : 1;
114 u32 dimensions : 2;
115 };
116 u32 _u32;
117
118 void ZZOptions(u32 value) { _u32 = value; }
119 } ZZOptions;
120
121 typedef struct
122 {
123 u8 mrtdepth; // write color in render target
124 u8 interlace; // intelacing mode 0, 1, 3-off
125 u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x
126 u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it)
127 ZZOptions zz_options;
128 gameHacks hacks; // game options -- different hacks.
129 gameHacks def_hacks;// default game settings
130 int width, height; // View target size, has no impact towards speed
131 int x, y; // Lets try for a persistant window position.
132 bool isWideScreen; // Widescreen support
133 u32 SkipDraw;
134 u32 log;
135 u32 disableHacks;
136
137 void incAA() { aa++; if (aa > 4) aa = 0; }
138 void decAA() { aa--; if (aa > 4) aa = 4; } // u8 is unsigned, so negative value is 255.
139
140 gameHacks settings()
141 {
142 if (disableHacks)
143 {
144 return hacks;
145 }
146 else
147 {
148 gameHacks tempHack;
149 tempHack._u32 = (hacks._u32 | def_hacks._u32);
150 return tempHack;
151 }
152 }
153
154 bool fullscreen() { return !!(zz_options.fullscreen); }
155 bool wireframe() { return !!(zz_options.wireframe); }
156 bool widescreen() { return !!(zz_options.widescreen); }
157 bool captureAvi() { return !!(zz_options.capture_avi); }
158 bool loaded() { return !!(zz_options.loaded); }
159
160 void setFullscreen(bool flag)
161 {
162 zz_options.fullscreen = (flag) ? 1 : 0;
163 }
164
165 void setWireframe(bool flag)
166 {
167 zz_options.wireframe = (flag) ? 1 : 0;
168 }
169
170 void setCaptureAvi(bool flag)
171 {
172 zz_options.capture_avi = (flag) ? 1 : 0;
173 }
174
175 void setLoaded(bool flag)
176 {
177 zz_options.loaded = (flag) ? 1 : 0;
178 }
179 void set_dimensions(u32 dim)
180 {
181 switch (dim)
182 {
183
184 case GSDim_640:
185 width = 640;
186 height = isWideScreen ? 360 : 480;
187 break;
188
189 case GSDim_800:
190 width = 800;
191 height = isWideScreen ? 450 : 600;
192 break;
193
194 case GSDim_1024:
195 width = 1024;
196 height = isWideScreen ? 576 : 768;
197 break;
198
199 case GSDim_1280:
200 width = 1280;
201 height = isWideScreen ? 720 : 960;
202 break;
203
204 default:
205 width = 800;
206 height = 600;
207 break;
208 }
209 }
210
211 } GSconf;
212 extern GSconf conf;
213
214 // ----------------------- Defines
215
216 #define REG64(name) \
217 union name \
218 { \
219 u64 i64; \
220 u32 ai32[2]; \
221 struct { \
222
223 #define REG128(name)\
224 union name \
225 { \
226 u64 ai64[2]; \
227 u32 ai32[4]; \
228 struct { \
229
230 #define REG64_(prefix, name) REG64(prefix##name)
231 #define REG128_(prefix, name) REG128(prefix##name)
232
233 #define REG_END }; };
234 #define REG_END2 };
235
236 #define REG64_SET(name) \
237 union name \
238 { \
239 u64 i64; \
240 u32 ai32[2]; \
241
242 #define REG128_SET(name)\
243 union name \
244 { \
245 u64 ai64[2]; \
246 u32 ai32[4]; \
247
248 #define REG_SET_END };
249
250 #define FORIT(it, v) for(it = (v).begin(); it != (v).end(); ++(it))
251
252 extern void LoadConfig();
253 extern void SaveConfig();
254
255 extern void (*GSirq)();
256
257 extern void *SysLoadLibrary(char *lib); // Loads Library
258 extern void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
259 extern char *SysLibError(); // Gets previous error loading sysbols
260 extern void SysCloseLibrary(void *lib); // Closes Library
261 extern void SysMessage(const char *fmt, ...);
262
263 #ifdef ZEROGS_DEVBUILD
264 extern char* EFFECT_NAME;
265 extern char* EFFECT_DIR;
266 extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
267 extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved;
268 #endif
269
270 extern bool g_bDisplayFPS; // should we display FPS on screen?
271
272 #endif // UTIL_H_INCLUDED

  ViewVC Help
Powered by ViewVC 1.1.22