Szhlopp Posted November 5, 2008 Posted November 5, 2008 (edited) I found my address and it's global offsets. However, CheatEngine is telling me that "4294964117 = -3179". If I am to program what I want I need to know how to convert that large number into the negative number I need. It's for a coordinate system. I enter -3179 in the 4byte search and it comes back with "4294964117" everytime. I know for sure I have the right address. And it works great when the number is positive. But as soon as it goes negative I have no idea anymore on how to convert it Thanks! Szhlopp Edited November 5, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+'
ProgAndy Posted November 5, 2008 Posted November 5, 2008 (edited) $Number = 4294964117 $int = DllStructCreate("int") $uint = DllStructCreate("uint") DllStructSetData($int,1,$Number) DllStructSetData($uint,1,$Number) MsgBox(0, $Number, "Int:" & DllStructGetData($int,1) & @CRLF & "uInt:" & DllStructGetData($uint,1)) or native AutoIt Code expandcollapse popup; http://support.microsoft.com/kb/189323 ; Gibt Die Zahl mit Vorzeichen zurück. ; Bei Fehler ( kleiner 0 oder größer MAXINT_4) wird der übergebene Wert zurückgegeben und @error auf 1 gesetzt. ; in AutoIt this is long, int and uint,ulong,dword Func UnsignedToLong($Value) Local Const $OFFSET_4 = 4294967296 Local Const $MAXINT_4 = 2147483647 If $Value < 0 Or $Value >= $OFFSET_4 Then Return SetError(1,0,$Value) ;' Overflow If $Value <= $MAXINT_4 Then Return $Value Else Return $Value - $OFFSET_4 EndIf EndFunc ; in AutoIt this is long, int and uint,ulong,dword Func LongToUnsigned($Value) Local Const $OFFSET_4 = 4294967296 If $Value < 0 Then Return $Value + $OFFSET_4 Else Return $Value EndIf EndFunc ; in AutoIt this is Short and UShort Func UnsignedToInteger($Value) Local Const $OFFSET_2 = 65536 Local Const $MAXINT_2 = 32767 If $Value < 0 Or $Value >= $OFFSET_2 Then Return SetError(1,0,$Value) ;' Overflow If $Value <= $MAXINT_2 Then Return $Value Else Return $Value - $OFFSET_2 EndIf EndFunc ; in AutoIt this is Short and UShort Func IntegerToUnsigned($Value) Local Const $OFFSET_2 = 65536 If $Value < 0 Then Return $Value + $OFFSET_2 Else Return $Value EndIf EndFunc Edited November 5, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Szhlopp Posted November 5, 2008 Author Posted November 5, 2008 $Number = 4294964117 $int = DllStructCreate("int") $uint = DllStructCreate("uint") DllStructSetData($int,1,$Number) DllStructSetData($uint,1,$Number) MsgBox(0, $Number, "Int:" & DllStructGetData($int,1) & @CRLF & "uInt:" & DllStructGetData($uint,1)) or native AutoIt Code expandcollapse popup; http://support.microsoft.com/kb/189323 ; Gibt Die Zahl mit Vorzeichen zurück. ; Bei Fehler ( kleiner 0 oder größer MAXINT_4) wird der übergebene Wert zurückgegeben und @error auf 1 gesetzt. ; in AutoIt this is long, int and uint,ulong,dword Func UnsignedToLong($Value) Local Const $OFFSET_4 = 4294967296 Local Const $MAXINT_4 = 2147483647 If $Value < 0 Or $Value >= $OFFSET_4 Then Return SetError(1,0,$Value) ;' Overflow If $Value <= $MAXINT_4 Then Return $Value Else Return $Value - $OFFSET_4 EndIf EndFunc ; in AutoIt this is long, int and uint,ulong,dword Func LongToUnsigned($Value) Local Const $OFFSET_4 = 4294967296 If $Value < 0 Then Return $Value + $OFFSET_4 Else Return $Value EndIf EndFunc ; in AutoIt this is Short and UShort Func UnsignedToInteger($Value) Local Const $OFFSET_2 = 65536 Local Const $MAXINT_2 = 32767 If $Value < 0 Or $Value >= $OFFSET_2 Then Return SetError(1,0,$Value) ;' Overflow If $Value <= $MAXINT_2 Then Return $Value Else Return $Value - $OFFSET_2 EndIf EndFunc ; in AutoIt this is Short and UShort Func IntegerToUnsigned($Value) Local Const $OFFSET_2 = 65536 If $Value < 0 Then Return $Value + $OFFSET_2 Else Return $Value EndIf EndFunc Thanks! RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+'
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now