Rice GLES2 (from mupen64plus-ae) plugin. Compile but doesn't works well on the OpenPa...
[mupen64plus-pandora.git] / source / gles2rice / src / Config.h
1 /*
2 Copyright (C) 2002 Rice1964
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
18 */
19
20 #ifndef _RICE_CONFIG_H_
21 #define _RICE_CONFIG_H_
22
23 #include <stdio.h>
24
25 #include "typedefs.h"
26
27 typedef enum
28 {
29     OGL_DEVICE,
30     OGL_1_1_DEVICE,
31     OGL_1_2_DEVICE,
32     OGL_1_3_DEVICE,
33     OGL_1_4_DEVICE,
34     OGL_1_4_V2_DEVICE,
35     OGL_TNT2_DEVICE,
36     NVIDIA_OGL_DEVICE,
37     OGL_FRAGMENT_PROGRAM,
38
39     DIRECTX_DEVICE,
40 } SupportedDeviceType;
41
42 enum DirectXCombinerType
43 {
44     DX_DISABLE_COMBINER,
45     DX_BEST_FIT,
46     DX_LOW_END,
47     DX_HIGH_END,
48     DX_NVIDIA_TNT,
49     DX_2_STAGES,
50     DX_3_STAGES,
51     DX_4_STAGES,
52     DX_PIXEL_SHADER,
53     DX_SEMI_PIXEL_SHADER,
54 };
55
56
57 typedef struct
58 {
59     const char* name;
60     SupportedDeviceType type;
61 } RenderEngineSetting;
62
63 enum {
64     FRM_BUF_NONE,
65     FRM_BUF_IGNORE,
66     FRM_BUF_BASIC,
67     FRM_BUF_BASIC_AND_WRITEBACK,
68     FRM_BUF_WRITEBACK_AND_RELOAD,
69     FRM_BUF_COMPLETE,
70     FRM_BUF_WITH_EMULATOR,
71     FRM_BUF_BASIC_AND_WITH_EMULATOR,
72     FRM_BUF_WITH_EMULATOR_READ_ONLY,
73     FRM_BUF_WITH_EMULATOR_WRITE_ONLY,
74 };
75
76 enum {
77     FRM_BUF_WRITEBACK_NORMAL,
78     FRM_BUF_WRITEBACK_1_2,
79     FRM_BUF_WRITEBACK_1_3,
80     FRM_BUF_WRITEBACK_1_4,
81     FRM_BUF_WRITEBACK_1_5,
82     FRM_BUF_WRITEBACK_1_6,
83     FRM_BUF_WRITEBACK_1_7,
84     FRM_BUF_WRITEBACK_1_8,
85 };
86
87 enum {
88     TXT_BUF_NONE,
89     TXT_BUF_IGNORE,
90     TXT_BUF_NORMAL,
91     TXT_BUF_WRITE_BACK,
92     TXT_BUF_WRITE_BACK_AND_RELOAD,
93 };
94
95 enum {
96     TXT_QUALITY_DEFAULT,
97     TXT_QUALITY_32BIT,
98     TXT_QUALITY_16BIT,
99 };
100
101 enum {
102     FORCE_DEFAULT_FILTER,
103     FORCE_POINT_FILTER,
104     FORCE_LINEAR_FILTER,
105 };
106
107 enum {
108     TEXTURE_NO_MIPMAP = 0,
109     TEXTURE_NO_FILTER,
110     TEXTURE_BILINEAR_FILTER,
111     TEXTURE_TRILINEAR_FILTER,
112 };
113
114 enum {
115     TEXTURE_NO_ENHANCEMENT,
116     TEXTURE_2X_ENHANCEMENT,
117     TEXTURE_2XSAI_ENHANCEMENT,
118     TEXTURE_HQ2X_ENHANCEMENT,
119     TEXTURE_LQ2X_ENHANCEMENT,
120     TEXTURE_HQ4X_ENHANCEMENT,
121     TEXTURE_SHARPEN_ENHANCEMENT,
122     TEXTURE_SHARPEN_MORE_ENHANCEMENT,
123     TEXTURE_EXTERNAL,
124     TEXTURE_MIRRORED,
125 };
126
127 enum {
128     TEXTURE_ENHANCEMENT_NORMAL,
129     TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_1,
130     TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_2,
131     TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_3,
132     TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_4,
133 };
134
135 enum {
136     SCREEN_UPDATE_DEFAULT = 0,
137     SCREEN_UPDATE_AT_VI_UPDATE = 1,
138     SCREEN_UPDATE_AT_VI_CHANGE = 2,
139     SCREEN_UPDATE_AT_CI_CHANGE = 3,
140     SCREEN_UPDATE_AT_1ST_CI_CHANGE = 4,
141     SCREEN_UPDATE_AT_1ST_PRIMITIVE = 5,
142     SCREEN_UPDATE_BEFORE_SCREEN_CLEAR = 6,
143     SCREEN_UPDATE_AT_VI_UPDATE_AND_DRAWN = 7,   // Update screen at VI origin is updated and the screen has been drawn
144 };
145
146 enum {
147     ONSCREEN_DISPLAY_NOTHING = 0,
148     ONSCREEN_DISPLAY_DLIST_PER_SECOND,
149     ONSCREEN_DISPLAY_FRAME_PER_SECOND,
150     ONSCREEN_DISPLAY_DEBUG_INFORMATION_ONLY,
151     ONSCREEN_DISPLAY_TEXT_FROM_CORE_ONLY,
152     ONSCREEN_DISPLAY_DLIST_PER_SECOND_WITH_CORE_MSG,
153     ONSCREEN_DISPLAY_FRAME_PER_SECOND_WITH_CORE_MSG,
154     ONSCREEN_DISPLAY_DEBUG_INFORMATION_WITH_CORE_MSG,
155 };
156
157 enum HACK_FOR_GAMES
158 {
159     NO_HACK_FOR_GAME,
160     HACK_FOR_BANJO_TOOIE,
161     HACK_FOR_DR_MARIO,
162     HACK_FOR_ZELDA,
163     HACK_FOR_MARIO_TENNIS,
164     HACK_FOR_BANJO,
165     HACK_FOR_PD,
166     HACK_FOR_GE,
167     HACK_FOR_PILOT_WINGS,
168     HACK_FOR_YOSHI,
169     HACK_FOR_NITRO,
170     HACK_FOR_TONYHAWK,
171     HACK_FOR_NASCAR,
172     HACK_FOR_SUPER_BOWLING,
173     HACK_FOR_CONKER,
174     HACK_FOR_ALL_STAR_BASEBALL,
175     HACK_FOR_TIGER_HONEY_HUNT,
176     HACK_REVERSE_XY_COOR,
177     HACK_REVERSE_Y_COOR,
178     HACK_FOR_GOLDEN_EYE,
179     HACK_FOR_FZERO,
180     HACK_FOR_COMMANDCONQUER,
181     HACK_FOR_RUMBLE,
182     HACK_FOR_SOUTH_PARK_RALLY,
183     HACK_FOR_BUST_A_MOVE,
184     HACK_FOR_OGRE_BATTLE,
185     HACK_FOR_TWINE,
186     HACK_FOR_EXTREME_G2,
187     HACK_FOR_ROGUE_SQUADRON,
188     HACK_FOR_MARIO_GOLF,
189     HACK_FOR_MLB,
190     HACK_FOR_POLARISSNOCROSS,
191     HACK_FOR_TOPGEARRALLY,
192     HACK_FOR_DUKE_NUKEM,
193     HACK_FOR_ZELDA_MM,
194     HACK_FOR_MARIO_KART,
195 };
196
197 enum {
198     NOT_USE_CI_WIDTH_AND_RATIO,
199     USE_CI_WIDTH_AND_RATIO_FOR_NTSC,
200     USE_CI_WIDTH_AND_RATIO_FOR_PAL,
201 };
202
203 typedef struct {
204     BOOL    bEnableHacks;
205     BOOL    bWinFrameMode;
206     BOOL    bOGLVertexClipper;
207     BOOL    bEnableSSE;
208     BOOL    bEnableVertexShader;
209     BOOL    bSkipFrame;
210     BOOL    bFullTMEM;
211     BOOL    bUseFullTMEM;
212
213     BOOL    bShowFPS;
214
215     uint32  mipmapping;
216     uint32  fogMethod;
217     uint32  forceTextureFilter;
218     uint32  textureEnhancement;
219     uint32  textureEnhancementControl;
220     uint32  textureQuality;
221     uint32  anisotropicFiltering;
222     uint32  multiSampling;
223     BOOL    bTexRectOnly;
224     BOOL    bSmallTextureOnly;
225     BOOL    bDumpTexturesToFiles;
226     BOOL    bLoadHiResTextures;
227     BOOL    bLoadHiResCRCOnly;
228
229     int     OpenglDepthBufferSetting;
230     int     OpenglRenderSetting;
231     uint32  colorQuality;
232
233     HACK_FOR_GAMES  enableHackForGames;
234 } GlobalOptions;
235
236 typedef struct {
237     bool    bUpdateCIInfo;
238
239     bool    bCheckBackBufs;         // Check texture again against the recent backbuffer addresses
240     bool    bWriteBackBufToRDRAM;   // If a recent backbuffer is used, write its content back to RDRAM
241     bool    bLoadBackBufFromRDRAM;  // Load content from RDRAM and draw into backbuffer
242     bool    bIgnore;                // Ignore all rendering into texture buffers
243
244     bool    bSupportRenderTextures;     // Support render-to-texture
245     bool    bCheckRenderTextures;           // Check texture again against the the last render_texture addresses
246     bool    bRenderTextureWriteBack;        // Write back render_texture into RDRAM
247     bool    bLoadRDRAMIntoRenderTexture;    // Load RDRAM content and render into render_texture
248
249     bool    bAtEachFrameUpdate;     // Reload and write back at each frame buffer and CI update
250
251     bool    bProcessCPUWrite;
252     bool    bProcessCPURead;
253
254     bool    bFillRectNextTextureBuffer;
255     bool    bIgnoreRenderTextureIfHeightUnknown;
256     //bool  bFillColor;
257 } FrameBufferOptions;
258
259 typedef struct {
260     uint32  N64FrameBufferEmuType;
261     uint32  N64FrameBufferWriteBackControl;
262     uint32  N64RenderToTextureEmuType;
263     uint32  screenUpdateSetting;
264     BOOL    bNormalCombiner;
265     BOOL    bNormalBlender;
266     BOOL    bFastTexCRC;
267     BOOL    bAccurateTextureMapping;
268     BOOL    bInN64Resolution;
269     BOOL    bDoubleSizeForSmallTxtrBuf;
270     BOOL    bSaveVRAM;
271 } RomOptions;
272
273 typedef struct IniSection
274 {
275     bool    bOutput;
276     char    crccheck[50];
277     char    name[50];
278
279     // Options with changeable default values
280     uint32  dwNormalCombiner;
281     uint32  dwNormalBlender;
282     uint32  dwFastTextureCRC;
283     uint32  dwAccurateTextureMapping;
284     uint32  dwFrameBufferOption;
285     uint32  dwRenderToTextureOption;
286     uint32  dwScreenUpdateSetting;
287
288     // Options with FALSE as default values
289     BOOL    bDisableBlender;
290     BOOL    bForceScreenClear;
291     BOOL    bEmulateClear;
292     BOOL    bForceDepthBuffer;
293
294     // Less useful options
295     BOOL    bDisableObjBG;
296     BOOL    bDisableTextureCRC;
297     BOOL    bIncTexRectEdge;
298     BOOL    bZHack;
299     BOOL    bTextureScaleHack;
300     BOOL    bFastLoadTile;
301     BOOL    bUseSmallerTexture;
302     BOOL    bPrimaryDepthHack;
303     BOOL    bTexture1Hack;
304     BOOL    bDisableCulling;
305
306     int     VIWidth;
307     int     VIHeight;
308     uint32  UseCIWidthAndRatio;
309
310     uint32  dwFullTMEM;
311     BOOL    bTxtSizeMethod2;
312     BOOL    bEnableTxtLOD;
313 } section;
314
315 struct ROMHeader
316 {
317     uint8  x1, x2, x3, x4;
318     uint32 dwClockRate;
319     uint32 dwBootAddressOffset;
320     uint32 dwRelease;
321     uint32 dwCRC1;
322     uint32 dwCRC2;
323     uint64   qwUnknown1;
324     char  szName[20];
325     uint32 dwUnknown2;
326     uint16  wUnknown3;
327     uint8  nUnknown4;
328     uint8  nManufacturer;
329     uint16  wCartID;
330     s8    nCountryID;
331     uint8  nUnknown5;
332 };
333
334 typedef struct 
335 {
336     // Other info from the rom. This is for convenience
337     unsigned char   szGameName[50+1];
338     s8  nCountryID;
339
340     // Copy of the ROM header
341     ROMHeader   romheader;
342
343     // With changeable default values
344     uint32  dwNormalCombiner;
345     uint32  dwNormalBlender;
346     uint32  dwAccurateTextureMapping;
347     uint32  dwFastTextureCRC;
348     uint32  dwFrameBufferOption;
349     uint32  dwRenderToTextureOption;
350     uint32  dwScreenUpdateSetting;
351
352     // With FALSE as its default values
353     BOOL    bForceScreenClear;
354     BOOL    bEmulateClear;
355     BOOL    bForceDepthBuffer;
356     BOOL    bDisableBlender;
357
358     // Less useful options
359     BOOL    bDisableObjBG;
360     BOOL    bDisableTextureCRC;
361     BOOL    bIncTexRectEdge;
362     BOOL    bZHack;
363     BOOL    bTextureScaleHack;
364     BOOL    bFastLoadTile;
365     BOOL    bUseSmallerTexture;
366     BOOL    bPrimaryDepthHack;
367     BOOL    bTexture1Hack;
368     BOOL    bDisableCulling;
369     int     VIWidth;
370     int     VIHeight;
371     uint32  UseCIWidthAndRatio;
372
373     uint32  dwFullTMEM;
374     BOOL    bTxtSizeMethod2;
375     BOOL    bEnableTxtLOD;
376 } GameSetting, *LPGAMESETTING;
377
378 typedef struct
379 {
380     s8  nCountryID;
381     char* szName;
382     uint32 nTvType;
383 } CountryIDInfo;
384
385 #define TV_SYSTEM_NTSC      1
386 #define TV_SYSTEM_PAL       0
387
388 extern GlobalOptions       options;
389 extern FrameBufferOptions  frameBufferOptions;
390 extern RomOptions          defaultRomOptions;
391 extern RomOptions          currentRomOptions;
392 extern const CountryIDInfo g_CountryCodeInfo[];
393 extern GameSetting         g_curRomInfo;
394 extern bool                bIniIsChanged;
395 extern char                szIniFileName[300];
396
397 extern BOOL InitConfiguration(void);
398 extern BOOL LoadConfiguration(void);
399 extern void WriteIniFile();
400 extern BOOL ReadIniFile();
401 extern void OutputSectionDetails(uint32 i, FILE * fh);
402 extern void GenerateCurrentRomOptions();
403 extern void Ini_GetRomOptions(LPGAMESETTING pGameSetting);
404 extern void Ini_StoreRomOptions(LPGAMESETTING pGameSetting);
405 extern uint32 CountryCodeToTVSystem(uint32 countryCode);
406 extern void ROM_GetRomNameFromHeader(unsigned char * szName, ROMHeader * pHdr);
407
408 #endif
409