Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@require cache (solved) #30

Closed
Altanis opened this issue Dec 19, 2021 · 29 comments
Closed

@require cache (solved) #30

Altanis opened this issue Dec 19, 2021 · 29 comments

Comments

@Altanis
Copy link
Contributor

Altanis commented Dec 19, 2021

Packet hook gives really bad lag (10fps + ~2000ms)

@diepiodiscord
Copy link
Collaborator

console.time() your packet handling code to make sure it's really the packet hook

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

it is, i tested only the packet hook by itself

@diepiodiscord
Copy link
Collaborator

diepiodiscord commented Dec 19, 2021

I cannot replicate, make sure you're using the latest version since there was a new build today

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

I import the script via a repl (so it automatically updates), there wasn't an issue until today's update. Can you reproduce with this?

// ==UserScript==
// @name         ABC Hook
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://diep.io/
// @icon         https://www.google.com/s2/favicons?domain=diep.io
// @require      https://raw.githubusercontent.com/Qwokka/wail.min.js/5e32d36bd7a5e0830d1ff4b64d3587aea13f77da/wail.min.js
// @require      https://wasm-hook-fetcher.codersudawuda.repl.co
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
})();

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Please stop opening off topic issues - I will update the build on packet hook now

@ABCxFF ABCxFF closed this as completed Dec 19, 2021
@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

how is this off topic?

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

This isnt

@ABCxFF ABCxFF changed the title lag Packet hook out of date Dec 19, 2021
@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Oh wait lol. The phook automator is actually still running so there really is an issue! LOL

@ABCxFF ABCxFF reopened this Dec 19, 2021
@ABCxFF ABCxFF changed the title Packet hook out of date LAG Dec 19, 2021
@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

@CoderSudaWuda I am not experiencing this issue. All you did was install the script? Or did you have other stuff

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

If you had another memory related script installed, it might have made the packet hook script from hooking into the wrong function hence the lag - so maybe try running packet hook without any other scripts.

@Craabby
Copy link
Contributor

Craabby commented Dec 19, 2021

Try looking at the performance tab

@diepiodiscord
Copy link
Collaborator

I could not reproduce with your repl version either

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

@CoderSudaWuda @require meta tag is cached in most Script Monkey extensions. Your issue is likely that the PacketHook cached in your extension is not the latest version. You can test this with PacketHook.CONFIG.BUILD === "b6c132517d2f9e84c9d9334a5fdeaba8a96e3343" in your userscript you sent above. If it returns false then that is the issue - if it returns true however, you can re open this issue

@ABCxFF ABCxFF closed this as completed Dec 19, 2021
@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

there isnt a config property for Hook.

as for the questions above: i tested in an environment where its the only script, there is no other script clashing

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

i can't open the issue so uh can someone read this

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Meant PacketHook.CONST not Hook.CONFIG Oops

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

yeah thats the issue, what do I do about it?

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Try fetch()ing the packet hook code yourself inside the script instead of depending on the tampermonkey/violentmonkey @require, that way it doesn't cache forever

@ABCxFF ABCxFF changed the title LAG @require cache (solved) Dec 19, 2021
@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

CORS error, I can't do that. even if i could evalling doesnt work.

@Craabby
Copy link
Contributor

Craabby commented Dec 19, 2021

that is an issue on your server, there is a cors package on npm

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

i can't fetch clientside

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Fetch it from jsdelivr

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

fetch("https://cdn.jsdelivr.net/gh/ABCxFF/diepindepth/protocol/userscripts/packethook.user.js?" + Date.now())

@Craabby
Copy link
Contributor

Craabby commented Dec 19, 2021

you could always make your own wasm hook and have it fetch the constants from an automator inside the hijacked WebAssembly.instatiate

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

the thing with fetching is that i can't import anything from it since evalling it wont work

@ABCxFF
Copy link
Owner

ABCxFF commented Dec 19, 2021

Maybe eval the config only? There should be a way, good luck on your scripting!

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

is there a way to import WAIL without using @require

@Altanis
Copy link
Contributor Author

Altanis commented Dec 19, 2021

ok i got around it!

    const resp = await fetch("https://cdn.jsdelivr.net/gh/ABCxFF/diepindepth/protocol/userscripts/packethook.user.js?" + Date.now());
    const js = await resp.text();

    const resp2 = await fetch('https://raw.githubusercontent.com/Qwokka/wail.min.js/5e32d36bd7a5e0830d1ff4b64d3587aea13f77da/wail.min.js');
    const js2 = await resp2.text();

    var script1 = document.createElement('script');
    script1.appendChild(document.createTextNode(js2));
    document.head.appendChild(script1);

    var script = document.createElement('script');
    script.appendChild(document.createTextNode(js));
    document.head.appendChild(script);

@diepiodiscord
Copy link
Collaborator

GM_xmlhttpRequest bypasses CORS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants