Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Fire Emblem Ultimate Tutorial.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
7.86 Mб
Скачать

Part 1: Background Info

  • Assembly, ASM hacking, whatever: I’ll likely just use terms loosely and call what we’re doing “ASM hacking”, meaning hacking assembly. We might sometimes actually write our own routines, in which case we’re doing less modding and more creating, but I’ll still call it an ASM hack, because whatever, proper terminology isn’t a huge deal to me.

  • Assembly can be viewed in a hex editor, like anything else. In fact, certain nightmare modules, like the vulnerary editor, actually edit assembly itself. Also, assembly can be found in various parts through the game, but the core of it is found in the first… roughly a megabyte, though I think it’d be more accurate to say it goes around to somewhere in the 0x080C0000 section.

  • Assembly codes, known as opcodes, usually take up 2 bytes. However, what it does is more dependent on the bits (review binary if you need to: I won’t explain it here). There are several exceptions in which case opcodes may take more than 2 bits or in the case of the ldr function, may have values stored at the end of a routine, as opposed to in the middle. This will make more sense later. (Also, function/code/opcode, it’s all the same to me, FYI.)

There are multiple ways to “hack the ASM”. You can edit it through a hex editor directly, but this is often too difficult because you would have to know what the hex for various opcodes are, and figuring them out can be a pain, to say the least. However, if you’re just editing a parameter, which may be one byte (e.g. 0x14, or 20, the level cap) then it’s probably much easier to just edit that parameter directly.

You can also write a text file that is usually saved as a .asm file and contains code for an assembly routine. FYI, an assembly routine is the generic term I use for any code of assembly that does something. It’s sort of like a script, except I might reference “the damage calculating routine”, which might in fact be part of many other routines, because the game WILL reuse code where relevant (for instance, the Random Number Generator code is used a lot).

Part 2: Inserting an Assembly Hack

Before you go making your own, let’s get you familiar with how to insert some pre-existing ones.

https://dl.dropbox.com/u/8875056/hacking/asm/Hector%20Hard%20Mode%20Hack.zip – Here is a hack I made that forces the game mode to be Hector Hard Mode. It’s very simple and we’ll use it as an example.

First, put the Assemble ARM batch file in a folder where you’ll stick your ASM hacks. It’s good to be organized so I suggest making a folder for every ASM hack you make once you’re done with it, naming it appropriately and taking notes ALL THE TIME. Taking notes is super important, especially in finding bugs in your own code—and if you ever have to go back to edit code, you’ll be happy you took notes because it can be a serious pain to figure out what the heck you wrote a few months or even weeks ago.

Extract it and take the .asm file and drag it onto the “Assemble ARM”. If devkitPro was installed successfully and everything, it should work fine. If not… well, we have a problem. Try restarting and changing your installation method or other random stuff. I’m really not too sure how it works but people tend to have problems with this. Sadly, I’m really no help here—hey, I warned you earlier.

It should give you a dialog message in a command window like so:

It may occasionally mention something about a “pipe”… I really don’t know what it means, but it doesn’t really affect anything, so don’t worry.

Two files should be outputted once it’s done: a .dmp file and .symbols file of the same name. The .symbols file is, as far as I know, useless. I don’t know what it does because I didn’t learn the programming language properly but I never needed it and I got pretty far.

The .dmp file is super important though. It contains the raw hex/binary (remember, it just depends on whether you look at it through a hex, binary, or even text editor—utlimately, the file is still the same).

To insert this ASM hack into your ROM, find some free space, copy all the data from the .dmp file, and paste it there. Note the offset.

Now the way this ASM hack works is that you have to call it somehow. Sometimes you can call ASM routines through events and other times you’ll want to insert your ASM into an already existing routine meaning you have to find the routine first and then insert over that routine or even expand the routine to branch elsewhere, put your code there, and then tell the game to go back to after you branched at the original point (meaning, where you were before you branched, but after the branch code itself, or else you’d infinitely branch: we’ll get to this later).

This one is easy because you can just write an event using the event assembler to activate it. You should know the code already, but if not, it’s:

ASMC 0xOFFSET

There’s a catch here though. 0xOFFSET is the offset in hex, okay. You know this. But if you insert it to say, 0xD50000, it won’t work. This is because the routine is written in THUMB and there’s a difference in how things work between THUMB and ARM.

What the hell are THUMB and ARM? Don’t ask me, I don’t really know. But we can use either THUMB or ARM to write our programs and we’re going to use THUMB. To let the game know we’re using THUMB, we’re going to make it start at an odd offset—meaning we add +1 to the offset we inserted the routine at. Yes, that’s right—you would actually type “ASMC 0xOFFSET+1”, or in our example, “ASMC 0xD50001” for it to load the routine at 0xD50000.

Go ahead and test the event: you probably won’t see anything happen because it’s such a simple event. However, secretly, it forced the game to be hector hard mode. In fact, if you beat the chapter you were on and save, you should be able to tell because in FE7, Hector Hard Mode playthroughs have grey-colored chapter titles. Granted you might have changed that in your hack, but that’s the default in vanilla (non-edited) Fire Emblem 7.

If you’re not convinced/don’t want to beat the chapter though, you can check the memory. Go to 0x0202BC13 in VBA’s memory viewer and you should see “0x03” there. 0x01 = Lyn’s mode, 0x02 = Eliwood’s mode, 0x03 = Hector’s mode. At 0x0202BC0C, you should see “0x40”. 0x40 is the value for hard mode (it’s likely a bit map though, meaning what actually matters is the bits in the ‘4’ that act as the flag for hard mode… anyhow, this hack FORCES it to be 0x40, so the other bits are set to 0 here).

Congratulations: you’ve now inserted your first ASM hack. A couple notes: using “ASMC” runs the code once. If you want to run it again, you use the code again. The program needs to… you know, end, or else it’ll go into an infinite loop and freeze, so you can’t “make the program loop” in that regards. Thus if you were trying to say, make sure someone’s HP was always at max all the time, using an ASM hack like this wouldn’t be a good idea because if it’s just constantly forcing that HP, it can’t do anything else… as in like, you couldn’t play the game, because the game runs on ASM. XP

Anyhow, next let’s figure out what the ASM hack actually did.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]