[!TIP] Audience: Rime (Weasel) users, people multiboxing games across multiple Windows accounts, and anyone curious about TSF input methods or Rust systems programming. Core goal: Document a two-day debugging session caused by running the control test under the wrong Windows account, and explain why I decided to build my own IME even after finding the real culprit. Problem–Solution Mapping:

  • Weasel shows no candidates in D2R and Space commits raw letters → Root cause: D2R was running under another Windows account where Rime had never been deployed; clicking “Redeploy” under that account brought the candidate window right up (showing the built-in Luna Pinyin, not my Wanxiang schema).
  • Wanting context-based reranking, post-commit correction, and multi-account support → All of these are blocked by the IME frontend, not the engine. The AI scrapped its original recommendation and pivoted to writing a custom “thin DLL + resident daemon” frontend in Rust.

Bottom line first: Weasel (0.17.4) failing to type Chinese in Diablo II: Resurrected (D2R) had nothing to do with D2R itself, nor was it weasel.dll or Blizzard’s anti-cheat. The reason was simply that I ran D2R under a second Windows account whose %APPDATA%\Rime had never been deployed.

To reach that conclusion, the AI working for me (Claude) and I burned two days: reading Weasel’s source code, digging through GitHub issues, and writing a minimal TSF IME probe in Rust to inject into D2R for self-diagnostics.

Even more ridiculous: once the truth came out and we could have called it a day, I didn’t stop. I told the AI to keep building. By that same night, a Rust IME frontend was typing in Notepad. I still haven’t tested it in D2R.

Symptoms: Late Night, November 14

I installed Weasel 0.17.4 on October 23 with the “Wanxiang Pinyin” schema. The whole point was to improve my Chinese typing accuracy so I’d stop backspacing over typos all the time.

In the D2R chat box, I switched to Weasel and typed nihao: no letters appeared, no candidate window popped up, pressing 1 did nothing, and pressing Space or Enter dumped the raw nihao straight into the chat box. Microsoft Pinyin and Sogou both worked fine in D2R. I opened Notepad as a control test—Weasel showed candidates normally and let me select “你好”. (That control test turned out to be under the wrong account; more on that later.)

The AI ran a first check: 64-bit weasel.dll was indeed loaded into D2R; neither D2R nor the Weasel server was running as Administrator; the game was in windowed mode, not fullscreen exclusive; and the server logs showed sessions being created and destroyed normally. Its hypothesis was that inline_preedit: true in my config broke D2R’s custom-drawn input box because it couldn’t handle inline preedit. That hypothesis was never proven and never ended up mattering.

It also wrote a monitoring script to watch for candidate windows, which failed to detect even the candidate window that was sitting right there in front of me in Notepad. So “monitor didn’t see a candidate window” proved nothing, and all the earlier monitoring runs had to be thrown out.

Me: Why Don’t You Search the Community?

I asked the AI: why don’t you search around and see what the community says? I don’t buy that I’m the only person hitting this.

One search later, rime/weasel turned up a pile of similar open issues: #455, #1809, #1876, #1874, #1964 (candidate window not showing in games), and #1974 (cannot type in LoL chat). Nothing specific to D2R.

The reporter on #1964 offered a mechanism analysis (unconfirmed by maintainers): the game replies pbShow=FALSE to BeginUIElement in TSF, meaning “I’ll draw the candidate window myself,” so Weasel obliges and skips drawing—except the game doesn’t draw it either. Sogou supposedly works because it injects a D3D overlay into the game. The reporter proposed a “force show candidate window” toggle, which wasn’t merged or released; 0.17.4 remains the latest stable build.

I tried the workaround from #1974 (switch to another IME and back). Didn’t work. The AI also pointed out that my symptoms (pressing 1 does nothing, Space commits raw letters) didn’t match #1964’s description (“commits text normally, only missing the candidate window”), so even if that patch landed, it wouldn’t necessarily fix my problem. We found no existing plugin that patches candidate windows into games. The AI’s recommendation at the time: just use Microsoft Pinyin in D2R, and don’t compile a custom Weasel build for a single game. It added a todo item to “watch #1964.” That should have been the end of it.

November 16: What If We Just Write Our Own?

A day later, it was still bugging me. I asked again: are big-tech IMEs really the only option now? Can’t we write a plugin to force-render it? Don’t big-tech IMEs have zero privacy?

The AI started out very conservative:

  • First distinguish Case A (candidate window hidden) from Case B (keystrokes aren’t intercepted at all—rendering won’t fix key capture);
  • Injecting a D3D overlay into a game carries an uncontrollable risk of tripping anti-cheat; not recommended;
  • Big-tech IME cloud features do upload data, though it hadn’t audited them one by one; besides, game chat is already going to Blizzard’s servers, so the privacy cost there is small;
  • Run a small experiment disabling inline_preedit first instead of rewriting an IME for one scenario.

