Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

VTank Log Guard

A tiny Windows tray utility that stops Virindi Tank's error log (vtank-error.txt) from ballooning to ~32 MB and stalling your in‑game macros.

This is a band‑aid, not a cure. It caps the symptom (a runaway log file). The cause is a server‑side value that overflows a signed 16‑bit field — see What's actually going wrong. The guard just keeps you playing until a server admin fixes the root cause.


The problem

On some Asheron's Call emulator servers, Virindi Tank (uTank2) hits this exception on an inbound network message and logs the full stack trace every time — often 15–20 times per second:

Value was either too large or too small for an Int16.
  at System.Convert.ToInt16(Int32 value)
  at Decal.Adapter.MessageStruct.Value[FieldType](String name)
  ...

At ~15 KB/s the log reaches ~32 MB in about half an hour, and the exception storm saturates VTank's network thread — at which point your macro quietly stops running.

What this tool does

A background watcher checks vtank-error.txt every few seconds and truncates it back to empty whenever it crosses a size cap (default 5 MB). It also reports the current "storm" write‑rate, so you can see when the underlying problem is fixed (the rate drops to quiet).

It ships in two forms:

File What it is
vtank_log_guard_tray.py System‑tray app with a right‑click menu (recommended)
vtank_log_guard.py Headless command‑line version (no dependencies)
start_vtank_guard.vbs Double‑click launcher for the tray app (no console window)

Tray menu

Guarding | storm: 8.2 KB/s | log: 3.1 MB | reclaimed: 40 MB (8 trims)   <- live status
------------------------------------------------------------------------
[x] Enabled            toggle trimming on/off
    Pause 10 min       temporary snooze, auto-resumes
    Trim now           force an immediate truncate
------------------------------------------------------------------------
    Open log folder    jump to the Virindi Tank folder
    Quit

The icon is a shield: green = guarding, yellow = paused / disabled / log not found, red = over cap but the file is momentarily locked.


Install

Requires Python 3.8+ on Windows.

pip install -r requirements.txt

(The headless vtank_log_guard.py needs nothing beyond the standard library; only the tray app needs pystray + Pillow.)

Usage

Tray app — double‑click start_vtank_guard.vbs, then look for the green shield in your system tray (Windows 11 hides new icons behind the ^ arrow — drag it onto the taskbar to keep it visible).

Headless / CLI:

python vtank_log_guard.py                      # watch, cap at 5 MB
python vtank_log_guard.py --max-mb 10 --interval 5
python vtank_log_guard.py --path "D:\Games\Decal Plugins\Virindi Tank\vtank-error.txt"
python vtank_log_guard.py --once               # single pass then exit

Configuration

By default the log is found at %USERPROFILE%\Documents\Decal Plugins\Virindi Tank\vtank-error.txt. If your Decal install lives elsewhere, override it:

Setting Env variable CLI flag (headless) Default
Log path VTANK_LOG_PATH --path <home>\Documents\Decal Plugins\Virindi Tank\vtank-error.txt
Size cap (MB) VTANK_MAX_MB --max-mb 5
Check interval (s) VTANK_INTERVAL --interval 5

Start automatically at login

Put a shortcut to start_vtank_guard.vbs in your Startup folder:

  1. Press Win + R, type shell:startup, press Enter.
  2. Create a shortcut in that folder pointing to start_vtank_guard.vbs.

To stop it starting at login, delete that shortcut (or disable it in Task Manager → Startup apps).


What's actually going wrong

The exception is a narrowing‑conversion overflow. The server sends a network message whose field holds a value greater than 32,767. VTank reads that field as a .NET signed Int16 (Convert.ToInt16(Int32)), which overflows for anything above 32,767 — even values that are perfectly valid as unsigned 16‑bit (32,768–65,535). On the retail client this field never grew that large, so it never broke.

Because this is data coming from the server, it can only be truly fixed server‑side — typically a one‑line content/database change (for example, renumbering a custom spell whose ID or category is ≥ 32,768, or clamping an oversized stack count / item value / property). On the popular open‑source emulator ACE this is a content edit, not an engine change.

If you run/help run the server, the fix is to keep whatever value this message carries within signed‑16‑bit range, or emit it in the correct 32‑bit field that matches the retail packet layout.

Disclaimer

This is an unofficial, third‑party utility. It is not affiliated with Virindi Tank, Decal, or any game or server. It only reads the size of, and truncates, a log file you already own. Use at your own risk.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages