Merge pull request #120 from Disquse/mrf-support

MRF files support
This commit is contained in:
dexyfex 2021-11-07 20:44:33 +11:00 committed by GitHub
commit e81b716dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2738 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,7 @@ namespace CodeWalker.GameFiles
Yfd = 26, Yfd = 26,
Heightmap = 27, Heightmap = 27,
Watermap = 28, Watermap = 28,
Mrf = 29,
} }

View File

@ -197,6 +197,7 @@ namespace CodeWalker.GameFiles
//TestYpts(); //TestYpts();
//TestYnvs(); //TestYnvs();
//TestYmaps(); //TestYmaps();
//TestMrfs();
//TestPlacements(); //TestPlacements();
//TestDrawables(); //TestDrawables();
//TestHeightmaps(); //TestHeightmaps();
@ -4179,6 +4180,29 @@ namespace CodeWalker.GameFiles
} }
} }
} }
public void TestMrfs()
{
foreach (RpfFile file in AllRpfs)
{
foreach (RpfEntry entry in file.AllEntries)
{
try
{
if (entry.NameLower.EndsWith(".mrf"))
{
UpdateStatus(string.Format(entry.Path));
MrfFile mrffile = RpfMan.GetFile<MrfFile>(entry);
if (mrffile != null)
{ }
}
}
catch (Exception ex)
{
UpdateStatus("Error! " + ex.ToString());
}
}
}
}
public void TestPlacements() public void TestPlacements()
{ {
//int totplacements = 0; //int totplacements = 0;

View File

@ -297,7 +297,7 @@ namespace CodeWalker
InitFileType(".png", "Portable Network Graphics", 16); InitFileType(".png", "Portable Network Graphics", 16);
InitFileType(".dds", "DirectDraw Surface", 16); InitFileType(".dds", "DirectDraw Surface", 16);
InitFileType(".ytd", "Texture Dictionary", 16, FileTypeAction.ViewYtd, true); InitFileType(".ytd", "Texture Dictionary", 16, FileTypeAction.ViewYtd, true);
InitFileType(".mrf", "MRF File", 18); InitFileType(".mrf", "Move Network File", 18, FileTypeAction.ViewMrf);
InitFileType(".ycd", "Clip Dictionary", 18, FileTypeAction.ViewYcd, true); InitFileType(".ycd", "Clip Dictionary", 18, FileTypeAction.ViewYcd, true);
InitFileType(".ypt", "Particle Effect", 18, FileTypeAction.ViewModel, true); InitFileType(".ypt", "Particle Effect", 18, FileTypeAction.ViewModel, true);
InitFileType(".ybn", "Static Collisions", 19, FileTypeAction.ViewModel, true); InitFileType(".ybn", "Static Collisions", 19, FileTypeAction.ViewModel, true);
@ -1401,6 +1401,7 @@ namespace CodeWalker
case FileTypeAction.ViewYld: case FileTypeAction.ViewYld:
case FileTypeAction.ViewYfd: case FileTypeAction.ViewYfd:
case FileTypeAction.ViewHeightmap: case FileTypeAction.ViewHeightmap:
case FileTypeAction.ViewMrf:
return true; return true;
case FileTypeAction.ViewHex: case FileTypeAction.ViewHex:
default: default:
@ -1530,6 +1531,9 @@ namespace CodeWalker
case FileTypeAction.ViewHeightmap: case FileTypeAction.ViewHeightmap:
ViewHeightmap(name, path, data, fe); ViewHeightmap(name, path, data, fe);
break; break;
case FileTypeAction.ViewMrf:
ViewMrf(name, path, data, fe);
break;
case FileTypeAction.ViewHex: case FileTypeAction.ViewHex:
default: default:
ViewHex(name, path, data); ViewHex(name, path, data);
@ -1771,7 +1775,13 @@ namespace CodeWalker
f.Show(); f.Show();
f.LoadMeta(heightmap); f.LoadMeta(heightmap);
} }
private void ViewMrf(string name, string path, byte[] data, RpfFileEntry e)
{
var mrf = RpfFile.GetFile<MrfFile>(e, data);
GenericForm f = new GenericForm(this);
f.Show();
f.LoadFile(mrf, mrf.RpfFileEntry);
}
private RpfFileEntry CreateFileEntry(string name, string path, ref byte[] data) private RpfFileEntry CreateFileEntry(string name, string path, ref byte[] data)
{ {
//this should only really be used when loading a file from the filesystem. //this should only really be used when loading a file from the filesystem.
@ -4693,6 +4703,7 @@ namespace CodeWalker
ViewYld = 21, ViewYld = 21,
ViewYfd = 22, ViewYfd = 22,
ViewHeightmap = 23, ViewHeightmap = 23,
ViewMrf = 24,
} }