Commits

Anonymous committed 79bb043

1. Update msvc11 project file to visual studio 2012 (msvc11)
2. fixed warnings and errors in vs2012

  • Participants
  • Parent commits df6c3f3

Comments (0)

Files changed (10)

File projects/msvc10/mupen64plus-video-glide64mk2.vcxproj

-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{A4D13408-A794-4199-8FC7-4A9A32505005}</ProjectGuid>
-    <RootNamespace>n64Glide</RootNamespace>
-    <ProjectName>mupen64plus-video-glide64mk2</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings" />
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
-    <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">F:\Code\Third Party\boost;$(IncludePath)</IncludePath>
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">F:\Code\Third Party\boost\stage\lib;$(LibraryPath)</LibraryPath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Debug/n64Glide.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(WXDIR)\lib\vc_lib\msw;$(WXDIR)\include;..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExceptionHandling>Async</ExceptionHandling>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeaderOutputFile>.\Debug/n64Glide.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>3dmathSIMD.obj;Texture.obj;FixedPoint.obj;glide3x.lib;wxmsw28d_core.lib;wxbase28d.lib;wxexpatd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)Glide64.dll</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>..\lib;$(WXDIR)\lib\vc_lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Debug/Glide64.pdb</ProgramDatabaseFile>
-      <ImportLibrary>.\Debug/Glide64.lib</ImportLibrary>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/n64Glide.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Release/n64Glide.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
-      <AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\include;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;__VISUALC__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <ExceptionHandling>Async</ExceptionHandling>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
-      <PrecompiledHeaderOutputFile>.\Release/n64Glide.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>SDL.lib;zlib.lib;libpng.lib;opengl32.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrt.lib;LIBCMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\libpng-1.2.37\lib;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\lib;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
-      <ImportLibrary>
-      </ImportLibrary>
-      <TargetMachine>MachineX86</TargetMachine>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/n64Glide.bsc</OutputFile>
-    </Bscmake>
-    <MASM>
-      <EnableMASM51Compatibility>true</EnableMASM51Compatibility>
-    </MASM>
-    <PostBuildEvent>
-      <Message>Copying shared data and libraries to build directory...</Message>
-      <Command>copy ..\..\data\* "$(OutDir)"</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\..\src\Glide64\3dmath.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Combine.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Config.cpp" />
-    <ClCompile Include="..\..\src\Glide64\CRC.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Debugger.cpp" />
-    <ClCompile Include="..\..\src\Glide64\DepthBufferRender.cpp" />
-    <ClCompile Include="..\..\src\Glide64\FBtoScreen.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Ini.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Keys.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Main.cpp" />
-    <ClCompile Include="..\..\src\Glide64\osal_dynamiclib_win32.c" />
-    <ClCompile Include="..\..\src\Glide64\rdp.cpp" />
-    <ClCompile Include="..\..\src\Glide64\TexBuffer.cpp" />
-    <ClCompile Include="..\..\src\Glide64\TexCache.cpp" />
-    <ClCompile Include="..\..\src\Glide64\Util.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\Ext_TxFilter.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\dxtn.c" />
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\fxt1.c" />
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\texstore.c" />
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\wrapper.c" />
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_2xsai.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq2x.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq4x.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxCache.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxDbg.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxFilter.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxFilterExport.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxHiResCache.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxImage.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxQuantize.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxReSample.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxTexCache.cpp" />
-    <ClCompile Include="..\..\src\GlideHQ\TxUtil.cpp" />
-    <ClCompile Include="..\..\src\Glitch64\combiner.cpp" />
-    <ClCompile Include="..\..\src\Glitch64\geometry.cpp" />
-    <ClCompile Include="..\..\src\Glitch64\main.cpp">
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release/%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glitch64\textures.cpp" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets" />
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A4D13408-A794-4199-8FC7-4A9A32505005}</ProjectGuid>
+    <RootNamespace>n64Glide</RootNamespace>
+    <ProjectName>mupen64plus-video-glide64mk2</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v110</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v110</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings" />
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
+    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">F:\Code\Third Party\boost;$(IncludePath)</IncludePath>
+    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">F:\Code\Third Party\boost\stage\lib;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Debug/n64Glide.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\src\Glitch64\inc;..\..\..\mupen64plus-win32-deps\boost-1.53.0\;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>.\Debug/n64Glide.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>opengl32.lib;glu32.lib;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\lib\libpng.lib;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\lib\zlib.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>..\lib;..\..\..\mupen64plus-win32-deps\boost-1.53.0\boost\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/Glide64.pdb</ProgramDatabaseFile>
+      <ImportLibrary>.\Debug/Glide64.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug/n64Glide.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Release/n64Glide.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
+      <AdditionalIncludeDirectories>..\..\..\mupen64plus-win32-deps\boost-1.53.0\;..\..\..\mupen64plus-core\src\api;..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\include;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;__VISUALC__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <PrecompiledHeaderOutputFile>.\Release/n64Glide.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>SDL.lib;zlib.lib;libpng.lib;opengl32.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrt.lib;LIBCMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\boost-1.53.0\boost\libs;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\lib;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\lib;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <ImportLibrary>
+      </ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/n64Glide.bsc</OutputFile>
+    </Bscmake>
+    <MASM>
+      <EnableMASM51Compatibility>true</EnableMASM51Compatibility>
+    </MASM>
+    <PostBuildEvent>
+      <Message>Copying shared data and libraries to build directory...</Message>
+      <Command>copy ..\..\data\* "$(OutDir)"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\Glide64\3dmath.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Combine.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Config.cpp" />
+    <ClCompile Include="..\..\src\Glide64\CRC.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Debugger.cpp" />
+    <ClCompile Include="..\..\src\Glide64\DepthBufferRender.cpp" />
+    <ClCompile Include="..\..\src\Glide64\FBtoScreen.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Ini.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Keys.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Main.cpp" />
+    <ClCompile Include="..\..\src\Glide64\osal_dynamiclib_win32.c" />
+    <ClCompile Include="..\..\src\Glide64\rdp.cpp" />
+    <ClCompile Include="..\..\src\Glide64\TexBuffer.cpp" />
+    <ClCompile Include="..\..\src\Glide64\TexCache.cpp" />
+    <ClCompile Include="..\..\src\Glide64\Util.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\Ext_TxFilter.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\dxtn.c" />
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\fxt1.c" />
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\texstore.c" />
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\wrapper.c" />
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_2xsai.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq2x.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq4x.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxCache.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxDbg.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxFilter.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxFilterExport.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxHiResCache.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxImage.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxQuantize.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxReSample.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxTexCache.cpp" />
+    <ClCompile Include="..\..\src\GlideHQ\TxUtil.cpp" />
+    <ClCompile Include="..\..\src\Glitch64\combiner.cpp" />
+    <ClCompile Include="..\..\src\Glitch64\geometry.cpp" />
+    <ClCompile Include="..\..\src\Glitch64\glitchmain.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release/%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glitch64\textures.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets" />
+</Project>

