Various fixes and updates
This commit is contained in:
parent
376ab664f7
commit
896b5e9945
@ -483,6 +483,54 @@ namespace UniversalEditor.IO
|
||||
{
|
||||
WriteInt64(value.ToBinary());
|
||||
}
|
||||
|
||||
public void WriteDecimal(decimal value)
|
||||
{
|
||||
int[] bits = decimal.GetBits(value);
|
||||
int lo = bits[0], mid = bits[1], hi = bits[2], flags = bits[3];
|
||||
|
||||
byte[] buffer = new byte[16];
|
||||
if (mvarEndianness == IO.Endianness.LittleEndian)
|
||||
{
|
||||
buffer[0] = (byte)lo;
|
||||
buffer[1] = (byte)(lo >> 8);
|
||||
buffer[2] = (byte)(lo >> 16);
|
||||
buffer[3] = (byte)(lo >> 24);
|
||||
buffer[4] = (byte)mid;
|
||||
buffer[5] = (byte)(mid >> 8);
|
||||
buffer[6] = (byte)(mid >> 16);
|
||||
buffer[7] = (byte)(mid >> 24);
|
||||
buffer[8] = (byte)hi;
|
||||
buffer[9] = (byte)(hi >> 8);
|
||||
buffer[10] = (byte)(hi >> 16);
|
||||
buffer[11] = (byte)(hi >> 24);
|
||||
buffer[12] = (byte)flags;
|
||||
buffer[13] = (byte)(flags >> 8);
|
||||
buffer[14] = (byte)(flags >> 16);
|
||||
buffer[15] = (byte)(flags >> 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[15] = (byte)lo;
|
||||
buffer[14] = (byte)(lo >> 8);
|
||||
buffer[13] = (byte)(lo >> 16);
|
||||
buffer[12] = (byte)(lo >> 24);
|
||||
buffer[11] = (byte)mid;
|
||||
buffer[10] = (byte)(mid >> 8);
|
||||
buffer[9] = (byte)(mid >> 16);
|
||||
buffer[9] = (byte)(mid >> 24);
|
||||
buffer[7] = (byte)hi;
|
||||
buffer[6] = (byte)(hi >> 8);
|
||||
buffer[5] = (byte)(hi >> 16);
|
||||
buffer[4] = (byte)(hi >> 24);
|
||||
buffer[3] = (byte)flags;
|
||||
buffer[2] = (byte)(flags >> 8);
|
||||
buffer[1] = (byte)(flags >> 16);
|
||||
buffer[0] = (byte)(flags >> 24);
|
||||
}
|
||||
WriteBytes(buffer);
|
||||
}
|
||||
|
||||
public void WriteVersion(Version version)
|
||||
{
|
||||
WriteVersion(version, 4);
|
||||
|
||||
@ -41,14 +41,14 @@ namespace UniversalEditor.DataFormats.AniMiku.AnimatedTexture
|
||||
|
||||
IO.Writer bw = base.Accessor.Writer;
|
||||
int unknown = 150;
|
||||
bw.Write(unknown);
|
||||
bw.WriteInt32(unknown);
|
||||
|
||||
bw.Write(fsom.Files.Count);
|
||||
bw.WriteInt32(fsom.Files.Count);
|
||||
foreach (File file in fsom.Files)
|
||||
{
|
||||
byte[] data = file.GetDataAsByteArray();
|
||||
bw.Write(data.Length);
|
||||
bw.Write(data);
|
||||
bw.WriteInt32(data.Length);
|
||||
bw.WriteBytes(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.IO;
|
||||
using UniversalEditor.ObjectModels.Multimedia3D.Motion;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Multimedia3D.Motion.AniMiku
|
||||
@ -22,7 +22,8 @@ namespace UniversalEditor.DataFormats.Multimedia3D.Motion.AniMiku
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
IO.Reader br = new IO.Reader(base.Accessor, System.Text.Encoding.UTF8);
|
||||
Reader br = new Reader(base.Accessor);
|
||||
base.Accessor.DefaultEncoding = Encoding.UTF8;
|
||||
br.Accessor.Position = 0;
|
||||
|
||||
MotionObjectModel motion = (objectModel as MotionObjectModel);
|
||||
@ -35,7 +36,7 @@ namespace UniversalEditor.DataFormats.Multimedia3D.Motion.AniMiku
|
||||
uint boneCount = br.ReadUInt32();
|
||||
for (uint i = 0; i < boneCount; i++)
|
||||
{
|
||||
string boneName = br.ReadString();
|
||||
string boneName = br.ReadLengthPrefixedString();
|
||||
uint frameCount = br.ReadUInt32();
|
||||
|
||||
for (uint j = 0; j < frameCount; j++)
|
||||
|
||||
@ -10,6 +10,7 @@ using UniversalEditor.ObjectModels.VersatileContainer;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer.Sections;
|
||||
using UniversalEditor.DataFormats.VersatileContainer;
|
||||
using UniversalEditor.Collections.Generic;
|
||||
using UniversalEditor.Accessors;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Concertroid.Concert
|
||||
{
|
||||
@ -71,75 +72,75 @@ namespace UniversalEditor.DataFormats.Concertroid.Concert
|
||||
MusicianInstrumentIndices.Add(musician, StringTable.GetValue1(musician.Instrument));
|
||||
}
|
||||
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
IO.Writer bw = new IO.Writer(ms);
|
||||
bw.Write(StringTable.Count);
|
||||
MemoryAccessor ma = new MemoryAccessor();
|
||||
IO.Writer bw = new IO.Writer(ma);
|
||||
bw.WriteInt32(StringTable.Count);
|
||||
foreach (KeyValuePair<int, string> kvp in StringTable)
|
||||
{
|
||||
bw.WriteNullTerminatedString(kvp.Value);
|
||||
}
|
||||
bw.Close();
|
||||
vcom.Sections.Add("StringTable", ms.ToArray());
|
||||
vcom.Sections.Add("StringTable", ma.ToArray());
|
||||
}
|
||||
#endregion
|
||||
|
||||
Dictionary<Musician, int> MusicianIndices = new Dictionary<Musician, int>();
|
||||
#region Concert
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
IO.Writer bw = new IO.Writer(ms);
|
||||
MemoryAccessor ma = new MemoryAccessor();
|
||||
IO.Writer bw = new IO.Writer(ma);
|
||||
bw.Write(StringTable.GetValue2(0));
|
||||
bw.Close();
|
||||
vcom.Sections.Add("Concert", ms.ToArray());
|
||||
vcom.Sections.Add("Concert", ma.ToArray());
|
||||
}
|
||||
#endregion
|
||||
#region Musicians
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
IO.Writer bw = new IO.Writer(ms);
|
||||
MemoryAccessor ma = new MemoryAccessor();
|
||||
IO.Writer bw = new IO.Writer(ma);
|
||||
int count = 0;
|
||||
foreach (Musician musician in concert.BandMusicians)
|
||||
{
|
||||
bw.Write(MusicianNameIndices[musician]);
|
||||
bw.Write(MusicianInstrumentIndices[musician]);
|
||||
bw.WriteInt32(MusicianNameIndices[musician]);
|
||||
bw.WriteInt32(MusicianInstrumentIndices[musician]);
|
||||
MusicianIndices[musician] = count;
|
||||
count++;
|
||||
}
|
||||
foreach (Musician musician in concert.GuestMusicians)
|
||||
{
|
||||
bw.Write(MusicianNameIndices[musician]);
|
||||
bw.Write(MusicianInstrumentIndices[musician]);
|
||||
bw.WriteInt32(MusicianNameIndices[musician]);
|
||||
bw.WriteInt32(MusicianInstrumentIndices[musician]);
|
||||
MusicianIndices[musician] = count;
|
||||
count++;
|
||||
}
|
||||
bw.Close();
|
||||
vcom.Sections.Add("Musicians", ms.ToArray());
|
||||
vcom.Sections.Add("Musicians", ma.ToArray());
|
||||
}
|
||||
#endregion
|
||||
#region BandMusicianReferences
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
IO.Writer bw = new IO.Writer(ms);
|
||||
MemoryAccessor ma = new MemoryAccessor();
|
||||
IO.Writer bw = new IO.Writer(ma);
|
||||
bw.WriteNullTerminatedString(concert.BandName);
|
||||
bw.Write(concert.BandMusicians.Count);
|
||||
bw.WriteInt32(concert.BandMusicians.Count);
|
||||
foreach (Musician musician in concert.BandMusicians)
|
||||
{
|
||||
bw.Write(MusicianIndices[musician]);
|
||||
bw.WriteInt32(MusicianIndices[musician]);
|
||||
}
|
||||
bw.Close();
|
||||
vcom.Sections.Add("BandMusicianReferences", ms.ToArray());
|
||||
vcom.Sections.Add("BandMusicianReferences", ma.ToArray());
|
||||
}
|
||||
#endregion
|
||||
#region GuestMusicianReferences
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
IO.Writer bw = new IO.Writer(ms);
|
||||
MemoryAccessor ma = new MemoryAccessor();
|
||||
IO.Writer bw = new IO.Writer(ma);
|
||||
foreach (Musician musician in concert.GuestMusicians)
|
||||
{
|
||||
bw.Write(MusicianIndices[musician]);
|
||||
bw.WriteInt32(MusicianIndices[musician]);
|
||||
}
|
||||
bw.Close();
|
||||
vcom.Sections.Add("GuestMusicianReferences", ms.ToArray());
|
||||
vcom.Sections.Add("GuestMusicianReferences", ma.ToArray());
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user