I followed up: what about redoing it in Rust? Why stick to C++? It said C++ was only because Weasel itself is in C++. Rust can write TSF via windows-rs and call librime over its C API; since an IME DLL gets injected into every process and crashing inside it takes down the host app, Rust’s memory safety has real value. Still, the language wasn’t the bottleneck—TSF was. Without knowing the root cause, a rewrite wasn’t guaranteed to help.

I asked again: aren’t there any new engines for the AI era? The AI searched around. The following are all from the projects’ own descriptions—we didn’t read their source code one by one: Yune (a Rust rewrite of a Rime-compatible engine, 1 star, no releases), Metasequoia / 水杉输入法 (ranks candidates with a local language model), HuoziIME (on-device Android), Nacre, and Rectfly. Not a single one was confirmed to solve candidate window or keystroke issues in games. It still advised against switching engines.

Then I said one sentence: “Think more about future compatibility and where things are headed. Don’t optimize for doing less work right now.”

The AI reversed its “don’t write a TSF frontend” stance on the spot. Its reasoning was that almost every capability you’d want in the AI era is bottlenecked at the frontend layer:

  1. Reranking candidates based on the text before the cursor. librime’s rime_api.h has no API for reading surrounding text (it checked the header).
  2. Showing initial candidates immediately, then refreshing asynchronously once a small model finishes scoring.
  3. Reaching back to fix a wrong word after it has already been committed.
  4. Game compatibility.

It also noted that stuffing AI logic into librime’s Lua layer locks you into Lua, and making synchronous HTTP calls from there freezes keystrokes.

That gave us the v2 plan, with four independently swappable layers: the data layer keeps Rime’s format; the engine layer wraps librime strictly behind its C API so it can be swapped out later; the AI layer is a standalone local service where requests carry sequence numbers—late replies get dropped, and if the service dies, typing continues unaffected; the frontend layer is written from scratch in Rust, with a thin tip.dll injected into apps and a resident server.exe communicating over named pipes, with server drawing the candidate window. The roadmap: P0 probe, P1 basic typing, P2 offline benchmark, P3 AI sidecar, P4 post-commit correction, P5 daily-driver readiness, P6 engine swap or mobile port.

Before writing the frontend, we tested one thing against real librime: using only the C API without Lua, could we fetch the full candidate list (30 candidates took ~1.1 ms), commit a candidate by global index, highlight without committing, and after selecting a shorter word mid-sentence, keep composing the remaining pinyin? All four passed. That confirmed reranking can live entirely in the server process.

As for prior art, I only checked repository pages and didn’t run them: the Windows version of Chewing (新酷音) has a TSF frontend written in Rust, and Metasequoia also uses a “thin DLL + server process drawing the candidate window” split. (The AI initially claimed Metasequoia was “Rust engine + C++ frontend,” then realized the repo docs didn’t say that and retracted the claim.)

P0 Probe: Using D2R as the Testbed

Step one was writing a minimal Rust IME that only observes and doesn’t touch any dictionary: probe_tip (minimal TSF text service), tsfctl (registration tool), and tsfhost (test host).

Two Early Gotchas

Registering an IME must write to HKLM and requires Administrator privileges; under normal user privileges, RegisterProfile returns 0x80004005. Also, the AI initially used PostMessage to send keystrokes to an edit control for automated testing—the probe didn’t receive a single key, and nihao appeared straight in the edit box. Only real input via SendInput goes through TSF interception.

Into D2R: A Chain of Conclusions Later Overturned

The first time I launched D2R, the probe log didn’t have a single line from D2R—the DLL wasn’t loaded at all. The AI first suspected a VC runtime version conflict, checked the D2R directory, found no bundled runtime, and dropped that idea. Then it moved the DLL from AppData under my user directory to C:\Program Files\TypeInput\, and it loaded. The AI recorded a deduction at the time: “D2R only loads DLLs from trusted directories like Program Files.” (Spoiler: this was later overturned.)

What we saw once it loaded:

  • nihao and the cursor were visible inside the chat box—inline preedit rendered fine.
  • The candidate window was drawn in the game’s own font style. The probe didn’t contain a single line of window-drawing code; it only implemented ITfCandidateListUIElement and handed over three hardcoded fake candidates, so that window had to be drawn by D2R itself. Logs showed its input thread activation flags were flags=0x4 (UILess in Microsoft’s docs), and BeginUIElement returned pbShow=false.
  • At the time I said, “This is obviously calling the game’s internal renderer, probably for anti-cheat.” The AI’s view was: this is Microsoft’s standard mechanism designed for games and fullscreen apps, and D2R just implemented it by the book.

