mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 11:24:14 +08:00
use ResourceInstance for formats instantiation.
This commit is contained in:
parent
3b74dae09f
commit
20cf6c191b
@ -138,6 +138,6 @@ namespace GameRes.Formats
|
||||
|
||||
public static AudioFormat Instance { get { return s_OggFormat.Value; } }
|
||||
|
||||
static readonly Lazy<AudioFormat> s_OggFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "OGG"));
|
||||
static readonly ResourceInstance<AudioFormat> s_OggFormat = new ResourceInstance<AudioFormat> ("OGG");
|
||||
}
|
||||
}
|
||||
|
@ -100,19 +100,16 @@ namespace GameRes.Formats.MAI
|
||||
return null;
|
||||
var offset = file.View.ReadUInt32 (index_offset+0x10);
|
||||
var entry = new AutoEntry (Path.Combine (current_folder, name), () => {
|
||||
uint signature = file.View.ReadUInt32 (offset);
|
||||
if (is_mask_arc)
|
||||
return ImageFormat.FindByTag ("MSK/MAI");
|
||||
else if (0x4d43 == (signature & 0xffff)) // 'CM'
|
||||
return ImageFormat.FindByTag ("CM/MAI");
|
||||
else if (0x4d41 == (signature & 0xffff)) // 'AM'
|
||||
return ImageFormat.FindByTag ("AM/MAI");
|
||||
else if (0x4d42 == (signature & 0xffff)) // 'BM'
|
||||
return ImageFormat.Bmp;
|
||||
else if (signature != 0)
|
||||
return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
|
||||
else
|
||||
return null;
|
||||
return s_MskFormat.Value;
|
||||
uint signature = file.View.ReadUInt32 (offset);
|
||||
switch (signature & 0xFFFF)
|
||||
{
|
||||
case 0x4D43: return s_CmFormat.Value;
|
||||
case 0x4D41: return s_AmFormat.Value;
|
||||
case 0x4D42: return ImageFormat.Bmp;
|
||||
default: return AutoEntry.DetectFileType (signature);
|
||||
}
|
||||
});
|
||||
entry.Offset = offset;
|
||||
entry.Size = file.View.ReadUInt32 (index_offset+0x14);
|
||||
@ -123,5 +120,9 @@ namespace GameRes.Formats.MAI
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
static readonly ResourceInstance<ImageFormat> s_AmFormat = new ResourceInstance<ImageFormat> ("AM/MAI");
|
||||
static readonly ResourceInstance<ImageFormat> s_CmFormat = new ResourceInstance<ImageFormat> ("CM/MAI");
|
||||
static readonly ResourceInstance<ImageFormat> s_MskFormat = new ResourceInstance<ImageFormat> ("MSK/MAI");
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ namespace GameRes.Formats.Majiro
|
||||
return ImageData.Create (meta, PixelFormats.Bgr24, null, pixels, (int)meta.Width*3);
|
||||
}
|
||||
|
||||
static readonly Lazy<ImageFormat> s_rc8_format = new Lazy<ImageFormat> (() => FindByTag ("RC8"));
|
||||
static readonly ResourceInstance<ImageFormat> s_rc8_format = new ResourceInstance<ImageFormat> ("RC8");
|
||||
|
||||
ImageData ApplyMaskToImage (RctMetaData info, byte[] image, string mask_name)
|
||||
{
|
||||
@ -298,7 +298,7 @@ namespace GameRes.Formats.Majiro
|
||||
return options.Password;
|
||||
}
|
||||
|
||||
static readonly Lazy<ArchiveFormat> s_Majiro = new Lazy<ArchiveFormat> (() => FormatCatalog.Instance.ArcFormats.FirstOrDefault (x => x.Tag == "MAJIRO"));
|
||||
static readonly ResourceInstance<ArchiveFormat> s_Majiro = new ResourceInstance<ArchiveFormat> ("MAJIRO");
|
||||
|
||||
private string FindImageKey ()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user