本文整理汇总了C#中Glare.Assets.AssetLoader.MakeBigEndian方法的典型用法代码示例。如果您正苦于以下问题:C# AssetLoader.MakeBigEndian方法的具体用法?C# AssetLoader.MakeBigEndian怎么用?C# AssetLoader.MakeBigEndian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Glare.Assets.AssetLoader
的用法示例。
在下文中一共展示了AssetLoader.MakeBigEndian方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NintendoOpticalDisc
internal NintendoOpticalDisc(AssetLoader loader)
: base(loader)
{
BinaryReader reader;
int magic = loader.Reader.ReadInt32();
loader.Reader.BaseStream.Seek(-4, SeekOrigin.Current);
if (magic == DolphinCompressedDisc.Magic) {
var disc = new DolphinCompressedDisc(loader.Reader);
var stream = new DolphinCompressedDiscStream(disc);
loader.Reader = new BigEndianBinaryReader(stream);
} else
loader.MakeBigEndian();
reader = Reader = loader.Reader;
DiscId = (NintendoOpticalDiscId)reader.ReadByte();
DiscGame = (NintendoOpticalDiscGame)reader.ReadInt16();
DiscRegion = (NintendoOpticalDiscRegion)reader.ReadByte();
DiscMaker = (NintendoOpticalDiscMaker)reader.ReadInt16();
DiscNumber = reader.ReadByte();
DiscVersion = reader.ReadByte();
DiscAudioStreaming = reader.ReadByte();
DiscStreamBufferSize = reader.ReadByte();
Unknowns.ReadBytes(reader, 14);
int wiiMagic = reader.ReadInt32();
int gameCubeMagic = reader.ReadInt32();
if (wiiMagic == (int)NintendoOpticalDiscSystem.Wii)
DiscSystem = NintendoOpticalDiscSystem.Wii;
else if (gameCubeMagic == (int)NintendoOpticalDiscSystem.GameCube)
DiscSystem = Wii.NintendoOpticalDiscSystem.GameCube;
else
throw new InvalidDataException();
DiscTitle = reader.ReadStringz(64, Encoding.ASCII);
if (DiscSystem == Wii.NintendoOpticalDiscSystem.GameCube) {
NintendoOpticalDiscPartition.LoadFileTable(this, reader, DiscSystem);
} else {
reader.BaseStream.Position = VolumeTableOffset;
for (int volumeIndex = 0; volumeIndex < 4; volumeIndex++) {
int partitionCount = reader.ReadInt32();
long partitionTableOffset = reader.ReadUInt32() * 4L;
if (partitionCount > 0)
new NintendoOpticalDiscVolume(this, volumeIndex, partitionCount, partitionTableOffset);
}
foreach (NintendoOpticalDiscVolume volume in Children)
volume.LoadPartitions(loader);
foreach (NintendoOpticalDiscVolume volume in Children)
foreach (NintendoOpticalDiscPartition partition in volume.Children)
partition.LoadHeaders(loader);
}
}
示例2: Package
internal Package(AssetLoader loader)
: base(loader)
{
loader.MakeBigEndian();
BinaryReader reader = Reader = loader.Reader;
ushort versionMajor = reader.ReadUInt16();
ushort versionMinor = reader.ReadUInt16();
reader.RequireZeroes(4);
int stringCount = reader.ReadInt32();
Codex<PackageString> strings = new Codex<PackageString>(stringCount);
for (int index = 0; index < stringCount; index++)
strings.Add(new PackageString(this, index, reader));
Strings = strings;
int fileCount = reader.ReadInt32();
for (int index = 0; index < fileCount; index++)
new PackageFile(this, index, loader);
}
示例3: Model
internal Model(AssetLoader loader)
: base(loader)
{
Asset context = loader.Context;
string name = loader.Name;
BinaryReader reader = loader.Reader;
FolderAsset textureArchive = null;
FolderAsset bonesFolder = new FolderAsset(this, "Bones");
FolderAsset materialsFolder = new FolderAsset(this, "Materials");
FolderAsset meshesFolder = new FolderAsset(this, "Meshes");
FolderAsset vertexDeclarationsFolder = new FolderAsset(this, "Vertex declarations");
ArrayBackedList<byte> bufferData = new ArrayBackedList<byte>();
if (context != null && context.Parent is FolderAsset) {
// @"/map/m##_##_##_##/m*.flver.dcx" for DS1; textures are in the @"/map/m##/" folder.
if (name.StartsWith(@"map/m")) {
string folderName = name.Substring(4, 3);
FolderAsset maps = (FolderAsset)context.Parent.Parent;
foreach (FolderAsset child in maps.Children) {
if (child.Name == folderName) {
textureArchive = child;
break;
}
}
} else
textureArchive = (FolderAsset)context.Parent;
}
#if Marking
MarkingStream markingStream = loader.StartMarking(out reader);
#endif
loader.ExpectMagic(Magic);
char endian = (char)reader.ReadByte();
switch (endian) {
case 'L':
ByteOrder = ByteOrder.LittleEndian;
break;
case 'B':
reader = loader.MakeBigEndian();
ByteOrder = ByteOrder.BigEndian;
break;
default:
throw new Exception();
}
using (reader) {
// Read header.
loader.Expect((byte)0);
Version = (ModelVersion)reader.ReadInt32();
if (Version != ModelVersion.DarkSouls && Version != ModelVersion.DarkSouls2)
loader.AddError(loader.Position - 4, "Unknown model version " + VersionString + "; will try to load it anyway.");
int dataOffset = reader.ReadInt32();
int dataSize = reader.ReadInt32();
if (((dataOffset + dataSize + 31) & ~31) != reader.BaseStream.Length)
loader.AddError(loader.Position - 4, "Data size and offset aren't correct.");
int boneUnknownCount = reader.ReadInt32();
int materialCount = reader.ReadInt32();
int boneCount = reader.ReadInt32();
int meshCount = reader.ReadInt32();
int meshCount2 = reader.ReadInt32();
if (meshCount != meshCount2)
loader.AddError(loader.Position - 4, "Mesh count 1 and 2 aren't the same.");
Bounds = new Box3f(reader.ReadVector3f(), reader.ReadVector3f());
Unknowns.ReadInt32s(reader, 1); // Possible the non-degenerate triangle count. Seems related.
int triangleCount = reader.ReadInt32();
loader.Expect(IsDS1 ? 272 : 0x10010100);
loader.Expect(IsDS1 ? 0 : 0xFFFF);
int partCount = reader.ReadInt32();
int vertexDeclarationCount = reader.ReadInt32();
int materialParameterCount = reader.ReadInt32();
loader.Expect(IsDS1 ? 0 : 0x1000000);
loader.ExpectZeroes(4, 8);
// Calculate offsets.
long boneUnknownsOffset = HeaderSize;
long materialsOffset = boneUnknownsOffset + boneUnknownCount * ModelBoneUnknown.DataSize;
long bonesOffset = materialsOffset + materialCount * ModelMaterial.DataSize;
long meshesOffset = bonesOffset + boneCount * ModelBone.DataSize;
long detailLevelsOffset = meshesOffset + meshCount * ModelMesh.DataSize;
long meshVerticesOffset = detailLevelsOffset + partCount * ModelDetailLevel.DataSize;
long vertexDeclarationsOffset = meshVerticesOffset + meshCount * ModelMesh.DataSizeVertexHeader;
long materialParametersOffset = vertexDeclarationsOffset + vertexDeclarationCount * ModelVertexDeclaration.DataSize;
long postHeaderOffset = materialParametersOffset + materialParameterCount * ModelMaterialParameter.DataSize;
// BoneUnknowns
ExpectedOffset(loader, boneUnknownsOffset, typeof(ModelBoneUnknown).Name);
for (int index = 0; index < boneUnknownCount; index++)
boneUnknowns.Add(new ModelBoneUnknown(bonesFolder, index, loader));
//.........这里部分代码省略.........