Coding

 Reply to this postStart new topic

The Memory Topic

Deji
post Dec 12 2009, 07:02 PM
Post #1


Coding like a Rockstar!

Group Icon

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



Double posting is allowed here as long as you are posting new tips (no useless spam) although it will be easier to simply edit your old post!


This topic is for everything memory related in coding. So it's for people who want to further advance in CLEO or make trainers for San Andreas.


Post any snippets of useful stuff here and ask/offer help ect. You can also show off any random work of arts that you've coded.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Dec 12 2009, 09:45 PM
Post #2


Coding like a Rockstar!

Group Icon

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



Cheats


A common wish for most people is the ability to code cheats in San Andreas. So I will show you the easiest ways to do it!

0x969110 is the start of a memory address pool that stores the last 30 pressed keys into the game memory. You can read these in order to tell if a player has typed cheats or simply a certain combination of keys.


Let's recreate the cheat "HESOYAM"

CODE
0A8D: 0@ = read_memory 0x969110 size 1 virtual_protect 0
0A8D: 1@ = read_memory 0x969111 size 2 virtual_protect 0
0A8D: 2@ = read_memory 0x969113 size 4 virtual_protect 0
if or
84A4:   not 2@ == 0x4845534F // Hex String 'HESO'
84A4:   not 1@ == 0x5941 // Hex String 'YA'
84A4:   not 0@ == 0x4D // Hex String 'M'
// hesoyam
else_jump @CHEATS_HEAL


We can only read 1, 2 or 4 of the last pressed keys at a time. So if we wanted to read all 30, we'd have to keep reading 4 until we get to 28, then read 2 or read 1 twice..

Each time we read 1, we have to increase the read_memory number by 1, otherwise we read the same key twice.


The if or conditions are there to make sure each of the keys have been pressed.

If the H, E, S, O, Y, A and M keys have been pressed (and pressed in the order of the descending variable number), then it will jump to :CHEATS_HEAL which will then heal the player.


Let's see an example with a 4-digit cheat.

CODE
0A8D: 2@ = read_memory 0x969116 size 4 virtual_protect 0
if or
84A4:   not 2@ == 0x424F4F4D // Hex String 'BOOM'
// boom
else_jump @CHEATS_BLOWUPSTUFF


Every 2 digits after the 0x is a different letter. Here, 42 = B. 4F = O and 4D = M.

You can get a full list of these in Sanny's help files (Help > Contents > CLEO 3 Code Library > Virtual key codes).</div>


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 11 2010, 10:37 PM
Post #3


Coding like a Rockstar!

Group Icon

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



Change Gravity


SANNY
0A8D: 0@ = read_memory 0x863984 size 4 virtual_protect 1


0x863984 is the address for the gravity in San Andreas. This is a float.


The default is: 0.008

You can change this to nearly anything. However, note that the gravity value is very sensitive, and so a small increase can change the gravity a lot. Have fun!
Go to the top of the page
 
+Quote Post
Deji
post Mar 7 2010, 11:34 PM
Post #4


Coding like a Rockstar!

Group Icon

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



Thanks to Seemann over in the Russian section of Sanny Builder for this.

SANNY
for 0@ = 354164 to 354188
&0(0@,1i) = 16843009
end


It edits the map and removes all the blue from covering the uncharted sections.

So basically, it makes the game think you've travelled everywhere in the game.


The map in this way is split into 24 sections. So this:

CODE
0@ = 354164
&0(0@,1i) = 16843009


Reveals the first strip (the top left corner) of the map.

The strips go down, so the next strip is below the first.

CODE
0@ = 354165
&0(0@,1i) = 16843009


The 16843009 value can be edited. If it is smaller, the strip is smaller. If larger, the strip is longer.

I'm not sure how that affects the rest of the edits though.


Again, thanks to Seemann for most of the work here.


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

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