Various fixes and updates

This commit is contained in:
Michael Becker 2014-04-02 00:36:36 -04:00
parent 1d9049938e
commit bb0b4323d4
6 changed files with 55 additions and 53 deletions

View File

@ -23,7 +23,7 @@ namespace UniversalEditor.DataFormats.Concertroid.Concert
_dfr = new DataFormatReference(GetType());
_dfr.Capabilities.Add(typeof(VersatileContainerObjectModel), DataFormatCapabilities.Bootstrap);
_dfr.Capabilities.Add(typeof(ConcertObjectModel), DataFormatCapabilities.All);
_dfr.Filters.Add("Concertroid compiled binary", new string[] { "*.cvb" });
_dfr.Filters.Add("Concertroid compili hed binary", new string[] { "*.cvb" });
}
return _dfr;
}

View File

@ -325,13 +325,13 @@ namespace UniversalEditor.DataFormats.FileSystem.ALTools.EGG
if ((flag & ALZipFileNameFlags.UseAreaCode) == ALZipFileNameFlags.UseAreaCode)
{
short locale = 0;
bw.Write(locale);
bw.WriteInt16(locale);
}
if ((flag & ALZipFileNameFlags.RelativePath) == ALZipFileNameFlags.RelativePath)
{
uint parentID = 0;
bw.Write(parentID);
bw.WriteUInt32(parentID);
}
bw.WriteFixedLengthString(fi.name);
@ -351,15 +351,15 @@ namespace UniversalEditor.DataFormats.FileSystem.ALTools.EGG
// 0 - store, 1 - deflate, 2 - bzip2, 3 - AZO, 4 - LZMA
bw.WriteByte((byte)bi.compressionMethod);
bw.Write(bi.hint);
bw.WriteByte(bi.hint);
bw.Write(bi.decompressedSize);
bw.Write(bi.compressedSize);
bw.Write(bi.crc32);
bw.WriteUInt32(bi.decompressedSize);
bw.WriteUInt32(bi.compressedSize);
bw.WriteUInt32(bi.crc32);
bw.WriteUInt32((uint)0x08E28222);
bw.Write(bi.compressedData);
bw.WriteBytes(bi.compressedData);
}
}
#endregion

View File

