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 


Feature Suggestion - Custom type(lua) base type tuples

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

Joined: 03 Oct 2015
Posts: 3

PostPosted: Sat Oct 03, 2015 3:02 pm    Post subject: Feature Suggestion - Custom type(lua) base type tuples Reply with quote

situation:
right now i'm trying to display some kind of cryptically stored value as 2 different ones:
1 integer containing 2 numbers, each 5 bit long (it's the 256*256 position of a small dungeon game)

prologue:
thus i tried to make a custom data type (lua) that returns only the upper postion and one that only returns the lower position.
I chose them as types but when i wanted to write the set function... well you see, i can't set the value right (without doing a full value read) when splitting them up.

Next i wanted to return a tuple as custom type -> saw you only accept int as return (as stated here (a)) -> what brings me to my feature suggestion/request

suggestion/request:
why don't you accept tuples of all the base types (that are predefined for search) (even mixed) and the special case of a single type would be a tuple of length one
in that case you could return all those base types not just integer and to be honest there are a lot of types that have no good integer representation (for example a java string which isn't equivalent to a c string as you all know)

Regarding the tuple implementation in the address table: what about splitting them up to different editing fields within one custom value type (that easens it a lot to distinct the elements independently of the actual type of each tuple element and thus makes it easier to pass the tuple back to lua in order to convert it back to bytes)

Even here in forum already are a few problems that only partially work if customtype lua allows only int as return, here 2 that i found while looking for solutions to my current problems:
(b) 32-bit pointer from a 64-bit process (p.s. this is only helpful if you don't want to use the structure dissect...)
(c) Custom Float Type (Lua Script) (btw. here Float was returned?!? -> in conflict to the specs/api (a))

ending:
rapus

used links:
(a) wiki.cheatengine.org/index.php?title=registerCustomTypeLua
(b) forum.cheatengine.org/viewtopic.php?t=576341
(c) forum.cheatengine.org/viewtopic.php?t=582513

p.s. sorry for being that informal.. it's just that i don't think you care about all that fancying stuff that only some kind of hides the important facts Smile
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Oct 03, 2015 4:15 pm    Post subject: Reply with quote

Well once you have the address, you can set the entry's type to binary with a length of 5.
Then create a second entry with the same address and have it start at bit 5.
Not sure if there's an easier way to scan specific bits without creating a custom type.
Back to top
View user's profile Send private message
rapus
How do I cheat?
Reputation: 0

Joined: 03 Oct 2015
Posts: 3

PostPosted: Sat Oct 03, 2015 4:18 pm    Post subject: Reply with quote

Well thanks... that clearly solves my local problem if i don't want to use the structure dissect tool... because there is no binary in the structure dissect tool :/

But are you planning to build a global solution? Very Happy in other words to follow that suggestion/request? Smile (especially that works everywhere -> cheat table, structure dissect etc pp)

What about making all types available everywhere? kind of using the same "domain" that "provides" the types

and if you use such a "domain" you can even define it recursive what means that you can use already existing custom types for the tuples Smile
if that's too complicated then seperate base custom types which just have a custom length etc and can be considered as base type since they could be represented as number from complex types which in fact are tuples of/a mix of base types but which can't be used as part of other complex types since we don't necessarily wanna reproduce a whole oop environment Very Happy
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Oct 03, 2015 7:03 pm    Post subject: Reply with quote

check http://forum.cheatengine.org/viewtopic.php?t=529904
it's a custom type that starts at bit 3 of the address it's reading from

custom types work on a per address basis. One address, one value
if you wish multiple values at the same address, you have to use mulijple custom types.
The one value per address is the basis of cheat engine.
only one small part that deviates from this (and is a huge eyesore in ce's sourcecode) is tbe binary type in the memoryscanner and addresslist. Only those two parts have completely seperate logic for the binary type

what this means is that support for custom types with a basis on binary isn't going to happen any time soon

if you mean the other types like string it may be possible in the future, but the custom type will then be responsible for parsing and interpreting the string fir every address. Especialky in lua this can be slow

_________________
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
rapus
How do I cheat?
Reputation: 0

Joined: 03 Oct 2015
Posts: 3

PostPosted: Sun Oct 04, 2015 3:59 am    Post subject: Reply with quote

the more i think about my suggestion the more i see that it's rather a custom interpretation than a custom type means that for searching it should be interpreted as array of bytes (of the given length specified in the lua code) what actually means when one searches for such a custom "interpretation" cheat engine translates that custom value to a byte array using the lua method then doing a search for array of bytes and once it found values everything goes vice versa means using that array of bytes putting it into the lua method and outputting the result of the method as tuple as recommended above

this would mean there in fact is __NO__ change to the search algorithm etc it just is an additional step that can be done in a simple if like "if is custom type... convert to byte array -> search byte array... results-> convert to custom->output" which in case of the "normal types" will just be skipped..
if you tell me in what class of the cheatengine structure on github i have to search for such stuff i consider trying to implement it myself and trying to merge it via pull request

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

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

PostPosted: Sun Oct 04, 2015 4:32 am    Post subject: Reply with quote

yes, but that's already how it is. The custom type gets an array of byte.
The type can then translate it to a integer or float for user convenience but internally it's just an array of bytes.

That's why string support may be added, but it will involve the custom type having to deal with the parsing and generating of the string on the user's side (and will be limited to exact value scans only)

But also, to point out the tuple thing.
You have a 2 byte value, bit 0-4 is value 1 , 5-9 is value 2
The memory scanner will get to the address of the 2 byte value, it passes the array of byte to the custom type, and the custom type returns one value depending on how it's coded. (It can't return both values)



here is the customtype handler:
https://github.com/cheat-engine/cheat-engine/blob/master/Cheat%20Engine/CustomTypeHandler.pas
It basically gets fed an array of byte and the custom type implementation then converts it (from bytes to an userinterface value, and from an userinterface value to bytes , if applicable)

_________________
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 -> 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