Snapshot for release 2026.10.8.1 (internal e654aa5)
This commit is contained in:
parent
cfcab27d0d
commit
650915dadc
26 changed files with 1154 additions and 30 deletions
25
tools/AcMouseOverTests/AcMouseOverTests.csproj
Normal file
25
tools/AcMouseOverTests/AcMouseOverTests.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for src\RynthCore.Engine\Compatibility\AcMouseOverRules.cs (2026-10-08):
|
||||
a nameplate drawn under AC's windows may take a click only where AC's own mouse-over is
|
||||
the 3D world (the SmartBox wrapper, type 0x10000030) - never on one of AC's windows - and
|
||||
keeps today's behaviour (takes it) whenever AC's UI state can't be read.
|
||||
The AC-side facts (offsets, the type id) are checked against acclient.exe by
|
||||
tools\ui_hooks_check.py.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>AcMouseOverTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\AcMouseOverRules.cs" Link="Engine\AcMouseOverRules.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
93
tools/AcMouseOverTests/Program.cs
Normal file
93
tools/AcMouseOverTests/Program.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace AcMouseOverTests;
|
||||
|
||||
/// <summary>
|
||||
/// AcMouseOverRules: what AC's UI manager says is under the mouse, and whether a nameplate
|
||||
/// drawn under AC's windows may take the click there.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private const uint SomeElement = 0x1A2B3C40;
|
||||
private const int SmartBox = AcMouseOverRules.UIElementTypeSmartBoxWrapper;
|
||||
private const int ItemList = 0x10000031; // the inventory's item lists (UiElementHooks)
|
||||
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
TheTypeId();
|
||||
WorldTakesTheClick();
|
||||
AcWindowsKeepTheClick();
|
||||
FailOpen();
|
||||
NothingUnderTheMouse();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
|
||||
Console.WriteLine(_failed == 0 ? "ALL AC MOUSE-OVER TESTS PASSED." : $"{_failed} FAILED.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static void TheTypeId()
|
||||
{
|
||||
Case("the 3D view's type is UIElement_SmartBoxWrapper's (GetUIElementType 0x004E5E80)");
|
||||
Check(SmartBox == 0x10000030, "0x10000030");
|
||||
}
|
||||
|
||||
private static void WorldTakesTheClick()
|
||||
{
|
||||
Case("cursor on the 3D world: the plate takes the click");
|
||||
AcMouseTarget t = AcMouseOverRules.Classify(true, false, SomeElement, true, SmartBox);
|
||||
Check(t == AcMouseTarget.World, $"SmartBox wrapper under the mouse = World (got {t})");
|
||||
Check(AcMouseOverRules.UnderUiOverlayMayTakeClick(t), "may take the click");
|
||||
}
|
||||
|
||||
private static void AcWindowsKeepTheClick()
|
||||
{
|
||||
Case("cursor on one of AC's windows: the click stays with AC");
|
||||
foreach (int type in new[] { ItemList, 0x10000001, 0x10000032, 0, -1, SmartBox + 1 })
|
||||
{
|
||||
AcMouseTarget t = AcMouseOverRules.Classify(true, false, SomeElement, true, type);
|
||||
Check(t == AcMouseTarget.AcWindow, $"type 0x{type:X8} = AcWindow (got {t})");
|
||||
Check(!AcMouseOverRules.UnderUiOverlayMayTakeClick(t), $"type 0x{type:X8}: plate may not take the click");
|
||||
}
|
||||
}
|
||||
|
||||
private static void FailOpen()
|
||||
{
|
||||
Case("AC's UI state unreadable: today's behaviour (the plate takes the click)");
|
||||
AcMouseTarget noMgr = AcMouseOverRules.Classify(false, false, SomeElement, true, ItemList);
|
||||
Check(noMgr == AcMouseTarget.Unknown, $"no manager / unreadable = Unknown (got {noMgr})");
|
||||
Check(AcMouseOverRules.UnderUiOverlayMayTakeClick(noMgr), "unknown manager: may take the click");
|
||||
AcMouseTarget noType = AcMouseOverRules.Classify(true, false, SomeElement, false, 0);
|
||||
Check(noType == AcMouseTarget.Unknown, $"element type unreadable = Unknown (got {noType})");
|
||||
Check(AcMouseOverRules.UnderUiOverlayMayTakeClick(noType), "unknown type: may take the click");
|
||||
Check(AcMouseOverRules.UnderUiOverlayMayTakeClick(AcMouseTarget.Unknown), "Unknown: may take the click");
|
||||
}
|
||||
|
||||
private static void NothingUnderTheMouse()
|
||||
{
|
||||
Case("AC reports nothing (cursor left the client, or no element took the mouse)");
|
||||
AcMouseTarget outside = AcMouseOverRules.Classify(true, true, SomeElement, true, ItemList);
|
||||
Check(outside == AcMouseTarget.Nothing, $"+0x2D4 set = Nothing, whatever +0x244 still holds (got {outside})");
|
||||
AcMouseTarget none = AcMouseOverRules.Classify(true, false, 0, false, 0);
|
||||
Check(none == AcMouseTarget.Nothing, $"+0x244 zero = Nothing (got {none})");
|
||||
Check(AcMouseOverRules.UnderUiOverlayMayTakeClick(outside) && AcMouseOverRules.UnderUiOverlayMayTakeClick(none),
|
||||
"Nothing: may take the click");
|
||||
}
|
||||
|
||||
private static void Case(string name)
|
||||
{
|
||||
_case = name;
|
||||
Console.WriteLine($"-- {name}");
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL [{_case}] {what}");
|
||||
}
|
||||
}
|
||||
25
tools/ChatTellTests/ChatTellTests.csproj
Normal file
25
tools/ChatTellTests/ChatTellTests.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for RynthChat's /reply + /retell and paste (compiled in):
|
||||
src\RynthCore.Engine\Compatibility\TellMemory.cs - who to reply / retell to, read off the
|
||||
chat lines, and the rewrite of "/r text" into "/tell Name, text";
|
||||
src\RynthCore.Engine\UI\Data\ChatInputPaste.cs - clipboard text made into one input line.
|
||||
Nothing native: no AC, no engine state.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>ChatTellTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\TellMemory.cs" Link="Engine\TellMemory.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatInputPaste.cs" Link="Engine\ChatInputPaste.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
184
tools/ChatTellTests/Program.cs
Normal file
184
tools/ChatTellTests/Program.cs
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
using RynthCore.Engine.Compatibility;
|
||||
using RynthCore.Engine.UI.Data;
|
||||
|
||||
namespace ChatTellTests;
|
||||
|
||||
/// <summary>
|
||||
/// RynthChat's /reply, /retell (TellMemory.cs) and Ctrl+V (ChatInputPaste.cs) without AC.
|
||||
/// Chat lines are written the way AC prints them (HearDirectSpeech's player link, ACE's
|
||||
/// "You tell" echo).
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
|
||||
private const string BobTells = "<Tell:IIDString:1342177281:Bob>Bob<\\Tell> tells you, \"hi there\"";
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
ParseShortcuts();
|
||||
IncomingTellSetsReplyTarget();
|
||||
NpcAndOtherLinesIgnored();
|
||||
OutgoingTellSetsRetellTarget();
|
||||
RewriteCases();
|
||||
PasteClean();
|
||||
PasteInsert();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
|
||||
Console.WriteLine(_failed == 0 ? "ALL CHAT TELL TESTS PASSED." : $"{_failed} FAILED.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── shortcuts ───────────────────────────────────────────────────────────
|
||||
|
||||
private static void ParseShortcuts()
|
||||
{
|
||||
Case("parse: /r /reply /rt /retell");
|
||||
Check(TellMemory.Parse("/r hello", out string m) == TellShortcut.Reply && m == "hello", "/r hello");
|
||||
Check(TellMemory.Parse("/reply hello there ", out m) == TellShortcut.Reply && m == "hello there", "/reply, trimmed");
|
||||
Check(TellMemory.Parse("/R Hi", out m) == TellShortcut.Reply && m == "Hi", "case-insensitive, message case kept");
|
||||
Check(TellMemory.Parse("@r hi", out m) == TellShortcut.Reply && m == "hi", "@ prefix, as AC accepts");
|
||||
Check(TellMemory.Parse("/rt again", out m) == TellShortcut.Retell && m == "again", "/rt");
|
||||
Check(TellMemory.Parse("/retell again", out m) == TellShortcut.Retell && m == "again", "/retell");
|
||||
Check(TellMemory.Parse("/r", out m) == TellShortcut.Reply && m == "", "/r alone");
|
||||
Check(TellMemory.Parse(" /rt ", out m) == TellShortcut.Retell && m == "", "/rt alone, padded");
|
||||
Check(TellMemory.Parse("/ra start", out _) == TellShortcut.None, "/ra is RynthAi's");
|
||||
Check(TellMemory.Parse("/rc ui", out _) == TellShortcut.None, "/rc is the engine's");
|
||||
Check(TellMemory.Parse("/rn", out _) == TellShortcut.None, "/rn");
|
||||
Check(TellMemory.Parse("/rtx hi", out _) == TellShortcut.None, "/rtx");
|
||||
Check(TellMemory.Parse("r hi", out _) == TellShortcut.None, "no slash: said aloud");
|
||||
Check(TellMemory.Parse("/tell Bob, hi", out _) == TellShortcut.None, "/tell");
|
||||
Check(TellMemory.Parse("", out _) == TellShortcut.None && TellMemory.Parse(null, out _) == TellShortcut.None, "empty / null");
|
||||
}
|
||||
|
||||
// ── tracking ────────────────────────────────────────────────────────────
|
||||
|
||||
private static void IncomingTellSetsReplyTarget()
|
||||
{
|
||||
Case("incoming player tell: the reply target");
|
||||
var t = new TellMemory();
|
||||
Check(t.LastTeller == null && t.LastTellee == null, "starts empty");
|
||||
t.OnChatLine(BobTells);
|
||||
Check(t.LastTeller == "Bob", "Bob");
|
||||
t.OnChatLine("<Tell:IIDString:1342177300:Sir Alice Two>Sir Alice Two<\\Tell> tells you, \"x, y\"");
|
||||
Check(t.LastTeller == "Sir Alice Two", "a spaced name; the newest tell wins");
|
||||
t.OnChatLine("<Tell:IIDString:1342177301:Olthy&>Olthy&<\\Tell> tells you, \"grr\"");
|
||||
Check(t.LastTeller == "Olthy", "an Olthoi player's suffix dropped");
|
||||
t.OnChatLine("<Tell:IIDString:1342177302:Carl>Carl<\\Tell> tells you, \"bye\"\n");
|
||||
Check(t.LastTeller == "Carl", "trailing line break");
|
||||
Check(t.LastTellee == null, "an incoming tell is not a retell target");
|
||||
}
|
||||
|
||||
private static void NpcAndOtherLinesIgnored()
|
||||
{
|
||||
Case("lines that aren't a player's tell change nothing");
|
||||
var t = new TellMemory();
|
||||
t.OnChatLine(BobTells);
|
||||
t.OnChatLine("Town Crier tells you, \"Hear ye\""); // an NPC: AC adds no link (retail /r ignores it too)
|
||||
Check(t.LastTeller == "Bob", "NPC tell");
|
||||
t.OnChatLine("Dave says, \"<Tell:IIDString:1:Eve>Eve<\\Tell> tells you, nonsense\"");
|
||||
Check(t.LastTeller == "Bob", "a quoted tell inside a say");
|
||||
t.OnChatLine("[Allegiance] <Tell:IIDString:1342177400:Fred>Fred<\\Tell> says, \"hi\"");
|
||||
Check(t.LastTeller == "Bob", "channel line with a link");
|
||||
t.OnChatLine("Dave says, \"You tell Bob, nothing\"");
|
||||
Check(t.LastTellee == null, "a quoted echo inside a say");
|
||||
t.OnChatLine("");
|
||||
t.OnChatLine(null);
|
||||
Check(t.LastTeller == "Bob" && t.LastTellee == null, "empty / null");
|
||||
}
|
||||
|
||||
private static void OutgoingTellSetsRetellTarget()
|
||||
{
|
||||
Case("tells you send: the retell target");
|
||||
var t = new TellMemory();
|
||||
t.OnChatLine("You tell Bob, \"hello\"");
|
||||
Check(t.LastTellee == "Bob", "server echo");
|
||||
t.NoteTellSent(" Alice ");
|
||||
Check(t.LastTellee == "Alice", "dispatcher's /tell, trimmed");
|
||||
t.OnChatLine("You tell Sir Bob Two, \"a, b\"");
|
||||
Check(t.LastTellee == "Sir Bob Two", "echo with a spaced name and a comma in the message");
|
||||
t.NoteTellSent("");
|
||||
t.NoteTellSent(null);
|
||||
t.NoteTellSent(" ");
|
||||
Check(t.LastTellee == "Sir Bob Two", "blank names ignored");
|
||||
Check(t.LastTeller == null, "a sent tell is not a reply target");
|
||||
t.Clear();
|
||||
Check(t.LastTeller == null && t.LastTellee == null, "Clear");
|
||||
}
|
||||
|
||||
// ── rewrite ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void RewriteCases()
|
||||
{
|
||||
Case("rewrite to /tell");
|
||||
var t = new TellMemory();
|
||||
Check(!t.TryRewrite("/say hi", out string? line, out string? err) && line == null && err == null, "not a shortcut");
|
||||
Check(t.TryRewrite("/r hi", out line, out err) && line == null && err == TellMemory.NoTellerMessage, "/r with no one to reply to");
|
||||
Check(t.TryRewrite("/rt hi", out line, out err) && line == null && err == TellMemory.NoTelleeMessage, "/rt with no one to retell");
|
||||
|
||||
t.OnChatLine(BobTells);
|
||||
t.NoteTellSent("Alice");
|
||||
Check(t.TryRewrite("/r thanks, mate", out line, out err) && line == "/tell Bob, thanks, mate" && err == null, "/r -> Bob (message commas kept)");
|
||||
Check(t.TryRewrite("/reply ok", out line, out _) && line == "/tell Bob, ok", "/reply -> Bob");
|
||||
Check(t.TryRewrite("/rt again", out line, out _) && line == "/tell Alice, again", "/rt -> Alice");
|
||||
Check(t.TryRewrite("/retell again", out line, out _) && line == "/tell Alice, again", "/retell -> Alice");
|
||||
Check(t.TryRewrite("/r", out line, out err) && line == null && err != null && err.Contains("Bob"), "/r alone: says who it would go to");
|
||||
|
||||
// The dispatcher's /tell then remembers Bob, so /rt after /r goes to Bob (retail too: the server echoes "You tell Bob").
|
||||
t.NoteTellSent("Bob");
|
||||
Check(t.TryRewrite("/rt more", out line, out _) && line == "/tell Bob, more", "/rt after /r");
|
||||
}
|
||||
|
||||
// ── paste ───────────────────────────────────────────────────────────────
|
||||
|
||||
private static void PasteClean()
|
||||
{
|
||||
Case("paste: one clean line");
|
||||
Check(ChatInputPaste.Clean("hello") == "hello", "plain");
|
||||
Check(ChatInputPaste.Clean("a\r\nb") == "a b", "CRLF -> space");
|
||||
Check(ChatInputPaste.Clean("a\n\n\nb") == "a b", "a run of breaks -> one space");
|
||||
Check(ChatInputPaste.Clean("a \nb") == "a b" && ChatInputPaste.Clean("a\n b") == "a b", "no double space at a break");
|
||||
Check(ChatInputPaste.Clean("\r\nab\r\n") == "ab", "leading / trailing breaks dropped");
|
||||
Check(ChatInputPaste.Clean("a\tb") == "a b", "tab -> space");
|
||||
Check(ChatInputPaste.Clean("a\u0016b\u0003c\u007Fd") == "abcd", "control characters dropped");
|
||||
Check(ChatInputPaste.Clean("héllo ✓") == "héllo ✓", "non-ASCII kept");
|
||||
Check(ChatInputPaste.Clean(null) == "" && ChatInputPaste.Clean("") == "", "null / empty");
|
||||
}
|
||||
|
||||
private static void PasteInsert()
|
||||
{
|
||||
Case("paste: inserted at the caret");
|
||||
Check(ChatInputPaste.Insert("/tell Bob, ", 11, "hi there", out int c) == "/tell Bob, hi there" && c == 19, "at the end");
|
||||
Check(ChatInputPaste.Insert("ac", 1, "b", out c) == "abc" && c == 2, "in the middle");
|
||||
Check(ChatInputPaste.Insert("bc", 0, "a", out c) == "abc" && c == 1, "at the start");
|
||||
Check(ChatInputPaste.Insert("ab", 99, "c", out c) == "abc" && c == 3, "caret past the end clamped");
|
||||
string same = "keep";
|
||||
Check(ReferenceEquals(ChatInputPaste.Insert(same, 2, "\r\n", out c), same) && c == 2, "nothing to paste: line unchanged");
|
||||
Check(ReferenceEquals(ChatInputPaste.Insert(same, 2, null, out c), same) && c == 2, "empty clipboard: line unchanged");
|
||||
|
||||
string big = new('x', 5000);
|
||||
string r = ChatInputPaste.Insert("ab", 2, big, out c);
|
||||
Check(r.Length == ChatInputPaste.MaxLineChars && c == ChatInputPaste.MaxLineChars, "capped at MaxLineChars");
|
||||
string full = new('y', ChatInputPaste.MaxLineChars);
|
||||
Check(ReferenceEquals(ChatInputPaste.Insert(full, 3, "z", out c), full) && c == 3, "full line: nothing added");
|
||||
string pair = new string('a', ChatInputPaste.MaxLineChars - 2);
|
||||
r = ChatInputPaste.Insert(pair, pair.Length, "b\U0001F600c", out c); // room for "b" + half the pair
|
||||
Check(r == pair + "b" && c == pair.Length + 1, "never splits a surrogate pair");
|
||||
}
|
||||
|
||||
private static void Case(string name)
|
||||
{
|
||||
_case = name;
|
||||
Console.WriteLine($"-- {name}");
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL [{_case}] {what}");
|
||||
}
|
||||
}
|
||||
|
|
@ -93,6 +93,7 @@ ENQUEUE = "AcMainThreadQueue.Enqueue"
|
|||
ENQUEUE_PRODUCER_ALLOW = {
|
||||
("AutoIdService.cs", "DrainTick"), # appraisal: enqueues 0xC8, sent on main thread in DrainRequestIds
|
||||
("RynthCoreChatCommands.cs", "Reply"), # /rc and /rv plates replies: only EnqueueWriteToChat
|
||||
("AcMouseOver.cs", "Say"), # /rc acmouse watch lines: only EnqueueWriteToChat (and the log)
|
||||
}
|
||||
|
||||
# CHECK C sinks: raw stores into memory. Comments are stripped before matching.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@ fails here instead of in game:
|
|||
client has CatchDroppedItem there (directly, or UIElement_Field's, which calls it);
|
||||
* every UIElement vtable has GetUIElementType at +0x98 (mov eax,imm32 / ret, or xor/ret),
|
||||
UIElement_ItemList's returns 0x10000031, GetParent is the vtable +0xA0 call that
|
||||
GetAncestorByID walks, and the element id is at +0x2E4.
|
||||
GetAncestorByID walks, and the element id is at +0x2E4;
|
||||
* AC's mouse-over (Compatibility/AcMouseOver.cs): SwitchMouseOver stores the element under
|
||||
the mouse at +0x244, every hit test that feeds it skips +0x2D4 (cursor left) and starts
|
||||
at the root (+0x9C), DeletingElement clears it, UseTime calls CheckTooltip with the
|
||||
manager every frame, and exactly one UIElement class (SmartBoxWrapper, the 3D view)
|
||||
has type 0x10000030.
|
||||
|
||||
Usage: python tools/ui_hooks_check.py ["<path-to-acclient.exe>"]
|
||||
Exit 0 = every check passed.
|
||||
|
|
@ -165,6 +170,51 @@ def main():
|
|||
check(not bad_type, f"every UIElement vtable's +0x98 is GetUIElementType ({len(tables) - len(bad_type)}/{len(tables)})")
|
||||
itemlist = [t for t in tables if at(u32(t + 0x98), 6) == bytes([0xB8, 0x31, 0x00, 0x00, 0x10, 0xC3])]
|
||||
check(len(itemlist) >= 1, f"UIElement_ItemList's GetUIElementType returns 0x10000031 ({len(itemlist)} vtable(s))")
|
||||
# 8a. the 3D view's element class (Compatibility/AcMouseOver.cs)
|
||||
smartbox = [t for t in tables if at(u32(t + 0x98), 6) == bytes([0xB8, 0x30, 0x00, 0x00, 0x10, 0xC3])]
|
||||
check(len(smartbox) == 1, f"UIElement_SmartBoxWrapper: one UIElement vtable whose GetUIElementType returns 0x10000030 ({len(smartbox)})")
|
||||
|
||||
# 8. AC's mouse-over element (Compatibility/AcMouseOver.cs): UIElementManager +0x244
|
||||
switch = find([0x53, 0x8B, 0x5C, 0x24, 0x08, 0x56, 0x8B, 0xF1, 0x8B, 0x86, 0x44, 0x02, 0x00, 0x00, 0x57, 0x33, 0xFF,
|
||||
0x3B, 0xD8, 0x74, 0x06, 0x89, 0x9E, 0x44, 0x02, 0x00, 0x00])
|
||||
check(switch is not None, f"SwitchMouseOver found: stores its argument at +0x244 (0x{(switch or 0):08X})")
|
||||
if switch:
|
||||
check(body_has(switch, [0x8A, 0x83, 0x45, 0x05, 0x00, 0x00], 0x40), "SwitchMouseOver: the hover element needs the element's +0x545 byte")
|
||||
hit_tests, recurse = 0, set()
|
||||
for c in rel_callers(switch):
|
||||
pre = W[c - BASE - 0x40:c - BASE]
|
||||
calls = [c - 0x40 + k + 5 + struct.unpack_from("<i", pre, k + 1)[0] for k in range(len(pre) - 5) if pre[k] == 0xE8]
|
||||
if b"\xD4\x02\x00\x00" in pre and b"\x9C\x00\x00\x00" in pre and calls:
|
||||
hit_tests += 1
|
||||
recurse.add(calls[-1])
|
||||
check(hit_tests >= 4 and len(recurse) == 1,
|
||||
f"{hit_tests} SwitchMouseOver calls follow a +0x2D4 test and a hit test from the root (+0x9C) "
|
||||
f"through one function (MouseMoveHandler, MouseDownEvent, UpdateMouseOver, DoMouseUpdate)")
|
||||
if len(recurse) == 1:
|
||||
r = recurse.pop()
|
||||
check(body_has(r, [0x8B, 0x85, 0xA4, 0x00, 0x00, 0x00], 0x20) and body_has(r, [0x8A, 0x85, 0x45, 0x05, 0x00, 0x00], 0xA0)
|
||||
and body_has(r, [0xC1, 0xE9, 0x06], 0xA0),
|
||||
f"MouseOverCriteria::Recurse (0x{r:08X}): visible elements only (+0xA4), returns one with +0x545 or +0xA4 bit 6")
|
||||
leave = find([0x6A, 0x00, 0xC6, 0x81, 0xD4, 0x02, 0x00, 0x00, 0x01, 0xE8])
|
||||
tgt = leave + 9 + 5 + struct.unpack_from("<i", W, leave - BASE + 10)[0] if leave else 0
|
||||
check(tgt == switch, "MouseLeaveEvent: sets +0x2D4 (cursor left) and SwitchMouseOver(0)")
|
||||
dele = find([0x39, 0xAE, 0x44, 0x02, 0x00, 0x00, 0x75, 0x21, 0x53, 0x8B, 0xCE, 0xE8, N, N, N, N,
|
||||
0x89, 0x9E, 0x48, 0x02, 0x00, 0x00, 0x89, 0x9E, 0x44, 0x02, 0x00, 0x00])
|
||||
check(dele is not None, "DeletingElement: clears +0x244 (and +0x248) when that element goes")
|
||||
usetime = find([0x56, 0x8B, 0xF1, 0xE8, N, N, N, N, 0x8B, 0xCE, 0xE8, N, N, N, N, 0x8A, 0x86, 0x40, 0x02, 0x00, 0x00,
|
||||
0x84, 0xC0, 0x74, 0x05, 0xE8, N, N, N, N, 0x8B, 0xCE, 0xE8])
|
||||
tgt = usetime + 32 + 5 + struct.unpack_from("<i", W, usetime - BASE + 33)[0] if usetime else 0
|
||||
check(tgt == va["UiElement.CheckTooltip"], "UIElementManager::UseTime calls CheckTooltip with ecx = the manager, every frame")
|
||||
check(len(matches(W, [0x68, 0x30, 0x00, 0x00, 0x10], limit=8)) >= 1,
|
||||
"push 10000030h present (SmartBoxWrapper::Register registers the type)")
|
||||
src = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "src", "RynthCore.Engine", "Compatibility")
|
||||
with open(os.path.join(src, "AcMouseOver.cs"), encoding="utf-8") as f:
|
||||
mo = f.read()
|
||||
with open(os.path.join(src, "AcMouseOverRules.cs"), encoding="utf-8") as f:
|
||||
rules = f.read()
|
||||
check("MgrMouseOver = 0x244" in mo and "MgrMouseOutside = 0x2D4" in mo and "VtGetUIElementType = 0x98" in mo,
|
||||
"AcMouseOver.cs reads +0x244, +0x2D4 and vtable +0x98")
|
||||
check("UIElementTypeSmartBoxWrapper = 0x10000030" in rules, "AcMouseOverRules.cs: the 3D view is type 0x10000030")
|
||||
|
||||
print("=" * 60)
|
||||
print("PASS - the UI hooks' facts hold on this client." if fails == 0 else f"FAIL - {fails} check(s) failed.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue