Peds form progress, new MetaNames, ped ymt metas parsing

This commit is contained in:
dexy 2019-11-07 03:51:35 +11:00
parent 90142cb6da
commit 8bfca3a338
14 changed files with 1358 additions and 120 deletions

View File

@ -61,6 +61,7 @@
<Compile Include="GameFiles\FileTypes\GtxdFile.cs" />
<Compile Include="GameFiles\FileTypes\Gxt2File.cs" />
<Compile Include="GameFiles\FileTypes\JPsoFile.cs" />
<Compile Include="GameFiles\FileTypes\PedFile.cs" />
<Compile Include="GameFiles\FileTypes\PedsFile.cs" />
<Compile Include="GameFiles\FileTypes\RelFile.cs" />
<Compile Include="GameFiles\FileTypes\Stats.cs" />

View File

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml;
using TC = System.ComponentModel.TypeConverterAttribute;
using EXP = System.ComponentModel.ExpandableObjectConverter;
namespace CodeWalker.GameFiles
{
[TC(typeof(EXP))] public class PedFile : GameFile, PackedFile
{
public Meta Meta { get; set; }
public PsoFile Pso { get; set; }
public RbfFile Rbf { get; set; }
public string Xml { get; set; }
public MCPedVariationInfo VariationInfo { get; set; }
public string[] Strings { get; set; }
public PedFile() : base(null, GameFileType.Ped)
{ }
public PedFile(RpfFileEntry entry) : base(entry, GameFileType.Ped)
{ }
public void Load(byte[] data, RpfFileEntry entry)
{
RpfFileEntry = entry;
Name = entry.Name;
FilePath = Name;
RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;
if (resentry == null)
{
NonMetaLoad(data);
Loaded = true;
return;
}
ResourceDataReader rd = new ResourceDataReader(resentry, data);
Meta = rd.ReadBlock<Meta>();
LoadMeta();
Loaded = true;
}
private void LoadMeta()
{
var vVariationInfo = MetaTypes.GetTypedData<CPedVariationInfo>(Meta, MetaName.CPedVariationInfo);
VariationInfo = new MCPedVariationInfo();
VariationInfo.Load(Meta, vVariationInfo);
Strings = MetaTypes.GetStrings(Meta);
if (Strings != null)
{
foreach (string str in Strings)
{
JenkIndex.Ensure(str); //just shove them in there
}
}
}
private void LoadPso()
{
var vVariationInfo = PsoTypes.GetRootItem<CPedVariationInfo>(Pso);
VariationInfo = new MCPedVariationInfo();
VariationInfo.Load(Pso, vVariationInfo);
}
private void NonMetaLoad(byte[] data)
{
//non meta not supported yet! but see what's in there...
MemoryStream ms = new MemoryStream(data);
if (RbfFile.IsRBF(ms))
{
Rbf = new RbfFile();
Rbf.Load(ms);
}
else if (PsoFile.IsPSO(ms))
{
Pso = new PsoFile();
Pso.Load(ms);
LoadPso();
}
else
{
}
}
}
}

View File

@ -23,8 +23,7 @@ namespace CodeWalker.GameFiles
public PedsFile() : base(null, GameFileType.Peds)
{ }
public PedsFile(RpfFileEntry entry) : base(entry, GameFileType.Peds)
{
}
{ }
public void Load(byte[] data, RpfFileEntry entry)
{

View File

@ -89,12 +89,13 @@ namespace CodeWalker.GameFiles
if (resentry == null)
{
NonMetaLoad(data);
Loaded = true;
return;
}
ResourceDataReader rd = new ResourceDataReader(resentry, data);
Meta = rd.ReadBlock<Meta>();
Meta = rd.ReadBlock<Meta>();//maybe null this after load to reduce memory consumption?
@ -232,12 +233,12 @@ namespace CodeWalker.GameFiles
MemoryStream ms = new MemoryStream(data);
if (RbfFile.IsRBF(ms))
{
var Rbf = new RbfFile();
Rbf = new RbfFile();
Rbf.Load(ms);
}
else if (PsoFile.IsPSO(ms))
{
var Pso = new PsoFile();
Pso = new PsoFile();
Pso.Load(ms);
//PsoTypes.EnsurePsoTypes(Pso);
}

View File

@ -76,6 +76,7 @@ namespace CodeWalker.GameFiles
CarVariations = 20,
VehicleLayouts = 21,
Peds = 22,
Ped = 23,
}

View File

