Tutorials

 Reply to this postStart new topic

[CLEO|TuT] Cheat Pool, again

Silent
post Oct 18 2010, 08:41 PM
Post #1


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



Cheating - even easier way than old...?


Scripts activated by cheats are popular, but that all stuff confuses 90% of users (including me today smile.gif ). Thing that confuses them is 'WTF are that integers, how to change them to my cheat!?!?'.

For remember - old way used:

SANNY
0A8D: 0@ = read_memory 0x969110 size 4 virtual_protect 0
0A8D: 1@ = read_memory 0x969114 size 2 virtual_protect 0
if and  // KILLME
    0039:   0@ == 0x4C4C4D45    // LLME
    0039:   1@ == 0x4B49        // KI
then
    0A8C: write_memory 0x969110 size 4 value 0x0 virtual_protect 0  // Clear (part) of buffer to prevent cheat looping
    // KILLME typed, let's go!


Looks pretty confusing, isn't it? Integers, backwards, forwards, 1@, 0@, DAMN!

But now I've noticed that the same thing can be done way easier:

SANNY
0A8D: 0@ = read_memory 0x969110 size 4 virtual_protect 0
0A8D: 1@ = read_memory 0x969114 size 2 virtual_protect 0
if    // KILLME
    05AE:   0@s == "EMLLIK" // @s == 'short'
then
    0A8C: write_memory 0x969110 size 4 value 0x0 virtual_protect 0  // Clear (part) of buffer to prevent cheat looping
    // KILLME typed, let's go!


EMLLIK == KILLME backwards. Way easier wink.gif
To use that method you MUST use longstring (" "), even if 05AE is designed for short strings (' ').

Using strings you can check cheats that are 1, 2, 4, 5, 6, 8, 9, 10, 12... chars long.

So to check 2 chars cheat:

SANNY
0A8D: 0@ = read_memory 0x969110 size 2 virtual_protect 0
0006: 1@ = 0x0    // I think that is nessesary - 0@s == 0@ 1@, and 1@ can be used before, means that won't be empty
if    // HI
    05AE:   0@s == "IH" // @s == 'short'
then
    0A8C: write_memory 0x969110 size 2 value 0x0 virtual_protect 0
    // HI typed, let's go!


14 chars...
Here we'll need two 05AE, even if max longstring length is 15 + /0 - that opcode is designed for short strings (7 + /0). Then if chars is checked backwards, 2nd string will have the beginning of code, and 1st will have ending, so:

SANNY
0A8D: 0@ = read_memory 0x969110 size 4 virtual_protect 0
0A8D: 1@ = read_memory 0x969114 size 4 virtual_protect 0
0A8D: 2@ = read_memory 0x969118 size 4 virtual_protect 0
0A8D: 3@ = read_memory 0x96911C size 2 virtual_protect 0
if and  // THEBANANAPHONE
    05AE:   2@s == "NANABEHT" // @s == 'short'
    05AE:   0@s == "ENOPHA" // @s == 'short'
then
    // THEBANANAPHONE typed, let's go!
    0A8C: write_memory 0x969110 size 4 value 0x0 virtual_protect 0


Sadly we can't check 3,7 etc. long words, because we can't read just 3 bytes to variable, and reading 2 + 1 won't do the trick.

But...

...maybe...

...we can devil.gif

SANNY
0A8D: 0@ = read_memory 0x969110 size 1 virtual_protect 0
0006: 1@ = 0x0
if  // SUN
    05AE:   0@s == "N" // @s == 'short'
then
    0A8D: 0@ = read_memory 0x969111 size 2 virtual_protect 0    
    if
        05AE:   0@s == "US" // @s == 'short'
    then
        // SUN typed, let's go!
        0A8C: write_memory 0x969110 size 2 value 0x0 virtual_protect 0


The same with 7-chars word - 1 + 6 word checking.

Theoretically 3-word checking can be done in one check, but that would require var offset reading, and writing 3rd char to 3rd byte of 0@ etc. etc. etc. Too much work and too many bytes wasted down.gif

