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 


Request - Binary Big Endian Custom Type

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Zephiles
Advanced Cheater
Reputation: 0

Joined: 04 Feb 2016
Posts: 56

PostPosted: Sun Mar 12, 2017 6:19 pm    Post subject: Request - Binary Big Endian Custom Type Reply with quote

I have several instances where I need to use the Binary custom type with multiple bytes in a row, but the Binary custom type seems to be handled as a Little Endian type, and therefore doesn't display the bits in the proper order. Can someone make a Big Endian custom type of this?
Back to top
View user's profile Send private message
FreeER
Expert Cheater
Reputation: 8

Joined: 09 Aug 2013
Posts: 196

PostPosted: Mon Mar 20, 2017 11:02 am    Post subject: Reply with quote

check out viewtopic.php?p=5305367 (I can't post links yet)
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 75

Joined: 29 Oct 2010
Posts: 3647

PostPosted: Mon Mar 20, 2017 11:21 am    Post subject: Reply with quote

If you stack the text, the link can be copy/pasted, as-is, for convenience:

http:
//forum.
cheatengine.
org/
viewtopic.php?p=5305367
Back to top
View user's profile Send private message
Zephiles
Advanced Cheater
Reputation: 0

Joined: 04 Feb 2016
Posts: 56

PostPosted: Wed Mar 22, 2017 6:50 pm    Post subject: Reply with quote

FreeER wrote:
check out viewtopic.php?p=5305367 (I can't post links yet)

That post does not help me with this, as I don't know how to write the code for it.
Back to top
View user's profile Send private message
FreeER
Expert Cheater
Reputation: 8

Joined: 09 Aug 2013
Posts: 196

PostPosted: Wed Mar 22, 2017 7:17 pm    Post subject: Reply with quote

It gives the scripts for 2 and 4 byte (1 byte is the same in both big and little), if you need something different then you need to actually say what you need other than just "Big Endian".

As far as I knew from what you posted, if they weren't enough then you had enough knowledge to take the scripts given and google how the instructions worked and what you'd need to do larger values. Since assuming that takes less work (and thus time I could spend on my kids, my friends, other people needing help, or simply hacking games) than me guessing at everything you might possibly be needing and doing all of them for you, that's all I gave you. It's really up to you to provide the information needed for people to help you get what you need, not us to play 20(0) questions to figure it out...
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 75

Joined: 29 Oct 2010
Posts: 3647

PostPosted: Wed Mar 22, 2017 7:46 pm    Post subject: Reply with quote

Very Happy
Back to top
View user's profile Send private message
Zephiles
Advanced Cheater
Reputation: 0

Joined: 04 Feb 2016
Posts: 56

PostPosted: Thu Mar 23, 2017 1:04 am    Post subject: Reply with quote

FreeER wrote:
It gives the scripts for 2 and 4 byte (1 byte is the same in both big and little), if you need something different then you need to actually say what you need other than just "Big Endian".

As far as I knew from what you posted, if they weren't enough then you had enough knowledge to take the scripts given and google how the instructions worked and what you'd need to do larger values. Since assuming that takes less work (and thus time I could spend on my kids, my friends, other people needing help, or simply hacking games) than me guessing at everything you might possibly be needing and doing all of them for you, that's all I gave you. It's really up to you to provide the information needed for people to help you get what you need, not us to play 20(0) questions to figure it out...

I clearly said that I need a custom type for Binary Big Endian. I don't see how this can possibly be made more clear. Linking me to the code for 2 Byte and 4 Byte Big Endian custom types doesn't help me with this, because the general coding for the Binary type is completely different.
Back to top
View user's profile Send private message
FreeER
Expert Cheater
Reputation: 8

Joined: 09 Aug 2013
Posts: 196

PostPosted: Thu Mar 23, 2017 5:14 am    Post subject: Reply with quote

Everything on a computer is binary... if you haven't learned that you might want to do some more research. CE showing it as hexadecimal, decimal, floating point, ASCII/Unicode, etc. is all just for convenience.

Big and Little Endian refer to the order of bytes in multi-byte values, Little Endian stores the least significant byte(s) first while Big Endian stores the most significant byte(s) first.

To copy an explanation I gave on reddit:

Quote:
If you had the value, say, 5461 which is 00010101 01010101 Big Endian says to store each byte exactly like that in memory with the 0001010 first followed by the 01010101 byte while Little Endian says to reverse the bytes and store 01010101 first followed by 00010101. The effect is that with Big Endian the most "significant" value is stored first while with Little Endian the "least" significant value is stored first and that with Little Endian you can easy read a value as 1 byte, 2 bytes, 4, 8, etc. simply by changing how many bytes in memory you choose to read while with Big Endian if you have 5461 stored as 2 bytes then you have 00010101 01010101 but if you have it stored as 4 bytes then you have 00000000 00000000 00010101 01010101, meaning to read it as 2 bytes you'd have to add 2 bytes to the address before you tried to read it with Little Endian the 4 byte version would be 01010101 00010101 00000000 00000000 so you don't have to add anything to read it as only 2 bytes (or 1, etc.).


If you wanted to represent it in hexadecimal, then 5461 is 0x15 55, which is how it'd be stored in Big Endian Format, the 0x15 byte first (0001 0101, 0x1 0x5) followed by the 0x55 byte (0101 0101, 0x5 0x5) while Little Endian would store the bytes in reverse with 0x55 (0101 0101, 0x5 0x5) first followed by 0x15 (0001 0101, 0x1 0x5).

^
https:
//reddit.
com/
r/
cheatengine/
comments/
5ztrw1/
cheat_engine_for_emulation/
df1h3dq/
?st=j0mapilh&
sh=807b0ec4


offtopic: is it just me or does this topic show clearly how unrelated number of posts is to how advanced of a cheater you are? Razz

edit (after DB/panraven): ah, I forgot CE had a actual binary scan (I never use it, but it's also not a custom AA/lua type), but even so big/little endian doesn't really apply to it unless you're still dealing with bytes and just want to represent them in binary for whatever reason... panraven's solution is essentially just doing a string reverse on the bits (so 1101 becomes 1011) which may be what's needed in this case but isn't related to big/little endian other than the fact that something is being reversed and it happens to be binary.


Last edited by FreeER on Thu Mar 23, 2017 7:08 am; edited 2 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 338

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

PostPosted: Thu Mar 23, 2017 6:36 am    Post subject: Reply with quote

That's currently not supported. Custom types only work on byte boundaries
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 25

Joined: 01 Oct 2008
Posts: 641

PostPosted: Thu Mar 23, 2017 6:47 am    Post subject: Reply with quote

May be a input helper?
Paste in a memory record AA script.
Code:

{$lua}

function bitReverse(bp)
  if type(bp)=='string' and bp:len()>0 and not bp:find"[^01]" then
    -- bit pattern in string, leading and trailing zeros is significant
    return bp:reverse()
  elseif type(bp)~='number' then -- error! but...
    return "**can't convert "..tostring(bp)
  else -- beware negative,
    local sum = 0
    while bp~=0 do
      sum,bp = sum*2 + (bAnd(bp,1)~=0 and 1 or 0), bShr(bp,1)
    end
    return sum
  end
end

if syntaxcheck then return end

local mf = GetMainForm()

local isBinary = mf.VarType.ItemIndex>=0 and
  mf.VarType.Items[mf.VarType.ItemIndex]=='Binary'

if not isBinary then showMessage"Not Binary scan type." end

local isBits = mf.rbBit.Checked or not mf.rbDec.Checked

local input = inputQuery(isBits and "B I T S" or "D E C I M A L",
  isBits and "Enter only 0/1 digits" or "enter a decimal Number or prefix '0x' for hex",
  '<value>')

local output = input and input:sub(1,1)=='*' and input or
  bitReverse(isBits and input or tonumber(input))

if output then mf.scanvalue.Text = output end

[ENABLE]

[DISABLE]


Not sure how to handle negative decimal, it will turn to a very big number (negative/positive depend on odd/even input) after my version of bit reversing.

bye~

_________________
- Retarded.
dropbox
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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