mirror of
https://github.com/4sval/FModel.git
synced 2026-04-08 10:06:40 -05:00
fixed index error on some asset onClick function
This commit is contained in:
parent
319a3d52b3
commit
4bf19551f4
|
|
@ -17,9 +17,9 @@ namespace FModel.PakReader.IO
|
|||
|
||||
public FIoChunkId ChunkId => ioStore.TocResource.ChunkIds[UserData];
|
||||
public FIoOffsetAndLength OffsetLength => ioStore.Toc[ChunkId];
|
||||
public long Offset => (long) OffsetLength.Offset;
|
||||
public override long Offset => (long) OffsetLength.Offset;
|
||||
public long Length => (long) OffsetLength.Length;
|
||||
public string CompressionMethodString => ioStore.TocResource.CompressionMethods[CompressionMethodIndex - 1];
|
||||
public string CompressionMethodString => ioStore.TocResource.CompressionMethods[CompressionMethodIndex > 0 ? CompressionMethodIndex - 1 : CompressionMethodIndex];
|
||||
|
||||
public FIoStoreEntry(FFileIoStoreReader ioStore, uint userData, string name, bool caseSensitive)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
public override string ContainerName { get; }
|
||||
public override string Name => _name;
|
||||
private readonly string _name;
|
||||
public readonly long Offset;
|
||||
public override long Offset => _offset;
|
||||
private readonly long _offset;
|
||||
public override long Size => _size;
|
||||
private readonly long _size;
|
||||
public override long UncompressedSize => _uncompressedSize;
|
||||
|
|
@ -42,7 +43,7 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
|
||||
var StartOffset = reader.BaseStream.Position;
|
||||
|
||||
Offset = reader.ReadInt64();
|
||||
_offset = reader.ReadInt64();
|
||||
_size = reader.ReadInt64();
|
||||
_uncompressedSize = reader.ReadInt64();
|
||||
if (Version < EPakVersion.FNAME_BASED_COMPRESSION_METHOD)
|
||||
|
|
@ -105,7 +106,7 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
|
||||
var StartOffset = reader.BaseStream.Position;
|
||||
|
||||
Offset = reader.ReadInt64();
|
||||
_offset = reader.ReadInt64();
|
||||
_size = reader.ReadInt64();
|
||||
_uncompressedSize = reader.ReadInt64();
|
||||
_compressionMethodIndex = reader.ReadUInt32();
|
||||
|
|
@ -125,7 +126,7 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
{
|
||||
ContainerName = pakName;
|
||||
_name = name;
|
||||
Offset = offset;
|
||||
_offset = offset;
|
||||
_size = size;
|
||||
_uncompressedSize = uncompressedSize;
|
||||
CompressionBlocks = compressionBlocks;
|
||||
|
|
@ -141,7 +142,7 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
{
|
||||
if (_compressionMethodIndex == 0U)
|
||||
{
|
||||
stream.Position = Offset + _structSize;
|
||||
stream.Position = _offset + _structSize;
|
||||
if (Encrypted)
|
||||
{
|
||||
var data = new byte[(_size & 15) == 0 ? _size : (_size / 16 + 1) * 16];
|
||||
|
|
@ -174,7 +175,7 @@ namespace FModel.PakReader.Parsers.Objects
|
|||
int bytesRead = 0;
|
||||
for (int i = 0; i < CompressionBlocks.Length; i++)
|
||||
{
|
||||
stream.Position = Offset + CompressionBlocks[i].CompressedStart;
|
||||
stream.Position = _offset + CompressionBlocks[i].CompressedStart;
|
||||
int uncompressedSize = (int)Math.Min(CompressionBlockSize, outData.Length - bytesRead);
|
||||
|
||||
byte[] blockBbuffer;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace FModel.PakReader
|
|||
{
|
||||
public abstract string Name { get; }
|
||||
public abstract long UncompressedSize { get; }
|
||||
public abstract long Offset { get; }
|
||||
public abstract long Size { get; }
|
||||
public abstract int StructSize { get; }
|
||||
public abstract uint CompressionMethodIndex { get; }
|
||||
|
|
|
|||
|
|
@ -16,18 +16,12 @@ namespace FModel.ViewModels.TabControl
|
|||
string ext = string.Join(" ", entry.GetExtension(), entry.Uexp?.GetExtension(), entry.Ubulk?.GetExtension());
|
||||
string offsets;
|
||||
string tSize;
|
||||
if (entry is FPakEntry pakEntry)
|
||||
if (entry is ReaderEntry pakEntry)
|
||||
{
|
||||
offsets = string.Join(" ", "0x" + (pakEntry.Offset + pakEntry.StructSize).ToString("X2"),
|
||||
entry.Uexp != null ? "0x" + (((FPakEntry)pakEntry.Uexp).Offset + pakEntry.StructSize).ToString("X2") : string.Empty,
|
||||
entry.Ubulk != null ? "0x" + (((FPakEntry)pakEntry.Ubulk).Offset + pakEntry.StructSize).ToString("X2") : string.Empty);
|
||||
tSize = Strings.GetReadableSize(pakEntry.Size + ((pakEntry.Uexp as FPakEntry)?.Size ?? 0) + ((pakEntry.Ubulk as FPakEntry)?.Size ?? 0));
|
||||
} else if (entry is FIoStoreEntry ioEntry)
|
||||
{
|
||||
offsets = string.Join(" ", "0x" + (ioEntry.Offset).ToString("X2"),
|
||||
entry.Uexp != null ? "0x" + (((FIoStoreEntry)ioEntry.Uexp).Offset).ToString("X2") : string.Empty,
|
||||
entry.Ubulk != null ? "0x" + (((FIoStoreEntry)ioEntry.Ubulk).Offset).ToString("X2") : string.Empty);
|
||||
tSize = Strings.GetReadableSize(ioEntry.Size + ((ioEntry.Uexp as FIoStoreEntry)?.Size ?? 0) + ((ioEntry.Ubulk as FIoStoreEntry)?.Size ?? 0));
|
||||
entry.Uexp != null ? "0x" + (pakEntry.Uexp?.Offset + pakEntry.StructSize)?.ToString("X2") : string.Empty,
|
||||
entry.Ubulk != null ? "0x" + (pakEntry.Ubulk?.Offset + pakEntry.StructSize)?.ToString("X2") : string.Empty);
|
||||
tSize = Strings.GetReadableSize(pakEntry.Size + (pakEntry.Uexp?.Size ?? 0) + (pakEntry.Ubulk?.Size ?? 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -165,11 +165,14 @@ This software uses the following open source packages:
|
|||
|
||||
## Support [](https://wakatime.com/badge/github/iAmAsval/FModel)
|
||||
|
||||
This project is not my full time job, donations are greatly appreciated.
|
||||
This project is not my full time job, donations and stars are greatly appreciated.
|
||||
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EP9SSWG8MW4UC&source=url">
|
||||
<img src="https://img.shields.io/badge/Paypal-Donate-00457C.svg?logo=paypal">
|
||||
</a>
|
||||
<a href="https://starchart.cc/iamasval/fmodel.svg">
|
||||
<img src="https://starchart.cc/iamasval/fmodel.svg">
|
||||
</a>
|
||||
|
||||
## You may also like...
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user