diff --git a/GARbro.sln b/GARbro.sln index fec1f4ff..1bdbb6a9 100644 --- a/GARbro.sln +++ b/GARbro.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 +VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GARbro.Console", "Console\GARbro.Console.csproj", "{B966F292-431A-4D8A-A1D3-1EB45048A1D2}" ProjectSection(ProjectDependencies) = postProject @@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Experimental", "Experimenta EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Legacy", "Legacy\Legacy.csproj", "{C79E82A8-8D32-485D-8442-2D4F71FBB5D5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Net20", "Net20\Net20.csproj", "{73B6C693-9846-4D33-8300-A80239FCFFF9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,6 +77,13 @@ Global {C79E82A8-8D32-485D-8442-2D4F71FBB5D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {C79E82A8-8D32-485D-8442-2D4F71FBB5D5}.Prerelease|Any CPU.ActiveCfg = Prerelease|Any CPU {C79E82A8-8D32-485D-8442-2D4F71FBB5D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C79E82A8-8D32-485D-8442-2D4F71FBB5D5}.Release|Any CPU.Build.0 = Release|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Prerelease|Any CPU.ActiveCfg = Prerelease|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Prerelease|Any CPU.Build.0 = Prerelease|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73B6C693-9846-4D33-8300-A80239FCFFF9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Net20/Gx4Lib/PackageFile.cs b/Net20/Gx4Lib/PackageFile.cs new file mode 100644 index 00000000..7ef443f1 --- /dev/null +++ b/Net20/Gx4Lib/PackageFile.cs @@ -0,0 +1,77 @@ +//! \file PackageFile.cs +//! \date 2018 Aug 30 +//! \brief Unity GX4Lib deserializer. +// +// Copyright (C) 2018 by morkt +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// + +using System; +using System.IO; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; + +namespace GameRes.Gx4Lib +{ + public class PackageFile + { + public PFHeader[] Deserialize (Stream input) + { + var bin = new BinaryFormatter { Binder = new Gx4TypeBinder() }; + var index = bin.Deserialize (input) as PFHeaders; + if (null == index) + return null; + return index.headers; + } + } + + [Serializable] + public class PFHeader + { + public string FileName; + public long readStartBytePos; + public long ByteLength; + } + + [Serializable] + public class PFHeaders + { + public PFHeader[] headers; + } + + internal class Gx4TypeBinder : SerializationBinder + { + public override Type BindToType (string assemblyName, string typeName) + { + if ("GX4Lib" == assemblyName) + { + if (typeName.StartsWith ("GX4.PackageFile`1+PFHeaders[[")) + { + return typeof(PFHeaders); + } + else if (typeName.StartsWith ("GX4.PackageFile`1+PFHeader[[")) + { + return typeof(PFHeader); + } + } + return null; + } + } +} diff --git a/Net20/Net20.csproj b/Net20/Net20.csproj new file mode 100644 index 00000000..7191d81b --- /dev/null +++ b/Net20/Net20.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + {73B6C693-9846-4D33-8300-A80239FCFFF9} + Library + Properties + GameRes.Net20 + Net20 + v2.0 + 512 + + + + true + full + false + ..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + 301989888 + + + pdbonly + true + ..\bin\Release\ + + + prompt + 4 + 301989888 + + + ..\bin\Prerelease\ + true + 301989888 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Net20/Properties/AssemblyInfo.cs b/Net20/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ed5a0b83 --- /dev/null +++ b/Net20/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Net20")] +[assembly: AssemblyDescription (".NET 2.0 dependent classes")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany ("mørkt")] +[assembly: AssemblyProduct("Net20")] +[assembly: AssemblyCopyright ("Copyright © 2018 mørkt")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a4cd3bdc-84d5-41aa-baa8-fcba0de9c8ac")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Net20/README.md b/Net20/README.md new file mode 100644 index 00000000..bf0c8135 --- /dev/null +++ b/Net20/README.md @@ -0,0 +1,4 @@ +GameRes.Net20 +============= + +Package containing classes that require .NET 2.0 environment.