@ -80,6 +80,9 @@ namespace CodeWalker.GameFiles
public Dictionary<MetaHash, VehicleInitData> VehiclesInitDict { get; set; }
public Dictionary<MetaHash, CPedModelInfo__InitData> PedsInitDict { get; set; }
public Dictionary<MetaHash, PedFile> PedVariationsDict { get; set; }
public Dictionary<MetaHash, Dictionary<MetaHash, RpfFileEntry>> PedDrawableDicts { get; set; }
public Dictionary<MetaHash, Dictionary<MetaHash, RpfFileEntry>> PedTextureDicts { get; set; }
public List<RpfFile> BaseRpfs { get; private set; }
public List<RpfFile> AllRpfs { get; private set; }
@ -1602,9 +1605,72 @@ namespace CodeWalker.GameFiles
if (!LoadPeds) return;
IEnumerable<RpfFile> rpfs = PreloadedMode ? AllRpfs : (IEnumerable<RpfFile>)ActiveMapRpfFiles.Values;
List<RpfFile> dlcrpfs = new List<RpfFile>();
if (EnableDlc)
{
foreach (var rpf in DlcActiveRpfs)
{
dlcrpfs.Add(rpf);
if (rpf.Children == null) continue;
foreach (var crpf in rpf.Children)
{
dlcrpfs.Add(crpf);
if (crpf.Children?.Count > 0)
{ }
}
}
}
var allPeds = new Dictionary<MetaHash, CPedModelInfo__InitData>();
var allPedsFiles = new List<PedsFile>();
var allPedYmts = new Dictionary<MetaHash, PedFile>();
var allPedDrwDicts = new Dictionary<MetaHash, Dictionary<MetaHash, RpfFileEntry>>();
var allPedTexDicts = new Dictionary<MetaHash, Dictionary<MetaHash, RpfFileEntry>>();
var addPedDicts = new Action<string, MetaHash, RpfDirectoryEntry>((namel, hash, dir)=>
{
if (dir?.Directories != null)
{
foreach (var cdir in dir.Directories)
{
if (cdir.NameLower == namel)
{
dir = cdir;
break;
}
}
var files = dir?.Files;
if (files != null)
{
Dictionary<MetaHash, RpfFileEntry> dict = null;
foreach (var file in files)
{
if (file?.NameLower == null) continue;
if (file.NameLower.EndsWith(".ydd"))
{
if (!allPedDrwDicts.TryGetValue(hash, out dict))
{
dict = new Dictionary<MetaHash, RpfFileEntry>();
allPedDrwDicts[hash] = dict;
}
dict[file.ShortNameHash] = file;
}
else if (file.NameLower.EndsWith(".ytd"))
{
if (!allPedTexDicts.TryGetValue(hash, out dict))
{
dict = new Dictionary<MetaHash, RpfFileEntry>();
allPedTexDicts[hash] = dict;
}
dict[file.ShortNameHash] = file;
}
}
}
}
});
var addPedsFiles = new Action<IEnumerable<RpfFile>>((from) =>
{
@ -1643,19 +1709,66 @@ namespace CodeWalker.GameFiles
#endif
}
}
});
var addPedFiles = new Action<IEnumerable<RpfFile>>((from) =>
{
foreach (RpfFile file in from)
{
if (file.AllEntries == null) continue;
foreach (RpfEntry entry in file.AllEntries)
{
#if !DEBUG
try
#endif
{
if (entry.NameLower.EndsWith(".ymt"))
{
var testname = entry.GetShortNameLower();
var testhash = JenkHash.GenHash(testname);
if (allPeds.ContainsKey(testhash))
{
var pf = RpfMan.GetFile<PedFile>(entry);
if (pf != null)
{
allPedYmts[testhash] = pf;
addPedDicts(testname, testhash, entry.Parent);
}
}
}
}
#if !DEBUG
catch (Exception ex)
{
string errstr = entry.Path + "\n" + ex.ToString();
ErrorLog(errstr);
}
#endif
}
}
});
addPedsFiles(rpfs);
if (EnableDlc)
{
addPedsFiles(DlcActiveRpfs);
}
addPedsFiles(rpfs);
addPedsFiles(dlcrpfs);
addPedFiles(rpfs);
addPedFiles(dlcrpfs);
PedsInitDict = allPeds;
PedVariationsDict = allPedYmts;
PedDrawableDicts = allPedDrwDicts;
PedTextureDicts = allPedTexDicts;
foreach (var kvp in PedsInitDict)
{
if (!PedVariationsDict.ContainsKey(kvp.Key))
{ }//checking we found them all!
}
}
@ -1726,7 +1839,7 @@ namespace CodeWalker.GameFiles
private void TryLoadEnqueue(GameFile gf)
public void TryLoadEnqueue(GameFile gf)
{
if (((!gf.Loaded)) && (requestQueue.Count < 10))// && (!gf.LoadQueued)
{
@ -2099,6 +2212,13 @@ namespace CodeWalker.GameFiles
}
public T GetFileUncached<T>(RpfFileEntry e) where T : GameFile, new()
{
var f = new T();
f.RpfFileEntry = e;
TryLoadEnqueue(f);
return f;
}

View File

@ -653,13 +653,14 @@ namespace CodeWalker.GameFiles
Unk1 = 0;
}
public void SwapEnd()
public Array_Structure SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
return this;
}
public override string ToString()
{
@ -963,6 +964,10 @@ namespace CodeWalker.GameFiles
[TC(typeof(EXP))] public struct ArrayOfBytes3 //array of 3 bytes
{
public byte b0, b1, b2;
public byte[] GetArray()
{
return new[] { b0, b1, b2 };
}
public override string ToString()
{
return b0.ToString() + ", " + b1.ToString() + ", " + b2.ToString();
@ -971,6 +976,10 @@ namespace CodeWalker.GameFiles
[TC(typeof(EXP))] public struct ArrayOfBytes4 //array of 4 bytes
{
public byte b0, b1, b2, b3;
public byte[] GetArray()
{
return new[] { b0, b1, b2, b3 };
}
public override string ToString()
{
return b0.ToString() + ", " + b1.ToString() + ", " + b2.ToString() + ", " + b3.ToString();
@ -979,14 +988,26 @@ namespace CodeWalker.GameFiles
[TC(typeof(EXP))] public struct ArrayOfBytes5 //array of 5 bytes
{
public byte b0, b1, b2, b3, b4;
public byte[] GetArray()
{
return new[] { b0, b1, b2, b3, b4 };
}
}
[TC(typeof(EXP))] public struct ArrayOfBytes6 //array of 6 bytes
{
public byte b0, b1, b2, b3, b4, b5;
public byte[] GetArray()
{
return new[] { b0, b1, b2, b3, b4, b5 };
}
}
[TC(typeof(EXP))] public struct ArrayOfBytes12 //array of 12 bytes
{
public byte b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11;
public byte[] GetArray()
{
return new[] { b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11 };
}
}
[TC(typeof(EXP))] public struct ArrayOfChars64 //array of 64 chars (bytes)
{

View File

@ -3489,16 +3489,23 @@ namespace CodeWalker.GameFiles
ePedRadioGenre = 2942646938,
eSexinessFlags = 374769227,
eExternallyDrivenDOFs = 637184392,
eAnchorPoints = 2834549053,
SpecialAbilityType = 2011786168,
DefaultSpawnPreference = 888587604,
numAlternatives = 2806194106,
CScenarioChainingEdge__eAction = 3609807418,
CScenarioChainingEdge__eNavMode = 3971773454,
CScenarioChainingEdge__eNavSpeed = 941086046,
CStreamingRequestCommonSet = 1358189812,
animal = 974042365, //in peds.ymt
standard_ped = 2703423328, //in peds.ymt
standard_male = 1860494962, //in peds.ymt PedCapsuleName
standard_male = 1860494962, //in peds.ymt PedCapsuleName - from pedbounds.xml
standard_female = 3778684510, //in peds.ymt PedCapsuleName
standard_player_male = 190297546, //in peds.ymt PedCapsuleName
standard_player_female = 3813733509, //in peds.ymt PedCapsuleName
large_male = 2182606047, //in peds.ymt PedCapsuleName
facial_clipset_group_gen_male = 2968316036, //in peds.ymt FacialClipsetGroupName
facial_clipset_group_gen_female = 984918963, //in peds.ymt FacialClipsetGroupName
facial_clipset_group_p_m_zero = 3839850645, //in peds.ymt FacialClipsetGroupName
@ -3542,6 +3549,17 @@ namespace CodeWalker.GameFiles
//ped ymt's hashes from Siprus
numAvailProps = 2598445407,
numAvailTex = 3371516811,
ownsCloth = 2828247905,
aComponentData3 = 3796409423, //is this a collision? it's good enough for now!
bHasTexVariations = 1235281004,
//GranularSound dat54.rel FileName hashes from NotGigo
engine_accel = 3748922026,
exhaust_accel = 598446449,

View File

@ -436,7 +436,7 @@ namespace CodeWalker.GameFiles
return new MetaStructureInfo(MetaName.CStreamingRequestRecord, 3825587854, 768, 40,
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CStreamingRequestFrame),
new MetaStructureEntryInfo_s(MetaName.Frames, 0, MetaStructureEntryDataType.Array, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, (MetaName)1358189812),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CStreamingRequestCommonSet),
new MetaStructureEntryInfo_s(MetaName.CommonSets, 16, MetaStructureEntryDataType.Array, 0, 2, 0),
new MetaStructureEntryInfo_s(MetaName.NewStyle, 32, MetaStructureEntryDataType.Boolean, 0, 0, 0)
);
@ -466,8 +466,8 @@ namespace CodeWalker.GameFiles
// new MetaStructureEntryInfo_s((MetaName)1762439591, 64, MetaStructureEntryDataType.Array, 0, 6, 0),
// new MetaStructureEntryInfo_s(MetaName.Flags, 80, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0)
// );
case (MetaName)1358189812:
return new MetaStructureInfo((MetaName)1358189812, 3710200606, 768, 16,
case MetaName.CStreamingRequestCommonSet:
return new MetaStructureInfo(MetaName.CStreamingRequestCommonSet, 3710200606, 768, 16,
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Hash, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.Requests, 0, MetaStructureEntryDataType.Array, 0, 0, 0)
);
@ -1009,7 +1009,7 @@ namespace CodeWalker.GameFiles
);
case MetaName.CPedPropInfo:
return new MetaStructureInfo(MetaName.CPedPropInfo, 1792487819, 768, 40,
new MetaStructureEntryInfo_s((MetaName)2598445407, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.numAvailProps, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CPedPropMetaData),
new MetaStructureEntryInfo_s(MetaName.aPropMetaData, 8, MetaStructureEntryDataType.Array, 0, 1, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CAnchorProps),
@ -1017,14 +1017,14 @@ namespace CodeWalker.GameFiles
);
case MetaName.CPedVariationInfo:
return new MetaStructureInfo(MetaName.CPedVariationInfo, 4030871161, 768, 112,
new MetaStructureEntryInfo_s((MetaName)1235281004, 0, MetaStructureEntryDataType.Boolean, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.bHasTexVariations, 0, MetaStructureEntryDataType.Boolean, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)4086467184, 1, MetaStructureEntryDataType.Boolean, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)911147899, 2, MetaStructureEntryDataType.Boolean, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)315291935, 3, MetaStructureEntryDataType.Boolean, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)2996560424, 4, MetaStructureEntryDataType.ArrayOfBytes, 0, 4, (MetaName)MetaTypeName.PsoPOINTER),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, (MetaName)3538495220),
new MetaStructureEntryInfo_s((MetaName)3796409423, 16, MetaStructureEntryDataType.Array, 0, 6, 0),
new MetaStructureEntryInfo_s(MetaName.aComponentData3, 16, MetaStructureEntryDataType.Array, 0, 6, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CPedSelectionSet),
new MetaStructureEntryInfo_s(MetaName.aSelectionSets, 32, MetaStructureEntryDataType.Array, 0, 8, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, MetaName.CComponentInfo),
@ -1034,18 +1034,18 @@ namespace CodeWalker.GameFiles
);
case (MetaName)3538495220:
return new MetaStructureInfo((MetaName)3538495220, 2024084511, 768, 24,
new MetaStructureEntryInfo_s((MetaName)3371516811, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.numAvailTex, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, (MetaName)1535046754),
new MetaStructureEntryInfo_s((MetaName)1756136273, 8, MetaStructureEntryDataType.Array, 0, 1, 0)
);
case (MetaName)2236980467:
return new MetaStructureInfo((MetaName)2236980467, 508935687, 0, 24,
new MetaStructureEntryInfo_s((MetaName)2828247905, 0, MetaStructureEntryDataType.Boolean, 0, 0, 0)
new MetaStructureEntryInfo_s(MetaName.ownsCloth, 0, MetaStructureEntryDataType.Boolean, 0, 0, 0)
);
case (MetaName)1535046754:
return new MetaStructureInfo((MetaName)1535046754, 124073662, 768, 48,
new MetaStructureEntryInfo_s(MetaName.propMask, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)2806194106, 1, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.numAlternatives, 1, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.Structure, 0, 0, (MetaName)1036962405),
new MetaStructureEntryInfo_s(MetaName.aTexData, 8, MetaStructureEntryDataType.Array, 0, 2, 0),
new MetaStructureEntryInfo_s(MetaName.clothData, 24, MetaStructureEntryDataType.Structure, 0, 0, (MetaName)2236980467)
@ -1096,7 +1096,7 @@ namespace CodeWalker.GameFiles
return new MetaStructureInfo(MetaName.CAnchorProps, 403574180, 768, 24,
new MetaStructureEntryInfo_s((MetaName)MetaTypeName.ARRAYINFO, 0, MetaStructureEntryDataType.UnsignedByte, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.props, 0, MetaStructureEntryDataType.Array, 0, 0, 0),
new MetaStructureEntryInfo_s(MetaName.anchor, 16, MetaStructureEntryDataType.IntEnum, 0, 0, (MetaName)2834549053)
new MetaStructureEntryInfo_s(MetaName.anchor, 16, MetaStructureEntryDataType.IntEnum, 0, 0, MetaName.eAnchorPoints)
);
case MetaName.CPedSelectionSet:
return new MetaStructureInfo(MetaName.CPedSelectionSet, 3120284999, 512, 48,
@ -1386,8 +1386,8 @@ namespace CodeWalker.GameFiles
new MetaEnumEntryInfo_s((MetaName)3735238938, 1),
new MetaEnumEntryInfo_s((MetaName)3395845123, 2)
);
case (MetaName)2834549053:
return new MetaEnumInfo((MetaName)2834549053, 1309372691,
case MetaName.eAnchorPoints:
return new MetaEnumInfo(MetaName.eAnchorPoints, 1309372691,
new MetaEnumEntryInfo_s(MetaName.ANCHOR_HEAD, 0),
new MetaEnumEntryInfo_s(MetaName.ANCHOR_EYES, 1),
new MetaEnumEntryInfo_s(MetaName.ANCHOR_EARS, 2),
@ -2264,7 +2264,7 @@ namespace CodeWalker.GameFiles
Unk_3395845123 = 2,
}
public enum Unk_2834549053 //component peds CAnchorProps anchor
public enum eAnchorPoints //component peds CAnchorProps eAnchorPoints
: int //Key:1309372691
{
ANCHOR_HEAD = 0,
@ -5880,9 +5880,9 @@ namespace CodeWalker.GameFiles
public struct CStreamingRequestRecord //40 bytes, Key:3825587854 //SRL YMT ROOT - in /streaming/ folder
{
public Array_Structure Frames { get; set; } //0 0: Array: 0: Frames//419044527 {0: Structure: CStreamingRequestFrame//999226379: 256}
public Array_Structure CommonSets { get; set; } //16 16: Array: 0: CommonSets//4248405899 {0: Structure: 1358189812: 256}
public byte NewStyle { get; set; } //32 32: Boolean: 0: 2333392588
public Array_Structure Frames { get; set; } //0 0: Array: 0: Frames {0: Structure: CStreamingRequestFrame: 256}
public Array_Structure CommonSets { get; set; } //16 16: Array: 0: CommonSets {0: Structure: CStreamingRequestCommonSet: 256}
public byte NewStyle { get; set; } //32 32: Boolean: 0: NewStyle
public byte Unused0 { get; set; }//33
public ushort Unused1 { get; set; }//34
public uint Unused2 { get; set; }//36
@ -5919,9 +5919,9 @@ namespace CodeWalker.GameFiles
public uint Unused4 { get; set; }//92
}
public struct Unk_1358189812 //16 bytes, Key:3710200606 //SRL hashes list?
public struct CStreamingRequestCommonSet //16 bytes, Key:3710200606 //SRL common set
{
public Array_uint Requests { get; set; } //0 0: Array: 0: Requests//2743119154 {0: Hash: 0: 256}
public Array_uint Requests { get; set; } //0 0: Array: 0: Requests {0: Hash: 0: 256}
}
@ -5990,41 +5990,290 @@ namespace CodeWalker.GameFiles
public struct CPedVariationInfo //112 bytes, Key:4030871161 //COMPONENT PEDS YMT ROOT - in componentpeds .rpf's
public struct CPedVariationInfo : IPsoSwapEnd //112 bytes, Key:4030871161 //COMPONENT PEDS YMT ROOT - in componentpeds .rpf's
{
public byte Unk_1235281004 { get; set; } //0 0: Boolean: 0: 1235281004
public byte bHasTexVariations { get; set; } //0 0: Boolean: 0: bHasTexVariations
public byte Unk_4086467184 { get; set; } //1 1: Boolean: 0: 4086467184
public byte Unk_911147899 { get; set; } //2 2: Boolean: 0: 911147899
public byte Unk_315291935 { get; set; } //3 3: Boolean: 0: 315291935
public ArrayOfBytes12 Unk_2996560424 { get; set; } //4 4: ArrayOfBytes: 12: 2996560424
public Array_Structure Unk_3796409423 { get; set; } //16 16: Array: 0: 3796409423 {0: Structure: 3538495220: 256}
public Array_Structure aSelectionSets { get; set; } //32 32: Array: 0: aSelectionSets {0: Structure: 253191135: 256}
public Array_Structure compInfos { get; set; } //48 48: Array: 0: compInfos//592652859 {0: Structure: CComponentInfo//1866571721: 256}
public CPedPropInfo propInfo { get; set; } //64 64: Structure: 2858946626: propInfo//2240851416
public Array_Structure aComponentData3 { get; set; } //16 16: Array: 0: aComponentData3 {0: Structure: 3538495220: 256}
public Array_Structure aSelectionSets { get; set; } //32 32: Array: 0: aSelectionSets {0: Structure: CPedSelectionSet: 256}
public Array_Structure compInfos { get; set; } //48 48: Array: 0: compInfos {0: Structure: CComponentInfo: 256}
public CPedPropInfo propInfo { get; set; } //64 64: Structure: CPedPropInfo: propInfo
public MetaHash dlcName { get; set; } //104 104: Hash: 0: dlcName
public uint Unused0 { get; set; }//108
public void SwapEnd()
{
aComponentData3 = aComponentData3.SwapEnd();
aSelectionSets = aSelectionSets.SwapEnd();
compInfos = compInfos.SwapEnd();
propInfo = propInfo.SwapEnd();
dlcName = MetaTypes.SwapBytes(dlcName);
}
}
public class MCPedVariationInfo : MetaWrapper
{
public CPedVariationInfo _Data;
public CPedVariationInfo Data { get { return _Data; } }
public byte[] ComponentIndices { get; set; }
public MUnk_3538495220[] ComponentVariations { get; set; }
public MCPedSelectionSet[] SelectionSets { get; set; }
public MCComponentInfo[] CompInfos { get; set; }
public MCPedPropInfo PropInfo { get; set; }
public override void Load(Meta meta, MetaPOINTER ptr)
{
var data = MetaTypes.GetData<CPedVariationInfo>(meta, ptr);
Load(meta, data);
}
public void Load(Meta meta, CPedVariationInfo data)
{
//maybe see https://github.com/emcifuntik/altv-cloth-tool/blob/master/AltTool/ResourceBuilder.cs
_Data = data;
ComponentIndices = data.Unk_2996560424.GetArray();
var vComponentVariations = MetaTypes.ConvertDataArray<Unk_3538495220>(meta, (MetaName)3538495220, _Data.aComponentData3);
if (vComponentVariations != null)
{
ComponentVariations = new MUnk_3538495220[vComponentVariations.Length];
for (int i = 0; i < vComponentVariations.Length; i++)
{
ComponentVariations[i] = new MUnk_3538495220(meta, vComponentVariations[i], this);
}
}
public struct Unk_3538495220 //24 bytes, Key:2024084511 //COMPONENT PEDS unknown
var vSelectionSets = MetaTypes.ConvertDataArray<CPedSelectionSet>(meta, MetaName.CPedSelectionSet, _Data.aSelectionSets);
if (vSelectionSets != null)
{
public byte Unk_3371516811 { get; set; } //0 0: UnsignedByte: 0: 3371516811
SelectionSets = new MCPedSelectionSet[vSelectionSets.Length];
for (int i = 0; i < vSelectionSets.Length; i++)
{
SelectionSets[i] = new MCPedSelectionSet(meta, vSelectionSets[i], this);
}
}
var vCompInfos = MetaTypes.ConvertDataArray<CComponentInfo>(meta, MetaName.CComponentInfo, _Data.compInfos);
if (vCompInfos != null)
{
CompInfos = new MCComponentInfo[vCompInfos.Length];
for (int i = 0; i < vCompInfos.Length; i++)
{
CompInfos[i] = new MCComponentInfo(meta, vCompInfos[i], this);
}
}
PropInfo = new MCPedPropInfo(meta, data.propInfo, this);
for (int i = 0; i < 12; i++) //set the component type indices on all the component variants, for them to use
{
var compInd = ComponentIndices[i];
if ((compInd > 0) && (compInd < ComponentVariations?.Length))
{
var compvar = ComponentVariations[compInd];
compvar.ComponentType = i;
if (compvar.Variations != null)
{
foreach (var cvp in compvar.Variations)
{
cvp.ComponentType = i;
//cvp.GetDrawableName();//testing
}
}
}
}
}
public void Load(PsoFile pso, CPedVariationInfo data)
{
//TODO!
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
public MUnk_3538495220 GetVariations(int componentType)
{
if ((componentType < 0) || (componentType > 11)) return null;
if (ComponentIndices == null) return null;
var index = ComponentIndices[componentType];
if (index > ComponentVariations?.Length) return null;
return ComponentVariations[index];
}
}
public struct Unk_3538495220 //24 bytes, Key:2024084511 //COMPONENT PEDS component variations item
{
public byte numAvailTex { get; set; } //0 0: UnsignedByte: 0: numAvailTex
public byte Unused0 { get; set; }//1
public ushort Unused1 { get; set; }//2
public uint Unused2 { get; set; }//4
public Array_Structure Unk_1756136273 { get; set; } //8 8: Array: 0: 1756136273 {0: Structure: 1535046754: 256}
}
public struct Unk_1535046754 //48 bytes, Key:124073662 //COMPONENT PEDS unknown /cloth?
public class MUnk_3538495220 : MetaWrapper
{
public byte propMask { get; set; } //0 0: UnsignedByte: 0: propMask//2932859459
public byte Unk_2806194106 { get; set; } //1 1: UnsignedByte: 0: 2806194106
public ushort Unused0 { get; set; }//2
public uint Unused1 { get; set; }//4
public Array_Structure aTexData { get; set; } //8 8: Array: 0: aTexData//1251090986 {0: Structure: 1036962405: 256}
public Unk_2236980467 clothData { get; set; } //24 24: Structure: 2236980467: clothData//2464583091
public MCPedVariationInfo Owner { get; set; }
public Unk_3538495220 _Data;
public Unk_3538495220 Data { get { return _Data; } }
public MUnk_1535046754[] Variations { get; set; }
public int ComponentType { get; set; } = 0;
public static string[] ComponentTypeNames { get; } =
{
"head",//0
"berd",//1
"hair",//2
"uppr",//3
"lowr",//4
"hand",//5
"feet",//6
"teef",//7
"accs",//8
"task",//9
"decl",//10
"jbib",//11
};
public MUnk_3538495220() { }
public MUnk_3538495220(Meta meta, Unk_3538495220 data, MCPedVariationInfo owner)
{
_Data = data;
Owner = owner;
Init(meta);
}
public struct Unk_1036962405 //3 bytes, Key:4272717794 //COMPONENT PEDS (cloth?) TexData
private void Init(Meta meta)
{
var vVariations = MetaTypes.ConvertDataArray<Unk_1535046754>(meta, (MetaName)1535046754, _Data.Unk_1756136273);
if (vVariations != null)
{
Variations = new MUnk_1535046754[vVariations.Length];
for (int i = 0; i < vVariations.Length; i++)
{
Variations[i] = new MUnk_1535046754(meta, vVariations[i], this, i);
}
}
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
_Data = MetaTypes.GetData<Unk_3538495220>(meta, ptr);
Init(meta);
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
public override string ToString()
{
string r = (ComponentType < 12) ? ComponentTypeNames[ComponentType] : "error";
return r + " : " + Variations?.Length.ToString() ?? base.ToString();
}
}
public struct Unk_1535046754 //48 bytes, Key:124073662 //COMPONENT PEDS drawable info
{
public byte propMask { get; set; } //0 0: UnsignedByte: 0: propMask
public byte numAlternatives { get; set; } //1 1: UnsignedByte: 0: 2806194106
public ushort Unused0 { get; set; }//2
public uint Unused1 { get; set; }//4
public Array_Structure aTexData { get; set; } //8 8: Array: 0: aTexData {0: Structure: 1036962405: 256}
public Unk_2236980467 clothData { get; set; } //24 24: Structure: 2236980467: clothData
}
public class MUnk_1535046754 : MetaWrapper
{
public MUnk_3538495220 Owner { get; set; }
public Unk_1535046754 _Data;
public Unk_1535046754 Data { get { return _Data; } }
public Unk_1036962405[] TexData { get; set; }
public int ComponentType { get; set; } = 0;
public int DrawableIndex { get; set; } = 0;
public int PropMask { get { return _Data.propMask; } }
public int NumAlternatives { get { return _Data.numAlternatives; } }
public int PropType { get { return (PropMask >> 4) & 3; } }
public string GetDrawableName(int altnum = 0)
{
string r = (ComponentType < 12) ? MUnk_3538495220.ComponentTypeNames[ComponentType] : "error";
r += "_";
r += DrawableIndex.ToString("000");
r += "_";
switch (PropType)
{
case 0: r += "u"; break;//what do these mean?
case 1: r += "r"; break;
case 2: r += "m"; break;
case 3: r += "m"; break;
default:
break;
}
if (altnum > 0)
{
r += "_";
r += altnum.ToString();
}
return r;
}
public MUnk_1535046754() { }
public MUnk_1535046754(Meta meta, Unk_1535046754 data, MUnk_3538495220 owner, int index)
{
_Data = data;
Owner = owner;
DrawableIndex = index;
TexData = MetaTypes.ConvertDataArray<Unk_1036962405>(meta, (MetaName)1036962405, _Data.aTexData);
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
public override string ToString()
{
return GetDrawableName();
}
}
public struct Unk_1036962405 //3 bytes, Key:4272717794 //COMPONENT PEDS (cloth?) aTexData
{
public byte texId { get; set; } //0 0: UnsignedByte: 0: texId
public byte distribution { get; set; } //1 1: UnsignedByte: 0: distribution//914976023
@ -6033,7 +6282,7 @@ namespace CodeWalker.GameFiles
public struct Unk_2236980467 //24 bytes, Key:508935687 //COMPONENT PEDS clothData
{
public byte Unk_2828247905 { get; set; } //0 0: Boolean: 0: 2828247905
public byte ownsCloth { get; set; } //0 0: Boolean: 0: ownsCloth
public byte Unused0 { get; set; }//1
public ushort Unused1 { get; set; }//2
public uint Unused2 { get; set; }//4
@ -6043,7 +6292,7 @@ namespace CodeWalker.GameFiles
public uint Unused6 { get; set; }//20
}
public struct CPedSelectionSet //48 bytes, Key:3120284999 //COMPONENT PEDS unknown
public struct CPedSelectionSet //48 bytes, Key:3120284999 //COMPONENT PEDS
{
public MetaHash name { get; set; } //0 0: Hash: 0: name
public ArrayOfBytes12 Unk_173599222 { get; set; } //4 4: ArrayOfBytes: 12: 173599222
@ -6053,8 +6302,32 @@ namespace CodeWalker.GameFiles
public ArrayOfBytes6 Unk_672172037 { get; set; } //40 40: ArrayOfBytes: 6: 672172037
public ushort Unused0 { get; set; }//46
}
public class MCPedSelectionSet : MetaWrapper
{
public MCPedVariationInfo Owner { get; set; }
public struct CComponentInfo //48 bytes, Key:3693847250 //COMPONENT PEDS CComponentInfo
public CPedSelectionSet _Data;
public CPedSelectionSet Data { get { return _Data; } }
public MCPedSelectionSet() { }
public MCPedSelectionSet(Meta meta, CPedSelectionSet data, MCPedVariationInfo owner)
{
_Data = data;
Owner = owner;
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
}
public struct CComponentInfo //48 bytes, Key:3693847250 //COMPONENT PEDS
{
public MetaHash Unk_802196719 { get; set; } //0 0: Hash: 0: 802196719
public MetaHash Unk_4233133352 { get; set; } //4 4: Hash: 0: 4233133352
@ -6073,18 +6346,108 @@ namespace CodeWalker.GameFiles
public byte Unk_4196345791 { get; set; } //45 45: UnsignedByte: 0: 4196345791
public ushort Unused5 { get; set; }//46
}
public struct CPedPropInfo //40 bytes, Key:1792487819 //COMPONENT PEDS unknown
public class MCComponentInfo : MetaWrapper
{
public byte Unk_2598445407 { get; set; } //0 0: UnsignedByte: 0: 2598445407
public MCPedVariationInfo Owner { get; set; }
public CComponentInfo _Data;
public CComponentInfo Data { get { return _Data; } }
public int ComponentType { get { return _Data.Unk_3509540765; } }
public int ComponentIndex { get { return _Data.Unk_4196345791; } }
public MCComponentInfo() { }
public MCComponentInfo(Meta meta, CComponentInfo data, MCPedVariationInfo owner)
{
_Data = data;
Owner = owner;
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
public override string ToString()
{
return (ComponentType < 12) ? MUnk_3538495220.ComponentTypeNames[ComponentType] + "_" + ComponentIndex.ToString("000") : base.ToString();
}
}
public struct CPedPropInfo //40 bytes, Key:1792487819 //COMPONENT PEDS
{
public byte numAvailProps { get; set; } //0 0: UnsignedByte: 0: numAvailProps
public byte Unused0 { get; set; }//1
public ushort Unused1 { get; set; }//2
public uint Unused2 { get; set; }//4
public Array_Structure aPropMetaData { get; set; } //8 8: Array: 0: aPropMetaData {0: Structure: CPedPropMetaData: 256}
public Array_Structure aAnchors { get; set; } //24 24: Array: 0: aAnchors {0: Structure: CAnchorProps: 256}
public CPedPropInfo SwapEnd()
{
aPropMetaData = aPropMetaData.SwapEnd();
aAnchors = aAnchors.SwapEnd();
return this;
}
}
public class MCPedPropInfo : MetaWrapper
{
public MCPedVariationInfo Owner { get; set; }
public CPedPropInfo _Data;
public CPedPropInfo Data { get { return _Data; } }
public MCPedPropMetaData[] PropMetaData { get; set; }
public MCAnchorProps[] Anchors { get; set; }
public MCPedPropInfo() { }
public MCPedPropInfo(Meta meta, CPedPropInfo data, MCPedVariationInfo owner)
{
_Data = data;
Owner = owner;
var vPropMetaData = MetaTypes.ConvertDataArray<CPedPropMetaData>(meta, MetaName.CPedPropMetaData, _Data.aPropMetaData);
if (vPropMetaData != null)
{
PropMetaData = new MCPedPropMetaData[vPropMetaData.Length];
for (int i = 0; i < vPropMetaData.Length; i++)
{
PropMetaData[i] = new MCPedPropMetaData(meta, vPropMetaData[i], this);
}
}
public struct CPedPropMetaData //56 bytes, Key:2029738350 //COMPONENT PEDS prop metadata
var vAnchors = MetaTypes.ConvertDataArray<CAnchorProps>(meta, MetaName.CAnchorProps, _Data.aAnchors);
if (vAnchors != null)
{
Anchors = new MCAnchorProps[vAnchors.Length];
for (int i = 0; i < vAnchors.Length; i++)
{
Anchors[i] = new MCAnchorProps(meta, vAnchors[i], this);
}
}
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
}
public struct CPedPropMetaData //56 bytes, Key:2029738350 //COMPONENT PEDS
{
public MetaHash audioId { get; set; } //0 0: Hash: 0: audioId
public ArrayOfBytes5 expressionMods { get; set; } //4 4: ArrayOfBytes: 5: expressionMods//942761829
@ -6103,8 +6466,35 @@ namespace CodeWalker.GameFiles
public byte Unused5 { get; set; }//53
public ushort Unused6 { get; set; }//54
}
public class MCPedPropMetaData : MetaWrapper
{
public MCPedPropInfo Owner { get; set; }
public struct CPedPropTexData //12 bytes, Key:2767296137 //COMPONENT PEDS prop texData
public CPedPropMetaData _Data;
public CPedPropMetaData Data { get { return _Data; } }
public CPedPropTexData[] TexData { get; set; }
public MCPedPropMetaData(Meta meta, CPedPropMetaData data, MCPedPropInfo owner)
{
_Data = data;
Owner = owner;
TexData = MetaTypes.ConvertDataArray<CPedPropTexData>(meta, MetaName.CPedPropTexData, _Data.texData);
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
}
public struct CPedPropTexData //12 bytes, Key:2767296137 //COMPONENT PEDS
{
public int inclusions { get; set; } //0 0: IntFlags2: 0: inclusions
public int exclusions { get; set; } //4 4: IntFlags2: 0: exclusions
@ -6117,10 +6507,37 @@ namespace CodeWalker.GameFiles
public struct CAnchorProps //24 bytes, Key:403574180 //COMPONENT PEDS CAnchorProps
{
public Array_byte props { get; set; } //0 0: Array: 0: props {0: UnsignedByte: 0: 256}
public Unk_2834549053 anchor { get; set; } //16 16: IntEnum: 2834549053: anchor
public eAnchorPoints anchor { get; set; } //16 16: IntEnum: eAnchorPoints: anchor
public uint Unused0 { get; set; }//20
}
public class MCAnchorProps : MetaWrapper
{
public MCPedPropInfo Owner { get; set; }
public CAnchorProps _Data;
public CAnchorProps Data { get { return _Data; } }
public byte[] Props { get; set; }
public MCAnchorProps(Meta meta, CAnchorProps data, MCPedPropInfo owner)
{
_Data = data;
Owner = owner;
Props = MetaTypes.GetByteArray(meta, _Data.props);
}
public override void Load(Meta meta, MetaPOINTER ptr)
{
throw new NotImplementedException();
}
public override MetaPOINTER Save(MetaBuilder mb)
{
throw new NotImplementedException();
}
}

View File

@ -13212,14 +13212,14 @@ namespace CodeWalker.GameFiles
);
case MetaName.CPedVariationInfo:
return new PsoStructureInfo(MetaName.CPedVariationInfo, 0, 0, 112,
new PsoStructureEntryInfo((MetaName)1235281004, PsoDataType.Bool, 0, 0, 0),
new PsoStructureEntryInfo(MetaName.bHasTexVariations, PsoDataType.Bool, 0, 0, 0),
new PsoStructureEntryInfo((MetaName)4086467184, PsoDataType.Bool, 1, 0, 0),
new PsoStructureEntryInfo((MetaName)911147899, PsoDataType.Bool, 2, 0, 0),
new PsoStructureEntryInfo((MetaName)315291935, PsoDataType.Bool, 3, 0, 0),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo((MetaName)2996560424, PsoDataType.Array, 4, 4, (MetaName)786436),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, (MetaName)3538495220),
new PsoStructureEntryInfo((MetaName)3796409423, PsoDataType.Array, 16, 0, (MetaName)6),
new PsoStructureEntryInfo(MetaName.aComponentData3, PsoDataType.Array, 16, 0, (MetaName)6),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, MetaName.CPedSelectionSet),
new PsoStructureEntryInfo(MetaName.aSelectionSets, PsoDataType.Array, 32, 0, (MetaName)8),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, MetaName.CComponentInfo),
@ -13229,7 +13229,7 @@ namespace CodeWalker.GameFiles
);
case MetaName.CPedPropInfo:
return new PsoStructureInfo(MetaName.CPedPropInfo, 0, 0, 40,
new PsoStructureEntryInfo((MetaName)2598445407, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo(MetaName.numAvailProps, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, MetaName.CPedPropMetaData),
new PsoStructureEntryInfo(MetaName.aPropMetaData, PsoDataType.Array, 8, 0, (MetaName)1),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, MetaName.CAnchorProps),
@ -13237,21 +13237,21 @@ namespace CodeWalker.GameFiles
);
case (MetaName)3538495220:
return new PsoStructureInfo((MetaName)3538495220, 0, 0, 24,
new PsoStructureEntryInfo((MetaName)3371516811, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo(MetaName.numAvailTex, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, (MetaName)1535046754),
new PsoStructureEntryInfo((MetaName)1756136273, PsoDataType.Array, 8, 0, (MetaName)1)
);
case (MetaName)1535046754:
return new PsoStructureInfo((MetaName)1535046754, 0, 0, 48,
new PsoStructureEntryInfo(MetaName.propMask, PsoDataType.UByte, 0, 0, 0),
new PsoStructureEntryInfo((MetaName)2806194106, PsoDataType.UByte, 1, 0, 0),
new PsoStructureEntryInfo(MetaName.numAlternatives, PsoDataType.UByte, 1, 0, 0),
new PsoStructureEntryInfo((MetaName)MetaTypeName.ARRAYINFO, PsoDataType.Structure, 0, 0, (MetaName)1036962405),
new PsoStructureEntryInfo(MetaName.aTexData, PsoDataType.Array, 8, 0, (MetaName)2),
new PsoStructureEntryInfo(MetaName.clothData, PsoDataType.Structure, 24, 0, (MetaName)2236980467)
);
case (MetaName)2236980467:
return new PsoStructureInfo((MetaName)2236980467, 0, 0, 24,
new PsoStructureEntryInfo((MetaName)2828247905, PsoDataType.Bool, 0, 0, 0)
new PsoStructureEntryInfo(MetaName.ownsCloth, PsoDataType.Bool, 0, 0, 0)
);
case (MetaName)1036962405:
return new PsoStructureInfo((MetaName)1036962405, 0, 0, 3,

View File

@ -78,6 +78,31 @@
this.ToolsPedTabPage = new System.Windows.Forms.TabPage();
this.ToolsTabControl = new System.Windows.Forms.TabControl();
this.ToolsPanel = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.CompHeadComboBox = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.CompBerdComboBox = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.CompHairComboBox = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.CompUpprComboBox = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.CompLowrComboBox = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.CompHandComboBox = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
this.CompFeetComboBox = new System.Windows.Forms.ComboBox();
this.label15 = new System.Windows.Forms.Label();
this.CompTeefComboBox = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.CompAccsComboBox = new System.Windows.Forms.ComboBox();
this.label17 = new System.Windows.Forms.Label();
this.CompTaskComboBox = new System.Windows.Forms.ComboBox();
this.label18 = new System.Windows.Forms.Label();
this.CompDeclComboBox = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
this.CompJbibComboBox = new System.Windows.Forms.ComboBox();
this.ConsolePanel.SuspendLayout();
this.ToolsOptionsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.TimeOfDayTrackBar)).BeginInit();
@ -601,9 +626,9 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 11);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.Size = new System.Drawing.Size(29, 13);
this.label3.TabIndex = 1;
this.label3.Text = "Name:";
this.label3.Text = "Ped:";
//
// PedNameComboBox
//
@ -616,6 +641,7 @@
this.PedNameComboBox.Name = "PedNameComboBox";
this.PedNameComboBox.Size = new System.Drawing.Size(182, 21);
this.PedNameComboBox.TabIndex = 0;
this.PedNameComboBox.SelectedIndexChanged += new System.EventHandler(this.PedNameComboBox_SelectedIndexChanged);
//
// StatsUpdateTimer
//
@ -625,6 +651,31 @@
//
// ToolsPedTabPage
//
this.ToolsPedTabPage.Controls.Add(this.label20);
this.ToolsPedTabPage.Controls.Add(this.CompJbibComboBox);
this.ToolsPedTabPage.Controls.Add(this.label18);
this.ToolsPedTabPage.Controls.Add(this.CompDeclComboBox);
this.ToolsPedTabPage.Controls.Add(this.label17);
this.ToolsPedTabPage.Controls.Add(this.CompTaskComboBox);
this.ToolsPedTabPage.Controls.Add(this.label16);
this.ToolsPedTabPage.Controls.Add(this.CompAccsComboBox);
this.ToolsPedTabPage.Controls.Add(this.label15);
this.ToolsPedTabPage.Controls.Add(this.CompTeefComboBox);
this.ToolsPedTabPage.Controls.Add(this.label13);
this.ToolsPedTabPage.Controls.Add(this.CompFeetComboBox);
this.ToolsPedTabPage.Controls.Add(this.label12);
this.ToolsPedTabPage.Controls.Add(this.CompHandComboBox);
this.ToolsPedTabPage.Controls.Add(this.label9);
this.ToolsPedTabPage.Controls.Add(this.CompLowrComboBox);
this.ToolsPedTabPage.Controls.Add(this.label8);
this.ToolsPedTabPage.Controls.Add(this.CompUpprComboBox);
this.ToolsPedTabPage.Controls.Add(this.label7);
this.ToolsPedTabPage.Controls.Add(this.CompHairComboBox);
this.ToolsPedTabPage.Controls.Add(this.label6);
this.ToolsPedTabPage.Controls.Add(this.CompBerdComboBox);
this.ToolsPedTabPage.Controls.Add(this.label5);
this.ToolsPedTabPage.Controls.Add(this.CompHeadComboBox);
this.ToolsPedTabPage.Controls.Add(this.label4);
this.ToolsPedTabPage.Controls.Add(this.label3);
this.ToolsPedTabPage.Controls.Add(this.PedNameComboBox);
this.ToolsPedTabPage.Location = new System.Drawing.Point(4, 22);
@ -664,6 +715,279 @@
this.ToolsPanel.TabIndex = 7;
this.ToolsPanel.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 53);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(69, 13);
this.label4.TabIndex = 2;
this.label4.Text = "Components:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 76);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(36, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Head:";
//
// CompHeadComboBox
//
this.CompHeadComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHeadComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHeadComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHeadComboBox.FormattingEnabled = true;
this.CompHeadComboBox.Location = new System.Drawing.Point(54, 73);
this.CompHeadComboBox.Name = "CompHeadComboBox";
this.CompHeadComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHeadComboBox.TabIndex = 3;
this.CompHeadComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHeadComboBox_SelectedIndexChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(16, 103);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(32, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Berd:";
//
// CompBerdComboBox
//
this.CompBerdComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompBerdComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompBerdComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompBerdComboBox.FormattingEnabled = true;
this.CompBerdComboBox.Location = new System.Drawing.Point(54, 100);
this.CompBerdComboBox.Name = "CompBerdComboBox";
this.CompBerdComboBox.Size = new System.Drawing.Size(182, 21);
this.CompBerdComboBox.TabIndex = 5;
this.CompBerdComboBox.SelectedIndexChanged += new System.EventHandler(this.CompBerdComboBox_SelectedIndexChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(19, 130);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(29, 13);
this.label7.TabIndex = 8;
this.label7.Text = "Hair:";
//
// CompHairComboBox
//
this.CompHairComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHairComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHairComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHairComboBox.FormattingEnabled = true;
this.CompHairComboBox.Location = new System.Drawing.Point(54, 127);
this.CompHairComboBox.Name = "CompHairComboBox";
this.CompHairComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHairComboBox.TabIndex = 7;
this.CompHairComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHairComboBox_SelectedIndexChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(15, 157);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(33, 13);
this.label8.TabIndex = 10;
this.label8.Text = "Uppr:";
//
// CompUpprComboBox
//
this.CompUpprComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompUpprComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompUpprComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompUpprComboBox.FormattingEnabled = true;
this.CompUpprComboBox.Location = new System.Drawing.Point(54, 154);
this.CompUpprComboBox.Name = "CompUpprComboBox";
this.CompUpprComboBox.Size = new System.Drawing.Size(182, 21);
this.CompUpprComboBox.TabIndex = 9;
this.CompUpprComboBox.SelectedIndexChanged += new System.EventHandler(this.CompUpprComboBox_SelectedIndexChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(15, 184);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(33, 13);
this.label9.TabIndex = 12;
this.label9.Text = "Lowr:";
//
// CompLowrComboBox
//
this.CompLowrComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompLowrComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompLowrComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompLowrComboBox.FormattingEnabled = true;
this.CompLowrComboBox.Location = new System.Drawing.Point(54, 181);
this.CompLowrComboBox.Name = "CompLowrComboBox";
this.CompLowrComboBox.Size = new System.Drawing.Size(182, 21);
this.CompLowrComboBox.TabIndex = 11;
this.CompLowrComboBox.SelectedIndexChanged += new System.EventHandler(this.CompLowrComboBox_SelectedIndexChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(12, 211);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(36, 13);
this.label12.TabIndex = 14;
this.label12.Text = "Hand:";
//
// CompHandComboBox
//
this.CompHandComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHandComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHandComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHandComboBox.FormattingEnabled = true;
this.CompHandComboBox.Location = new System.Drawing.Point(54, 208);
this.CompHandComboBox.Name = "CompHandComboBox";
this.CompHandComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHandComboBox.TabIndex = 13;
this.CompHandComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHandComboBox_SelectedIndexChanged);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(17, 238);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(31, 13);
this.label13.TabIndex = 16;
this.label13.Text = "Feet:";
//
// CompFeetComboBox
//
this.CompFeetComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompFeetComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompFeetComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompFeetComboBox.FormattingEnabled = true;
this.CompFeetComboBox.Location = new System.Drawing.Point(54, 235);
this.CompFeetComboBox.Name = "CompFeetComboBox";
this.CompFeetComboBox.Size = new System.Drawing.Size(182, 21);
this.CompFeetComboBox.TabIndex = 15;
this.CompFeetComboBox.SelectedIndexChanged += new System.EventHandler(this.CompFeetComboBox_SelectedIndexChanged);
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(16, 265);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(32, 13);
this.label15.TabIndex = 18;
this.label15.Text = "Teef:";
//
// CompTeefComboBox
//
this.CompTeefComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompTeefComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompTeefComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompTeefComboBox.FormattingEnabled = true;
this.CompTeefComboBox.Location = new System.Drawing.Point(54, 262);
this.CompTeefComboBox.Name = "CompTeefComboBox";
this.CompTeefComboBox.Size = new System.Drawing.Size(182, 21);
this.CompTeefComboBox.TabIndex = 17;
this.CompTeefComboBox.SelectedIndexChanged += new System.EventHandler(this.CompTeefComboBox_SelectedIndexChanged);
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(14, 292);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(34, 13);
this.label16.TabIndex = 20;
this.label16.Text = "Accs:";
//
// CompAccsComboBox
//
this.CompAccsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompAccsComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompAccsComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompAccsComboBox.FormattingEnabled = true;
this.CompAccsComboBox.Location = new System.Drawing.Point(54, 289);
this.CompAccsComboBox.Name = "CompAccsComboBox";
this.CompAccsComboBox.Size = new System.Drawing.Size(182, 21);
this.CompAccsComboBox.TabIndex = 19;
this.CompAccsComboBox.SelectedIndexChanged += new System.EventHandler(this.CompAccsComboBox_SelectedIndexChanged);
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(14, 319);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(34, 13);
this.label17.TabIndex = 22;
this.label17.Text = "Task:";
//
// CompTaskComboBox
//
this.CompTaskComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompTaskComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompTaskComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompTaskComboBox.FormattingEnabled = true;
this.CompTaskComboBox.Location = new System.Drawing.Point(54, 316);
this.CompTaskComboBox.Name = "CompTaskComboBox";
this.CompTaskComboBox.Size = new System.Drawing.Size(182, 21);
this.CompTaskComboBox.TabIndex = 21;
this.CompTaskComboBox.SelectedIndexChanged += new System.EventHandler(this.CompTaskComboBox_SelectedIndexChanged);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(16, 346);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(32, 13);
this.label18.TabIndex = 24;
this.label18.Text = "Decl:";
//
// CompDeclComboBox
//
this.CompDeclComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompDeclComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompDeclComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompDeclComboBox.FormattingEnabled = true;
this.CompDeclComboBox.Location = new System.Drawing.Point(54, 343);
this.CompDeclComboBox.Name = "CompDeclComboBox";
this.CompDeclComboBox.Size = new System.Drawing.Size(182, 21);
this.CompDeclComboBox.TabIndex = 23;
this.CompDeclComboBox.SelectedIndexChanged += new System.EventHandler(this.CompDeclComboBox_SelectedIndexChanged);
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(19, 373);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(29, 13);
this.label20.TabIndex = 26;
this.label20.Text = "Jbib:";
//
// CompJbibComboBox
//
this.CompJbibComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompJbibComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompJbibComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompJbibComboBox.FormattingEnabled = true;
this.CompJbibComboBox.Location = new System.Drawing.Point(54, 370);
this.CompJbibComboBox.Name = "CompJbibComboBox";
this.CompJbibComboBox.Size = new System.Drawing.Size(182, 21);
this.CompJbibComboBox.TabIndex = 25;
this.CompJbibComboBox.SelectedIndexChanged += new System.EventHandler(this.CompJbibComboBox_SelectedIndexChanged);
//
// PedsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -754,5 +1078,30 @@
private System.Windows.Forms.TabPage ToolsPedTabPage;
private System.Windows.Forms.TabControl ToolsTabControl;
private System.Windows.Forms.Panel ToolsPanel;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox CompHeadComboBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox CompHairComboBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox CompBerdComboBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox CompUpprComboBox;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.ComboBox CompHandComboBox;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox CompLowrComboBox;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.ComboBox CompFeetComboBox;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.ComboBox CompTeefComboBox;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.ComboBox CompTaskComboBox;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ComboBox CompAccsComboBox;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.ComboBox CompJbibComboBox;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.ComboBox CompDeclComboBox;
}
}

View File

@ -74,6 +74,32 @@ namespace CodeWalker.Peds
string SelectedPedName = string.Empty;
MetaHash SelectedPedHash = 0;//ped name hash
CPedModelInfo__InitData SelectedPedInit = null; //ped init data
YddFile SelectedPedYdd = null; //ped drawables
YftFile SelectedPedYft = null; //ped skeleton YFT
PedFile SelectedPedYmt = null; //ped variation info
Drawable SelectedHead = null;
Drawable SelectedBerd = null;
Drawable SelectedHair = null;
Drawable SelectedUppr = null;
Drawable SelectedLowr = null;
Drawable SelectedHand = null;
Drawable SelectedFeet = null;
Drawable SelectedTeef = null;
Drawable SelectedAccs = null;
Drawable SelectedTask = null;
Drawable SelectedDecl = null;
Drawable SelectedJbib = null;
public PedsForm()
{
InitializeComponent();
@ -92,7 +118,7 @@ namespace CodeWalker.Peds
//Renderer.renderclouds = true;
//Renderer.individualcloudfrag = "Contrails";
Renderer.rendermoon = false;
Renderer.renderskeletons = false;
Renderer.renderskeletons = true;
Renderer.SelectionFlagsTestAll = true;
}
@ -425,7 +451,7 @@ namespace CodeWalker.Peds
{
//move the camera to a default place where the given sphere is fully visible.
rad = Math.Max(0.01f, rad);
rad = Math.Max(0.01f, rad*0.1f);
camera.FollowEntity.Position = pos;
camera.TargetDistance = rad * 1.6f;
@ -662,36 +688,70 @@ namespace CodeWalker.Peds
var pednamel = pedname.ToLowerInvariant();
MetaHash pedhash = JenkHash.GenHash(pednamel);
SelectedPedName = string.Empty;
SelectedPedHash = 0;
SelectedPedInit = null;
SelectedPedYdd = null;
SelectedPedYft = null;
SelectedPedYmt = null;
ClearCombo(CompHeadComboBox); SelectedHead = null;
ClearCombo(CompBerdComboBox); SelectedBerd = null;
ClearCombo(CompHairComboBox); SelectedHair = null;
ClearCombo(CompUpprComboBox); SelectedUppr = null;
ClearCombo(CompLowrComboBox); SelectedLowr = null;
ClearCombo(CompHandComboBox); SelectedHand = null;
ClearCombo(CompFeetComboBox); SelectedFeet = null;
ClearCombo(CompTeefComboBox); SelectedTeef = null;
ClearCombo(CompAccsComboBox); SelectedAccs = null;
ClearCombo(CompTaskComboBox); SelectedTask = null;
ClearCombo(CompDeclComboBox); SelectedDecl = null;
ClearCombo(CompJbibComboBox); SelectedJbib = null;
CPedModelInfo__InitData initdata = null;
if (!GameFileCache.PedsInitDict.TryGetValue(pedhash, out initdata)) return;
bool pedchange = SelectedPedHash != pedhash;
SelectedPedName = pedname;
SelectedPedHash = pedhash;
SelectedPedInit = initdata;
SelectedPedYdd = GameFileCache.GetYdd(pedhash);
SelectedPedYft = GameFileCache.GetYft(pedhash);
GameFileCache.PedVariationsDict?.TryGetValue(pedhash, out SelectedPedYmt);
while ((SelectedPedYdd != null) && (!SelectedPedYdd.Loaded))
{
Thread.Sleep(20);//kinda hacky
SelectedPedYdd = GameFileCache.GetYdd(SelectedPedHash);
}
while ((SelectedPedYft != null) && (!SelectedPedYft.Loaded))
{
Thread.Sleep(20);//kinda hacky
SelectedPedYft = GameFileCache.GetYft(SelectedPedHash);
}
LoadModel(SelectedPedYft, pedchange);
var vi = SelectedPedYmt?.VariationInfo;
if (vi != null)
{
PopulateCompCombo(CompHeadComboBox, vi.GetVariations(0));
PopulateCompCombo(CompBerdComboBox, vi.GetVariations(1));
PopulateCompCombo(CompHairComboBox, vi.GetVariations(2));
PopulateCompCombo(CompUpprComboBox, vi.GetVariations(3));
PopulateCompCombo(CompLowrComboBox, vi.GetVariations(4));
PopulateCompCombo(CompHandComboBox, vi.GetVariations(5));
PopulateCompCombo(CompFeetComboBox, vi.GetVariations(6));
PopulateCompCombo(CompTeefComboBox, vi.GetVariations(7));
PopulateCompCombo(CompAccsComboBox, vi.GetVariations(8));
PopulateCompCombo(CompTaskComboBox, vi.GetVariations(9));
PopulateCompCombo(CompDeclComboBox, vi.GetVariations(10));
PopulateCompCombo(CompJbibComboBox, vi.GetVariations(11));
}
//MetaHash modelhashhi = JenkHash.GenHash(pednamel + "_hi");
//bool hidet = VehicleHighDetailCheckBox.Checked;
//var yfthash = hidet ? modelhashhi : pedhash;
//VehicleInitData vid = null;
//if (GameFileCache.VehiclesInitDict.TryGetValue(pedhash, out vid))
//{
// bool vehiclechange = SelectedVehicleHash != pedhash;
// SelectedModelHash = yfthash;
// SelectedVehicleHash = pedhash;
// SelectedVehicleInit = vid;
// SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);
// while (!SelectedVehicleYft.Loaded)
// {
// Thread.Sleep(20);//kinda hacky
// SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);
// }
// LoadModel(SelectedVehicleYft, vehiclechange);
// VehicleMakeLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.vehicleMakeName.ToLower()));
// VehicleNameLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.gameName.ToLower()));
//}
//else
//{
// SelectedModelHash = 0;
// SelectedVehicleHash = 0;
// SelectedVehicleInit = null;
// SelectedVehicleYft = null;
// VehicleMakeLabel.Text = "-";
// VehicleNameLabel.Text = "-";
//}
}
public void LoadModel(YftFile yft, bool movecamera = true)
@ -712,6 +772,68 @@ namespace CodeWalker.Peds
private void ClearCombo(ComboBox c)
{
c.Items.Clear();
c.Text = string.Empty;
}
private void PopulateCompCombo(ComboBox c, MUnk_3538495220 vars)
{
if (vars?.Variations == null) return;
foreach (var item in vars.Variations)
{
c.Items.Add(item.GetDrawableName());
}
if (vars.Variations.Length > 0)
{
c.SelectedIndex = 0;
}
}
private Drawable GetComponentDrawable(string name)
{
var namel = name.ToLowerInvariant();
MetaHash hash = JenkHash.GenHash(namel);
Drawable d;
if (SelectedPedYdd?.Dict != null)
{
if (SelectedPedYdd.Dict.TryGetValue(hash, out d)) return d;
}
Dictionary<MetaHash, RpfFileEntry> peddict = null;
if (GameFileCache.PedDrawableDicts.TryGetValue(SelectedPedHash, out peddict))
{
RpfFileEntry file = null;
if (peddict.TryGetValue(hash, out file))
{
var ydd = GameFileCache.GetFileUncached<YddFile>(file);
while ((ydd != null) && (!ydd.Loaded))
{
Thread.Sleep(20);//kinda hacky
GameFileCache.TryLoadEnqueue(ydd);
}
if (ydd?.Drawables?.Length > 0)
{
return ydd.Drawables[0];//should only be one in this dict
}
}
}
return null;
}
private void UpdateTimeOfDayLabel()
{
int v = TimeOfDayTrackBar.Value;
@ -889,31 +1011,26 @@ namespace CodeWalker.Peds
private void RenderPed()
{
//YftFile yft = GameFileCache.GetYft(SelectedModelHash);
//if (yft != null)
//{
// if (yft.Loaded)
// {
// if (yft.Fragment != null)
// {
// var f = yft.Fragment;
// var txdhash = SelectedVehicleHash;// yft.RpfFileEntry?.ShortNameHash ?? 0;
YftFile yft = SelectedPedYft;// GameFileCache.GetYft(SelectedModelHash);
if (yft != null)
{
if (yft.Loaded)
{
if (yft.Fragment != null)
{
var f = yft.Fragment;
var txdhash = 0u;// SelectedVehicleHash;// yft.RpfFileEntry?.ShortNameHash ?? 0;
//var namelower = yft.RpfFileEntry?.GetShortNameLower();
// if (namelower?.EndsWith("_hi") ?? false)
// {
// txdhash = JenkHash.GenHash(namelower.Substring(0, namelower.Length - 3));
// }
// Archetype arch = null;// TryGetArchetype(hash);
Archetype arch = null;// TryGetArchetype(hash);
// Renderer.RenderFragment(arch, null, f, txdhash);
Renderer.RenderFragment(arch, null, f, txdhash);
// //seldrwbl = f.Drawable;
// }
// }
//}
//seldrwbl = f.Drawable;
}
}
}
}
@ -1413,5 +1530,75 @@ namespace CodeWalker.Peds
private void PedNameComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (!GameFileCache.IsInited) return;
LoadPed();
}
private void CompHeadComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHead = GetComponentDrawable(CompHeadComboBox.Text);
}
private void CompBerdComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedBerd = GetComponentDrawable(CompBerdComboBox.Text);
}
private void CompHairComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHair = GetComponentDrawable(CompHairComboBox.Text);
}
private void CompUpprComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedUppr = GetComponentDrawable(CompUpprComboBox.Text);
}
private void CompLowrComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedLowr = GetComponentDrawable(CompLowrComboBox.Text);
}
private void CompHandComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHand = GetComponentDrawable(CompHandComboBox.Text);
}
private void CompFeetComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedFeet = GetComponentDrawable(CompFeetComboBox.Text);
}
private void CompTeefComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedTeef = GetComponentDrawable(CompTeefComboBox.Text);
}
private void CompAccsComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedAccs = GetComponentDrawable(CompAccsComboBox.Text);
}
private void CompTaskComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedTask = GetComponentDrawable(CompTaskComboBox.Text);
}
private void CompDeclComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedDecl = GetComponentDrawable(CompDeclComboBox.Text);
}
private void CompJbibComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedJbib = GetComponentDrawable(CompJbibComboBox.Text);
}
}
}

View File

@ -78,7 +78,7 @@ namespace CodeWalker.Rendering
public void Update(DeviceContext context, T[] data)
{
var dataBox = context.MapSubresource(Buffer, 0, MapMode.WriteDiscard, MapFlags.None);
Utilities.Write(dataBox.DataPointer, data, 0, data.Length);
Utilities.Write(dataBox.DataPointer, data, 0, Math.Min(data.Length, StructCount));
context.UnmapSubresource(Buffer, 0);
}

View File

@ -680,7 +680,7 @@ namespace CodeWalker.Vehicles
SelectedVehicleHash = modelhash;
SelectedVehicleInit = vid;
SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);
while (!SelectedVehicleYft.Loaded)
while ((SelectedVehicleYft != null) && (!SelectedVehicleYft.Loaded))
{
Thread.Sleep(20);//kinda hacky
SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);