diff --git a/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs b/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs index 49af946f..05c77fe9 100644 --- a/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs +++ b/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs @@ -19,6 +19,26 @@ namespace Ryujinx.Common } } + public unsafe static T[] ReadStructArray(this BinaryReader reader, int count) + where T : struct + { + int size = Marshal.SizeOf(); + + T[] result = new T[count]; + + for (int i = 0; i < count; i++) + { + byte[] data = reader.ReadBytes(size); + + fixed (byte* ptr = data) + { + result[i] = Marshal.PtrToStructure((IntPtr)ptr); + } + } + + return result; + } + public unsafe static void WriteStruct(this BinaryWriter writer, T value) where T : struct { diff --git a/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs b/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs index 0c4396e7..c6605e0e 100644 --- a/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs +++ b/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System; +using System.Reflection; using System.Text; namespace Ryujinx.Common.Logging @@ -31,7 +32,23 @@ namespace Ryujinx.Common.Logging { sb.Append(prop.Name); sb.Append(": "); - sb.Append(prop.GetValue(args.Data)); + + if (typeof(Array).IsAssignableFrom(prop.PropertyType)) + { + Array enumerable = (Array)prop.GetValue(args.Data); + foreach (var item in enumerable) + { + sb.Append(item.ToString()); + sb.Append(", "); + } + + sb.Remove(sb.Length - 2, 2); + } + else + { + sb.Append(prop.GetValue(args.Data)); + } + sb.Append(" - "); }