本帖最后由 xuson 于 2020-7-30 19:34 编辑
由于游戏版本不同导致基址不一,我已经找其它版本的基址信息,现在想多版本支持,却不知道怎么动态修改下面那些红色标记的常量
024329CCh
02F53190h
01EBA270h
01E8708Ch
01DB96E0h
01D40B50h
01DB96E0h
[C++] 纯文本查看 复制代码 //===================================================================================================
NAKED void EV_SetTraceHull(int hull)
{
__asm
{
MOV ECX,DWORD PTR DS:[024329CCh] ; hl.02D5FE20
MOV EAX,DWORD PTR SS:[ESP+04h]
MOV DWORD PTR DS:[ECX+0BCh],EAX
RETN
}
}
//===================================================================================================
NAKED model_s* GetModelByIndex(int index)
{
__asm
{
SUB ESP,10h
PUSH ESI
PUSH EDI
MOV EDI,DWORD PTR SS:[ESP+1Ch]
MOV ESI,DWORD PTR DS:[EDI*04h+02F53190h]
TEST ESI,ESI
JNZ label_01
POP EDI
XOR EAX,EAX
POP ESI
ADD ESP,10h
RETN
label_01:
MOV EAX,DWORD PTR DS:[ESI+40h]
CMP EAX,01h
JE label_02
CMP EAX,02h
JNZ label_03
label_02:
FLD DWORD PTR DS:[01EBA270h]
FCOMP DWORD PTR DS:[01E8708Ch]
FSTSW AX
TEST AH,44h
JPO label_04
MOV EAX,01DB96E0h
CALL EAX
FSTP QWORD PTR SS:[ESP+10h]
PUSH 00h
PUSH 00h
PUSH ESI
MOV EAX,01D40B50h
CALL EAX
MOV EAX,01DB96E0h
CALL EAX
FSTP QWORD PTR SS:[ESP+14h]
FLD QWORD PTR SS:[ESP+14h]
FSUB QWORD PTR SS:[ESP+1Ch]
ADD ESP,04h
FSTP DWORD PTR SS:[ESP+24h]
FLD DWORD PTR SS:[ESP+24h]
FSTP QWORD PTR SS:[ESP]
PUSH ESI
PUSH 01EBC26Ch ; ASCII "fs_precache_timings: loaded model %s in time %.3f sec"
MOV EAX,01D2F960h
CALL EAX
MOV EAX,DWORD PTR DS:[EDI*04h+02F53190h]
ADD ESP,10h
POP EDI
POP ESI
ADD ESP,10h
RETN
label_04:
PUSH 00h
PUSH 00h
PUSH ESI
MOV EAX,01D40B50h
CALL EAX
ADD ESP,0Ch
label_03:
MOV EAX,DWORD PTR DS:[EDI*04h+02F53190h]
POP EDI
POP ESI
ADD ESP,10h
RETN
}
} |