DigDig.IO X-Ray

Let's you see more in digdig.io

  1. // ==UserScript==
  2. // @name DigDig.IO X-Ray
  3. // @namespace https://tampermonkey.net/
  4. // @version 0.1.0
  5. // @description Let's you see more in digdig.io
  6. // @author Zertalious (Zert)
  7. // @match *://digdig.io/*
  8. // @icon https://www.google.com/s2/favicons?domain=digdig.io
  9. // @require https://cdn.jsdelivr.net/gh/Qwokka/WAIL@9ed21abc43045e19f9b3756de109a6e361fb9292/wail.js
  10. // ==/UserScript==
  11.  
  12. // Only works when fow is done client side
  13. // Should or shouldn't work depending on the current live build
  14. // Created on build: 41e6c4662ebb8e04b62e5ac95c03eb1d8f5427d1
  15.  
  16. const _instantiateStreaming = WebAssembly.instantiateStreaming;
  17.  
  18. WebAssembly.instantiateStreaming = function () {
  19. return _instantiateStreaming(new Response());
  20. };
  21.  
  22. const _instantiate = WebAssembly.instantiate;
  23.  
  24. WebAssembly.instantiate = function (buffer, imports) {
  25. const array = new Uint8Array(buffer);
  26.  
  27. find(array, [
  28. OP_END,
  29. OP_I32_LOAD8_U, -1, -1,
  30. OP_I32_CONST, 1,
  31. OP_I32_SUB,
  32. OP_BR_TABLE
  33. ], function (i, end) {
  34. console.log('here!!');
  35. i++;
  36. array[i++] = OP_BR;
  37. array[i++] = 1;
  38. array[i++] = OP_NOP;
  39. i++;
  40. array[i] = OP_NOP;
  41. });
  42.  
  43. find(array, [
  44. OP_F32_CONST, ...Float32ToArray(2),
  45. OP_SET_LOCAL, -1
  46. ], function (start, end) {
  47. array.set(Float32ToArray(-1), start + 1);
  48. });
  49.  
  50. // changes the shape of the fog to a rectangle
  51. find(array, [
  52. OP_F64_CONST, ...Float64ToArray(1.4142135623730951)
  53. ], function (start, end) {
  54. array.set(Float64ToArray(1), start + 1);
  55. });
  56.  
  57. return _instantiate(buffer, imports);
  58. };
  59.  
  60. function find(array, search, callback) {
  61. main: for (let i = 0; i < array.length; i++) {
  62. for (let j = 0; j < search.length; j++) {
  63. if (search[j] !== -1 && array[i + j] !== search[j]) {
  64. continue main;
  65. }
  66. }
  67. callback(i, i + search.length - 1);
  68. }
  69. }
  70.  
  71. function Float32ToArray(x) {
  72. return new Uint8Array(new Float32Array([x]).buffer);
  73. }
  74.  
  75. function Float64ToArray(x) {
  76. return new Uint8Array(new Float64Array([x]).buffer);
  77. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址