CodeWalker.Core
1.0.2
See the version list below for details.
dotnet add package CodeWalker.Core --version 1.0.2
NuGet\Install-Package CodeWalker.Core -Version 1.0.2
<PackageReference Include="CodeWalker.Core" Version="1.0.2" />
paket add CodeWalker.Core --version 1.0.2
#r "nuget: CodeWalker.Core, 1.0.2"
// Install CodeWalker.Core as a Cake Addin #addin nuget:?package=CodeWalker.Core&version=1.0.2 // Install CodeWalker.Core as a Cake Tool #tool nuget:?package=CodeWalker.Core&version=1.0.2
Basic usage
YMAP
Reading a YMAP and printing the names of all entities using a nametable to resolve the hashes.
using CodeWalker.GameFiles;
List<string> nameTables = File.ReadAllLines("allnames.nametable").ToList();
nameTables.ForEach(x => JenkIndex.Ensure(x.Trim()));
YmapFile yf = new();
yf.Load(File.ReadAllBytes("test.ymap"));
yf.AllEntities.ToList().ForEach(x => Console.WriteLine(x.Name));
Result
prop_alien_egg_01
prop_alien_egg_01
prop_alien_egg_01
prop_alien_egg_01
Reading a YMAP and adding random Vectors to all entities positions and then saving it.
using CodeWalker.GameFiles;
using SharpDX;
YmapFile yf = new();
yf.Load(File.ReadAllBytes("test.ymap"));
Console.WriteLine("Old positions:");
foreach (var entity in yf.AllEntities)
{
Console.WriteLine(entity._CEntityDef.position);
Vector3 randomV3 = new Random().NextVector3(new Vector3(-5000), new Vector3(5000));
entity._CEntityDef.position += randomV3;
}
Console.WriteLine("New positions:");
yf.AllEntities.ToList().ForEach(x => Console.WriteLine(x._CEntityDef.position));
File.WriteAllBytes("test_randomized.ymap", yf.Save());
Result
Old positions:
X:-1.8011817 Y:-3.3898313 Z:98.875374
X:2.8794594 Y:5.299817 Z:101.86926
X:10.3870735 Y:0.07335186 Z:102.33895
X:9.735979 Y:-13.5480585 Z:102.319534
New positions:
X:2152.357 Y:-618.8588 Z:-572.4889
X:-1108.6493 Y:-3069.503 Z:375.84045
X:-2076.676 Y:4744.5967 Z:-213.85342
X:-4593.8706 Y:-4129.6787 Z:3528.502
Reading a YMAP and exporting it as a XML (Nametables are required to export actual entities' names).
using CodeWalker.GameFiles;
YmapFile yf = new YmapFile();
string path = "test.ymap";
byte[] data = File.ReadAllBytes(path);
yf.Load(data);
string xml = MetaXml.GetXml(yf, out _);
File.WriteAllText($"{Path.GetFileNameWithoutExtension(path)}.ymap.xml", xml);
YTYP
Reading a YTYP and printing the amount of archetypes with a greater LOD distance than 73.
using CodeWalker.GameFiles;
YtypFile yt = new YtypFile();
yt.Load(File.ReadAllBytes("hei_hollywood_metadata_001_strm.ytyp"));
Console.WriteLine(yt.AllArchetypes.Count(x => x._BaseArchetypeDef.lodDist > 100));
Result
7
Reading a YTYP and setting all archetypes textureDictionary
to the same and then saving it
using CodeWalker.GameFiles;
YtypFile yt = new YtypFile();
yt.Load(File.ReadAllBytes("hei_hollywood_metadata_001_strm.ytyp"));
yt.AllArchetypes.ToList().ForEach(x => x._BaseArchetypeDef.textureDictionary = JenkHash.GenHash("my_new_txd"));
File.WriteAllBytes("hei_hollywood_metadata_001_strm_modified.ytyp", yt.Save());
YDR
Reading YDR files and deleting any embedded collisions and then saving them.
using CodeWalker.GameFiles;
List<string> ydrFiles = Directory.GetFiles("ydrFiles", "*.ydr").ToList();
foreach (string ydrFile in ydrFiles)
{
string? parentDir = Path.GetDirectoryName(ydrFile);
string ydrFileName = Path.GetFileNameWithoutExtension(ydrFile);
YdrFile ydr = new YdrFile();
RpfFile.LoadResourceFile(ydr, File.ReadAllBytes(ydrFile), 165);
if(ydr.Drawable.Bound != null)
{
ydr.Drawable.Bound = null;
File.WriteAllBytes($"{parentDir}/{ydrFileName}_nocol.ydr", ydr.Save());
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- SharpDX (>= 4.2.0)
- SharpDX.Mathematics (>= 4.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
YDD,YED,YPT,AWC,REL XML conversion improvements, YFT XML collisions improvements, Resource packing improvements, Bug fixes for ymap editing