Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Having trouble doing a binary read/write on python

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
bernardomassruha
How do I cheat?
Reputation: 0

Joined: 29 Jun 2022
Posts: 1

PostPosted: Wed Jun 29, 2022 1:43 am    Post subject: Having trouble doing a binary read/write on python Reply with quote

So this is probably not the place to ask since it isnt a CE issue, i just want to recreate this in python and i have no idea how to where to start / where to go, i want to read/write binarys that have startBit and length. im using pymeow btw[/img]


Screenshot 2022-06-29 044242.png
 Description:
 Filesize:  3.84 KB
 Viewed:  2041 Time(s)

Screenshot 2022-06-29 044242.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 440

Joined: 09 May 2003
Posts: 24390
Location: The netherlands

PostPosted: Wed Jun 29, 2022 2:19 am    Post subject: Reply with quote

I'm don't know python or the library you use, but first read the byte at the address
then "SHIFT RIGHT" 2 bits and then "AND" it with 1111b (0xf)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
bernardomassruha
How do I cheat?
Reputation: 0

Joined: 29 Jun 2022
Posts: 1

PostPosted: Thu Jun 30, 2022 1:13 am    Post subject: Reply with quote

Dark Byte wrote:
I'm don't know python or the library you use, but first read the byte at the address
then "SHIFT RIGHT" 2 bits and then "AND" it with 1111b (0xf)



It worked, thank you. but what about binarys that use different "lengths" and "startbits" ?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 440

Joined: 09 May 2003
Posts: 24390
Location: The netherlands

PostPosted: Thu Jun 30, 2022 1:36 am    Post subject: Reply with quote

first shift right by 'startbit'

and then AND it with a mask that holds 'length' bits

formula to get a mask from bitcount: (1 shift left bitlength)-1
1=1
2=3
3=7
4=15
...

And you may have to use 2 byte or bigger values

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites