Structural and Memory Safety Improvements, Analyzer Cleanup
Summary
This PR introduces structural improvements, enhanced memory safety, and code cleanups throughout the codebase.
Changes
- Applied
LayoutKind.Sequentialto many structs, including theArrayseries (Array1<T>toArray384<T>), to ensure predictable memory layout. This is critical for correctness, as the project heavily relies onUnsafe.Asfor low-level memory manipulation. - Refactored methods to
staticin theSupervisorCallnamespace. - Improved memory safety in
SDL2HardwareDeviceDriver. - Refactored
Buffer16and updatedBitStream128usage. - Simplified
ReadAsyncparameters inUpdater.cs. - Refactored update method for async downloads.
- Removed unused variables and unnecessary
thisqualifiers. - Eliminated extra blank lines and multiple warning pragmas.
- Cleaned up
usingdirectives and randotnet format. - Updated
.editorconfigfor consistent code style (includingthisusage).
Outstanding Issues
There are currently 4 warnings related to the use of unsafe TLS versions remain.
Resolving these would require changes that may be subjective or not universally agreed upon.
Benefits
- Improved code clarity, performance, and memory safety.
- More consistent and maintainable codebase.
- Better alignment with modern C# practices and interop standards.
Edited by MrKev