Tutorials

 Reply to this postStart new topic

[CLEO|Tut] Changing Memory Without CLEO

Deji
post Jun 5 2010, 10:47 PM
Post #1


Coding like a Rockstar!

Group Icon

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



Changing Memory Without CLEO



There is indeed a way to read/write memory without the use of the CLEO read_memory or write_memory opcodes.

However, not all memory supports this method.


Step 1


Get any memory address. Let's use the cash address: 0xB7CE50


Step 2

Using Windows calculator (or within the code itself), take 0xA49960 from the address. This is the address of the beginning of the SCM block.

CODE
0xB7CE50 - 0xA49960 = 0x1334F0


For gta_sa.exe version 1.1, use 0xA4BFE0.


Step 3


Divide the result by 4 (variable size).

CODE
0x1334F0 / 4 = 0x4CD3C


So now 0x4CD3C is the address we use for controlling the players cash. However, this value needs to be turned into a decimal, for one:

Ctrl+H in Sanny Builder

CODE
314684


And turn it to a negative.

CODE
-314684



Step 4


Store -314684 into a variable and then use it in an array like the one below.

In the example, the players cash is set to $1337

SANNY
0@ = -314684
&0(0@,1i) = 1337


To increase it by $1000...

SANNY
0@ = -314684
000A: &0(0@,1i) += 1000



Simple. Now you can do some editing of memoy within a main.scm without CLEO. Dunno why you'd want to, these days.. but there are some advanced techniques this can go towards using.


--------------------
Go to the top of the page
 
+Quote Post
glairhemma
post Sep 16 2013, 10:37 AM
Post #2


The New Guy!

Posts: 2
Joined: 15-September 13



Where should I place these codes?
Go to the top of the page
 
+Quote Post
Deji
post Sep 16 2013, 10:48 AM
Post #3


Coding like a Rockstar!

Group Icon

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



Anywhere. Adjust the variables as needed. You could just make SCM functions which sort out all the tricky bits for you, e.g:
:my_code
CALL @WriteMemory 0xB7CE50 99999999
TERMINATE_THIS_CUSTOM_SCRIPT

:GetMemoryLocalPtr{\_[ptr]__(dwAddress)_}
0@ -= 0xA49960
0@ /= -4  // turns negative and divides by 4
RET 1 0@

:WriteMemory{\_[void]__(dwAddress,_dwValue)_}
CALL @GetMemoryLocalPtr 1 0@ 0@
&0(0@,1i) = 1@
RET 0

:ReadMemory{\_[dwValue]__(dwAddress)_}
CALL @GetMemoryLocalPtr 1 0@ 0@
RET 1 &0(0@,1i)


This is written in "SCR for SB" style. Remember that this method of accessing memory only works for DWORD's (4 byte integers).


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

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