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,
Heightmap = 27,
Watermap = 28,
Mrf = 29,
}

View File

@ -197,6 +197,7 @@ namespace CodeWalker.GameFiles
//TestYpts();
//TestYnvs();
//TestYmaps();
//TestMrfs();
//TestPlacements();
//TestDrawables();
//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()
{
//int totplacements = 0;

View File

@ -297,7 +297,7 @@ namespace CodeWalker
InitFileType(".png", "Portable Network Graphics", 16);
InitFileType(".dds", "DirectDraw Surface", 16);
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(".ypt", "Particle Effect", 18, FileTypeAction.ViewModel, true);
InitFileType(".ybn", "Static Collisions", 19, FileTypeAction.ViewModel, true);
@ -1401,6 +1401,7 @@ namespace CodeWalker
case FileTypeAction.ViewYld:
case FileTypeAction.ViewYfd:
case FileTypeAction.ViewHeightmap:
case FileTypeAction.ViewMrf:
return true;
case FileTypeAction.ViewHex:
default:
@ -1530,6 +1531,9 @@ namespace CodeWalker
case FileTypeAction.ViewHeightmap:
ViewHeightmap(name, path, data, fe);
break;
case FileTypeAction.ViewMrf:
ViewMrf(name, path, data, fe);
break;
case FileTypeAction.ViewHex:
default:
ViewHex(name, path, data);
@ -1771,7 +1775,13 @@ namespace CodeWalker
f.Show();
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)
{
//this should only really be used when loading a file from the filesystem.
@ -4693,6 +4703,7 @@ namespace CodeWalker
ViewYld = 21,
ViewYfd = 22,
ViewHeightmap = 23,
ViewMrf = 24,
}