| 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 _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 | |
| 29 | typedef 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 | |
| 60 | typedef 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 | |
| 72 | typedef enum |
| 73 | { |
| 74 | RSP_SCISSOR, |
| 75 | RDP_SCISSOR, |
| 76 | UNKNOWN_SCISSOR, |
| 77 | } CurScissorType; |
| 78 | |
| 79 | typedef 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 | |
| 156 | extern PluginStatus status; |
| 157 | extern GFX_INFO g_GraphicsInfo; |
| 158 | extern WindowSettingStruct windowSetting; |
| 159 | |
| 160 | extern unsigned int g_dwRamSize; |
| 161 | extern unsigned int *g_pRDRAMu32; |
| 162 | extern signed char *g_pRDRAMs8; |
| 163 | extern unsigned char *g_pRDRAMu8; |
| 164 | |
| 165 | /* declarations of pointers to Core config functions */ |
| 166 | extern ptr_ConfigListSections ConfigListSections; |
| 167 | extern ptr_ConfigOpenSection ConfigOpenSection; |
| 168 | extern ptr_ConfigListParameters ConfigListParameters; |
| 169 | extern ptr_ConfigSaveFile ConfigSaveFile; |
| 170 | extern ptr_ConfigSetParameter ConfigSetParameter; |
| 171 | extern ptr_ConfigGetParameter ConfigGetParameter; |
| 172 | extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; |
| 173 | extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt; |
| 174 | extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat; |
| 175 | extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool; |
| 176 | extern ptr_ConfigSetDefaultString ConfigSetDefaultString; |
| 177 | extern ptr_ConfigGetParamInt ConfigGetParamInt; |
| 178 | extern ptr_ConfigGetParamFloat ConfigGetParamFloat; |
| 179 | extern ptr_ConfigGetParamBool ConfigGetParamBool; |
| 180 | extern ptr_ConfigGetParamString ConfigGetParamString; |
| 181 | |
| 182 | extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath; |
| 183 | extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath; |
| 184 | extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath; |
| 185 | extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath; |
| 186 | |
| 187 | /* declarations of pointers to Core video extension functions */ |
| 188 | extern ptr_VidExt_Init CoreVideo_Init; |
| 189 | extern ptr_VidExt_Quit CoreVideo_Quit; |
| 190 | extern ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes; |
| 191 | extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode; |
| 192 | extern ptr_VidExt_SetCaption CoreVideo_SetCaption; |
| 193 | extern ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen; |
| 194 | extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow; |
| 195 | extern ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress; |
| 196 | extern ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute; |
| 197 | extern ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute; |
| 198 | extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers; |
| 199 | |
| 200 | /* global functions provided by Video.cpp */ |
| 201 | extern char generalText[]; |
| 202 | extern void (*renderCallback)(int); |
| 203 | void DebugMessage(int level, const char *message, ...); |
| 204 | |
| 205 | void SetVIScales(); |
| 206 | extern void _VIDEO_DisplayTemporaryMessage2(const char *msg, ...); |
| 207 | extern void _VIDEO_DisplayTemporaryMessage(const char *msg); |
| 208 | extern void XBOX_Debugger_Log(const char *Message, ...); |
| 209 | |
| 210 | #endif |
| 211 | |