Fix Resource Watcher crash

This commit is contained in:
Ottermandias 2023-04-01 14:22:17 +02:00
parent 113078af90
commit d4738934f8
2 changed files with 27 additions and 25 deletions

View file

@ -95,35 +95,37 @@ internal unsafe struct Record
var path = handle->FileName().Clone();
return new Record
{
Time = DateTime.UtcNow,
Path = path,
OriginalPath = ByteString.Empty,
Collection = null,
Handle = handle,
ResourceType = handle->FileType.ToFlag(),
Category = handle->Category.ToFlag(),
RefCount = handle->RefCount,
RecordType = RecordType.Destruction,
Synchronously = OptionalBool.Null,
ReturnValue = OptionalBool.Null,
CustomLoad = OptionalBool.Null,
Time = DateTime.UtcNow,
Path = path,
OriginalPath = ByteString.Empty,
Collection = null,
Handle = handle,
ResourceType = handle->FileType.ToFlag(),
Category = handle->Category.ToFlag(),
RefCount = handle->RefCount,
RecordType = RecordType.Destruction,
Synchronously = OptionalBool.Null,
ReturnValue = OptionalBool.Null,
CustomLoad = OptionalBool.Null,
AssociatedGameObject = string.Empty,
};
}
public static Record CreateFileLoad(ByteString path, ResourceHandle* handle, bool ret, bool custom)
=> new()
{
Time = DateTime.UtcNow,
Path = path.IsOwned ? path : path.Clone(),
OriginalPath = ByteString.Empty,
Collection = null,
Handle = handle,
ResourceType = handle->FileType.ToFlag(),
Category = handle->Category.ToFlag(),
RefCount = handle->RefCount,
RecordType = RecordType.FileLoad,
Synchronously = OptionalBool.Null,
ReturnValue = ret,
CustomLoad = custom,
Time = DateTime.UtcNow,
Path = path.IsOwned ? path : path.Clone(),
OriginalPath = ByteString.Empty,
Collection = null,
Handle = handle,
ResourceType = handle->FileType.ToFlag(),
Category = handle->Category.ToFlag(),
RefCount = handle->RefCount,
RecordType = RecordType.FileLoad,
Synchronously = OptionalBool.Null,
ReturnValue = ret,
CustomLoad = custom,
AssociatedGameObject = string.Empty,
};
}

View file

@ -20,7 +20,7 @@ using Penumbra.UI.Classes;
namespace Penumbra.UI;
public partial class ResourceWatcher : IDisposable, ITab
public class ResourceWatcher : IDisposable, ITab
{
public const int DefaultMaxEntries = 1024;
public const RecordType AllRecords = RecordType.Request | RecordType.ResourceLoad | RecordType.FileLoad | RecordType.Destruction;