rustenium-identity 0.1.10

A versatile stealth overlay for rustenium
Documentation
// Runtime GPU update — re-applies the WebGL vendor/renderer substitution to an
// already-running context. Kept in sync with the block in main_world.js.
//
// Requires PropertyModifier to be present (it is, via the stealth bootstrap).
// Re-running is safe: spoofMethod captures whatever getParameter is currently
// installed, so a second call simply layers over the first.
(function () {
  var vendor = "{{WEBGL_VENDOR}}";
  var renderer = "{{WEBGL_RENDERER}}";
  function hook(target) {
    if (typeof target === 'undefined' || !target) return;
    PropertyModifier.spoofMethod(target.prototype, 'getParameter', function (orig) {
      return function getParameter(parameter) {
        var real = orig.apply(this, arguments);
        if (parameter !== 37445 && parameter !== 37446) return real;
        // UNMASKED_* only read back once WEBGL_debug_renderer_info is enabled;
        // mirror the native null so probing without the extension isn't a tell.
        if (real === null || real === undefined) return real;
        return parameter === 37445 ? vendor : renderer;
      };
    });
  }
  hook(typeof WebGLRenderingContext !== 'undefined' ? WebGLRenderingContext : null);
  hook(typeof WebGL2RenderingContext !== 'undefined' ? WebGL2RenderingContext : null);
})();