File projects/msvc10/mupen64plus-video-glide64mk2.vcxproj.filters

-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Glitch64">
-      <UniqueIdentifier>{44b9ea4e-bb1f-45ef-9b11-c93aace0416c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="GlideHQ">
-      <UniqueIdentifier>{daabfc00-53db-4996-9c67-80f7092cb54f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="GlideHQ\tc-1.1+">
-      <UniqueIdentifier>{8e81e299-f474-448c-a104-5149bffd92f4}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Glide64">
-      <UniqueIdentifier>{d0e07863-9ec2-4409-a91e-bddc436aa16b}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Glide64\Windows">
-      <UniqueIdentifier>{c6ba9864-aee3-4434-954b-8c5679c2959c}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="..\..\src\Glitch64\geometry.cpp">
-      <Filter>Glitch64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glitch64\textures.cpp">
-      <Filter>Glitch64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glitch64\combiner.cpp">
-      <Filter>Glitch64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq4x.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxCache.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxDbg.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxFilter.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxFilterExport.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxHiResCache.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxImage.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxQuantize.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxReSample.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxTexCache.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TxUtil.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\Ext_TxFilter.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_2xsai.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq2x.cpp">
-      <Filter>GlideHQ</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\texstore.c">
-      <Filter>GlideHQ\tc-1.1+</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\wrapper.c">
-      <Filter>GlideHQ\tc-1.1+</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\dxtn.c">
-      <Filter>GlideHQ\tc-1.1+</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\fxt1.c">
-      <Filter>GlideHQ\tc-1.1+</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Util.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\3dmath.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Combine.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Config.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\CRC.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Debugger.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\DepthBufferRender.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\FBtoScreen.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Ini.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Keys.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\Main.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\rdp.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\TexBuffer.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\TexCache.cpp">
-      <Filter>Glide64</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glide64\osal_dynamiclib_win32.c">
-      <Filter>Glide64\Windows</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\Glitch64\main.cpp">
-      <Filter>Glitch64</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Glitch64">
+      <UniqueIdentifier>{44b9ea4e-bb1f-45ef-9b11-c93aace0416c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="GlideHQ">
+      <UniqueIdentifier>{daabfc00-53db-4996-9c67-80f7092cb54f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="GlideHQ\tc-1.1+">
+      <UniqueIdentifier>{8e81e299-f474-448c-a104-5149bffd92f4}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Glide64">
+      <UniqueIdentifier>{d0e07863-9ec2-4409-a91e-bddc436aa16b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Glide64\Windows">
+      <UniqueIdentifier>{c6ba9864-aee3-4434-954b-8c5679c2959c}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\Glitch64\geometry.cpp">
+      <Filter>Glitch64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glitch64\textures.cpp">
+      <Filter>Glitch64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glitch64\combiner.cpp">
+      <Filter>Glitch64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq4x.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxCache.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxDbg.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxFilter.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxFilterExport.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxHiResCache.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxImage.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxQuantize.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxReSample.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxTexCache.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TxUtil.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\Ext_TxFilter.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_2xsai.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq2x.cpp">
+      <Filter>GlideHQ</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\texstore.c">
+      <Filter>GlideHQ\tc-1.1+</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\wrapper.c">
+      <Filter>GlideHQ\tc-1.1+</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\dxtn.c">
+      <Filter>GlideHQ\tc-1.1+</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\GlideHQ\tc-1.1+\fxt1.c">
+      <Filter>GlideHQ\tc-1.1+</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Util.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\3dmath.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Combine.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Config.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\CRC.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Debugger.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\DepthBufferRender.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\FBtoScreen.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Ini.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Keys.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\Main.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\rdp.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\TexBuffer.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\TexCache.cpp">
+      <Filter>Glide64</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glide64\osal_dynamiclib_win32.c">
+      <Filter>Glide64\Windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\Glitch64\glitchmain.cpp">
+      <Filter>Glitch64</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

File src/Glide64/3dmath.cpp

   {
 #ifndef _DEBUG
     int IsSSE = FALSE;
+#if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
     int edx, eax;
-#if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
     GLIDE64_TRY
     {
   #if defined(__x86_64__)

File src/Glide64/Ini.cpp

 #endif
 
 #ifdef _WIN32
-#define PATH_MAX _MAX_PATH
+  #define PATH_MAX _MAX_PATH
+  #define stricmp _stricmp
 #endif
 
 FILE *ini;

File src/Glide64/Main.cpp

 
 int InitGfx ()
 {
+#ifdef TEXTURE_FILTER
   wchar_t romname[256];
   wchar_t foldername[PATH_MAX + 64];
   wchar_t cachename[PATH_MAX + 64];
+#endif
   if (fullscreen)
     ReleaseGfx ();
 

File src/Glide64/TexCache.cpp

   for (; height; height--) {
     for (i = width; i; --i) {
       twopixel_crc = i * (uint64_t)(pixelpos[1] + pixelpos[0] + crc);
-      crc = (twopixel_crc >> 32) + twopixel_crc;
+      crc = (uint32_t) ((twopixel_crc >> 32) + twopixel_crc);
       pixelpos += 2;
     }
     crc = ((unsigned int)height * (uint64_t)crc >> 32) + height * crc;

File src/Glide64/rdp.h

 #define uc(x) coord[x<<1]
 #define vc(x) coord[(x<<1)+1]
 
-#if defined __VISUALC__
-#define DECLAREALIGN16VAR(var) __declspec(align(16)) float (var)
-#elif defined __GNUG__
+#if defined(_MSC_VER)
+#define DECLAREALIGN16VAR(var) __declspec(align(16)) float var
+#elif defined(__GNUG__)
 #define DECLAREALIGN16VAR(var) float (var) __attribute__ ((aligned(16)))
 #endif
 

File src/GlideHQ/TxImage.cpp

   uint8 *image = NULL;
   uint8 *image_row = NULL;
   uint8 *tmpimage = NULL;
-  unsigned int row_bytes, pos, i, j;
+  unsigned int row_bytes, pos;
+  int i, j;
   /* Windows Bitmap */
   BITMAPFILEHEADER bmp_fhdr;
   BITMAPINFOHEADER bmp_ihdr;
         if (fread(image_row, 1, row_bytes, fp) != row_bytes)
             ERRLOG("fread failed for row of '%i' bytes in 4-bit BMP image", row_bytes);
         /* expand 4bpp to 8bpp. stuff 4bit values into 8bit comps. */
-        for (j = 0; j < row_bytes; j++) {
+        for (j = 0; j < (int) row_bytes; j++) {
           tmpimage[j << 1] = image_row[j] & 0x0f;
           tmpimage[(j << 1) + 1] = (image_row[j] & 0xf0) >> 4;
         }

File src/Glitch64/glitchmain.cpp

+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002  Dave2001
+* Copyright (c) 2003-2009  Sergey 'Gonetz' Lipski
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#define SAVE_CBUFFER
+
+#ifdef _WIN32
+#include <windows.h>
+#include <commctrl.h>
+#else
+#include <stdint.h>
+#include <stdarg.h>
+#include <string.h>
+#include <SDL.h>
+#endif // _WIN32
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+#include <math.h>
+#include "glide.h"
+#include "g3ext.h"
+#include "main.h"
+#include "m64p.h"
+
+#ifdef VPDEBUG
+#include <IL/il.h>
+#endif
+
+extern void (*renderCallback)(int);
+
+wrapper_config config = {0, 0, 0, 0};
+int screen_width, screen_height;
+
+static inline void opt_glCopyTexImage2D( GLenum target,
+                                        GLint level,
+                                        GLenum internalFormat,
+                                        GLint x,
+                                        GLint y,
+                                        GLsizei width,
+                                        GLsizei height,
+                                        GLint border )
+
+{
+  int w, h, fmt;
+  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
+  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
+  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
+  //printf("copyteximage %dx%d fmt %x oldfmt %x\n", width, height, internalFormat, fmt);
+  if (w == (int) width && h == (int) height && fmt == (int) internalFormat) {
+    if (x+width >= screen_width) {
+      width = screen_width - x;
+      //printf("resizing w --> %d\n", width);
+    }
+    if (y+height >= screen_height+viewport_offset) {
+      height = screen_height+viewport_offset - y;
+      //printf("resizing h --> %d\n", height);
+    }
+    glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
+  } else {
+    //printf("copyteximage %dx%d fmt %x old %dx%d oldfmt %x\n", width, height, internalFormat, w, h, fmt);
+    //       glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, internalFormat, GL_UNSIGNED_BYTE, 0);
+    //       glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
+    //       printf("--> %dx%d newfmt %x\n", width, height, fmt);
+    glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
+  }
+}
+#define glCopyTexImage2D opt_glCopyTexImage2D
+
+
+#ifdef _WIN32
+PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
+PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
+PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
+PFNGLFOGCOORDFPROC glFogCoordfEXT;
+
+PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
+
+PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
+PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
+PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
+PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
+PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
+PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
+PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
+PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
+PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
+PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
+
+PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
+PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
+PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
+PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
+PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
+PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
+PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
+PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
+PFNGLUNIFORM1IARBPROC glUniform1iARB;
+PFNGLUNIFORM4IARBPROC glUniform4iARB;
+PFNGLUNIFORM4FARBPROC glUniform4fARB;
+PFNGLUNIFORM1FARBPROC glUniform1fARB;
+PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
+PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
+PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
+PFNGLSECONDARYCOLOR3FPROC glSecondaryColor3f;
+
+// FXT1,DXT1,DXT5 support - Hiroshi Morii <koolsmoky(at)users.sourceforge.net>
+// NOTE: Glide64 + GlideHQ use the following formats
+// GL_COMPRESSED_RGB_S3TC_DXT1_EXT
+// GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
+// GL_COMPRESSED_RGB_FXT1_3DFX
+// GL_COMPRESSED_RGBA_FXT1_3DFX
+PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2DARB;
+#endif // _WIN32
+
+
+
+typedef struct
+{
+  unsigned int address;
+  int width;
+  int height;
+  unsigned int fbid;
+  unsigned int zbid;
+  unsigned int texid;
+  int buff_clear;
+} fb;
+
+int nbTextureUnits;
+int nbAuxBuffers, current_buffer;
+int width, widtho, heighto, height;
+int saved_width, saved_height;
+int blend_func_separate_support;
+int npot_support;
+int fog_coord_support;
+int render_to_texture = 0;
+int texture_unit;
+int use_fbo;
+int buffer_cleared;
+// ZIGGY
+// to allocate a new static texture name, take the value (free_texture++)
+int free_texture;
+int default_texture; // the infamous "32*1024*1024" is now configurable
+int current_texture;
+int depth_texture, color_texture;
+int glsl_support = 1;
+int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0;
+int save_w, save_h;
+int lfb_color_fmt;
+float invtex[2];
+//Gonetz
+int UMAmode = 0; //support for VSA-100 UMA mode;
+
+#ifdef _WIN32
+static HDC hDC = NULL;
+static HGLRC hGLRC = NULL;
+static HWND hToolBar = NULL;
+static HWND hwnd_win = NULL;
+static unsigned long windowedExStyle, windowedStyle;
+#endif // _WIN32
+static unsigned long fullscreen;
+#ifdef _WIN32
+static RECT windowedRect;
+static HMENU windowedMenu;
+#endif // _WIN32
+
+static int savedWidtho, savedHeighto;
+static int savedWidth, savedHeight;
+unsigned int pBufferAddress;
+static int pBufferFmt;
+static int pBufferWidth, pBufferHeight;
+static fb fbs[100];
+static int nb_fb = 0;
+static unsigned int curBufferAddr = 0;
+
+struct TMU_USAGE { int min, max; } tmu_usage[2] = { {0xfffffff, 0}, {0xfffffff, 0} };
+
+struct texbuf_t {
+  FxU32 start, end;
+  int fmt;
+};
+#define NB_TEXBUFS 128 // MUST be a power of two
+static texbuf_t texbufs[NB_TEXBUFS];
+static int texbuf_i;
+
+unsigned short frameBuffer[2048*2048];
+unsigned short depthBuffer[2048*2048];
+
+//#define VOODOO1
+
+void display_warning(const char *text, ...)
+{
+  static int first_message = 100;
+  if (first_message)
+  {
+    char buf[1000];
+
+    va_list ap;
+
+    va_start(ap, text);
+    vsprintf(buf, text, ap);
+    va_end(ap);
+    first_message--;
+  }
+}
+
+#ifdef _WIN32
+void display_error()
+{
+  LPVOID lpMsgBuf;
+  if (!FormatMessage(
+    FORMAT_MESSAGE_ALLOCATE_BUFFER |
+    FORMAT_MESSAGE_FROM_SYSTEM |
+    FORMAT_MESSAGE_IGNORE_INSERTS,
+    NULL,
+    GetLastError(),
+    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+    (LPTSTR) &lpMsgBuf,
+    0,
+    NULL ))
+  {
+    // Handle the error.
+    return;
+  }
+  // Process any inserts in lpMsgBuf.
+  // ...
+  // Display the string.
+  MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
+
+  // Free the buffer.
+  LocalFree( lpMsgBuf );
+}
+#endif // _WIN32
+
+#ifdef LOGGING
+char out_buf[256];
+bool log_open = false;
+std::ofstream log_file;
+
+void OPEN_LOG()
+{
+  if (!log_open)
+  {
+    log_file.open ("wrapper_log.txt", std::ios_base::out|std::ios_base::app);
+    log_open = true;
+  }
+}
+
+void CLOSE_LOG()
+{
+  if (log_open)
+  {
+    log_file.close();
+    log_open = false;
+  }
+}
+
+void LOG(const char *text, ...)
+{
+#ifdef VPDEBUG
+  if (!dumping) return;
+#endif
+	if (!log_open)
+    return;
+	va_list ap;
+	va_start(ap, text);
+	vsprintf(out_buf, text, ap);
+  log_file << out_buf;
+  log_file.flush();
+	va_end(ap);
+}
+
+class LogManager {
+public:
+	LogManager() {
+		OPEN_LOG();
+	}
+	~LogManager() {
+		CLOSE_LOG();
+	}
+};
+
+LogManager logManager;
+
+#else // LOGGING
+#define OPEN_LOG()
+#define CLOSE_LOG()
+//#define LOG
+#endif // LOGGING
+
+FX_ENTRY void FX_CALL
+grSstOrigin(GrOriginLocation_t  origin)
+{
+  LOG("grSstOrigin(%d)\r\n", origin);
+  if (origin != GR_ORIGIN_UPPER_LEFT)
+    display_warning("grSstOrigin : %x", origin);
+}
+
+FX_ENTRY void FX_CALL
+grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy )
+{
+  LOG("grClipWindow(%d,%d,%d,%d)\r\n", minx, miny, maxx, maxy);
+
+  if (use_fbo && render_to_texture) {
+    if (int(minx) < 0) minx = 0;
+    if (int(miny) < 0) miny = 0;
+    if (maxx < minx) maxx = minx;
+    if (maxy < miny) maxy = miny;
+    glScissor(minx, miny, maxx - minx, maxy - miny);
+    glEnable(GL_SCISSOR_TEST);
+    return;
+  }
+
+  if (!use_fbo) {
+    int th = height;
+    if (th > screen_height)
+      th = screen_height;
+    maxy = th - maxy;
+    miny = th - miny;
+    FxU32 tmp = maxy; maxy = miny; miny = tmp;
+    if (maxx > (FxU32) width) maxx = width;
+    if (maxy > (FxU32) height) maxy = height;
+    if (int(minx) < 0) minx = 0;
+    if (int(miny) < 0) miny = 0;
+    if (maxx < minx) maxx = minx;
+    if (maxy < miny) maxy = miny;
+    glScissor(minx, miny+viewport_offset, maxx - minx, maxy - miny);
+    //printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
+  } else {
+    glScissor(minx, (viewport_offset)+height-maxy, maxx - minx, maxy - miny);
+  }
+  glEnable(GL_SCISSOR_TEST);
+}
+
+FX_ENTRY void FX_CALL
+grColorMask( FxBool rgb, FxBool a )
+{
+  LOG("grColorMask(%d, %d)\r\n", rgb, a);
+  glColorMask(rgb, rgb, rgb, a);
+}
+
+FX_ENTRY void FX_CALL
+grGlideInit( void )
+{
+  LOG("grGlideInit()\r\n");
+}
+
+FX_ENTRY void FX_CALL
+grSstSelect( int which_sst )
+{
+  LOG("grSstSelect(%d)\r\n", which_sst);
+}
+
+int isExtensionSupported(const char *extension)
+{
+  const GLubyte *extensions = NULL;
+  const GLubyte *start;
+  GLubyte *where, *terminator;
+
+  where = (GLubyte *)strchr(extension, ' ');
+  if (where || *extension == '\0')
+    return 0;
+
+  extensions = glGetString(GL_EXTENSIONS);
+
+  start = extensions;
+  for (;;)
+  {
+    where = (GLubyte *) strstr((const char *) start, extension);
+    if (!where)
+      break;
+
+    terminator = where + strlen(extension);
+    if (where == start || *(where - 1) == ' ')
+      if (*terminator == ' ' || *terminator == '\0')
+        return 1;
+
+    start = terminator;
+  }
+
+  return 0;
+}
+
+#ifdef _WIN32
+int isWglExtensionSupported(const char *extension)
+{
+  const GLubyte *extensions = NULL;
+  const GLubyte *start;
+  GLubyte *where, *terminator;
+
+  where = (GLubyte *)strchr(extension, ' ');
+  if (where || *extension == '\0')
+    return 0;
+
+  extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC());
+
+  start = extensions;
+  for (;;)
+  {
+    where = (GLubyte *) strstr((const char *) start, extension);
+    if (!where)
+      break;
+
+    terminator = where + strlen(extension);
+    if (where == start || *(where - 1) == ' ')
+      if (*terminator == ' ' || *terminator == '\0')
+        return 1;
+
+    start = terminator;
+  }
+
+  return 0;
+}
+#endif // _WIN32
+
+#define GrPixelFormat_t int
+
+FX_ENTRY GrContext_t FX_CALL
+grSstWinOpenExt(
+                HWND                 hWnd,
+                GrScreenResolution_t screen_resolution,
+                GrScreenRefresh_t    refresh_rate,
+                GrColorFormat_t      color_format,
+                GrOriginLocation_t   origin_location,
+                GrPixelFormat_t      pixelformat,
+                int                  nColBuffers,
+                int                  nAuxBuffers)
+{
+  LOG("grSstWinOpenExt(%d, %d, %d, %d, %d, %d %d)\r\n", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
+  return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format,
+    origin_location, nColBuffers, nAuxBuffers);
+}
+
+#ifdef WIN32
+# include <fcntl.h>
+# ifndef ATTACH_PARENT_PROCESS
+#  define ATTACH_PARENT_PROCESS ((FxU32)-1)
+# endif
+#endif
+
+FX_ENTRY GrContext_t FX_CALL
+grSstWinOpen(
+             HWND                 hWnd,
+             GrScreenResolution_t screen_resolution,
+             GrScreenRefresh_t    refresh_rate,
+             GrColorFormat_t      color_format,
+             GrOriginLocation_t   origin_location,
+             int                  nColBuffers,
+             int                  nAuxBuffers)
+{
+  static int show_warning = 1;
+
+  // ZIGGY
+  // allocate static texture names
+  // the initial value should be big enough to support the maximal resolution
+  free_texture = 32*2048*2048;
+  default_texture = free_texture++;
+  color_texture = free_texture++;
+  depth_texture = free_texture++;
+
+  LOG("grSstWinOpen(%08lx, %d, %d, %d, %d, %d %d)\r\n", hWnd, screen_resolution&~0x80000000, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
+
+#ifdef _WIN32
+  if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
+  hwnd_win = (HWND)hWnd;
+#endif // _WIN32
+  width = height = 0;
+
+  m64p_handle video_general_section;
+  printf("&ConfigOpenSection is %p\n", &ConfigOpenSection);
+  if (ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS)
+  {
+    printf("Could not open video settings");
+    return false;
+  }
+  width = ConfigGetParamInt(video_general_section, "ScreenWidth");
+  height = ConfigGetParamInt(video_general_section, "ScreenHeight");
+  fullscreen = ConfigGetParamBool(video_general_section, "Fullscreen");
+  int vsync = ConfigGetParamBool(video_general_section, "VerticalSync");
+  //viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
+  // ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero
+  viewport_offset = 0; //-10 //-20;
+
+  // ZIGGY not sure, but it might be better to let the system choose
+  CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1);
+  CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, vsync);
+  CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, 16);
+  //   SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
+  //   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+  //   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+  //   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+  //   SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+  CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, 16);
+
+  printf("(II) Setting video mode %dx%d...\n", width, height);
+  if(CoreVideo_SetVideoMode(width, height, 0, fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, (m64p_video_flags) 0) != M64ERR_SUCCESS)
+  {
+    printf("(EE) Error setting videomode %dx%d\n", width, height);
+    return false;
+  }
+
+  char caption[500];
+# ifdef _DEBUG
+  sprintf(caption, "Glide64mk2 debug");
+# else // _DEBUG
+  sprintf(caption, "Glide64mk2");
+# endif // _DEBUG
+  CoreVideo_SetCaption(caption);
+
+  glViewport(0, viewport_offset, width, height);
+  lfb_color_fmt = color_format;
+  if (origin_location != GR_ORIGIN_UPPER_LEFT) display_warning("origin must be in upper left corner");
+  if (nColBuffers != 2) display_warning("number of color buffer is not 2");
+  if (nAuxBuffers != 1) display_warning("number of auxiliary buffer is not 1");
+
+  if (isExtensionSupported("GL_ARB_texture_env_combine") == 0 &&
+    isExtensionSupported("GL_EXT_texture_env_combine") == 0 &&
+    show_warning)
+    display_warning("Your video card doesn't support GL_ARB_texture_env_combine extension");
+  if (isExtensionSupported("GL_ARB_multitexture") == 0 && show_warning)
+    display_warning("Your video card doesn't support GL_ARB_multitexture extension");
+  if (isExtensionSupported("GL_ARB_texture_mirrored_repeat") == 0 && show_warning)
+    display_warning("Your video card doesn't support GL_ARB_texture_mirrored_repeat extension");
+  show_warning = 0;
+
+#ifdef _WIN32
+  glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
+  glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB");
+#endif // _WIN32
+
+  nbTextureUnits = 0;
+  glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &nbTextureUnits);
+  if (nbTextureUnits == 1) display_warning("You need a video card that has at least 2 texture units");
+
+  nbAuxBuffers = 0;
+  glGetIntegerv(GL_AUX_BUFFERS, &nbAuxBuffers);
+  if (nbAuxBuffers > 0)
+    printf("Congratulations, you have %d auxilliary buffers, we'll use them wisely !\n", nbAuxBuffers);
+
+#ifdef VOODOO1
+  nbTextureUnits = 2;
+#endif
+
+  if (isExtensionSupported("GL_EXT_blend_func_separate") == 0)
+    blend_func_separate_support = 0;
+  else
+    blend_func_separate_support = 1;
+
+  if (isExtensionSupported("GL_EXT_packed_pixels") == 0)
+    packed_pixels_support = 0;
+  else {
+    printf("packed pixels extension used\n");
+    packed_pixels_support = 1;
+  }
+
+  if (isExtensionSupported("GL_ARB_texture_non_power_of_two") == 0)
+    npot_support = 0;
+  else {
+    printf("NPOT extension used\n");
+    npot_support = 1;
+  }
+
+#ifdef _WIN32
+  glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)wglGetProcAddress("glBlendFuncSeparateEXT");
+#endif // _WIN32
+
+  if (isExtensionSupported("GL_EXT_fog_coord") == 0)
+    fog_coord_support = 0;
+  else
+    fog_coord_support = 1;
+
+#ifdef _WIN32
+  glFogCoordfEXT = (PFNGLFOGCOORDFPROC)wglGetProcAddress("glFogCoordfEXT");
+#endif // _WIN32
+
+#ifdef _WIN32
+  wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
+#endif // _WIN32
+
+#ifdef _WIN32
+  glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress("glBindFramebufferEXT");
+  glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)wglGetProcAddress("glFramebufferTexture2DEXT");
+  glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
+  glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddress("glCheckFramebufferStatusEXT");
+  glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
+
+  glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress("glBindRenderbufferEXT");
+  glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)wglGetProcAddress("glDeleteRenderbuffersEXT");
+  glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
+  glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
+  glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
+  use_fbo = config.fbo && (glFramebufferRenderbufferEXT != NULL);
+#else
+  use_fbo = config.fbo;
+#endif // _WIN32
+
+  printf("use_fbo %d\n", use_fbo);
+
+  if (isExtensionSupported("GL_ARB_shading_language_100") &&
+    isExtensionSupported("GL_ARB_shader_objects") &&
+    isExtensionSupported("GL_ARB_fragment_shader") &&
+    isExtensionSupported("GL_ARB_vertex_shader"))
+  {
+
+#ifdef _WIN32
+    glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress("glCreateShaderObjectARB");
+    glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress("glShaderSourceARB");
+    glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)wglGetProcAddress("glCompileShaderARB");
+    glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)wglGetProcAddress("glCreateProgramObjectARB");
+    glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)wglGetProcAddress("glAttachObjectARB");
+    glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)wglGetProcAddress("glLinkProgramARB");
+    glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)wglGetProcAddress("glUseProgramObjectARB");
+    glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocationARB");
+    glUniform1iARB = (PFNGLUNIFORM1IARBPROC)wglGetProcAddress("glUniform1iARB");
+    glUniform4iARB = (PFNGLUNIFORM4IARBPROC)wglGetProcAddress("glUniform4iARB");
+    glUniform4fARB = (PFNGLUNIFORM4FARBPROC)wglGetProcAddress("glUniform4fARB");
+    glUniform1fARB = (PFNGLUNIFORM1FARBPROC)wglGetProcAddress("glUniform1fARB");
+    glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)wglGetProcAddress("glDeleteObjectARB");
+    glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)wglGetProcAddress("glGetInfoLogARB");
+    glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB");
+
+    glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)wglGetProcAddress("glSecondaryColor3f");
+#endif // _WIN32
+  }
+
+  if (isExtensionSupported("GL_EXT_texture_compression_s3tc") == 0  && show_warning)
+    display_warning("Your video card doesn't support GL_EXT_texture_compression_s3tc extension");
+  if (isExtensionSupported("GL_3DFX_texture_compression_FXT1") == 0  && show_warning)
+    display_warning("Your video card doesn't support GL_3DFX_texture_compression_FXT1 extension");
+
+#ifdef _WIN32
+  glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)wglGetProcAddress("glCompressedTexImage2DARB");
+#endif
+
+
+#ifdef _WIN32
+  glViewport(0, viewport_offset, width, height);
+  viewport_width = width;
+  viewport_height = height;
+  nvidia_viewport_hack = 1;
+#else
+  glViewport(0, viewport_offset, width, height);
+  viewport_width = width;
+  viewport_height = height;
+#endif // _WIN32
+
+  //   void do_benchmarks();
+  //   do_benchmarks();
+
+  // VP try to resolve z precision issues
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  glTranslatef(0, 0, 1-zscale);
+  glScalef(1, 1, zscale);
+
+  widtho = width/2;
+  heighto = height/2;
+
+  pBufferWidth = pBufferHeight = -1;
+
+  current_buffer = GL_BACK;
+
+  texture_unit = GL_TEXTURE0_ARB;
+
+  {
+    int i;
+    for (i=0; i<NB_TEXBUFS; i++)
+      texbufs[i].start = texbufs[i].end = 0xffffffff;
+  }
+
+  if (!use_fbo && nbAuxBuffers == 0) {
+    // create the framebuffer saving texture
+    int w = width, h = height;
+    glBindTexture(GL_TEXTURE_2D, color_texture);
+    if (!npot_support) {
+      w = h = 1;
+      while (w<width) w*=2;
+      while (h<height) h*=2;
+    }
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
+    glBindTexture(GL_TEXTURE_2D, 0);
+    save_w = save_h = 0;
+  }
+
+  void FindBestDepthBias();
+  FindBestDepthBias();
+
+  init_geometry();
+  init_textures();
+  init_combiner();
+
+  // Aniso filter check
+  if (config.anisofilter > 0 )
+    glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy);
+
+  // ATI hack - certain texture formats are slow on ATI?
+  // Hmm, perhaps the internal format need to be specified explicitly...
+  {
+    GLint ifmt;
+    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
+    glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &ifmt);
+    if (ifmt != GL_RGB5_A1) {
+      display_warning("ATI SUCKS %x\n", ifmt);
+      ati_sucks = 1;
+    } else
+      ati_sucks = 0;
+  }
+
+  return 1;
+}
+
+FX_ENTRY void FX_CALL
+grGlideShutdown( void )
+{
+  LOG("grGlideShutdown\r\n");
+}
+
+FX_ENTRY FxBool FX_CALL
+grSstWinClose( GrContext_t context )
+{
+  int i, clear_texbuff = use_fbo;
+  LOG("grSstWinClose(%d)\r\n", context);
+
+  for (i=0; i<2; i++) {
+    tmu_usage[i].min = 0xfffffff;
+    tmu_usage[i].max = 0;
+    invtex[i] = 0;
+  }
+
+  free_combiners();
+#ifndef WIN32
+  try // I don't know why, but opengl can be killed before this function call when emulator is closed (Gonetz).
+    // ZIGGY : I found the problem : it is a function pointer, when the extension isn't supported , it is then zero, so just need to check the pointer prior to do the call.
+  {
+    if (use_fbo)
+      glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+  }
+  catch (...)
+  {
+    clear_texbuff = 0;
+  }
+
+  if (clear_texbuff)
+  {
+    for (i=0; i<nb_fb; i++)
+    {
+      glDeleteTextures( 1, &(fbs[i].texid) );
+      glDeleteFramebuffersEXT( 1, &(fbs[i].fbid) );
+      glDeleteRenderbuffersEXT( 1, &(fbs[i].zbid) );
+    }
+  }
+#endif
+  nb_fb = 0;
+
+  free_textures();
+#ifndef WIN32
+  // ZIGGY for some reasons, Pj64 doesn't like remove_tex on exit
+  remove_tex(0, 0xfffffff);
+#endif
+
+  //*/
+#ifdef _WIN32
+  if (hGLRC)
+  {
+    wglMakeCurrent(hDC,NULL);
+    wglDeleteContext(hGLRC);
+    hGLRC = NULL;
+  }
+  if (fullscreen)
+  {
+    ChangeDisplaySettings(NULL, 0);
+    SetWindowPos(hwnd_win, NULL,
+      windowedRect.left, windowedRect.top,
+      0, 0,
+      SWP_NOZORDER | SWP_NOSIZE);
+    SetWindowLong(hwnd_win, GWL_STYLE, windowedStyle);
+    SetWindowLong(hwnd_win, GWL_EXSTYLE, windowedExStyle);
+    if (windowedMenu) SetMenu(hwnd_win, windowedMenu);
+    fullscreen = 0;
+  }
+#else
+  //SDL_QuitSubSystem(SDL_INIT_VIDEO);
+  //sleep(2);
+#endif
+  return FXTRUE;
+}
+
+FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t  		tmu,
+                                         FxU32 				startAddress,
+                                         GrLOD_t 			lodmin,
+                                         GrLOD_t 			lodmax,
+                                         GrAspectRatio_t 	aspect,
+                                         GrTextureFormat_t 	fmt,
+                                         FxU32 				evenOdd)
+{
+  int i;
+  static int fbs_init = 0;
+
+  //printf("grTextureBufferExt(%d, %d, %d, %d, %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
+  LOG("grTextureBufferExt(%d, %d, %d, %d %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
+  if (lodmin != lodmax) display_warning("grTextureBufferExt : loading more than one LOD");
+  if (!use_fbo) {
+
+    if (!render_to_texture) { //initialization
+      return;
+    }
+
+    render_to_texture = 2;
+
+    if (aspect < 0)
+    {
+      pBufferHeight = 1 << lodmin;
+      pBufferWidth = pBufferHeight >> -aspect;
+    }
+    else
+    {
+      pBufferWidth = 1 << lodmin;
+      pBufferHeight = pBufferWidth >> aspect;
+    }
+
+    if (curBufferAddr && startAddress+1 != curBufferAddr)
+      updateTexture();
+#ifdef SAVE_CBUFFER
+    //printf("saving %dx%d\n", pBufferWidth, pBufferHeight);
+    // save color buffer
+    if (nbAuxBuffers > 0) {
+      glDrawBuffer(GL_AUX0);
+      current_buffer = GL_AUX0;
+    } else {
+      int tw, th;
+      if (pBufferWidth < screen_width)
+        tw = pBufferWidth;
+      else
+        tw = screen_width;
+      if (pBufferHeight < screen_height)
+        th = pBufferHeight;
+      else
+        th = screen_height;
+      glReadBuffer(GL_BACK);
+      glActiveTextureARB(texture_unit);
+      glBindTexture(GL_TEXTURE_2D, color_texture);
+      // save incrementally the framebuffer
+      if (save_w) {
+        if (tw > save_w && th > save_h) {
+          glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
+            0, viewport_offset+save_h, tw, th-save_h);
+          glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
+            save_w, viewport_offset, tw-save_w, save_h);
+          save_w = tw;
+          save_h = th;
+        } else if (tw > save_w) {
+          glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
+            save_w, viewport_offset, tw-save_w, save_h);
+          save_w = tw;
+        } else if (th > save_h) {
+          glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
+            0, viewport_offset+save_h, save_w, th-save_h);
+          save_h = th;
+        }
+      } else {
+        glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
+          0, viewport_offset, tw, th);
+        save_w = tw;
+        save_h = th;
+      }
+      glBindTexture(GL_TEXTURE_2D, default_texture);
+    }
+#endif
+
+    if (startAddress+1 != curBufferAddr ||
+      (curBufferAddr == 0L && nbAuxBuffers == 0))
+      buffer_cleared = 0;
+
+    curBufferAddr = pBufferAddress = startAddress+1;
+    pBufferFmt = fmt;
+
+    int rtmu = startAddress < grTexMinAddress(GR_TMU1)? 0 : 1;
+    int size = pBufferWidth*pBufferHeight*2; //grTexFormatSize(fmt);
+    if ((unsigned int) tmu_usage[rtmu].min > pBufferAddress)
+      tmu_usage[rtmu].min = pBufferAddress;
+    if ((unsigned int) tmu_usage[rtmu].max < pBufferAddress+size)
+      tmu_usage[rtmu].max = pBufferAddress+size;
+    //   printf("tmu %d usage now %gMb - %gMb\n",
+    //          rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);
+
+
+    width = pBufferWidth;
+    height = pBufferHeight;
+
+    widtho = width/2;
+    heighto = height/2;
+
+    // this could be improved, but might be enough as long as the set of
+    // texture buffer addresses stay small
+    for (i=(texbuf_i-1)&(NB_TEXBUFS-1) ; i!=texbuf_i; i=(i-1)&(NB_TEXBUFS-1))
+      if (texbufs[i].start == pBufferAddress)
+        break;
+    texbufs[i].start = pBufferAddress;
+    texbufs[i].end = pBufferAddress + size;
+    texbufs[i].fmt = fmt;
+    if (i == texbuf_i)
+      texbuf_i = (texbuf_i+1)&(NB_TEXBUFS-1);
+    //printf("texbuf %x fmt %x\n", pBufferAddress, fmt);
+
+    // ZIGGY it speeds things up to not delete the buffers
+    // a better thing would be to delete them *sometimes*
+    //   remove_tex(pBufferAddress+1, pBufferAddress + size);
+    add_tex(pBufferAddress);
+
+    //printf("viewport %dx%d\n", width, height);
+    if (height > screen_height) {
+      glViewport( 0, viewport_offset + screen_height - height, width, height);
+    } else
+      glViewport( 0, viewport_offset, width, height);
+
+    glScissor(0, viewport_offset, width, height);
+
+
+  } else {
+    if (!render_to_texture) //initialization
+    {
+      if(!fbs_init)
+      {
+        for(i=0; i<100; i++) fbs[i].address = 0;
+        fbs_init = 1;
+        nb_fb = 0;
+      }
+      return; //no need to allocate FBO if render buffer is not texture buffer
+    }
+
+    render_to_texture = 2;
+
+    if (aspect < 0)
+    {
+      pBufferHeight = 1 << lodmin;
+      pBufferWidth = pBufferHeight >> -aspect;
+    }
+    else
+    {
+      pBufferWidth = 1 << lodmin;
+      pBufferHeight = pBufferWidth >> aspect;
+    }
+    pBufferAddress = startAddress+1;
+
+    width = pBufferWidth;
+    height = pBufferHeight;
+
+    widtho = width/2;
+    heighto = height/2;
+
+    for (i=0; i<nb_fb; i++)
+    {
+      if (fbs[i].address == pBufferAddress)
+      {
+        if (fbs[i].width == width && fbs[i].height == height) //select already allocated FBO
+        {
+          glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+          glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbs[i].fbid );
+          glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fbs[i].texid, 0 );
+          glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, fbs[i].zbid );
+          glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, fbs[i].zbid );
+          glViewport( 0, 0, width, height);
+          glScissor( 0, 0, width, height);
+          if (fbs[i].buff_clear)
+          {
+            glDepthMask(1);
+            glClear( GL_DEPTH_BUFFER_BIT ); //clear z-buffer only. we may need content, stored in the frame buffer
+            fbs[i].buff_clear = 0;
+          }
+          CHECK_FRAMEBUFFER_STATUS();
+          curBufferAddr = pBufferAddress;
+          return;
+        }
+        else //create new FBO at the same address, delete old one
+        {
+          glDeleteFramebuffersEXT( 1, &(fbs[i].fbid) );
+          glDeleteRenderbuffersEXT( 1, &(fbs[i].zbid) );
+          if (nb_fb > 1)
+            memmove(&(fbs[i]), &(fbs[i+1]), sizeof(fb)*(nb_fb-i));
+          nb_fb--;
+          break;
+        }
+      }
+    }
+
+    remove_tex(pBufferAddress, pBufferAddress + width*height*2/*grTexFormatSize(fmt)*/);
+    //create new FBO
+    glGenFramebuffersEXT( 1, &(fbs[nb_fb].fbid) );
+    glGenRenderbuffersEXT( 1, &(fbs[nb_fb].zbid) );
+    glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, fbs[nb_fb].zbid );
+    glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);
+    fbs[nb_fb].address = pBufferAddress;
+    fbs[nb_fb].width = width;
+    fbs[nb_fb].height = height;
+    fbs[nb_fb].texid = pBufferAddress;
+    fbs[nb_fb].buff_clear = 0;
+    add_tex(fbs[nb_fb].texid);
+    glBindTexture(GL_TEXTURE_2D, fbs[nb_fb].texid);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0,
+      GL_RGB, GL_UNSIGNED_BYTE, NULL);
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+
+    glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbs[nb_fb].fbid);
+    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
+      GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fbs[nb_fb].texid, 0);
+    glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, fbs[nb_fb].zbid );
+    glViewport(0,0,width,height);
+    glScissor(0,0,width,height);
+    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
+    glDepthMask(1);
+    glClear( GL_DEPTH_BUFFER_BIT );
+    CHECK_FRAMEBUFFER_STATUS();
+    curBufferAddr = pBufferAddress;
+    nb_fb++;
+  }
+}
+
+int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info )
+{
+  int found, i;
+  if (!use_fbo) {
+    for (found=i=0; i<2; i++)
+      if ((FxU32) tmu_usage[i].min <= startAddress && (FxU32) tmu_usage[i].max > startAddress) {
+        //printf("tmu %d == framebuffer %x\n", tmu, startAddress);
+        found = 1;
+        break;
+      }
+  } else {
+    found = i = 0;
+    while (i < nb_fb)
+    {
+      unsigned int end = fbs[i].address + fbs[i].width*fbs[i].height*2;
+      if (startAddress >= fbs[i].address &&  startAddress < end)
+      {
+        found = 1;
+        break;
+      }
+      i++;
+    }
+  }
+
+  if (!use_fbo && found) {
+    int tw, th, rh, cw, ch;
+    if (info->aspectRatioLog2 < 0)
+    {
+      th = 1 << info->largeLodLog2;
+      tw = th >> -info->aspectRatioLog2;
+    }
+    else
+    {
+      tw = 1 << info->largeLodLog2;
+      th = tw >> info->aspectRatioLog2;
+    }
+
+    if (info->aspectRatioLog2 < 0)
+    {
+      ch = 256;
+      cw = ch >> -info->aspectRatioLog2;
+    }
+    else
+    {
+      cw = 256;
+      ch = cw >> info->aspectRatioLog2;
+    }
+
+    if (use_fbo || th < screen_height)
+      rh = th;
+    else
+      rh = screen_height;
+
+    //printf("th %d rh %d ch %d\n", th, rh, ch);
+
+    invtex[tmu] = 1.0f - (th - rh) / (float)th;
+  } else
+    invtex[tmu] = 0;
+
+  if (info->format == GR_TEXFMT_ALPHA_INTENSITY_88 ) {
+    if (!found) {
+      return 0;
+    }
+    if(tmu == 0)
+    {
+      if(blackandwhite1 != found)
+      {
+        blackandwhite1 = found;
+        need_to_compile = 1;
+      }
+    }
+    else
+    {
+      if(blackandwhite0 != found)
+      {
+        blackandwhite0 = found;
+        need_to_compile = 1;
+      }
+    }
+    return 1;
+  }
+  return 0;
+
+}
+
+
+FX_ENTRY void FX_CALL
+grTextureAuxBufferExt( GrChipID_t tmu,
+                      FxU32      startAddress,
+                      GrLOD_t    thisLOD,
+                      GrLOD_t    largeLOD,
+                      GrAspectRatio_t aspectRatio,
+                      GrTextureFormat_t format,
+                      FxU32      odd_even_mask )
+{
+  LOG("grTextureAuxBufferExt(%d, %d, %d, %d %d, %d, %d)\r\n", tmu, startAddress, thisLOD, largeLOD, aspectRatio, format, odd_even_mask);
+  //display_warning("grTextureAuxBufferExt");
+}
+
+FX_ENTRY void FX_CALL grAuxBufferExt( GrBuffer_t buffer );
+
+FX_ENTRY GrProc FX_CALL
+grGetProcAddress( char *procName )
+{
+  LOG("grGetProcAddress(%s)\r\n", procName);
+  if(!strcmp(procName, "grSstWinOpenExt"))
+    return (GrProc)grSstWinOpenExt;
+  if(!strcmp(procName, "grTextureBufferExt"))
+    return (GrProc)grTextureBufferExt;
+  if(!strcmp(procName, "grChromaRangeExt"))
+    return (GrProc)grChromaRangeExt;
+  if(!strcmp(procName, "grChromaRangeModeExt"))
+    return (GrProc)grChromaRangeModeExt;
+  if(!strcmp(procName, "grTexChromaRangeExt"))
+    return (GrProc)grTexChromaRangeExt;
+  if(!strcmp(procName, "grTexChromaModeExt"))
+    return (GrProc)grTexChromaModeExt;
+  // ZIGGY framebuffer copy extension
+  if(!strcmp(procName, "grFramebufferCopyExt"))
+    return (GrProc)grFramebufferCopyExt;
+  if(!strcmp(procName, "grColorCombineExt"))
+    return (GrProc)grColorCombineExt;
+  if(!strcmp(procName, "grAlphaCombineExt"))
+    return (GrProc)grAlphaCombineExt;
+  if(!strcmp(procName, "grTexColorCombineExt"))
+    return (GrProc)grTexColorCombineExt;
+  if(!strcmp(procName, "grTexAlphaCombineExt"))
+    return (GrProc)grTexAlphaCombineExt;
+  if(!strcmp(procName, "grConstantColorValueExt"))
+    return (GrProc)grConstantColorValueExt;
+  if(!strcmp(procName, "grTextureAuxBufferExt"))
+    return (GrProc)grTextureAuxBufferExt;
+  if(!strcmp(procName, "grAuxBufferExt"))
+    return (GrProc)grAuxBufferExt;
+  if(!strcmp(procName, "grWrapperFullScreenResolutionExt"))
+    return (GrProc)grWrapperFullScreenResolutionExt;
+  if(!strcmp(procName, "grConfigWrapperExt"))
+    return (GrProc)grConfigWrapperExt;
+  if(!strcmp(procName, "grKeyPressedExt"))
+    return (GrProc)grKeyPressedExt;
+  if(!strcmp(procName, "grQueryResolutionsExt"))
+    return (GrProc)grQueryResolutionsExt;
+  if(!strcmp(procName, "grGetGammaTableExt"))
+    return (GrProc)grGetGammaTableExt;
+  display_warning("grGetProcAddress : %s", procName);
+  return 0;
+}
+
+FX_ENTRY FxU32 FX_CALL
+grGet( FxU32 pname, FxU32 plength, FxI32 *params )
+{
+  LOG("grGet(%d,%d)\r\n", pname, plength);
+  switch(pname)
+  {
+  case GR_MAX_TEXTURE_SIZE:
+    if (plength < 4 || params == NULL) return 0;
+    params[0] = 2048;
+    return 4;
+    break;
+  case GR_NUM_TMU:
+    if (plength < 4 || params == NULL) return 0;