Forged
Premium Member
For all your curious kids out their this is how you make a maphack.
___________________________________________________
Hi there.... I've been working on a map hack for Age of Wonders 2 which I'm
gonna write some about. If you aren't too experienced with SoftIce and assembler
yet, I would recommend you to work on other kind of options first though(and
practicing SoftIce/assembler)... other than that, there's also gonna be a little
C++ and DirectX... but I'll just tell you what you have to know about that...
Another thing is that you have to run SoftIce in universal mode to make this
work. If SoftIce is running it's own full screen, the game won't be repainting
SoftIce which we need to happen to track down the game's drawing routines.
Well... you can track it down in other ways as well, but this is much faster and
easier so I won't bother with anything else.
If you're not running SoftIce in universal mode... just open up the video
setup/settings and hit the Universal Mode checkbox... now restart the computer.
So, that's it, time to start
Finding the game's drawing-routine
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The first thing we'll have to do to make this work is to find the routine that
updates the screen... and by that, I mean a call which puts a whole new frame
onto the screen. (the game does this all the time... all games do...)
Start off by entering SoftIce. Right below the code window, you'll see something
like AoW2!CODE+some_number if SoftIce popped up while aow2's code was executing.
If it says something else, you'll have to close and reopen SoftIce until you're
in aow2.
Now that you're there.... this is when you need SoftIce knowledge/experience.
You have to be good at crawling around loops and functions, because that is what
you have to do now. You're gonna step out of loops and functions and execute
loops of code and just any code until SoftIce looks weird, because SoftIce will
look weird once the game updates the screen. Your aim is to get out of as many
loops and functions as possible.... the more functions you return from, the more
likely you are to run across the drawing-routine. This is something that you
HAVE to do on your own... you can appear just anywhere inside the code with
SoftIce, and there's no way I could cover all of it. Just keep in mind to check
that you're inside aow2's code, it has to say AoW2!CODE+some_number below the
code window, otherwise you're gonna have to try closing/opening SoftIce again.
In case you're curious as to what it looks like when you run across this screen
update, put a breakpoint at 4F4A9B, and then hit F10 when SoftIce breaks. This
is what it looks like and this is what you're looking for...
Once you do come across the update.... typing rs in SoftIce and hitting enter
twice will clear it up for you. rs is a command used to hide SoftIce, so that
you can see what is behind it, and it then waits for a key to be hit before it
returns... and once it returns, you'll have a new and fresh view of SoftIce.
If you have trouble getting to this call that paints the screen.... a tip is
that hitting F12 in SoftIce will bring you right below the call which executed
the function you were currently in... I'll show an example, suppose this is the
scenario:
...
push ecx
push eax
call 4785a1
mov ecx, eax
xor ebx, ebx
...
4785a1:
...
mov edx, [edx]
add ecx, edx <----- This is where SoftIce popped up
sub bl, 12
...
ret
Now.... if you hit F12... SoftIce will proceed until it gets to the ret
instruction at the end, execute it... and you're gonna be at the "mov ecx, eax"
instruction.
If you keep doing this and hit F10 ("p" command) to walk you through loops and
code and the like will get SoftIce messed up in time. Once this happens, take
note of the address of the instruction (it'll be a call, always will be...)
which messed up SoftIce.
This will take some messing around... but after doing it a few times you will
get there... you'll just stumble across it soon enough... there isn't really
much I can do to help you get to it.... but if you're familiair with SoftIce I'm
certain you'll find your way.
This is the address which I found: 4F4A9B... now that you've found it, you're
gonna have to trace into(F8) that function and look for a call inside this new
function which messes up SoftIce.... and you do that over and over again...
AND... ultimately, you'll spot a call which jumps into DirectX code (that
is... when it won't say AoW2!CODE+some_value below the code window, it would be
ddraw instead...)
To quickly trace into a function when the highlighted line is below the call...
you just leftclick at the call you wish to trace into, which puts the cursor
right at the call instruction... now hit F7. This will make SoftIce
automatically put a breakpoint on it, and let the game execute till it gets
there. So the call instruction will now be highlighted and you can trace into it
Here are the calls I found by tracing downwards that draws onto the screen:
004F4A9B call [edx+000000C8] (first one)
004F47CB call [edx+48] (found by tracing downwards)
004F541A call [ebx+54] (found by tracing downwards)
00428410 call [eax+1C] (DirectX call)
There... the last one is the DirectX call that puts a new frame on the screen...
as it says ddraw!.text below the code window when you trace into it, you'll know
it's DirectX(DirectDraw) code that you traced into.... and that's as far as we
have to go. Now, we're gonna have a look at this call to mess up the drawing
Continued
___________________________________________________
Hi there.... I've been working on a map hack for Age of Wonders 2 which I'm
gonna write some about. If you aren't too experienced with SoftIce and assembler
yet, I would recommend you to work on other kind of options first though(and
practicing SoftIce/assembler)... other than that, there's also gonna be a little
C++ and DirectX... but I'll just tell you what you have to know about that...
Another thing is that you have to run SoftIce in universal mode to make this
work. If SoftIce is running it's own full screen, the game won't be repainting
SoftIce which we need to happen to track down the game's drawing routines.
Well... you can track it down in other ways as well, but this is much faster and
easier so I won't bother with anything else.
If you're not running SoftIce in universal mode... just open up the video
setup/settings and hit the Universal Mode checkbox... now restart the computer.
So, that's it, time to start
Finding the game's drawing-routine
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The first thing we'll have to do to make this work is to find the routine that
updates the screen... and by that, I mean a call which puts a whole new frame
onto the screen. (the game does this all the time... all games do...)
Start off by entering SoftIce. Right below the code window, you'll see something
like AoW2!CODE+some_number if SoftIce popped up while aow2's code was executing.
If it says something else, you'll have to close and reopen SoftIce until you're
in aow2.
Now that you're there.... this is when you need SoftIce knowledge/experience.
You have to be good at crawling around loops and functions, because that is what
you have to do now. You're gonna step out of loops and functions and execute
loops of code and just any code until SoftIce looks weird, because SoftIce will
look weird once the game updates the screen. Your aim is to get out of as many
loops and functions as possible.... the more functions you return from, the more
likely you are to run across the drawing-routine. This is something that you
HAVE to do on your own... you can appear just anywhere inside the code with
SoftIce, and there's no way I could cover all of it. Just keep in mind to check
that you're inside aow2's code, it has to say AoW2!CODE+some_number below the
code window, otherwise you're gonna have to try closing/opening SoftIce again.
In case you're curious as to what it looks like when you run across this screen
update, put a breakpoint at 4F4A9B, and then hit F10 when SoftIce breaks. This
is what it looks like and this is what you're looking for...
Once you do come across the update.... typing rs in SoftIce and hitting enter
twice will clear it up for you. rs is a command used to hide SoftIce, so that
you can see what is behind it, and it then waits for a key to be hit before it
returns... and once it returns, you'll have a new and fresh view of SoftIce.
If you have trouble getting to this call that paints the screen.... a tip is
that hitting F12 in SoftIce will bring you right below the call which executed
the function you were currently in... I'll show an example, suppose this is the
scenario:
...
push ecx
push eax
call 4785a1
mov ecx, eax
xor ebx, ebx
...
4785a1:
...
mov edx, [edx]
add ecx, edx <----- This is where SoftIce popped up
sub bl, 12
...
ret
Now.... if you hit F12... SoftIce will proceed until it gets to the ret
instruction at the end, execute it... and you're gonna be at the "mov ecx, eax"
instruction.
If you keep doing this and hit F10 ("p" command) to walk you through loops and
code and the like will get SoftIce messed up in time. Once this happens, take
note of the address of the instruction (it'll be a call, always will be...)
which messed up SoftIce.
This will take some messing around... but after doing it a few times you will
get there... you'll just stumble across it soon enough... there isn't really
much I can do to help you get to it.... but if you're familiair with SoftIce I'm
certain you'll find your way.
This is the address which I found: 4F4A9B... now that you've found it, you're
gonna have to trace into(F8) that function and look for a call inside this new
function which messes up SoftIce.... and you do that over and over again...
AND... ultimately, you'll spot a call which jumps into DirectX code (that
is... when it won't say AoW2!CODE+some_value below the code window, it would be
ddraw instead...)
To quickly trace into a function when the highlighted line is below the call...
you just leftclick at the call you wish to trace into, which puts the cursor
right at the call instruction... now hit F7. This will make SoftIce
automatically put a breakpoint on it, and let the game execute till it gets
there. So the call instruction will now be highlighted and you can trace into it
Here are the calls I found by tracing downwards that draws onto the screen:
004F4A9B call [edx+000000C8] (first one)
004F47CB call [edx+48] (found by tracing downwards)
004F541A call [ebx+54] (found by tracing downwards)
00428410 call [eax+1C] (DirectX call)
There... the last one is the DirectX call that puts a new frame on the screen...
as it says ddraw!.text below the code window when you trace into it, you'll know
it's DirectX(DirectDraw) code that you traced into.... and that's as far as we
have to go. Now, we're gonna have a look at this call to mess up the drawing
Continued