One miscommunication: I said “whatever I type, it’s always Hello Probe,” and the AI took that to mean “text commit succeeded.” I actually meant the candidate window only ever listed the hardcoded fake candidates. The AI corrected its notes: at that point there was still zero evidence that committing text worked.

Commit length limit: pressing Space to commit a 36-character status string did nothing; pressing F4 to commit a 30-character string also produced nothing in the chat box, even though the TSF call returned success in the logs. Short strings of 13 to 15 characters committed fine. This D2R input box has a per-commit cap somewhere between 15 and 29 characters—anything longer is silently dropped without an error. So after committing, you have to read back the text to verify; you cannot trust TSF’s return value. In the logs, the composition was terminated twice, both times right after an Alt key event—caused by me Alt-Tabbing out (probably to take screenshots). The game itself wasn’t interrupting preedit.

Stumbles Along the Way

  • The probe tried writing logs to 4 directories inside D2R, and from the outside I couldn’t see a single file. The AI guessed D2R or anti-cheat was blocking file writes for reasons unknown, so we switched to OutputDebugString and wrote a dbgview collector to capture it.
  • The AI next inferred that “Weasel didn’t hand over candidate data via the candidate interface,” went to read Weasel’s CandidateList.cpp, and found a complete implementation that still updates properly even when pbShow=false. Retracted.
  • One last suspicion: Weasel’s DLL relies on a named pipe to talk to WeaselServer—could D2R be blocking named pipes? So we added a self-check suite to the probe (revision r4): file write, system file read, named pipe, named event, and loopback TCP.
  • Deploying r4 failed to take effect the first two times. Windows returned “The operation was canceled by the user,” and the AI briefly thought I hadn’t clicked “Yes” on the UAC prompt. Turns out the deployment script was saved as UTF-8 without BOM; Windows PowerShell 5.1 misread the Chinese characters as mojibake, failed to parse the script right at the top, and executed nothing after elevation. Adding a BOM made it pass on the first try.
  • Another hiccup: I had set the collector timeout to 1500 seconds, so by the time I actually typed in-game it had already exited—and because the self-check only runs once on first activation, the output was lost. We restarted the collector, and I closed and relaunched D2R.

The Twist: D2R Was Running Under Another Account

The self-check results came back. From inside the D2R process: writing files (to all 4 directories), reading win.ini, connecting to a named pipe (it connected right into my collector process), opening a named event, and connecting over local TCP—every single one succeeded. The “blocked pipe” theory was dead.

In that same round, the AI checked the owner of the D2R process and spotted a massive blind spot: this D2R instance wasn’t running under my daily Windows account—it was running under a different account. It asked whether I did that on purpose or didn’t know. I answered: on purpose. To multibox D2R, I use nearly ten Windows accounts.

All three of our earlier “D2R-specific restrictions” suddenly had a completely different explanation:

  1. The probe wouldn’t load from AppData but loaded from Program Files: nothing to do with “trusted directories”—the game account simply didn’t have permission to read my main account’s AppData.
  2. “Couldn’t write logs” inside D2R: it actually wrote them just fine, into the game account’s own directories. When I went looking from my daily account, access was denied, so I thought no files were written.
  3. Weasel “not handing over candidate data”: already disproven by reading the source.

What I had chalked up to game restrictions turned out under real testing to be basic account isolation. Worse still: the “working control test” I did in Notepad on the first night was run under my daily account, and my Wanxiang schema and dictionaries were only deployed in that account’s %APPDATA%\Rime. The game account running D2R had never deployed Rime at all.

Verification: I switched to that game account, opened Notepad, and typed nihao: preedit box showed up, zero candidates, and Space committed raw nihao—the exact same symptom as in D2R. Then, still in that account, I clicked “Redeploy” on the Weasel tray icon: Luna Pinyin candidates (你好, 妳好, 逆號, 擬好, 你) popped up in Notepad, and the exact same game-drawn candidate window popped up in D2R. I confirmed Space committed the Chinese characters properly.

So: the root cause of Weasel failing to type in D2R was simply that Rime had never been deployed under the game account. It had nothing to do with D2R, weasel.dll, named pipes, or inline preedit. The “game suppresses candidate windows” mechanism described in community issue #1964 did not hold true on my machine in D2R; I haven’t tested other machines or other games, so I’m drawing no conclusions about those.

I casually asked: doesn’t the installer have an “install for all users” option? The AI explained that the program binaries are installed for all accounts (DLL in System32, registered under HKLM), but Rime’s user data lives in each account’s own %APPDATA%\Rime. “Deploy” is per-account, and the installer only runs it once for whichever account launched the installer, so reinstalling wouldn’t help. (That’s the AI’s explanation; I didn’t verify the installer myself.)

A side note on disk space: my Wanxiang setup takes about 587 MB per account (398 MB for the .gram language model, ~140 MB for build). Duplicating that across nearly ten accounts would burn several gigabytes, and the accounts can’t read each other’s folders anyway.

