Added NamcoTales plugin and re-included FileSystem plugin

This commit is contained in:
Michael Becker 2014-06-04 15:31:38 -04:00
parent 3cfca7fcb0
commit bb9e698bbe
4 changed files with 209 additions and 0 deletions

View File

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniversalEditor.Accessors;
using UniversalEditor.ObjectModels.FileSystem;
namespace UniversalEditor.DataFormats.FileSystem.NamcoTales
{
public class TLZCDataFormat : DataFormat
{
private static DataFormatReference _dfr = null;
public override DataFormatReference MakeReference()
{
if (_dfr == null)
{
_dfr = base.MakeReference();
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
_dfr.Filters.Add("Namco Tales Studio TLZC archive", new byte?[][] { new byte?[] { (byte)'T', (byte)'L', (byte)'Z', (byte)'C' } }, new string[] { "*.dat" });
}
return _dfr;
}
private uint mvarBlockSize = 10000;
public uint BlockSize { get { return mvarBlockSize; } set { mvarBlockSize = value; } }
protected override void LoadInternal(ref ObjectModel objectModel)
{
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
IO.Reader reader = base.Accessor.Reader;
string TLZC = reader.ReadFixedLengthString(4);
if (TLZC != "TLZC") throw new InvalidDataFormatException();
string filename = "FILENAME.FPS4";
if (base.Accessor is FileAccessor)
{
filename = System.IO.Path.GetFileName((base.Accessor as FileAccessor).FileName);
filename = System.IO.Path.ChangeExtension(filename, ".fps4");
}
// comtype MSF
uint version = reader.ReadUInt32();
uint compressedSize = reader.ReadUInt32();
uint decompressedSize = reader.ReadUInt32();
byte[] filedata = new byte[decompressedSize];
reader.Seek(0x1D, IO.SeekOrigin.Begin);
uint blockcount = decompressedSize;
blockcount += 0xFFFF;
blockcount /= mvarBlockSize;
short[] zsizes = new short[blockcount];
for (uint i = 0; i < blockcount; i++)
{
short zsize = reader.ReadInt16();
zsizes[i] = zsize;
}
for (uint i = 0; i < blockcount; i++)
{
long offset = base.Accessor.Position;
short zsize = zsizes[i];
if (decompressedSize >= mvarBlockSize)
{
byte[] block = reader.ReadBytes(mvarBlockSize);
// block = decompress(block);
Array.Copy(block, 0, filedata, i * mvarBlockSize, block.Length);
}
else
{
// append
if (zsize == 0)
{
// log MEMORY_FILE OFFSET tsize
}
else
{
// clog MEMORY_FILE OFFSET ZSIZE tsize
}
// append
}
decompressedSize -= 0x10000;
offset += zsize;
base.Accessor.Seek(offset, IO.SeekOrigin.Begin);
}
fsom.Files.Add(filename, filedata);
// get SIZE asize MEMORY_FILE
// log name 0 SIZE MEMORY_FILE
}
protected override void SaveInternal(ObjectModel objectModel)
{
throw new NotImplementedException();
}
}
}

View File

@ -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("UniversalEditor.Plugins.NamcoTales")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("City of Orlando")]
[assembly: AssemblyProduct("UniversalEditor.Plugins.NamcoTales")]
[assembly: AssemblyCopyright("Copyright © City of Orlando 2014")]
[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("fac0ad65-d944-4ada-be44-a05293996f19")]
// 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")]

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{19AEFD28-37E8-4FFD-B879-FEE57824689D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UniversalEditor</RootNamespace>
<AssemblyName>UniversalEditor.Plugins.NamcoTales</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataFormats\FileSystem\NamcoTales\TLZCDataFormat.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
<Project>{2d4737e6-6d95-408a-90db-8dff38147e85}</Project>
<Name>UniversalEditor.Core</Name>
</ProjectReference>
<ProjectReference Include="..\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
<Name>UniversalEditor.Essential</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -49,6 +49,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{5A423A3E-51C5-4188-8AD5-FB5C0CB76C6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.NamcoTales", "Plugins\UniversalEditor.Plugins.NamcoTales\UniversalEditor.Plugins.NamcoTales.csproj", "{19AEFD28-37E8-4FFD-B879-FEE57824689D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.FileSystem", "Plugins\UniversalEditor.Plugins.FileSystem\UniversalEditor.Plugins.FileSystem.csproj", "{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -155,6 +159,18 @@ Global
{118E40C4-323E-4B4B-8EF4-38EED6CC5E83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{118E40C4-323E-4B4B-8EF4-38EED6CC5E83}.Release|Any CPU.Build.0 = Release|Any CPU
{118E40C4-323E-4B4B-8EF4-38EED6CC5E83}.Release|x86.ActiveCfg = Release|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Debug|x86.ActiveCfg = Debug|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Release|Any CPU.Build.0 = Release|Any CPU
{19AEFD28-37E8-4FFD-B879-FEE57824689D}.Release|x86.ActiveCfg = Release|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Debug|x86.ActiveCfg = Debug|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Release|Any CPU.Build.0 = Release|Any CPU
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -172,6 +188,8 @@ Global
{30A2F772-8EC1-425A-8D5D-36A0BE4D6B66} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
{3DC2C1F6-F332-4E55-BF6A-AED78A7C3FD2} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
{899E3DD6-EA65-4168-AAE3-867A4F9650A6} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
{19AEFD28-37E8-4FFD-B879-FEE57824689D} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
{FE016EA3-DC31-4A92-8B0A-8C746EC117E1} = {46041F27-7C1C-4209-B72B-251EDB5D4C61}
{C1F34183-7A2F-41A6-9958-F6F329099654} = {A846CA33-9CAA-4237-B14F-8721DBA89442}
{2013757E-4240-4E07-AD22-91219AD9B74F} = {C1F34183-7A2F-41A6-9958-F6F329099654}