mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-26 23:24:00 +08:00
feat: SPC-PS2 Image Format
This commit is contained in:
parent
30b875efe8
commit
0434623308
@ -133,6 +133,7 @@
|
||||
<Compile Include="Ism\ImagePNG.cs" />
|
||||
<Compile Include="Kid\ArcDATRAW.cs" />
|
||||
<Compile Include="Kid\ImageLBG.cs" />
|
||||
<Compile Include="Kid\ImageSPC.cs" />
|
||||
<Compile Include="Kogado\ArcARC.cs" />
|
||||
<Compile Include="Ice\ImageIBM.cs" />
|
||||
<Compile Include="Ice\ScriptISD.cs" />
|
||||
|
@ -33,7 +33,7 @@ namespace GameRes.Formats.Cri
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class SpcFormat : XtxFormat
|
||||
{
|
||||
public override string Tag { get { return "SPC"; } }
|
||||
public override string Tag { get { return "SPC/Xbox360"; } }
|
||||
public override string Description { get { return "CRI MiddleWare compressed texture format"; } }
|
||||
public override uint Signature { get { return 0; } }
|
||||
|
||||
|
44
ArcFormats/Kid/ImageSPC.cs
Normal file
44
ArcFormats/Kid/ImageSPC.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using GameRes.Compression;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace GameRes.Formats.Kid
|
||||
{
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class SpcFormat: LbgFormat
|
||||
{
|
||||
public override string Tag { get { return "SPC/PS2"; } }
|
||||
public override string Description { get { return "PS2 CRI MiddleWare compressed texture format"; } }
|
||||
public override uint Signature { get { return 0; } }
|
||||
public SpcFormat()
|
||||
{
|
||||
Extensions = new string[] { "spc" };
|
||||
}
|
||||
|
||||
public override ImageMetaData ReadMetaData(IBinaryStream stream)
|
||||
{
|
||||
uint unpacked_size = stream.Signature;
|
||||
if (unpacked_size <= 0x20 || unpacked_size > 0x5000000) // ~83MB
|
||||
return null;
|
||||
stream.Position = 4;
|
||||
using (var lzss = new LzssStream(stream.AsStream, LzssMode.Decompress, true))
|
||||
using (var input = new SeekableStream(lzss))
|
||||
using (var lbg = new BinaryStream(input, stream.Name))
|
||||
return base.ReadMetaData(lbg);
|
||||
}
|
||||
|
||||
public override ImageData Read(IBinaryStream stream, ImageMetaData info)
|
||||
{
|
||||
stream.Position = 4;
|
||||
using (var lzss = new LzssStream(stream.AsStream, LzssMode.Decompress, true))
|
||||
using (var input = new SeekableStream(lzss))
|
||||
using (var lbg = new BinaryStream(input, stream.Name))
|
||||
return base.Read(lbg, info);
|
||||
}
|
||||
|
||||
public override void Write(Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException("SpcFormat.Write not implemented");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user