mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix material change in mdls for different suffix sizes.
This commit is contained in:
parent
25b65ce628
commit
3d6d3ed2d6
2 changed files with 21 additions and 8 deletions
|
|
@ -576,7 +576,7 @@ namespace Penumbra.UI
|
|||
}
|
||||
|
||||
ImGui.TableSetColumnIndex( 9 );
|
||||
if( ImGui.Selectable( $"{list[ manipIdx ].Value}##{manipIdx}" ) )
|
||||
if( ImGui.Selectable( $"{list[ manipIdx ].Value:X}##{manipIdx}" ) )
|
||||
{
|
||||
ImGui.OpenPopup( $"##MetaPopup{manipIdx}" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -75,6 +76,17 @@ public static class ModelChanger
|
|||
return replacements;
|
||||
}
|
||||
|
||||
private static void ReplaceStringSize( byte[] main, int sizeDiff )
|
||||
{
|
||||
var stackSize = BitConverter.ToUInt32( main, 4 );
|
||||
var runtimeBegin = stackSize + 0x44;
|
||||
var stringsLengthOffset = runtimeBegin + 4;
|
||||
var stringsLength = BitConverter.ToUInt32( main, ( int )stringsLengthOffset );
|
||||
var newLength = stringsLength + sizeDiff;
|
||||
Debug.Assert( newLength > 0 );
|
||||
BitConverter.TryWriteBytes( main.AsSpan( ( int )stringsLengthOffset ), ( uint )newLength );
|
||||
}
|
||||
|
||||
private static int ReplaceSubSequences( ref byte[] main, byte[] subLhs, byte[] subRhs )
|
||||
{
|
||||
if( subLhs.Length == subRhs.Length )
|
||||
|
|
@ -88,7 +100,8 @@ public static class ModelChanger
|
|||
replacements.Add( i );
|
||||
}
|
||||
|
||||
var ret = new byte[main.Length + ( subRhs.Length - subLhs.Length ) * replacements.Count];
|
||||
var sizeDiff = ( subRhs.Length - subLhs.Length ) * replacements.Count;
|
||||
var ret = new byte[main.Length + sizeDiff];
|
||||
|
||||
var last = 0;
|
||||
var totalLength = 0;
|
||||
|
|
@ -103,7 +116,7 @@ public static class ModelChanger
|
|||
}
|
||||
|
||||
main.AsSpan( last ).CopyTo( ret.AsSpan( totalLength ) );
|
||||
|
||||
ReplaceStringSize( ret, sizeDiff );
|
||||
main = ret;
|
||||
return replacements.Count;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue