- No emote parsing on AutoTranslate

- nint everything
This commit is contained in:
Infi
2024-06-02 14:17:45 +02:00
parent a35ebae09c
commit 9c4b975605
10 changed files with 35 additions and 64 deletions
+2 -2
View File
@@ -268,7 +268,7 @@ internal static class AutoTranslate
}
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);
private static extern int memcmp(byte[] b1, byte[] b2, nuint count);
internal static void ReplaceWithPayload(ref byte[] bytes)
{
@@ -312,7 +312,7 @@ internal static class AutoTranslate
}
}
if (i + search.Length < bytes.Length && memcmp(bytes[i..], search, (UIntPtr) search.Length) == 0)
if (i + search.Length < bytes.Length && memcmp(bytes[i..], search, (nuint) search.Length) == 0)
start = i;
}
}
-27
View File
@@ -2,33 +2,6 @@ using Dalamud.Game.Text.SeStringHandling;
namespace ChatTwo.Util;
internal static class PayloadExt
{
// TODO: Remove after Key and Group in AutoTranslatePayload became public
// From: https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Game/Text/SeStringHandling/Payload.cs#L366
/// <summary>
/// Retrieve the packed integer from SE's native data format.
/// </summary>
/// <param name="input">The BinaryReader instance.</param>
/// <returns>An integer.</returns>
internal static uint GetInteger(BinaryReader input)
{
uint marker = input.ReadByte();
if (marker < 0xD0)
return marker - 1;
marker = (marker + 1) & 0b1111;
var ret = new byte[4];
for (var i = 3; i >= 0; i--)
{
ret[i] = (marker & (1 << i)) == 0 ? (byte)0 : input.ReadByte();
}
return BitConverter.ToUInt32(ret, 0);
}
}
internal class PartyFinderPayload : Payload {
public override PayloadType Type => (PayloadType) 0x50;
+1 -1
View File
@@ -12,7 +12,7 @@ internal static class StringUtil {
}
// Taken from https://stackoverflow.com/a/4975942
internal static String BytesToString(long byteCount) {
internal static string BytesToString(long byteCount) {
string[] suf = ["B", "KB", "MB", "GB", "TB", "PB", "EB"]; // Longs run out around EB
if (byteCount == 0)
return "0" + suf[0];