Skip to content

Commit 2a64f23

Browse files
committed
fix: update func id
1 parent 28c8029 commit 2a64f23

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

electron/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ function createWindow() {
302302
WebAssembly.instantiate = async function(buffer, imports = {}) {
303303
const wasmFunctionNames = ${JSON.stringify(funcNames)};
304304
window.ayuHooks.functions = wasmFunctionNames;
305-
window.ayuHooks.parsedFunctions = ${JSON.stringify(parsedFunctions)};
306305
307306
if (!imports.hooks) imports.hooks = {};
308307
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
import {dispatcher} from "@/commands/dispatcher.ts";
1+
import {commandManager, dispatcher} from "@/commands/dispatcher.ts";
22
import {literal} from "@jsprismarine/brigadier";
33
import {addChatMessage} from "@/gameChat/gameChatUtility.ts";
44

55
dispatcher.register(
6-
literal('aaccept').executes(
6+
literal('ban').executes(
77
async () => {
88
addChatMessage([
99
{
10-
text: 'Joining squad 3v7f7v',
10+
text: 'Banned',
1111
r: 163,
1212
g: 196,
1313
b: 243
1414
}
1515
]);
16-
return '/squad-join 3v7f7v';
1716
}
1817
)
19-
)
18+
);
19+
20+
commandManager.registerCommand('ban', 'Ban someone in chat');

src/commands/builtin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import './ahelp.ts';
2-
import './asquad.ts';
2+
import './ban.ts';

src/commands/dispatcher.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ if (window.electron) {
6767
}
6868

6969
let firstPtr = 0;
70-
window.Module.asm.registerHookPre(440);
70+
window.Module.asm.registerHookPre(439);
7171

72-
window.ayuHooks.pre_79 = (arg0: number, arg1: number) => {
72+
window.ayuHooks.pre_78 = (arg0: number, arg1: number) => {
73+
console.log(arg0, arg1);
7374
if (!firstPtr) {
7475
firstPtr = arg1;
7576
}
7677
if (arg1 == firstPtr) {
77-
for (const [, { ptr }] of commandManager.getAllCommands()) {
78-
window.Module.asm[79]?.(arg0, ptr);
79-
}
78+
[...commandManager.getAllCommands().keys()].reverse().forEach(key => {
79+
window.Module.asm[78]?.(arg0, commandManager.getAllCommands().get(key)!.ptr);
80+
});
8081
}
8182
};
8283
})();

0 commit comments

Comments
 (0)