Added aspect ratio option to RICE GLES1.1
[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;
e18935a7 33
34 unsigned short uDisplayX, uDisplayY;
35 BOOL bDisplayRatio;
d07c171f 36
37 BOOL bDisplayFullscreen;
38 BOOL bVerticalSync;
39
40 float fMultX, fMultY;
41 int vpLeftW, vpTopW, vpRightW, vpBottomW, vpWidthW, vpHeightW;
42
43 int statusBarHeight, statusBarHeightToUse, toolbarHeight, toolbarHeightToUse;
44 BOOL screenSaverStatus;
45
46 struct {
47 uint32 left;
48 uint32 top;
49 uint32 right;
50 uint32 bottom;
51 uint32 width;
52 uint32 height;
53 bool needToClip;
54 } clipping;
55
56 int timer;
57 float fps; // frame per second
58 float dps; // dlist per second
59 uint32 lastSecFrameCount;
60 uint32 lastSecDlistCount;
61}WindowSettingStruct;
62
63typedef enum
64{
65 PRIM_TRI1,
66 PRIM_TRI2,
67 PRIM_TRI3,
68 PRIM_DMA_TRI,
69 PRIM_LINE3D,
70 PRIM_TEXTRECT,
71 PRIM_TEXTRECTFLIP,
72 PRIM_FILLRECT,
73} PrimitiveType;
74
75typedef enum
76{
77 RSP_SCISSOR,
78 RDP_SCISSOR,
79 UNKNOWN_SCISSOR,
80} CurScissorType;
81
82typedef struct {
83 bool bGameIsRunning;
84 uint32 dwTvSystem;
85 float fRatio;
86
87 BOOL frameReadByCPU;
88 BOOL frameWriteByCPU;
89
90 uint32 SPCycleCount; // Count how many CPU cycles SP used in this DLIST
91 uint32 DPCycleCount; // Count how many CPU cycles DP used in this DLIST
92
93 uint32 dwNumTrisRendered;
94 uint32 dwNumDListsCulled;
95 uint32 dwNumTrisClipped;
96 uint32 dwNumVertices;
97 uint32 dwBiggestVertexIndex;
98
99 uint32 gDlistCount;
100 uint32 gFrameCount;
101 uint32 gUcodeCount;
102 uint32 gRDPTime;
103 BOOL ToToggleFullScreen;
104 bool ToResize;
105 uint32 gNewResizeWidth, gNewResizeHeight;
106 bool bDisableFPS;
107
108 bool bUseModifiedUcodeMap;
109 bool ucodeHasBeenSet;
110 bool bUcodeIsKnown;
111
112 uint32 curRenderBuffer;
113 uint32 curDisplayBuffer;
114 uint32 curVIOriginReg;
115 CurScissorType curScissor;
116
117 PrimitiveType primitiveType;
118
119 uint32 lastPurgeTimeTime; // Time textures were last purged
120
121 bool UseLargerTile[2]; // This is a speed up for large tile loading,
122 uint32 LargerTileRealLeft[2]; // works only for TexRect, LoadTile, large width, large pitch
123
124 bool bVIOriginIsUpdated;
125 bool bCIBufferIsRendered;
126 int leftRendered,topRendered,rightRendered,bottomRendered;
127
128 bool isMMXSupported;
129 bool isSSESupported;
130 bool isVertexShaderSupported;
131
132 bool isMMXEnabled;
133 bool isSSEEnabled;
134 bool isVertexShaderEnabled;
135 bool bUseHW_T_L; // Use hardware T&L, for debug purpose only
136
137 bool toShowCFB;
138
139 bool bAllowLoadFromTMEM;
140
141 // Frame buffer simulation related status variables
142 bool bN64FrameBufferIsUsed; // Frame buffer is used in the frame
143 bool bN64IsDrawingTextureBuffer; // The current N64 game is rendering into render_texture, to create self-rendering texture
144 bool bHandleN64RenderTexture; // Do we need to handle of the N64 render_texture stuff?
145 bool bDirectWriteIntoRDRAM; // When drawing into render_texture, this value =
146 // = true don't render, but write real N64 graphic value into RDRAM
147 // = false rendering into render_texture of DX or OGL, the render_texture
148 // will be copied into RDRAM at the end
149 bool bFrameBufferIsDrawn; // flag to mark if the frame buffer is ever drawn
150 bool bFrameBufferDrawnByTriangles; // flag to tell if the buffer is even drawn by Triangle cmds
151
152 bool bScreenIsDrawn;
153
154} PluginStatus;
155
156#define MI_INTR_DP 0x00000020
157#define MI_INTR_SP 0x00000001
158
159extern PluginStatus status;
160extern GFX_INFO g_GraphicsInfo;
161extern WindowSettingStruct windowSetting;
162
163extern unsigned int g_dwRamSize;
164extern unsigned int *g_pRDRAMu32;
165extern signed char *g_pRDRAMs8;
166extern unsigned char *g_pRDRAMu8;
167
168/* declarations of pointers to Core config functions */
169extern ptr_ConfigListSections ConfigListSections;
170extern ptr_ConfigOpenSection ConfigOpenSection;
171extern ptr_ConfigListParameters ConfigListParameters;
172extern ptr_ConfigSaveFile ConfigSaveFile;
173extern ptr_ConfigSetParameter ConfigSetParameter;
174extern ptr_ConfigGetParameter ConfigGetParameter;
175extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;
176extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt;
177extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat;
178extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool;
179extern ptr_ConfigSetDefaultString ConfigSetDefaultString;
180extern ptr_ConfigGetParamInt ConfigGetParamInt;
181extern ptr_ConfigGetParamFloat ConfigGetParamFloat;
182extern ptr_ConfigGetParamBool ConfigGetParamBool;
183extern ptr_ConfigGetParamString ConfigGetParamString;
184
185extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath;
186extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath;
187extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath;
188extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath;
189
190/* declarations of pointers to Core video extension functions */
191extern ptr_VidExt_Init CoreVideo_Init;
192extern ptr_VidExt_Quit CoreVideo_Quit;
193extern ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes;
194extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode;
195extern ptr_VidExt_SetCaption CoreVideo_SetCaption;
196extern ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen;
197extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow;
198extern ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress;
199extern ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute;
200extern ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute;
201extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers;
202
203/* global functions provided by Video.cpp */
204extern char generalText[];
205extern void (*renderCallback)(int);
206void DebugMessage(int level, const char *message, ...);
207
208void SetVIScales();
209extern void _VIDEO_DisplayTemporaryMessage2(const char *msg, ...);
210extern void _VIDEO_DisplayTemporaryMessage(const char *msg);
211extern void XBOX_Debugger_Log(const char *Message, ...);
212
213#endif
214