Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0de04d6
texture management overhaul, now tracking textures more closely
pandinocoder Feb 16, 2025
ea2dcca
fix compilation errors due to moving Timing
pandinocoder Feb 16, 2025
9e67855
WIP Texture management
pandinocoder Feb 16, 2025
9b19a2f
consolidate application contexts in the editor and fix compilation is…
pandinocoder Feb 16, 2025
c0fbe2f
More WIP to try and improve performance (the debug window keeps slowi…
pandinocoder Feb 17, 2025
c2d8683
unsubscribe events to resolve exceptions on application close
pandinocoder Feb 17, 2025
2e6bd3e
trying to speed up the UI while maintaining threadsafety
pandinocoder Feb 17, 2025
3c5b00c
using a thread queue seems to be improving performance but there's a …
pandinocoder Feb 17, 2025
269b3b0
cleanup, threading fix in TableRow, optimization in ThreadQueue, stil…
pandinocoder Feb 17, 2025
323825c
fixed "race condition" with moving nodes in a grandchild innerpanel
pandinocoder Feb 17, 2025
88a4a88
fix double disposes and NRE
pandinocoder Feb 17, 2025
70c6b3e
move safety, though the event window is busted and its modal crashes …
pandinocoder Feb 17, 2025
6c725fe
fix modal dispose crash
pandinocoder Feb 17, 2025
e1c5673
visibility fixes
pandinocoder Feb 18, 2025
d0343df
ignore out-of-bounds mouse buttons
pandinocoder Feb 18, 2025
6b1f948
rename Defer to RunOnMainThread for clarity, need a separate defer
pandinocoder Feb 18, 2025
9e7953a
fix eventwindow scroll to bottom on skip typewriting
pandinocoder Feb 18, 2025
a8a2286
fix options not displaying
pandinocoder Feb 18, 2025
eb051fe
fix InputBox not closing on submit
pandinocoder Feb 18, 2025
c7fd65a
fix content menus expanding ad infinitum
pandinocoder Feb 18, 2025
7dcb339
make sure mouse interceptors also ignore out of bounds clicks
pandinocoder Feb 18, 2025
bed899e
fix null exception from mouse out of bounds clicks before UI initialized
pandinocoder Feb 18, 2025
bba55d4
trying to dedupe context menu logic (positioning not completely working)
pandinocoder Feb 18, 2025
539aed4
don't call RecurseLayout() twice per frame (already called in DoThink())
pandinocoder Feb 18, 2025
666ca59
force main thread queue to be executed regardless of visibility
pandinocoder Feb 18, 2025
f16c7cc
fix restricted node visibility
pandinocoder Feb 18, 2025
c12362e
fix infinite rebuild of simple rich labels
pandinocoder Feb 18, 2025
76d459f
remove cause of infinite rebuild on more complex interfaces, I'm not …
pandinocoder Feb 18, 2025
5aef582
debug/settings window deferral, dock calculation deferral
pandinocoder Feb 18, 2025
efa5da0
skin/null reference/lifecycle fixes
pandinocoder Feb 18, 2025
f4da7a7
fix listening/unlistening
pandinocoder Feb 18, 2025
1ecde94
fix allocation counter desync
pandinocoder Feb 18, 2025
024f17f
remove unnecessary nullable
pandinocoder Feb 18, 2025
abd56eb
add these commented out headers, I didn't realize I had committed this
pandinocoder Feb 18, 2025
3cf33ff
fix resize spam for empty table cells
pandinocoder Feb 19, 2025
3046696
use native Clamp() and speed up copying data into buffer
pandinocoder Feb 19, 2025
5f5c806
remove ThreadQueue parent
pandinocoder Feb 19, 2025
f58364a
squeeze blood out of threadqueue stone
pandinocoder Feb 19, 2025
612a32d
for instead of for-each, in this case there's actually a small benefi…
pandinocoder Feb 19, 2025
b8f21b7
acquiring no locks and having no thread safety checks when the queue …
pandinocoder Feb 19, 2025
abe43f4
fix fullscreen settings (we want borderless)
pandinocoder Feb 19, 2025
16aae9f
fix entitybox disposal crash
pandinocoder Feb 19, 2025
23704a1
change getters to throw inside of an if statement so debugger breakpo…
pandinocoder Feb 19, 2025
487b932
ensure correct display resolution when in fullscreen, regardless of s…
pandinocoder Feb 19, 2025
fb11200
thread queue refcount
pandinocoder Feb 19, 2025
4a550c2
FPS counter
pandinocoder Feb 19, 2025
8ff21ab
fix gpu allocations table
pandinocoder Feb 19, 2025
a9ab00e
Only show second debug window when running a debug build, and clearly…
pandinocoder Feb 19, 2025
7732af0
clean up debug window and add system memory
pandinocoder Feb 19, 2025
c2c1d96
unload textures if we're too low on VRAM
pandinocoder Feb 19, 2025
561ccfb
cleaning up GameRenderer
pandinocoder Feb 20, 2025
8cc656c
fix JSON serialization of unnamed children
pandinocoder Feb 20, 2025
8f4cd76
fix hotkeys being sorted before builtin
pandinocoder Feb 20, 2025
532a864
separate control materialization into a separate line for easier debu…
pandinocoder Feb 20, 2025
c42aac1
fix premature creation of settings window
pandinocoder Feb 20, 2025
b80ec33
fix column calculations in settings
pandinocoder Feb 20, 2025
c1aeb38
fix column recalculations when row has padding
pandinocoder Feb 20, 2025
1768683
fix chatbox auto scrolling
pandinocoder Feb 20, 2025
911ba08
fix double dispose from finalizer
pandinocoder Feb 20, 2025
0af7cc8
guild window context menu correction
pandinocoder Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{

// Our cryptographic provider, and the key to be used to encrypt. Note, it NEEDS to be 16 characters or more!
private static AesCryptoServiceProvider cryptoProvider;

Check warning on line 14 in Framework/Intersect.Framework.Core/Compression/GzipCompression.cs

View workflow job for this annotation

GitHub Actions / build

'AesCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' (https://aka.ms/dotnet-warnings/SYSLIB0021)
private static string cryptoKey = "T3ZncHUsIGdueHIgdmcgYmUgeXJuaXIgdmcu";

/// <summary>
Expand All @@ -23,7 +23,7 @@

// Take a few bytes out of this delicious morsel and grow stronk.
var keyBytes = ASCIIEncoding.ASCII.GetBytes(cryptoKey);
cryptoProvider.Key = keyBytes.Take(16).ToArray();
cryptoProvider.Key = keyBytes.Take(16).ToArray();
cryptoProvider.IV = keyBytes.Reverse().Take(16).ToArray();
}

Expand Down Expand Up @@ -56,11 +56,11 @@
}

/// <summary>
/// Read decompressed unencrypted data from an existing filestream.
/// Read decompressed unencrypted data from an existing <see cref="Stream"/>.
/// </summary>
/// <param name="stream">The Filestream to write data from.</param>
/// <param name="stream">The <see cref="Stream"/> to write data from.</param>
/// <returns>Returns a decompressed <see cref="CryptoStream"/> of the stream's content.</returns>
public static CryptoStream CreateDecompressedFileStream(FileStream stream)
public static CryptoStream CreateDecompressedFileStream(Stream stream)
{
if (cryptoProvider == null)
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ bool IsDebug
/// </summary>
bool IsRunning { get; }

/// <summary>
/// The name of the application.
/// </summary>
string Name { get; }

/// <summary>
/// The options the application was started with.
/// </summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<ItemGroup>
<PackageReference Include="Ceras" Version="4.1.7" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.6" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="MessagePackAnalyzer" Version="2.6.100-alpha">
Expand Down
5 changes: 5 additions & 0 deletions Framework/Intersect.Framework.Core/Point.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public static Point FromString(string val)

public static Point operator /(Point point, float scalar) => new((int)(point.X / scalar), (int)(point.Y / scalar));

public void Deconstruct(out int x, out int y)
{
x = X;
y = Y;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;

namespace Intersect.Utilities;
namespace Intersect.Framework.Core;

/// <summary>
/// Utility class for timing.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
using System.Collections;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;

namespace Intersect.Framework.Collections;

public class ConcurrentConditionalDequeue<TValue> : IReadOnlyCollection<TValue>, IProducerConsumerCollection<TValue>
{
private static readonly Func<TValue, TValue, bool> IsEqual =
typeof(TValue).IsValueType ? StructEquals : (a, b) => ReferenceEquals(a, b);

private readonly object _dequeueLock = new();
private readonly ConcurrentQueue<TValue> _queue = [];

private ICollection QueueAsGenericCollection => _queue;

private IProducerConsumerCollection<TValue> QueueAsProducerConsumerCollection => _queue;

public bool IsReadOnly => false;

public void CopyTo(TValue[] array, int arrayIndex)
{
_queue.CopyTo(array, arrayIndex);
}

public TValue[] ToArray()
{
return _queue.ToArray();
}

bool IProducerConsumerCollection<TValue>.TryAdd(TValue item)
{
return QueueAsProducerConsumerCollection.TryAdd(item);
}

bool IProducerConsumerCollection<TValue>.TryTake([MaybeNullWhen(false)] out TValue item)
{
lock (_dequeueLock)
{
return QueueAsProducerConsumerCollection.TryTake(out item);
}
}

void ICollection.CopyTo(Array array, int index)
{
QueueAsGenericCollection.CopyTo(array, index);
}

bool ICollection.IsSynchronized => QueueAsProducerConsumerCollection.IsSynchronized;

object ICollection.SyncRoot => QueueAsProducerConsumerCollection.SyncRoot;

public int Count => _queue.Count;

public IEnumerator<TValue> GetEnumerator()
{
return _queue.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

public void Clear()
{
lock (_dequeueLock)
{
_queue.Clear();
}
}

public void Enqueue(TValue item)
{
_queue.Enqueue(item);
}

public bool TryDequeueIf(Func<TValue, bool> consumer)
{
return TryDequeueIf(consumer, out _);
}

public bool TryDequeueIf(Func<TValue, bool> consumer, [NotNullWhen(true)] out TValue? value)
{
ArgumentNullException.ThrowIfNull(consumer);

lock (_dequeueLock)
{
if (!_queue.TryPeek(out value))
{
return false;
}

if (value == null)
{
return false;
}

if (!consumer(value))
{
return false;
}

if (!_queue.TryDequeue(out var dequeuedValue))
{
throw new InvalidOperationException("Dequeue failed, collection may have been removed from or cleared without being locked.");
}

if (!IsEqual(value, dequeuedValue))
{
throw new InvalidOperationException("Unexpected dequeued value, collection may have been removed from or cleared without being locked.");
}

return true;
}
}

public bool TryPeek([NotNullWhen(true)] out TValue? value)
{
lock (_dequeueLock)
{
return _queue.TryPeek(out value);

Check warning on line 122 in Framework/Intersect.Framework/Collections/ConcurrentConditionalDequeue.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'value' must have a non-null value when exiting with 'true'.
}
}

private static bool StructEquals(TValue a, TValue b) => a!.Equals(b);
}
109 changes: 109 additions & 0 deletions Framework/Intersect.Framework/Collections/ListExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
namespace Intersect.Framework.Collections;

public static class ListExtensions
{
public static void AddSorted<T>(this List<T> @this, T item) where T : IComparable<T>
{
if (@this.Count == 0)
{
@this.Add(item);
return;
}

if (@this[^1].CompareTo(item) <= 0)
{
@this.Add(item);
return;
}

if (@this[0].CompareTo(item) >= 0)
{
@this.Insert(0, item);
return;
}

int index = @this.BinarySearch(item);
if (index < 0)
{
index = ~index;
}
@this.Insert(index, item);
}

public static void Resort<T>(this List<T> @this, T item) where T : IComparable<T>
{
if (@this.Count < 1)
{
@this.AddSorted(item);
return;
}

@this.Remove(item);
@this.AddSorted(item);
}

private sealed class KeyComparer<TItem, TKey>(Func<TItem?, TKey?> keySelector)
: IComparer<TItem> where TKey : IComparable<TKey>
{
public int Compare(TItem? x, TItem? y)
{
var keyX = keySelector(x);
var keyY = keySelector(y);

if (keyX is not null)
{
return keyX.CompareTo(keyY);
}

if (keyY is null)
{
return 0;
}

return -keyY.CompareTo(keyX);
}
}

public static void AddSorted<TItem, TKey>(this List<TItem> @this, TItem item, Func<TItem?, TKey?> keySelector) where TKey : IComparable<TKey>
{
if (@this.Count == 0)
{
@this.Add(item);
return;
}

KeyComparer<TItem, TKey> comparer = new(keySelector);

if (comparer.Compare(@this[^1], item) <= 0)
{
@this.Add(item);
return;
}

if (comparer.Compare(@this[0], item) >= 0)
{
@this.Insert(0, item);
return;
}

int index = @this.BinarySearch(item, comparer);
if (index < 0)
{
index = ~index;
}
@this.Insert(index, item);
}

public static void Resort<TItem, TKey>(this List<TItem> @this, TItem item, Func<TItem?, TKey?> keySelector)
where TKey : IComparable<TKey>
{
if (@this.Count < 1)
{
@this.AddSorted(item, keySelector);
return;
}

@this.Remove(item);
@this.AddSorted(item, keySelector);
}
}
3 changes: 3 additions & 0 deletions Framework/Intersect.Framework/Eventing/EventHandler`2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Intersect.Framework.Eventing;

public delegate void EventHandler<in TSender, in TArgs>(TSender sender, TArgs args) where TArgs : EventArgs;
5 changes: 5 additions & 0 deletions Framework/Intersect.Framework/Intersect.Framework.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="Hardware.Info" Version="101.0.1" />
<PackageReference Include="MessagePack.Annotations" Version="2.6.100-alpha" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.14" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
Expand Down Expand Up @@ -32,4 +33,8 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Folder Include="System\" />
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Intersect.Framework.SystemInformation;

public interface IGPUStatisticsProvider
{
long? AvailableMemory { get; }

long? TotalMemory { get; }
}
Loading
Loading