mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(ArcAil): use archive name in generated filenames.
This commit is contained in:
parent
6e4dc2db53
commit
5423e32bef
@ -23,11 +23,9 @@
|
|||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using GameRes.Utility;
|
using GameRes.Utility;
|
||||||
|
|
||||||
namespace GameRes.Formats.Ail
|
namespace GameRes.Formats.Ail
|
||||||
@ -54,6 +52,7 @@ namespace GameRes.Formats.Ail
|
|||||||
long offset = 4+count*4;
|
long offset = 4+count*4;
|
||||||
if (offset >= file.MaxOffset)
|
if (offset >= file.MaxOffset)
|
||||||
return null;
|
return null;
|
||||||
|
var base_name = Path.GetFileNameWithoutExtension (file.Name);
|
||||||
uint index_offset = 4;
|
uint index_offset = 4;
|
||||||
var dir = new List<Entry>();
|
var dir = new List<Entry>();
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
@ -63,7 +62,7 @@ namespace GameRes.Formats.Ail
|
|||||||
{
|
{
|
||||||
var entry = new PackedEntry
|
var entry = new PackedEntry
|
||||||
{
|
{
|
||||||
Name = i.ToString ("D5"),
|
Name = string.Format ("{0}#{1:D5}", base_name, i),
|
||||||
Offset = offset,
|
Offset = offset,
|
||||||
Size = size,
|
Size = size,
|
||||||
IsPacked = false,
|
IsPacked = false,
|
||||||
@ -84,15 +83,18 @@ namespace GameRes.Formats.Ail
|
|||||||
uint extra = 6;
|
uint extra = 6;
|
||||||
if (extra > entry.Size)
|
if (extra > entry.Size)
|
||||||
continue;
|
continue;
|
||||||
int label = file.View.ReadUInt16 (entry.Offset);
|
uint signature = file.View.ReadUInt32 (entry.Offset);
|
||||||
if (1 == label)
|
if (1 == (signature & 0xFFFF))
|
||||||
{
|
{
|
||||||
entry.IsPacked = true;
|
entry.IsPacked = true;
|
||||||
entry.UnpackedSize = file.View.ReadUInt32 (entry.Offset+2);
|
entry.UnpackedSize = file.View.ReadUInt32 (entry.Offset+2);
|
||||||
}
|
}
|
||||||
|
else if (0 == signature)
|
||||||
|
{
|
||||||
|
extra = 4;
|
||||||
|
}
|
||||||
entry.Offset += extra;
|
entry.Offset += extra;
|
||||||
entry.Size -= extra;
|
entry.Size -= extra;
|
||||||
uint signature;
|
|
||||||
if (entry.IsPacked)
|
if (entry.IsPacked)
|
||||||
{
|
{
|
||||||
file.View.Read (entry.Offset, preview, 0, (uint)preview.Length);
|
file.View.Read (entry.Offset, preview, 0, (uint)preview.Length);
|
||||||
@ -128,14 +130,9 @@ namespace GameRes.Formats.Ail
|
|||||||
|
|
||||||
static void SetEntryType (Entry entry, uint signature)
|
static void SetEntryType (Entry entry, uint signature)
|
||||||
{
|
{
|
||||||
var res = FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
|
var res = AutoEntry.DetectFileType (signature);
|
||||||
if (null != res)
|
if (null != res)
|
||||||
{
|
entry.ChangeType (res);
|
||||||
entry.Type = res.Type;
|
|
||||||
var ext = res.Extensions.FirstOrDefault();
|
|
||||||
if (!string.IsNullOrEmpty (ext))
|
|
||||||
entry.Name += '.' + ext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user