QuestionHelpConvert to 8 bits ( 1 byte )

Posts 1–9 of 9 · Page 1 of 1
Convert to 8 bits ( 1 byte )
Hello every one

i know that

Int16 = 2 bytes
Int32 and int = 4 bytes
Int64 = 8 bytes

just one question how to convert to 1 byte as cheat engine does

i have this code to convert number to float,double and 2 bytes

Dim Mynumber As Long = TextBox1.Text

Dim MynumberAsByte As Byte() = BitConverter.GetBytes(Mynumber)

Label4.Text = BitConverter.ToSingle(MynumberAsByte , 0)
Label5.Text = BitConverter.ToDouble(MynumberAsByte , 0)
Label15.Text = BitConverter.ToUInt16(MynumberAsByte , 0)
Label16.Text = ...........................................

i hope someone reply to me soon with code that does it
Int32 byteValue = Convert.ToInt32(myNumberAsByte[0]);
Quote Originally Posted by Hell_Demon View Post
Int32 byteValue = Convert.ToInt32(myNumberAsByte[0]);
it is working thanks

what about convert to 8 bytes i tried this

'Convert to 8 bytes
Label8.Text = BitConverter.ToInt64(MynumberAsByte, 0)

it is not giving same result as cheat engine
Quote Originally Posted by Ell0ll View Post
it is working thanks

what about convert to 8 bytes i tried this

'Convert to 8 bytes
Label8.Text = BitConverter.ToInt64(MynumberAsByte, 0)

it is not giving same result as cheat engine
What does Cheat Engine display, versus what yours displays(and your source data)
Quote Originally Posted by Hell_Demon View Post
What does Cheat Engine display, versus what yours displays(and your source data)
i am searching for unknown value 8 bytes i get some addresses one address has this value >> 2611954354944
when i use this address and change type from 8 bytes to 4 bytes the value also changes to >> 614238976

so 8 bytes >>> 2611954354944 = 4 bytes 614238976

but when i put this value ( 614238976 ) in my program to convert it to 8 bytes

it is not giving same result ( 2611954354944 )

it is giving me ( 614238976 )

i hope now you understand me and tell me what is my problem

Edit : here is my code

Dim Mynumber As Long = TextBox1.Text

Dim MynumberAsByte As Byte() = BitConverter.GetBytes(Mynumber)

'Convert to 8 bytes
Label8.Text = BitConverter.ToInt64(MynumberAsByte, 0)
No one knows what is the problem ?
2611954354944 in hex is 00000260 249C8B00, which is 8 bytes
614238976 in hex is 249C8B00, which is 4 bytes

If you interpret 614238976 as 8 bytes you'll end up with 00000000 249C8B00, which as you can see has the first 4 bytes as 0. The value won't change.

You'll have to use the full 8 byte to get the correct value, so input 2611954354944
Quote Originally Posted by Hell_Demon View Post
2611954354944 in hex is 00000260 249C8B00, which is 8 bytes
614238976 in hex is 249C8B00, which is 4 bytes

If you interpret 614238976 as 8 bytes you'll end up with 00000000 249C8B00, which as you can see has the first 4 bytes as 0. The value won't change.

You'll have to use the full 8 byte to get the correct value, so input 2611954354944
You do not understand me so i created simple project to make it clear for you

Just download and test it

In button2 convert 8 bytes to 4 bytes >>> it is working

In button1 i want to invert the convert 4 bytes (614238976) > gives me 8 bytes (2611954354944) >>> that is not working
The attachment is broken, but that is what I'm saying. You can't convert 614238976(0x249C8B00) into 2611954354944(0x260249C8B00) because you're missing information(the part in bold).
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Need help?