Added aspect ratio option to RICE GLES2
[mupen64plus-pandora.git] / source / rice_gles / src / Video.h
CommitLineData
d07c171f 1/*
2Copyright (C) 2002 Rice1964
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18*/
19
20#ifndef _DLLINTERFACE_H_
21#define _DLLINTERFACE_H_
22
23#define M64P_PLUGIN_PROTOTYPES 1
24#include "typedefs.h"
25#include "m64p_config.h"
26#include "m64p_plugin.h"
27#include "m64p_vidext.h"
28
29typedef struct {
30 float fViWidth, fViHeight;
31 unsigned short uViWidth, uViHeight;
32 unsigned short uDisplayWidth, uDisplayHeight;
33
34 BOOL bDisplayFullscreen;
35 BOOL bVerticalSync;
36
37 float fMultX, fMultY;
38 int vpLeftW, vpTopW, vpRightW, vpBottomW, vpWidthW, vpHeightW;
39
40 int statusBarHeight, statusBarHeightToUse, toolbarHeight, toolbarHeightToUse;
41 BOOL screenSaverStatus;
42
43 struct {
44 uint32 left;
45 uint32 top;
46 uint32 right;
47 uint32 bottom;
48 uint32 width;
49 uint32 height;
50 bool needToClip;
51 } clipping;
52
53 int timer;
54 float fps; // frame per second
55 float dps; // dlist per second
56 uint32 lastSecFrameCount;
57 uint32 lastSecDlistCount;
58}WindowSettingStruct;
59
60typedef enum
61{
62 PRIM_TRI1,
63 PRIM_TRI2,
64 PRIM_TRI3,
65 PRIM_DMA_TRI,
66 PRIM_LINE3D,
67 PRIM_TEXTRECT,
68 PRIM_TEXTRECTFLIP,
69 PRIM_FILLRECT,
70} PrimitiveType;
71
72typedef enum
73{
74 RSP_SCISSOR,
75 RDP_SCISSOR,
76 UNKNOWN_SCISSOR,
77} CurScissorType;
78
79typedef struct {
80 bool bGameIsRunning;
81 uint32 dwTvSystem;
82 float fRatio;
83
84 BOOL frameReadByCPU;
85 BOOL frameWriteByCPU;
86
87 uint32 SPCycleCount; // Count how many CPU cycles SP used in this DLIST
88 uint32 DPCycleCount; // Count how many CPU cycles DP used in this DLIST
89
90 uint32 dwNumTrisRendered;
91 uint32 dwNumDListsCulled;
92 uint32 dwNumTrisClipped;
93 uint32 dwNumVertices;
94 uint32 dwBiggestVertexIndex;
95
96 uint32 gDlistCount;
97 uint32 gFrameCount;
98 uint32 gUcodeCount;
99 uint32 gRDPTime;
100 BOOL ToToggleFullScreen;
101 bool ToResize;
102 uint32 gNewResizeWidth, gNewResizeHeight;
103 bool bDisableFPS;
104
105 bool bUseModifiedUcodeMap;
106 bool ucodeHasBeenSet;
107 bool bUcodeIsKnown;
108
109 uint32 curRenderBuffer;
110 uint32 curDisplayBuffer;
111 uint32 curVIOriginReg;
112 CurScissorType curScissor;
113
114 PrimitiveType primitiveType;
115
116 uint32 lastPurgeTimeTime; // Time textures were last purged
117
118 bool UseLargerTile[2]; // This is a speed up for large tile loading,
119 uint32 LargerTileRealLeft[2]; // works only for TexRect, LoadTile, large width, large pitch
120
121 bool bVIOriginIsUpdated;
122 bool bCIBufferIsRendered;
123 int leftRendered,topRendered,rightRendered,bottomRendered;
124
125 bool isMMXSupported;
126 bool isSSESupported;
127 bool isVertexShaderSupported;
128
129 bool isMMXEnabled;
130 bool isSSEEnabled;
131 bool isVertexShaderEnabled;
132 bool bUseHW_T_L; // Use hardware T&L, for debug purpose only
133
134 bool toShowCFB;
135
136 bool bAllowLoadFromTMEM;
137
138 // Frame buffer simulation related status variables
139 bool bN64FrameBufferIsUsed; // Frame buffer is used in the frame
140 bool bN64IsDrawingTextureBuffer; // The current N64 game is rendering into render_texture, to create self-rendering texture
141 bool bHandleN64RenderTexture; // Do we need to handle of the N64 render_texture stuff?
142 bool bDirectWriteIntoRDRAM; // When drawing into render_texture, this value =
143 // = true don't render, but write real N64 graphic value into RDRAM
144 // = false rendering into render_texture of DX or OGL, the render_texture
145 // will be copied into RDRAM at the end
146 bool bFrameBufferIsDrawn; // flag to mark if the frame buffer is ever drawn
147 bool bFrameBufferDrawnByTriangles; // flag to tell if the buffer is even drawn by Triangle cmds
148
149 bool bScreenIsDrawn;
150
151} PluginStatus;
152
153#define MI_INTR_DP 0x00000020
154#define MI_INTR_SP 0x00000001
155
156extern PluginStatus status;
157extern GFX_INFO g_GraphicsInfo;
158extern WindowSettingStruct windowSetting;
159
160extern unsigned int g_dwRamSize;
161extern unsigned int *g_pRDRAMu32;
162extern signed char *g_pRDRAMs8;
163extern unsigned char *g_pRDRAMu8;
164
165/* declarations of pointers to Core config functions */
166extern ptr_ConfigListSections ConfigListSections;
167extern ptr_ConfigOpenSection ConfigOpenSection;
168extern ptr_ConfigListParameters ConfigListParameters;
169extern ptr_ConfigSaveFile ConfigSaveFile;
170extern ptr_ConfigSetParameter ConfigSetParameter;
171extern ptr_ConfigGetParameter ConfigGetParameter;
172extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;
173extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt;
174extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat;
175extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool;
176extern ptr_ConfigSetDefaultString ConfigSetDefaultString;
177extern ptr_ConfigGetParamInt ConfigGetParamInt;
178extern ptr_ConfigGetParamFloat ConfigGetParamFloat;
179extern ptr_ConfigGetParamBool ConfigGetParamBool;
180extern ptr_ConfigGetParamString ConfigGetParamString;
181
182extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath;
183extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath;
184extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath;
185extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath;
186
187/* declarations of pointers to Core video extension functions */
188extern ptr_VidExt_Init CoreVideo_Init;
189extern ptr_VidExt_Quit CoreVideo_Quit;
190extern ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes;
191extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode;
192extern ptr_VidExt_SetCaption CoreVideo_SetCaption;
193extern ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen;
194extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow;
195extern ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress;
196extern ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute;
197extern ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute;
198extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers;
199
200/* global functions provided by Video.cpp */
201extern char generalText[];
202extern void (*renderCallback)(int);
203void DebugMessage(int level, const char *message, ...);
204
205void SetVIScales();
206extern void _VIDEO_DisplayTemporaryMessage2(const char *msg, ...);
207extern void _VIDEO_DisplayTemporaryMessage(const char *msg);
208extern void XBOX_Debugger_Log(const char *Message, ...);
209
210#endif
211