Staging random bug fixes

This commit is contained in:
dexyfex 2018-05-01 13:20:39 +10:00
parent cda768eb22
commit 945bf410cc
6 changed files with 121 additions and 8 deletions

View File

@ -538,6 +538,7 @@ namespace CodeWalker.GameFiles
CExtensionDefSpawnPointOverride = 2716862120,
CExtensionDefWindDisturbance = 569228403,
CFiringPatternInfo = 4139644871,
CFiringPatternInfoManager = 3698419088,
CGrabHelper__Tunables = 1898505781,
Chances = 3434267272,
changeSetName = 3618800523,
@ -1605,6 +1606,7 @@ namespace CodeWalker.GameFiles
VEHICLE_LAYOUTS_FILE = 2004032454,
VEHICLE_METADATA_FILE = 4125139733,
VEHICLE_POPULATION_FILE = 4010054647,
VEHICLE_RESPONSE_DEFAULT = 3986150789,
VEHICLE_RESPONSE_ARMY_BASE = 317362887,
VEHICLE_RESPONSE_COUNTRYSIDE = 2467847847,
VEHICLE_SHOP_DLC_FILE = 3203173146,
@ -1621,6 +1623,13 @@ namespace CodeWalker.GameFiles
VFXINTERIORINFO_FILE = 354822867,
VFXPEDINFO_FILE = 962370952,
VFXREGIONINFO_FILE = 3633596549,
vfxregioninfo_default = 526963733,
vfxregioninfo_desert = 1202232026,
vfxregioninfo_beach = 4239901007,
vfxregioninfo_slum = 4267832995,
vfxregioninfo_woodland = 1397181648,
vfxregioninfo_mountain = 3282595980,
vfxregioninfo_countryside = 2691334223,
vfxTagHashName = 1944993828,
VFXVEHICLEINFO_FILE = 1918258814,
vfxVehicleInfos = 1829968483,
@ -3528,9 +3537,15 @@ namespace CodeWalker.GameFiles
spName = 4254542050,
//from rubidium
//from rubidium / dav90 PSO XML / zonebind
mpName = 2031203854,
zoneName = 257000,
vfxRegion = 3384955624,
vehDirtMin = 1831590592,
vehDirtMax = 625824556,
vehDirtGrowScale = 2919812941,
pedDirtMin = 1861946207,
pedDirtMax = 3150688023,

View File

@ -23,6 +23,95 @@
//shamelessly stolen and mangled
/*
Regarding saving PSO files:
[for checksum - use whole file]
Brick - Today
uint32_t joaat_checksum(const void* memory, const size_t length)
{
uint32_t hash = 0x3FAC7125;
for (size_t i = 0; i < length; ++i)
{
hash += static_cast<const int8_t*>(memory)[i];
hash += hash << 10;
hash ^= hash >> 6;
}
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
return hash;
}
[before doing checksum for file:]
v12->Checksum = 0;
v12->FileSize = 0;
v12->Magic = 'SKHC';
v12->Size = 0x14000000;
v22 = v12;
LOBYTE(v12->Platform) = platformChar[0];
Brick - Today
This is a table i made a while ago for the pso types btw
| Index | Type | Size | Align | Name | Serialization
| 0 | Simple | 1 | 1 | bool |
| 1 | Simple | 1 | 1 | s8 |
| 2 | Simple | 1 | 1 | u8 |
| 3 | Simple | 2 | 2 | s16 |
| 4 | Simple | 2 | 2 | u16 |
| 5 | Simple | 4 | 4 | s32 |
| 6 | Simple | 4 | 4 | u32 |
| 7 | Simple | 4 | 4 | f32 |
| 8 | Vector | 8 | 4 | vec2 |
| 9 | Vector | 16 | 16 | vec3 |
| 10 | Vector | 16 | 16 | vec4 |
| 11 | String | 0 | 0 | string |
| 12 | Struct | 0 | 0 | struct |
| 13 | Array | 0 | 0 | array |
| 14 | Enum | 0 | 0 | enum |
| 15 | Bitset | 0 | 0 | bitset |
| 16 | Map | 0 | 0 | map |
| 17 | Matrix | 64 | 16 | matrix43 | shuffled
| 18 | Matrix | 64 | 16 | matrix44 | shuffled
| 19 | Vector | 16 | 16 | vec4 | x, y, x, x
| 20 | Vector | 16 | 16 | vec4 | x, y, z, x
| 21 | Vector | 16 | 16 | vec4 | x, y, z, w
| 22 | Matrix | 48 | 16 | matrix34 |
| 23 | Matrix | 64 | 16 | matrix43 |
| 24 | Matrix | 64 | 16 | matrix44 |
| 25 | Simple | 16 | 16 | f32_vec4 | fill all with f32
| 26 | Simple | 16 | 16 | bool_int4 | fill all with 0x00000000 or 0xFFFFFFFF depending on bool
| 27 | Vector | 16 | 16 | bool4_int4 | fill each with 0x00000000 or 0xFFFFFFFF depending on bools
| 28 | Simple | 8 | 8 | s32_i64 | sign extended s32
| 29 | Simple | 8 | 8 | s32_u64 | sign extended s32
| 30 | Simple | 2 | 2 | f16 | f64 converted to f16
| 31 | Simple | 8 | 8 | s64 |
| 32 | Simple | 8 | 8 | u64 |
| 33 | Simple | 8 | 8 | f64 |
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;

View File

@ -687,6 +687,9 @@ namespace CodeWalker.GameFiles
private static int GetEnumInt(MetaName type, string enumString)
{
//BUG: needs to handle multiple flags!!!
var enumName = (MetaName)(uint)GetHash(enumString);
var infos = MetaTypes.GetEnumInfo(type);

View File

@ -626,6 +626,7 @@ namespace CodeWalker.GameFiles
RpfFileEntry entry = CreateResourceFileEntry(ref data, 0);
if ((data != null) && (entry != null))
{
data = ResourceBuilder.Decompress(data);
file = new T();
file.Load(data, entry);
}

View File

@ -420,13 +420,6 @@ namespace CodeWalker.World
{
AddRpfYnds(rpffile, yndentries);
}
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load nodes from current dlc rpfs
{
foreach (var rpffile in dlcrpf.Children)
{
AddRpfYnds(rpffile, yndentries);
}
}
var updrpf = rpfman.FindRpfFile("update\\update.rpf"); //load nodes from patch area...
if (updrpf != null)
{
@ -435,6 +428,13 @@ namespace CodeWalker.World
AddRpfYnds(rpffile, yndentries);
}
}
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load nodes from current dlc rpfs
{
foreach (var rpffile in dlcrpf.Children)
{
AddRpfYnds(rpffile, yndentries);
}
}
Vector3 corner = new Vector3(-8192, -8192, -2048);

View File

@ -2201,7 +2201,9 @@ namespace CodeWalker
var fpaths = OpenFileDialog.FileNames;
foreach (var fpath in fpaths)
{
#if !DEBUG
try
#endif
{
if (!File.Exists(fpath))
{
@ -2254,10 +2256,13 @@ namespace CodeWalker
RpfFile.CreateFile(parentrpffldr, fname, data);
}
#if !DEBUG
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Unable to import file");
}
#endif
}
CurrentFolder.ListItems = null;