Permalink
Browse files

Merge branch 'sync-video-glide64mk2'

  • Loading branch information...
littleguy77 committed Jan 11, 2015
2 parents 9eb6647 + 9bdb01c commit d9f2dcfb42dec9b0f040cf9b84890f339f9ec3a3
@@ -0,0 +1,181 @@
+<?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>v100</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v100</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\Glitch64\OGLcombiner.cpp" />
+ <ClCompile Include="..\..\src\Glitch64\OGLgeometry.cpp" />
+ <ClCompile Include="..\..\src\Glitch64\OGLglitchmain.cpp" />
+ <ClCompile Include="..\..\src\Glitch64\OGLtextures.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets" />
+</Project>
@@ -151,14 +151,14 @@ wxUint32 fps_count = 0;
wxUint32 vi_count = 0;
float vi = 0.0f;
-
-wxUint32 region = 0;
-
-float ntsc_percent = 0.0f;
-float pal_percent = 0.0f;
-
#endif
+/* custom macros made up by cxd4 for tracking the system type better */
+#define OS_TV_TYPE_PAL 0
+#define OS_TV_TYPE_NTSC 1
+#define OS_TV_TYPE_MPAL 2
+unsigned int region;
+
// ref rate
// 60=0x0, 70=0x1, 72=0x2, 75=0x3, 80=0x4, 90=0x5, 100=0x6, 85=0x7, 120=0x8, none=0xff
@@ -241,7 +241,7 @@ void _ChangeSize ()
#endif
rdp.scale_x = (float)settings.res_x / rdp.vi_width;
- if (region > 0 && settings.pal230)
+ if (region != OS_TV_TYPE_NTSC && settings.pal230)
{
// odd... but pal games seem to want 230 as height...
rdp.scale_y = res_scl_y * (230.0f / rdp.vi_height) * aspect;
@@ -1902,17 +1902,50 @@ EXPORT int CALL RomOpen (void)
ucode_error_report = TRUE; // allowed to report ucode errors
rdp_reset ();
- // Get the country code & translate to NTSC(0) or PAL(1)
- wxUint16 code = ((wxUint16*)gfx.HEADER)[0x1F^1];
-
- if (code == 0x4400) region = 1; // Germany (PAL)
- if (code == 0x4500) region = 0; // USA (NTSC)
- if (code == 0x4A00) region = 0; // Japan (NTSC)
- if (code == 0x5000) region = 1; // Europe (PAL)
- if (code == 0x5500) region = 0; // Australia (NTSC)
+ /* cxd4 -- Glide64 tries to predict PAL scaling based on the ROM header. */
+ region = OS_TV_TYPE_NTSC; /* Invalid region codes are probably NTSC betas. */
+ switch (gfx.HEADER[0x3E ^ 3])
+ {
+ case 'A': /* generic NTSC, not documented, used by 1080 Snowboarding */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'B': /* Brazilian */
+ region = OS_TV_TYPE_MPAL; break;
+ case 'C': /* Chinese */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'D': /* German */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'E': /* North America */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'F': /* French */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'G': /* Gateway 64 (NTSC) */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'H': /* Dutch */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'I': /* Italian */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'J': /* Japanese */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'K': /* Korean */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'L': /* Gateway 64 (PAL) */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'N': /* Canadian */
+ region = OS_TV_TYPE_NTSC; break;
+ case 'P': /* European (basic spec.) */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'S': /* Spanish */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'U': /* Australian */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'W': /* Scandinavian */
+ region = OS_TV_TYPE_PAL ; break;
+ case 'X': case 'Y': case 'Z': /* documented "others", always PAL I think? */
+ region = OS_TV_TYPE_PAL ; break;
+ }
#ifdef USE_FRAMESKIPPER
- frameSkipper.setTargetFPS(region == 1 ? 50 : 60);
+ frameSkipper.setTargetFPS(region == OS_TV_TYPE_PAL ? 50 : 60);
#endif
char name[21] = "DEFAULT";
@@ -2086,8 +2119,6 @@ EXPORT void CALL UpdateScreen (void)
{
fps = (float)(fps_count / diff_secs);
vi = (float)(vi_count / diff_secs);
- ntsc_percent = vi / 0.6f;
- pal_percent = vi / 0.5f;
fps_last = fps_next;
fps_count = 0;
vi_count = 0;
@@ -2191,10 +2222,9 @@ void newSwapBuffers()
{
if (settings.show_fps & 4)
{
- if (region) // PAL
- output (0, y, 0, "%d%% ", (int)pal_percent);
- else
- output (0, y, 0, "%d%% ", (int)ntsc_percent);
+ const float percentage = vi / (region == OS_TV_TYPE_PAL ? .5f : .6f); /* PAL is 50Hz; NTSC & MPAL are 60Hz */
+
+ output(0, y, 0, "%d%% ", (int)percentage);
y -= 16;
}
if (settings.show_fps & 2)
@@ -254,7 +254,7 @@ void display_error()
#endif // _WIN32
#ifdef LOGGING
-char out_buf[256];
+char log_buf[256];
bool log_open = false;
std::ofstream log_file;
@@ -285,8 +285,8 @@ void LOG(const char *text, ...)
return;
va_list ap;
va_start(ap, text);
- vsprintf(out_buf, text, ap);
- log_file << out_buf;
+ vsprintf(log_buf, text, ap);
+ log_file << log_buf;
log_file.flush();
va_end(ap);
}
@@ -306,7 +306,7 @@ LogManager logManager;
#else // LOGGING
#define OPEN_LOG()
#define CLOSE_LOG()
-//#define LOG
+#define LOG
#endif // LOGGING
FX_ENTRY void FX_CALL
@@ -250,7 +250,7 @@ void display_error()
#endif // _WIN32
#ifdef LOGGING
-char out_buf[256];
+char log_buf[256];
bool log_open = false;
std::ofstream log_file;
@@ -281,8 +281,8 @@ void LOG(const char *text, ...)
return;
va_list ap;
va_start(ap, text);
- vsprintf(out_buf, text, ap);
- log_file << out_buf;
+ vsprintf(log_buf, text, ap);
+ log_file << log_buf;
log_file.flush();
va_end(ap);
}
@@ -302,7 +302,7 @@ LogManager logManager;
#else // LOGGING
#define OPEN_LOG()
#define CLOSE_LOG()
-//#define LOG
+#define LOG
#endif // LOGGING
FX_ENTRY void FX_CALL
@@ -23,7 +23,6 @@
#include <m64p_types.h>
-#define LOG(...) // WriteLog(M64MSG_VERBOSE, __VA_ARGS__)
#define LOGINFO(...) WriteLog(M64MSG_INFO, __VA_ARGS__)
#ifdef __cplusplus
extern "C" {
@@ -385,11 +384,11 @@ grConstantColorValueExt(GrChipID_t tmu,
#ifdef LOGGING
void OPEN_LOG();
void CLOSE_LOG();
-//void LOG(const char *text, ...);
+void LOG(const char *text, ...);
#else // LOGGING
#define OPEN_LOG()
#define CLOSE_LOG()
-//#define LOG
+#define LOG
#endif // LOGGING
#endif
View
@@ -29,7 +29,7 @@ set -e
cd ..
BASE_DIR=`pwd`
-COMPONENTS_ALL="audio-sdl core rsp-hle ui-console video-rice"
+COMPONENTS_ALL="audio-sdl core rsp-hle ui-console video-glide64mk2 video-rice"
echo
echo "Type the names of the upstream repositories you wish to pull, separated by whitespace."

0 comments on commit d9f2dcf

Please sign in to comment.