Skip to content

The game

Which game it is, its files, and what it’s made with. game.gameInfo() gives a Game.Info. It’s cheap and doesn’t touch the disk, so call it whenever.

Field What
id Wraith’s id, like steam-1245620, or its own name for games it knows, like ffxiv
store, title Where it’s from, like steam, and the store’s name for it
build The store’s build, like steam:18234455, the way a manifest’s builds lists them. Only Steam says so far
exe, dir The exe’s full path, and its folder
file_version, product_version From the exe, like 1.2.0.0. Empty if it has none
game_engine Like unity, unreal, godot or rpg_maker, from the files beside the exe. Empty if it’s not one Wraith knows
game_engine_variant, game_engine_version Like IL2CPP and 2021.3.16 for Unity. Empty if there’s none
anticheat Anti-cheat beside the game or loaded in it, each with an id and name. Wraith doesn’t stop for it, but your plugin might want to
graphics_api Like d3d11 or vulkan. Empty till the overlay’s first frame
window The game window’s handle, an HWND. 0 till it’s found
wraith_version Wraith’s own version

sha512 gives the exe’s SHA-512 in hex, the way a manifest’s hashes lists it. It’s worked out in the background as the game starts, so it’s async.

import { Wraith } from "wraith";
const game = Wraith.game();
const info = game.gameInfo();
if (info.game_engine === "unity" && info.game_engine_variant === "IL2CPP") {
// GameAssembly.dll has the game's code
}
const hash = await game.sha512();

setSpeed makes the game run faster, up to 100, or slower. Wraith and your plugin keep real time. speed says what it’s at, and it goes back to 1 when your plugin goes. The player can change it too, from the speed slider. Players can read about it in Game speed.

How it’s done depends on the game. If a plugin for the game or its engine provides speed, like unity with Unity’s time scale, that’s used, and anything from 0, a pause, up goes. Otherwise Wraith speeds up or slows down the clocks games time themselves with, like Cheat Engine’s speedhack, down to 0.01, so only a provider can pause. Nearly every game follows the clocks, though a few read the time in ways they can’t change.

import { Wraith } from "wraith";
game.setSpeed(2);
Wraith.log().info(`${game.speed()}`); // 2

Engine and game plugins can handle the game’s speed by claiming its lease with claimSpeed, which is what lets the game pause. While you hold it, the handler gets each speed, starting with what it is now, and says whether it applied it. If it doesn’t, the clocks do. When you lose it, it gets 1, to put the game’s own speed back. It’s called from any thread, so keep it quick, and don’t set the speed from it.

game.claimSpeed((speed) => {
wanted = speed; // put on next frame
return true;
}, null);

Some games break when their speed changes, like ones played online. A game’s plugin can keep it off with setSpeedControl(false), so the slider and pause key are greyed out and setSpeed fails with SpeedOff. Turn it back on where it works, like in a photo mode, with setSpeedControl(true). Turning it off puts the speed back to normal. A game’s plugin’s say beats a game engine’s, which beats the rest, then the newest say wins. It goes when that plugin does. speedControl says whether it’s on now.

game.setSpeedControl(false); // as the plugin starts
// entering the game's photo mode
game.setSpeedControl(true);

Made with ♥ by Asgard