mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(Cherry): sanity check.
This commit is contained in:
parent
126cf16527
commit
d7504811bc
@ -27,8 +27,6 @@ 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.Compression;
|
using GameRes.Compression;
|
||||||
|
|
||||||
namespace GameRes.Formats.Cherry
|
namespace GameRes.Formats.Cherry
|
||||||
@ -104,8 +102,7 @@ namespace GameRes.Formats.Cherry
|
|||||||
if (0 == text_size || text_offset+text_size > entry.Size)
|
if (0 == text_size || text_offset+text_size > entry.Size)
|
||||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
|
|
||||||
var data = new byte[entry.Size];
|
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||||
arc.File.View.Read (entry.Offset, data, 0, entry.Size);
|
|
||||||
for (uint i = 0; i < text_size; ++i)
|
for (uint i = 0; i < text_size; ++i)
|
||||||
{
|
{
|
||||||
data[text_offset+i] ^= (byte)i;
|
data[text_offset+i] ^= (byte)i;
|
||||||
@ -146,9 +143,8 @@ namespace GameRes.Formats.Cherry
|
|||||||
int count = file.View.ReadInt32 (0x14);
|
int count = file.View.ReadInt32 (0x14);
|
||||||
long base_offset = file.View.ReadUInt32 (0x18);
|
long base_offset = file.View.ReadUInt32 (0x18);
|
||||||
bool is_encrypted = false;
|
bool is_encrypted = false;
|
||||||
int min_offset = 0x1C + count * 0x18;
|
|
||||||
while (!IsSaneCount (count) || base_offset >= file.MaxOffset
|
while (!IsSaneCount (count) || base_offset >= file.MaxOffset
|
||||||
|| (2 == version && !is_compressed && base_offset != min_offset))
|
|| (2 == version && !is_compressed && base_offset != (0x1C + count * 0x18)))
|
||||||
{
|
{
|
||||||
if (is_encrypted)
|
if (is_encrypted)
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user