[1298] Negative max weight workaround
This is not a complete fix, it's a workaround so that you can't get negative max weight.The problem when you get negative max weight is that the variable can at most hold the number 32767 (7FFF in hex) before going negative.
What this patch does is to check if the max weight is above 32767 and if that's the case it will set the variable to the maximum number it can hold.
This is the original code we will patch over:004A0F0CCMP DWORD PTR SS:,0
004A0F10MOV WORD PTR DS:,AXWith this jump to the codecave:004A0F0CJMP 004A17F4Codecave:004A17F4PUSHAD
004A17F5CMP AX,7FFF
004A17F9JB SHORT 004A17FF
004A17FBMOV AX,7FFF
004A17FFMOV WORD PTR DS:,AX
004A1806POPAD
004A1807MOV AX,WORD PTR DS:
004A180ECMP DWORD PTR SS:,0
004A1812JNZ 004A0F8F
004A1818JMP 004A0F19Edit: This patch is for ebenezer.
页:
[1]