From 6efe8ad30b8297e16749dd1bd57a166f08736724 Mon Sep 17 00:00:00 2001 From: ManicSteiner Date: Thu, 7 Dec 2023 21:42:38 +0800 Subject: [PATCH] perf: edit arc --- ArcFormats/MAGES/ArcLoveOnce.cs | 2 ++ ArcFormats/NipponIchi/ArcCASN.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ArcFormats/MAGES/ArcLoveOnce.cs b/ArcFormats/MAGES/ArcLoveOnce.cs index 1fc51465..3463f8e0 100644 --- a/ArcFormats/MAGES/ArcLoveOnce.cs +++ b/ArcFormats/MAGES/ArcLoveOnce.cs @@ -22,12 +22,14 @@ namespace GameRes.Formats.MAGES { string filepath = Path.GetDirectoryName(filedata.Name); filepath = Path.Combine(filepath, "list.bin"); + if (! File.Exists(filepath)) return null; filelist = new ArcView(filepath); } else if (filedata.Name.EndsWith("list.bin")) { string filepath = Path.GetDirectoryName(filedata.Name); filepath = Path.Combine(filepath, "data.bin"); + if (!File.Exists(filepath)) return null; filelist = new ArcView(filepath); return TryOpen(filelist); } diff --git a/ArcFormats/NipponIchi/ArcCASN.cs b/ArcFormats/NipponIchi/ArcCASN.cs index fe2eb2c7..d76a7db3 100644 --- a/ArcFormats/NipponIchi/ArcCASN.cs +++ b/ArcFormats/NipponIchi/ArcCASN.cs @@ -16,6 +16,8 @@ namespace GameRes.Formats.NipponIchi public override ArcFile TryOpen(ArcView file) { int count = Binary.BigEndian(file.View.ReadUInt16(6)); + if (!IsSaneCount(count)) + return null; long index_offset = count * 10 + 30; //actually count*10 + 28, ignored two bytes of 000C or 000B var dir = new List(count); for (int i = 0; i < count; ++i)