From 7e6ec7860f5009c32eb65a282a3c04a0380a4ada Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:37:47 +0800 Subject: [PATCH] [saco] Implement/match `GetTaskTypeFromTask(...)` --- saco/game/util.cpp | 20 ++++++++++++++++++++ saco/game/util.h | 1 + 2 files changed, 21 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 1a5b168..b12d83e 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1376,6 +1376,26 @@ DWORD * GetNextTaskFromTask(DWORD *task) //----------------------------------------------------------- +int GetTaskTypeFromTask(DWORD *task) +{ + int i = 0; + + if(!task || *task < 0x800000 || *task > 0x900000) return 0; + + _asm pushad + _asm mov edx, task + _asm mov ebx, [edx] + _asm mov edx, [ebx+10h] + _asm mov ecx, task + _asm call edx + _asm mov i, eax + _asm popad + + return i; +} + +//----------------------------------------------------------- + BOOL __stdcall GameIsEntityOnScreen(DWORD * pdwEnt) { BOOL bResult = FALSE; diff --git a/saco/game/util.h b/saco/game/util.h index 31623c8..51fbb47 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -74,4 +74,5 @@ void RemoveColorEmbedsFromString(char *szString); UINT GetVehicleSubtypeFromVehiclePtr(VEHICLE_TYPE *pVehicle); DWORD * GetNextTaskFromTask(DWORD *task); +int GetTaskTypeFromTask(DWORD *task);