Add support for Kid P2T files, Broccoli Pak/GRP/MPEG and Leaf Video

This commit is contained in:
gopicolo
2026-01-26 11:53:30 -03:00
parent 2e89ad5832
commit 85c6ccfea9
6 changed files with 372 additions and 0 deletions

View File

@@ -161,6 +161,7 @@
<Compile Include="Ism\ImagePNG.cs" />
<Compile Include="Kid\ArcDATRAW.cs" />
<Compile Include="Kid\ArcKLZ.cs" />
<Compile Include="Kid\ArcP2T.cs" />
<Compile Include="Kid\ImageBIP.cs" />
<Compile Include="Kid\ImageBIParc.cs" />
<Compile Include="Kid\ImageKLZ.cs" />
@@ -201,6 +202,7 @@
<Compile Include="ArcARCX.cs" />
<Compile Include="ArcASAR.cs" />
<Compile Include="Artemis\ArcMJA.cs" />
<Compile Include="Leaf\LeafVideo.cs" />
<Compile Include="Macintosh\ImagePICT.cs" />
<Compile Include="Macromedia\ArcDXR.cs" />
<Compile Include="Macromedia\AudioSND.cs" />
@@ -218,6 +220,7 @@
<Compile Include="NipponIchi\ArcPSFS.cs" />
<Compile Include="NipponIchi\ImageNMT.cs" />
<Compile Include="NScripter\Script.cs" />
<Compile Include="Ps1\ImageTIM.cs" />
<Compile Include="Psp\ArcQPK.cs" />
<Compile Include="ScrPlayer\ImageIMG.cs" />
<Compile Include="SingleFileArchive.cs" />

View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Utility;
namespace GameRes.Formats.Leaf
{
[Export(typeof(ArchiveFormat))]
public class VideoOpener : ArchiveFormat
{
public override string Tag { get { return "VIDEO/LEAF"; } }
public override string Description { get { return "Leaf/Aquaplus Video Container"; } }
public override uint Signature { get { return 0; } } // Dynamic verification
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen(ArcView file)
{
// Read the first 16 bytes to check the signature
if (file.MaxOffset < 16)
return null;
string ext = null;
uint head = file.View.ReadUInt32(0);
// 1. Check if it is WMV/ASF (Leaf standard)
// GUID: 30 26 B2 75 8E 66 CF 11 ...
// In Little Endian UInt64: 0x11CF668E75B22630
if (head == 0x75B22630)
{
ulong asfGuid = file.View.ReadUInt64(0);
if (asfGuid == 0x11CF668E75B22630)
{
ext = ".wmv";
}
}
// 2. Check if it is AVI (RIFF ... AVI )
else if (head == 0x46464952) // "RIFF"
{
// Check if the type at offset 8 is "AVI "
if (file.View.ReadUInt32(8) == 0x20495641)
{
ext = ".avi";
}
}
// 3. Check if it is MPEG (Reusing logic, in case an old game uses it)
else if (head == 0xBA010000)
{
ext = ".mpg";
}
if (ext == null)
return null;
// Create the virtual entry with the correct extension
var entry = new Entry
{
Name = Path.GetFileNameWithoutExtension(file.Name) + ext,
Type = "video",
Offset = 0,
Size = (uint)file.MaxOffset
};
return new ArcFile(file, this, new List<Entry> { entry });
}
}
}