fixed stuff up

This commit is contained in:
Boki 2026-03-02 16:36:12 -05:00
parent 18d8721dd5
commit e5ebe05571
4 changed files with 69 additions and 63 deletions

View file

@ -258,15 +258,8 @@ public class GameMemoryReader : IDisposable
// Cache the resolved address for fast per-frame reads
_cachedCameraMatrixAddr = matrixAddr;
// Read 64-byte Matrix4x4 as 16 floats
var bytes = mem.ReadBytes(matrixAddr, 64);
if (bytes is null || bytes.Length < 64) return;
var m = new Matrix4x4(
BitConverter.ToSingle(bytes, 0), BitConverter.ToSingle(bytes, 4), BitConverter.ToSingle(bytes, 8), BitConverter.ToSingle(bytes, 12),
BitConverter.ToSingle(bytes, 16), BitConverter.ToSingle(bytes, 20), BitConverter.ToSingle(bytes, 24), BitConverter.ToSingle(bytes, 28),
BitConverter.ToSingle(bytes, 32), BitConverter.ToSingle(bytes, 36), BitConverter.ToSingle(bytes, 40), BitConverter.ToSingle(bytes, 44),
BitConverter.ToSingle(bytes, 48), BitConverter.ToSingle(bytes, 52), BitConverter.ToSingle(bytes, 56), BitConverter.ToSingle(bytes, 60));
// Read 64-byte Matrix4x4 as a single struct (System.Numerics.Matrix4x4 is already unmanaged/sequential)
var m = mem.Read<Matrix4x4>(matrixAddr);
// Quick sanity check
if (float.IsNaN(m.M11) || float.IsInfinity(m.M11)) return;