Skip to content

Commit

Permalink
update to framework 4.6.2. Since Windows XP 64 was very rarely used, …
Browse files Browse the repository at this point in the history
…there's no loss in switching to this if we're going to 64 bit. Add `FrameworkZipWriter` based on the 4.5 framework's built in zip writer. It shaves a decent amount of time off savestate save time, but rolling our own off of DeflateStream would be even faster.
  • Loading branch information
nattthebear committed May 27, 2017
1 parent 37dc990 commit 76022f6
Show file tree
Hide file tree
Showing 23 changed files with 2,754 additions and 2,628 deletions.
11 changes: 9 additions & 2 deletions BizHawk.Client.ApiHawk/BizHawk.Client.ApiHawk.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
Expand All @@ -13,6 +13,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
Expand All @@ -28,6 +29,7 @@
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<DocumentationFile>..\output64\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -38,8 +40,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.ApiHawk</RootNamespace>
<AssemblyName>BizHawk.Client.ApiHawk</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -52,6 +55,7 @@
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>
</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -62,6 +66,7 @@
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -73,6 +78,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>
</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\output\dll\</OutputPath>
Expand All @@ -83,6 +89,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>..\output\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
3 changes: 2 additions & 1 deletion BizHawk.Client.Common/BinarySaveStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ private static void WriteVersion(Stream s)

public BinaryStateSaver(string path, bool notamovie = true) // notamovie is hack, really should have separate something
{
_zip = new IonicZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
////_zip = new IonicZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
////_zip = new SharpZipWriter(path, Global.Config.SaveStateCompressionLevelNormal);
////_zip = new SevenZipWriter(path, Global.Config.SaveStateCompressionLevelNormal);
_zip = new FrameworkZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);

if (notamovie)
{
Expand Down
11 changes: 9 additions & 2 deletions BizHawk.Client.Common/BizHawk.Client.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand All @@ -10,8 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.Common</RootNamespace>
<AssemblyName>BizHawk.Client.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -23,6 +24,7 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -33,6 +35,7 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -51,6 +54,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
Expand All @@ -69,6 +73,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
Expand All @@ -87,6 +92,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -151,6 +157,7 @@
<Compile Include="ExceptionClasses.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="FirmwareManager.cs" />
<Compile Include="FrameworkZipWriter.cs" />
<Compile Include="Global.cs" />
<Compile Include="inputAdapters\AutoPattern.cs" />
<Compile Include="inputAdapters\BitwiseAdapters.cs" />
Expand Down
44 changes: 44 additions & 0 deletions BizHawk.Client.Common/FrameworkZipWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace BizHawk.Client.Common
{
public class FrameworkZipWriter : IZipWriter
{
private ZipArchive _archive;
private readonly CompressionLevel _level;

public FrameworkZipWriter(string path, int compressionlevel)
{
_archive = new ZipArchive(new FileStream(path, FileMode.Create, FileAccess.Write),
ZipArchiveMode.Create, false);
if (compressionlevel == 0)
_level = CompressionLevel.NoCompression;
else if (compressionlevel < 5)
_level = CompressionLevel.Fastest;
else
_level = CompressionLevel.Optimal;
}

public void WriteItem(string name, Action<Stream> callback)
{
using (var stream = _archive.CreateEntry(name, _level).Open())
{
callback(stream);
}
}

public void Dispose()
{
if (_archive != null)
{
_archive.Dispose();
_archive = null;
}
}
}
}
Loading

0 comments on commit 76022f6

Please sign in to comment.