(Legacy): certain formats enabled in debug build only.

This commit is contained in:
morkt 2018-01-16 11:56:01 +04:00
parent aa93dabd2d
commit 9388afd54f
14 changed files with 368 additions and 0 deletions

View File

@ -44,6 +44,10 @@ namespace GameRes.Formats.Cocktail
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
// static readonly uint[] KnownKeyCode = { 0x385AB4BA, 0x52CCCF4E };
// static readonly uint[] KnownKeyCode = { 0x33C074B5, 0xB6744357 };
static readonly uint[] KnownKeyCode = { 0xBBB64423, 0x4D765A33 };
public override ArcFile TryOpen (ArcView file)
{
int count = file.View.ReadInt32 (4);

View File

@ -29,7 +29,9 @@ using System.Windows.Media;
namespace GameRes.Formats.EbgSystem
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class BinOpener : ArchiveFormat
{
public override string Tag { get { return "BIN/EBG_SYSTEM"; } }

View File

@ -31,7 +31,9 @@ using System.Text.RegularExpressions;
namespace GameRes.Formats.Factor
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class PackOpener : ArchiveFormat
{
public override string Tag { get { return "PACK/FACTOR"; } }

View File

@ -29,7 +29,9 @@ using System.Windows.Media;
namespace GameRes.Formats.Nabe
{
#if DEBUG
[Export(typeof(ImageFormat))]
#endif
public class YpfFormat : ImageFormat
{
public override string Tag { get { return "YPF/NABE"; } }

View File

@ -27,6 +27,8 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
// [000630][STONE HEADS] Sei Cosplay Gakuen ~Game Bunkou~
namespace GameRes.Formats.Nekotaro
{
[Export(typeof(ArchiveFormat))]

63
Legacy/PlanTech/ArcPAC.cs Normal file
View File

@ -0,0 +1,63 @@
//! \file ArcPAC.cs
//! \date 2018 Jan 03
//! \brief PLANTECH bitmap packages.
//
// 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.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
namespace GameRes.Formats.PlanTech
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class PacOpener : ArchiveFormat
{
public override string Tag { get { return "PAC/PLANTECH"; } }
public override string Description { get { return "PLANTECH engine bitmap package"; } }
public override uint Signature { get { return 0; } }
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen (ArcView file)
{
if (file.View.ReadInt32 (0) != 0)
return null;
if (!file.View.AsciiEqual (8, "BM"))
return null;
if (file.View.ReadUInt32 (4) != file.View.ReadUInt32 (10))
return null;
var dir = new List<Entry> (1);
var entry = new Entry {
Name = Path.GetFileNameWithoutExtension (file.Name) + ".BMP",
Type = "image",
Offset = 8,
Size = (uint)(file.MaxOffset - 8),
};
dir.Add (entry);
return new ArcFile (file, this, dir);
}
}
}

View File

@ -0,0 +1,80 @@
//! \file ImagePAC.cs
//! \date 2018 Jan 03
//! \brief PLANTECH bitmap packages.
//
// 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.ComponentModel.Composition;
using System.IO;
using System.Windows.Media;
namespace GameRes.Formats.PlanTech
{
#if DEBUG
[Export(typeof(ImageFormat))]
#endif
public class PacFormat : ImageFormat
{
public override string Tag { get { return "PAC/PLANTECH"; } }
public override string Description { get { return "PLANTECH engine bitmap package"; } }
public override uint Signature { get { return 0; } }
public override ImageMetaData ReadMetaData (IBinaryStream file)
{
if (file.Signature != 0)
return null;
var header = file.ReadHeader (14);
if (!header.AsciiEqual (8, "BM"))
return null;
if (header.ToUInt32 (4) != header.ToUInt32 (10))
return null;
using (var region = new StreamRegion (file.AsStream, 8, true))
using (var bmp = new BinaryStream (region, file.Name))
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream file, ImageMetaData info)
{
var meta = (BmpMetaData)info;
file.Position = 8 + meta.ImageOffset;
int stride = (((int)info.Width * info.BPP / 8) + 3) & ~3;
var pixels = file.ReadBytes (stride * (int)info.Height);
PixelFormat format;
if (24 == info.BPP)
format = PixelFormats.Bgr24;
else if (32 == info.BPP)
format = PixelFormats.Bgr32;
else if (16 == info.BPP)
format = PixelFormats.Bgr565;
else if (8 == info.BPP)
format = PixelFormats.Gray8;
else
throw new InvalidFormatException();
return ImageData.Create (info, format, null, pixels, stride);
}
public override void Write (Stream file, ImageData image)
{
throw new System.NotImplementedException ("PacFormat.Write not implemented");
}
}
}

View File

@ -31,7 +31,9 @@ using GameRes.Utility;
namespace GameRes.Formats.ShapeShifter
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class BndOpener : ArchiveFormat
{
public override string Tag { get { return "BND"; } }

View File

@ -36,7 +36,9 @@ namespace GameRes.Formats.Uran
public byte Method;
}
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class NclOpener : ArchiveFormat
{
public override string Tag { get { return "NCL"; } }

125
Legacy/Weapon/ArcDAT.cs Normal file
View File

@ -0,0 +1,125 @@
//! \file ArcDAT.cs
//! \date 2018 Jan 04
//! \brief Weapon event CG archives.
//
// 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.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Windows.Media;
namespace GameRes.Formats.Weapon
{
internal class CgEntry : Entry
{
public uint Height;
}
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class DatOpener : ArchiveFormat
{
public override string Tag { get { return "DAT/WEAPON"; } }
public override string Description { get { return "Weapon resource archive"; } }
public override uint Signature { get { return 0; } }
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
const uint DefaultWidth = 800;
public override ArcFile TryOpen (ArcView file)
{
var arc_name = Path.GetFileName (file.Name);
uint[] height_table;
if (!KnownFileTables.TryGetValue (arc_name, out height_table))
return null;
uint stride = DefaultWidth * 2;
uint offset = 0;
var base_name = Path.GetFileNameWithoutExtension (arc_name);
var dir = new List<Entry> (height_table.Length);
for (int i = 0; i < height_table.Length; ++i)
{
var name = string.Format ("{0}#{1:D4}", base_name, i);
var entry = new CgEntry {
Name = name,
Type = "image",
Offset = offset,
Size = height_table[i] * stride,
Height = height_table[i],
};
if (!entry.CheckPlacement (file.MaxOffset))
return null;
dir.Add (entry);
offset += entry.Size;
}
return new ArcFile (file, this, dir);
}
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
{
var cgent = (CgEntry)entry;
var input = arc.File.CreateStream (entry.Offset, entry.Size);
var info = new ImageMetaData { Width = DefaultWidth, Height = cgent.Height, BPP = 16 };
return new CgDecoder (input, info);
}
static readonly Dictionary<string, uint[]> KnownFileTables = new Dictionary<string, uint[]> (StringComparer.InvariantCultureIgnoreCase) {
{ "eventcg.dat",
new uint[] {
600, 600, 600, 600, 600, 1200, 600, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200,
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 600, 600, 600,
}
},
{ "buy.dat",
new uint[] {
900, 34
}
},
};
}
internal class CgDecoder : BinaryImageDecoder
{
public CgDecoder (IBinaryStream input, ImageMetaData info) : base (input, info)
{
}
protected override ImageData GetImageData ()
{
int stride = (int)Info.Width * 2;
var pixels = m_input.ReadBytes (stride * (int)Info.Height);
for (int i = 0; i < pixels.Length; i += 2)
{
int hi = pixels[i] << 2 | (pixels[i+1] & 3);
int lo = pixels[i+1] >> 2 | (pixels[i] & ~0x1F);
pixels[i] = (byte)lo;
pixels[i+1] = (byte)hi;
}
return ImageData.Create (Info, PixelFormats.Bgr555, null, pixels, stride);
}
}
}

78
Legacy/Weapon/ArcVoice.cs Normal file
View File

@ -0,0 +1,78 @@
//! \file ArcVoice.cs
//! \date 2018 Jan 04
//! \brief Weapon audio archive.
//
// 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.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
namespace GameRes.Formats.Weapon
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class VoiceOpener : ArchiveFormat
{
public override string Tag { get { return "DAT/W/VOICE"; } }
public override string Description { get { return "Weapon audio archive"; } }
public override uint Signature { get { return 0; } }
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen (ArcView file)
{
int count = file.View.ReadInt32 (0);
if (!IsSaneCount (count))
return null;
uint index_size = (uint)count * 4 + 8;
if (index_size > file.View.Reserve (0, index_size))
return null;
if (file.View.ReadUInt32 (index_size-4) != file.MaxOffset)
return null;
uint index_offset = 4;
uint offset = file.View.ReadUInt32 (index_offset);
if (offset < index_size)
return null;
var base_name = Path.GetFileNameWithoutExtension (file.Name);
var dir = new List<Entry> (count);
for (int i = 0; i < count; ++i)
{
index_offset += 4;
var entry = new Entry {
Name = string.Format ("{0}#{1:D4}.wav", base_name, i),
Type = "audio",
Offset = offset,
};
offset = file.View.ReadUInt32 (index_offset);
entry.Size = (uint)(offset - entry.Offset);
if (!entry.CheckPlacement (file.MaxOffset))
return null;
dir.Add (entry);
}
return new ArcFile (file, this, dir);
}
}
}

View File

@ -28,7 +28,9 @@ using System.ComponentModel.Composition;
namespace GameRes.Formats.WestGate
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class UcaOpener : ArchiveFormat
{
public override string Tag { get { return "UCA"; } }

View File

@ -28,7 +28,9 @@ using System.ComponentModel.Composition;
namespace GameRes.Formats.WestGate
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class UsfOpener : ArchiveFormat
{
public override string Tag { get { return "USF"; } }

View File

@ -29,7 +29,9 @@ using System.IO;
namespace GameRes.Formats.WestGate
{
#if DEBUG
[Export(typeof(ArchiveFormat))]
#endif
public class UwfOpener : ArchiveFormat
{
public override string Tag { get { return "UWF"; } }