The AI wrote down the lesson from this episode, and I agree with it: before debugging why something “doesn’t work in App X,” first verify that the target process’s user account, session, and integrity level match your control group. That whole tight-looking chain of reasoning we built earlier (preedit rejected, candidates not exposed, trusted directories, blocked pipes) was derived entirely from the flawed premise of running the control test under the wrong account.

Even After Knowing the Truth, I Told It to Build Ours Anyway

Once we knew the root cause, the AI offered the low-effort option: just use Luna Pinyin Simplified (press F4 to select the schema) on the game accounts without touching any files. It reasoned that in-game chat is mostly short phrases where the accuracy gap barely matters, and leaned toward doing that first—since we were planning to build our own frontend anyway, multi-account shared data would be redesigned from scratch later, and rigging up a shared directory for Weasel right now might just be throwaway work.

I replied: “I’ve already changed it. Then just build our own. Go.”

I didn’t elaborate. What I’d said earlier—“Think more about future compatibility and where things are headed”—still stood. None of the things the v2 plan aimed for (context-based reranking, post-commit correction, multi-account sharing, a future mobile port) would be solved just by getting Weasel to type in D2R.

P1 kicked off that same night. We set up five Rust crates: proto (versioned pipe protocol between tip and server), engine (librime adapter), ipc (pipes named by user SID, ACLs restricted to the current user and SYSTEM, client timeouts), server (sessions, background engine deployment, GDI candidate window), and tip (the thin DLL injected into apps). Tests: 6 in proto, 9 unit tests plus 1 real-Rime integration test in engine, 5 in ipc, 8 unit tests plus a real multi-process end-to-end test in server, and 3 in tip.

Having been burned earlier, we locked in a few decisions from day one:

  • Never crash the host app: removed panic = "abort" from release builds and wrapped every COM entry point in catch_unwind. A bug in the IME must never take down someone else’s application.
  • Cross-account awareness: tip and server might run under different accounts, so pipe permissions are set explicitly, with one server instance per user; logs go through OutputDebugString because log files can’t be read across accounts.
  • No keystroke freezing on cold start: first-time Rime deployment on a fresh account was measured at 18.7 seconds, so it runs on a background thread in server while keystrokes pass straight through to the app in the meantime.
  • Latency: in a debug build, each keystroke takes ~0.2 ms round-trip over the pipe, except the very first key on a new connection took 110 to 130 ms. I’ve already had the server pre-warm sessions, though that requires redeploying the new build to take effect, so the build currently installed still has the slow first key.

After approving the UAC prompt to install tip_r1.dll into C:\Program Files\TypeInput\, we ran automated checks in the test host first: nihao + Space produced “你好”; nihaoshijie + Space produced “你好世界”; jintiantianqizhenbucuo + Space produced “今天天气真不错”; nihao + Enter committed raw ASCII; nihao + Esc canceled; RichEdit behaved the same; and when server wasn’t running, tip spawned it automatically (the initial background deploy after auto-spawning took 19.5 seconds).

The test host can’t read inline preedit or trigger the candidate window, so checking whether the candidate window actually renders and lands in the right spot had to be done by me in a real app. The AI asked me to test it in Notepad. I replied: “Works. Everything looks normal.” Then I listed the next steps—user dictionary learning, kaomoji/text emoticons, English pass-through mode, and Simplified/Traditional switching—and told it to clean up the docs so I can push it to GitHub as a new project.

What’s Not Done Yet & Limitations

Typing in Notepad is still a long way from replacing my daily-driver IME:

  • Not tested in D2R yet: this whole saga started because of D2R, but I haven’t actually tested my own IME inside D2R yet, nor have I enabled it on the game accounts.
  • Barebones candidate window: no mouse click selection; not DPI-aware, so the window position may be off in some apps.
  • D2R swallowing long commits: currently we only log when a readback mismatches; we haven’t implemented chunked retries yet.
  • Schemas and everyday features missing: right now it only wires up default Luna Pinyin Simplified—my Wanxiang schema isn’t hooked up yet; user dictionary accumulation, text emoticons, English mode, and Simplified/Traditional toggling aren’t implemented.
  • Zero lines of AI code written: offline benchmarking (P2), async reranking (P3), and post-commit correction (P4) haven’t been touched, and we have zero numbers on whether small-model reranking is even worth wiring up.
  • Engineering debt: x64 only, no x86 DLL; unsigned binaries; untested in Chrome, VS Code, Windows Terminal, or WeChat; no installer, deployment relies on manual scripts.
  • Open-source licensing undecided: I plan to clean up the docs and push it to GitHub as a new project, but haven’t decided how to release it yet.
  • Other people’s #1964: whether the issue on other people’s machines has the same cause (e.g., an undeployed secondary account) is something I have no way of knowing.