@ -704,7 +704,7 @@ namespace UniversalEditor.DataFormats.FileSystem.FAT
extendedBootSignature = 0x28;
}
}
bw.Write(extendedBootSignature);
bw.WriteByte(extendedBootSignature);
if (extendedBootSignature == 0x29 || extendedBootSignature == 0x28)
{
@ -714,7 +714,7 @@ namespace UniversalEditor.DataFormats.FileSystem.FAT
// number. Alternatively, some DR-DOS disk utilities provide a /# option to generate a
// human-readable time stamp "mmdd-hhmm" build from BCD-encoded 8-bit values for the month, day,
// hour and minute instead of a serial number.
bw.Write(mvarExtendedBiosParameterBlock.ExtendedBootSignature.VolumeSerialNumber);
bw.WriteInt32(mvarExtendedBiosParameterBlock.ExtendedBootSignature.VolumeSerialNumber);
}
if (extendedBootSignature == 0x29)
{

View File

@ -7,7 +7,6 @@ using UniversalEditor.IO;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.ObjectModels.Multimedia.Picture;
using UniversalEditor.ObjectModels.Multimedia3D.Model;
using UniversalEditor.UserInterface;
namespace UniversalEditor.DataFormats.FileSystem.Moosta.Container
{
@ -132,7 +131,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.Container
}
// br.BaseStream.Position = 0;
// br.Accessor.Position = 0;
// model.Surfaces.Clear();
#region Load Surfaces
{
@ -200,7 +199,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.Container
for (uint j = 0; j < deformerCount; j++)
{
ModelSkin skin = new ModelSkin();
skin.Name = br.ReadInt16UnicodeString();
skin.Name = br.ReadInt16String();
uint deformerVertexCount = br.ReadUInt32();
for (uint k = 0; k < deformerVertexCount; k++)
{
@ -230,17 +229,17 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.Container
ModelMaterial mat = new ModelMaterial();
int unknown1 = br.ReadInt32();
int unknown2 = br.ReadInt32();
mat.Name = br.ReadInt16UnicodeString();
mat.Name = br.ReadInt16String();
mat.AmbientColor = br.ReadColorARGBSingle();
mat.DiffuseColor = br.ReadColorARGBSingle();
mat.SpecularColor = br.ReadColorARGBSingle();
mat.Shininess = br.ReadSingle();
string textureFileName = br.ReadInt16UnicodeString();
string toonFileName = br.ReadInt16UnicodeString();
string unknown5 = br.ReadInt16UnicodeString();
string unknown6 = br.ReadInt16UnicodeString();
string unknown7 = br.ReadInt16UnicodeString();
string textureFileName = br.ReadInt16String();
string toonFileName = br.ReadInt16String();
string unknown5 = br.ReadInt16String();
string unknown6 = br.ReadInt16String();
string unknown7 = br.ReadInt16String();
// mat.ToonFileName = toonFileName;
mat.Textures.Add(textureFileName, null, ModelTextureFlags.Texture);
model.Materials.Add(mat);
@ -255,7 +254,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.Container
for (uint i = 0; i < boneCount; i++)
{
ModelBone bone = new ModelBone();
bone.Name = br.ReadInt16UnicodeString();
bone.Name = br.ReadInt16String();
#region Bone Matrix #1
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.FileSystem;
namespace UniversalEditor.DataFormats.FileSystem.Moosta.ImageCollection
@ -26,18 +27,18 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.ImageCollection
if (fsom == null) throw new ObjectModelNotSupportedException();
List<File> files = new List<File>();
IO.Reader br = base.Stream.Reader;
IO.Reader br = base.Accessor.Reader;
int fileCount = br.ReadInt32();
for (int i = 0; i < fileCount; i++)
{
string fileName = br.ReadString();
string fileName = br.ReadLengthPrefixedString();
files.Add(fsom.AddFile(fileName));
}
for (int i = 0; i < fileCount; i++)
{
int length = br.ReadInt32();
int unknown1 = br.ReadInt32();
long offset = br.BaseStream.Position;
long offset = br.Accessor.Position;
files[i].Properties.Add("length", length);
files[i].Properties.Add("offset", offset);
@ -45,7 +46,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.ImageCollection
files[i].Size = length;
files[i].DataRequest += IMCDataFormat_DataRequest;
br.BaseStream.Seek(length, System.IO.SeekOrigin.Current);
br.Accessor.Seek(length, SeekOrigin.Current);
}
}
@ -55,7 +56,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.ImageCollection
IO.Reader br = (IO.Reader)file.Properties["reader"];
int length = (int)file.Properties["length"];
long offset = (long)file.Properties["offset"];
br.BaseStream.Seek(offset, System.IO.SeekOrigin.Begin);
br.Accessor.Seek(offset, SeekOrigin.Begin);
e.Data = br.ReadBytes(length);
}
protected override void SaveInternal(ObjectModel objectModel)
@ -63,18 +64,18 @@ namespace UniversalEditor.DataFormats.FileSystem.Moosta.ImageCollection
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
if (fsom == null) throw new ObjectModelNotSupportedException();
IO.Writer bw = base.Stream.Writer;
IO.Writer bw = base.Accessor.Writer;
File[] files = fsom.GetAllFiles();
bw.Write(files.Length);
bw.WriteInt32(files.Length);
foreach (File file in files)
{
bw.Write(file.Name);
}
foreach (File file in files)
{
bw.Write(file.Size);
bw.Write(file.GetDataAsByteArray());
bw.WriteInt64(file.Size);
bw.WriteBytes(file.GetDataAsByteArray());
}
bw.Flush();
}

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.Moosta.MotionPack;
using UniversalEditor.ObjectModels.Multimedia.Picture;
@ -42,7 +42,9 @@ namespace UniversalEditor.DataFormats.Moosta.MotionPack.MoPkg
MotionPackObjectModel mopkg = (objectModel as MotionPackObjectModel);
if (mopkg == null) throw new ObjectModelNotSupportedException();
IO.Reader br = base.Stream.Reader;
IO.Reader br = base.Accessor.Reader;
base.Accessor.DefaultEncoding = Encoding.UTF16LittleEndian;
string signature = br.ReadFixedLengthString(5);
if (signature != "MoPkg") throw new InvalidDataFormatException("File does not begin with \"MoPkg\"");
@ -55,7 +57,7 @@ namespace UniversalEditor.DataFormats.Moosta.MotionPack.MoPkg
for (int i = 0; i < packageInfoCount1; i++)
{
int langID = br.ReadInt32();
string value = br.ReadInt16UnicodeString();
string value = br.ReadInt16String();
PackageInformation ste = new PackageInformation();
ste.LanguageID = langID;
@ -66,7 +68,7 @@ namespace UniversalEditor.DataFormats.Moosta.MotionPack.MoPkg
for (int i = 0; i < packageInfoCount2; i++)
{
int langID = br.ReadInt32();
string value = br.ReadInt16UnicodeString();
string value = br.ReadInt16String();
if (i < mopkg.PackageInformation.Count)
{
mopkg.PackageInformation[i].PackageDescription = value;
@ -75,7 +77,7 @@ namespace UniversalEditor.DataFormats.Moosta.MotionPack.MoPkg
int copyrightCount = br.ReadInt32();
for (int i = 0; i < copyrightCount; i++)
{
string copyright = br.ReadInt16UnicodeString();
string copyright = br.ReadInt16String();
mvarCopyrights.Add(copyright);
}
@ -109,50 +111,50 @@ namespace UniversalEditor.DataFormats.Moosta.MotionPack.MoPkg
MotionPackObjectModel mopkg = (objectModel as MotionPackObjectModel);
if (mopkg == null) throw new ObjectModelNotSupportedException();
IO.Writer bw = base.Stream.Writer;
IO.Writer bw = base.Accessor.Writer;
bw.WriteFixedLengthString("MoPkg");
bw.Write(FormatVersion);
bw.Write(mvarPackageVersion);
bw.WriteSingle(FormatVersion);
bw.WriteSingle(mvarPackageVersion);
// bw.Write(mopkg.Animations.Count);
bw.Write(mopkg.PackageInformation.Count);
bw.WriteInt32(mopkg.PackageInformation.Count);
foreach (PackageInformation packageName in mopkg.PackageInformation)
{
bw.Write(packageName.LanguageID);
bw.Write(packageName.PackageName);
bw.WriteInt32(packageName.LanguageID);
bw.WriteLengthPrefixedString(packageName.PackageName);
}
bw.Write(mopkg.PackageInformation.Count);
bw.WriteInt32(mopkg.PackageInformation.Count);
foreach (PackageInformation packageName in mopkg.PackageInformation)
{
bw.Write(packageName.LanguageID);
bw.Write(packageName.PackageDescription);
bw.WriteInt32(packageName.LanguageID);
bw.WriteLengthPrefixedString(packageName.PackageDescription);
}
foreach (string copyright in mopkg.Copyrights)
{
bw.WriteUInt16SizedString(copyright);
}
bw.Write(mvarIsRemovable);
bw.WriteBoolean(mvarIsRemovable);
if (mvarThumbnail != null)
{
bw.Write(mvarThumbnail.Width);
bw.Write(mvarThumbnail.Height);
bw.WriteInt32(mvarThumbnail.Width);
bw.WriteInt32(mvarThumbnail.Height);
for (int y = 0; y < mvarThumbnail.Height; y++)
{
for (int x = 0; x < mvarThumbnail.Width; x++)
{
Color pixel = mvarThumbnail.GetPixel(x, y);
bw.Write((byte)(pixel.Alpha * 255));
bw.Write((byte)(pixel.Red * 255));
bw.Write((byte)(pixel.Green * 255));
bw.Write((byte)(pixel.Blue * 255));
bw.WriteByte((byte)(pixel.Alpha * 255));
bw.WriteByte((byte)(pixel.Red * 255));
bw.WriteByte((byte)(pixel.Green * 255));
bw.WriteByte((byte)(pixel.Blue * 255));
}
}
}
else
{
bw.Write(0);
bw.Write(0);
bw.WriteInt32(0);
bw.WriteInt32(0);
}
bw.Write(mvarCompressionMode);
bw.WriteByte(mvarCompressionMode);
}
}
}