From 000ef55273e764fd85fe880e7e3a387c12ace9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 5 Nov 2024 10:25:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=80=E7=82=B9=E5=B0=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/packet/client/nativeClient.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/packet/client/nativeClient.ts b/src/core/packet/client/nativeClient.ts index 9399d133..7bfb43ab 100644 --- a/src/core/packet/client/nativeClient.ts +++ b/src/core/packet/client/nativeClient.ts @@ -46,15 +46,16 @@ export class NativePacketClient extends PacketClient { const moehoo_path = path.join(dirname(fileURLToPath(import.meta.url)), './moehoo/MoeHoo.' + platform + '.node'); process.dlopen(this.MoeHooExport, moehoo_path, constants.dlopen.RTLD_LAZY); console.log('MoeHooExport:', this.MoeHooExport); - // this.MoeHooExport.exports.InitHook?.(recv, send, (type: number, uin: string, seq: number, cmd: string, hex_data: string) => { - // const callback = this.cb.get(createHash('md5').update(Buffer.from(hex_data, 'hex')).digest('hex') + (type === 0 ? 'send' : 'recv')); - // if (callback) { - // callback({ seq, cmd, hex_data }); - // } else { - // this.logger.logError(`Callback not found for hex_data: ${hex_data}`); - // } - // console.log('type:', type, 'uin:', uin, 'seq:', seq, 'cmd:', cmd, 'hex_data:', hex_data); - // }); + console.log('recv:', recv, 'send:', ); + this.MoeHooExport.exports.InitHook?.(send, recv, (type: number, uin: string, seq: number, cmd: string, hex_data: string) => { + const callback = this.cb.get(createHash('md5').update(Buffer.from(hex_data, 'hex')).digest('hex') + (type === 0 ? 'send' : 'recv')); + if (callback) { + callback({ seq, cmd, hex_data }); + } else { + this.logger.logError(`Callback not found for hex_data: ${hex_data}`); + } + console.log('type:', type, 'uin:', uin, 'seq:', seq, 'cmd:', cmd, 'hex_data:', hex_data); + }); this.isAvailable = true; }