Skip to content

Fundamentals of Memory Editing

Fexty edited this page Dec 27, 2021 · 5 revisions

Memory Editing

This guide will give you an introduction to in-memory mod making.

Table of contents

What is memory editing?

Memory editing is the process of modifying parts of the game while it is running, i.e. in memory. This allows you to make dynamic changes to the game's state and modify things that may not be editable in files. With some effort, it also allows you to add your own logic to certain game functions.

However memory editing should not be treated as a blanket replacement for editing files.

As a rule of thumb: If it can be edited via files, do it via files.

Things usually get a lot more complex and finnicky once they get loaded into memory, so don't make your life harder than it needs to be.

It is recommended that you have at least a little bit of low-level programming experience. I.e. C or C++. I will be explaining things as I go, but having some knowledge on the subject will make it easier to understand.

Approaches

There are multiple different ways of going about making memory edits. In general, we differentiate between 3 distinct approaches. All of these can of course be mixed and matched as needed.

  1. Following and reading from/writing to pointers
  2. Directly modifying assembly instructions
  3. Hooking functions

These are in order from easiest to hardest. Keep in mind that using them is not the hard part, understanding how they work is. But do not worry, all three approaches will be covered in this guide.

Pointers

The most straight forward method of making memory edits is by using pointers. Most simple cheats operate using this approach to change simple values such as zenny, item count, damage, etc.

If you do not know what a pointer is I highly recommend reading up on it as you will be hearing this word a lot in this guide.

Here is a Wikipedia article to get started.

If you know what a pointer is it should already be pretty apparent what this approach aims to do. We get a persistent pointer to a certain value in memory which we wish to modify. That pointer may or may not be multiple levels deep.

To elaborate, a multilevel pointer is a pointer which you may need to dereference multiple times, possibly adding additional offsets between each step.

Get Started

Assembly

The assembly modification approach is a bit more technical than the pointer one. In this approach we replace certain assembly instructions with our own to influence control flow or game state.

These edits are usually pretty simple, just replacing a few instructions.

For example we modify a write operation to always write a certain value. This could be used to lock your stamina at 100% at all times, just to give an example.

You should know at least a little bit about x86_64 assembly to follow this guide, but you can also just look up instructions as you go. If you do not know what assembly is at all, I don't recommend following this guide just yet.

I will be explaining some common instructions in the guide as we go.

Get Started

Hooking

Hooking functions is the most "difficult" approach of the three. Understanding it requires some more indepth knowledge about assembly.

Hooking a function is the process of detouring control flow to your own code and then back to the games code. This allows you to make more elaborate changes compared to direct asm modification.

You can do more advanced changes such as modifying function parameters, doing comparisons, completely rewriting certain functions, etc.

If you don't know basic assembly I highly recommend checking out one of the other two guides instead.

Get Started

External vs. Internal

There are 2 primary methods of accessing program memory.

The first is by creating an exe, which will access the games memory externally, the other is by injecting a dll (i.e. plugin) into the game and accessing program memory internally.

Both approaches are equally viable but one may be more useful than the other for specific purposes. Here are some points of reference:

External

Pros:

  • Straight forward, easy to get started with
  • Ability to add a GUI/CLI to your mod

Cons:

  • Slower, due to WinAPI
  • More easily detected
  • Has to be manually started upon game launch

Internal

Pros:

  • Fast
  • Is auto-loaded upon game launch (plugin)
  • Harder to detect

Cons:

  • Annoying to add a GUI/CLI
  • Harder to debug

General Tutorials

General Tutorials

Animation Tutorials

Animation Tutorials

Audio Tutorials:

Audio Tutorials

IDs:

File & In Game IDs

Model Tutorials:

Model Tutorials

Effects Tutorials:

EFX Tutorials

FSM Tutorials

FSM Editing

MRL3 Tutorials:

MRL3 Tutorials

NPC Editing:

NPC Editing

Map Editing:

Map Editing

Plugins and Memory Editing:

Plugins and Memory Editing

Quest Editing:

Quest Editing

Monster AI Editing:

Monster AI Editing

Texture Tutorials:

General Texture Tutorials
Specific Texture Tutorials

TIML Editing

TIML Editing

Asterisk's Plugin Notes:

Asterisk's Plugin Notes

Miscellaneous Tutorials:

Miscellaneous Tutorials

Outdated Tutorials:

Outdated Tutorials
Clone this wiki locally