Maybe an aDMA version would be good too...? I'll try to do some later.

This post has been edited by Silent: Nov 7 2010, 07:36 PM
Go to the top of the page
 
+Quote Post
jayd00
post Nov 16 2010, 08:01 PM
Post #2


Ameteur Member

Posts: 42
From: Guatemala
Joined: 22-December 09



cool! but what about using arrays ??

I saw that Deji use arrays in some scripts, and he added something like:

CODE
:Begin
0006: 30@ = -229908
0006: 31@ = -229907
wait 1000

:FireBall
wait 150
if and
    0038: &0(30@,1i) == 0x42414C4C
    0038: &0(31@,1i) == 0x46495245
else_jump @FireBall
03E5: show_text_box "CHEAT1"
0004: &0(30@,1i) = 0x00414C4C

:FireLit
wait 0
if or
    8038: not &0(30@,1i) == 0x42414C4C
    8038: not &0(31@,1i) == 0x46495245
else_jump @End
jump @FireBall

:End
0004: &0(30@,1i) = 0x00414C4C
03E5: show_text_box "CHEAT8"


can you explain it?? how can I use arrays for my own cheats?

and which is the best way to make a cheat?


thanks!



--------------------


Go to the top of the page
 
+Quote Post
Silent
post Nov 16 2010, 08:44 PM
Post #3


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



You can use aDMA in similar way to this, but you can check only 4-8-12-16 etc. chars long codes.

Here's an example:

SANNY

:Begin
0006: 30@ = -229907

:FireBall
wait 250
if
    05AE:   &0(30@,1s) == "OHAI" // @s == 'short'
then
    // OHAI typed!
    03E5: show_text_box "CHEAT1"
    0004: &0(30@,1i) = 0x0
Go to the top of the page
 
+Quote Post
jayd00
post Nov 16 2010, 09:47 PM
Post #4


Ameteur Member

Posts: 42
From: Guatemala
Joined: 22-December 09



CODE
0006: 30@ = -229907

what is this number mean?


mm... and what about a 6 char long word?


CODE
0004: &0(30@,1i) = 0x0

this part is to prevent cheat looping, right?


--------------------


Go to the top of the page
 
+Quote Post
Deji
post Nov 16 2010, 10:33 PM
Post #5


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Yes. By resetting the cheat, it prevents the cheat still being active the next time we check.

CLEO 4 opcode:
SANNY
0ADC:   test_cheat "BLOWUP"


Does all the checking and resetting automatically anyway... why not use that for starters?

SANNY
0006: 30@ = -229907

The value assigned is a direct offset to the start of the cheat pool when used in an array.

You can read this topic to understand more about it. There are a few topics on GTAForums that go over this too, but I'm not sure where about. They can help you to understand why this method was originally used and such, though.


--------------------
Go to the top of the page
 
+Quote Post
jayd00
post Nov 17 2010, 04:11 AM
Post #6


Ameteur Member

Posts: 42
From: Guatemala
Joined: 22-December 09



thnks for the page! I can understand now!..

answering your question; I only want to learn different ways to make cheats...

and I make that question because I already did one using arrays but I didn't understand it very well...

and you did the same but with less lines xD

here is my code


CODE
{$CLEO .cs}
0000:

:start
while true
     if and
        0256:   player $PLAYER_CHAR defined
        044B:   actor $PLAYER_ACTOR on_foot
     then
        30@ = -229907
        008B: 30@ = &0(30@,1i) // (int)
        0085: 31@ = 30@ // (int)
        31@ /= 65536
        31@ *= 65536
        0062: 30@ -= 31@ // (int)
        
        if
           30@ == 20033
        else_jump @start
            30@ = -229908

            if
                &0(30@,1i) == 0x5255544F
            then
                &0(30@,1i) = 0x52555400
            end // if
     end // if
end // while


This post has been edited by jayd00: Nov 18 2010, 03:57 AM


--------------------


Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

6 User(s) are reading this topic (6 Guests and 0 Anonymous Users)
0 Members: