Jump to content

Memory Example


Recommended Posts

I've seen alot of posts lately about how the memory functions work. I personally had no idea, so I thought I'd learn...

CheatEngine <--- Site you use to get Cheat Engine 5.4

This program allows you to grab the 'Memory Address' you use in NomadMemory.

I'm on Vista, so hopefully this works for XP as well ;)

1) Start up 'CheatEngine.exe'

2) Go through tutorials (if you havn't already) Tutorials

3) Learn how pointers work

4) Make sure you know how multi-pointers work. Tutorial 8

5) Find the level-2 pointer for the 'Score' value. (The last value, it's green...)

Picture of the last pointer value for the score:

NOTE: Yours WILL be different!

Open up "Solitaire"

Open up my script and run it.

In the pointer value input box, put "0x" and the lvl-2 pointer. (Ex: 0x00EB2848)

It should automatically update the label with the current score.

Set a value in the second input box and click the "Set Score" button.

Here is the code you use for this example. I suggest studying how this works so you can use it for any program you like :D

#include <NomadMemory.au3>
#include <GUIConstants.au3>
SetPrivilege("SeDebugPrivilege", 1)
;
$pid = WinGetProcess("Solitaire")
Global $Pointer_2
$Offset1 = "44"
$Offset2 = "16"
$startvalue = "0x00EB2848"

$Form1 = GUICreate("Solitaire Score Hacker", 314, 130, 193, 125)
$Input1 = GUICtrlCreateInput("", 131, 12, 130, 21)
$Label1 = GUICtrlCreateLabel("Pointer2(0x********)", 34, 13, 92, 17)

$Input2 = GUICtrlCreateInput("", 131, 42, 130, 21)
$Label2 = GUICtrlCreateLabel("Score to set", 63, 44, 60, 17)

$Button1 = GUICtrlCreateButton("Set Score", 20, 92, 99, 33, 0)
$Button2 = GUICtrlCreateButton("UpdateMemory", 190, 92, 99, 33, 0)
$Label3 = GUICtrlCreateLabel("Label3", 138, 101, 36, 17)
GUISetState(@SW_SHOW)

AdlibEnable("updatememory", 500)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button2
            UpdateMemory()
            
        Case $Button1
            MemoryWrite()
        
    EndSwitch
WEnd


Func UpdateMemory()
$startvalue = GUICtrlRead($Input1)

$openmem = _MemoryOpen($pid)

$Value = _MemoryRead($startvalue, $openmem)
If @Error Then
    MsgBox(4096, "ERROR", "Failed to read memory.")
    Exit
EndIf

$Pointer_1 = "0x" & hex($Value + $Offset1)
$Value = _MemoryRead($Pointer_1, $openmem) 

$Pointer_2 = '0x' & hex($Value + $Offset2) 
$Value = _MemoryRead($Pointer_2, $openmem)
    


_MemoryClose($openmem)
GUICtrlSetData($Label3, $Value)

EndFunc

Func MemoryWrite()
    
    $openmem = _MemoryOpen($pid)
    _MemoryWrite($Pointer_2, $openmem, GUICtrlRead($Input2))
    _MemoryClose($openmem)
    
    
EndFunc

Enjoy! Hope this helps you with Memory functions!

Szh

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...