[FE7] Full (?) "magic replaces resistance" hacks (like in FE5)

These hacks reroute damage and staff heal/range/accuracy calculations such that all magic weapons and staves have their output calculated from the Resistance stat, thereby having a system similar to FE5 in which the resistance stat does not exist and magic damage and defense are both calculated from a single stat.

There are two hacks featured in this topic. The first is Hextator’s hack and the primary hack at that–it makes it so that any weapon with the “Magic” flag (0x02) in the Item Editor calculates its damage from the Resistance stat. Using the “Magic Damage” flag (0x40) will give the item the same function as a vanilla FE7 weapon i.e. targets resistance & halves Str stat at range.

The second is a fix by @Crazycolorz5 in order to complete the hack. It makes it so that staff heals are also calculated from the Resistance stat, as is the range and accuracy of status staves/physic staves.

Please note that these hacks are currently untested and it is advisable that you create a backup of your ROM before applying these. The full hack consists of two components:

By default, Hextator’s patch will write the data to 0xD00000 so it is suggested you move any existing data there or reassemble the patch with the desired offset.

After you have applied these hacks you may choose to replace the “Res” text seen in the stat screen to “Mag” and update its description accordingly, and also change “Mag” to “Str” after that. The functionality of this hack largely depends on the user–for people like myself it makes balancing magic swords easy and introduces the possibility of a fused magic/strength class, such as a Mage Fighter.


Edit: Omg yes it works, ahahahahah

Okay, so change the bytes at 16CF4 from whatever they were to 01 F0 4C FF (This makes heals based off Res)
And the bytes at 2A672 from whatever they were to EE F7 8D FA (This makes offensive staves base their accuracy off of Res)
And the bytes at 184C0 from whatever they were to FD F7 2C FE 18 21 (This makes Mag/2 ranges, encoded in the 0xC byte of item data as 0x10, to have range based on Res(+equip’s bonus). You might want to apply a display patch so it doesn’t display “Mag/2”)

That’s it. Just tell it to branch to a different subroutine(one that fetches Res+bonus, not Str+bonus, bonus being from equipped weapon). I’ve tested it both with and without aureola equipped and it does make a difference and go off of boosted res. The routine I call is the one I note at the very bottom of this post. I’m leaving all my thoughts here for documentation. It does document how to fetch boosted other stats as well.

Edit3: Now analyzing how “Mag/2” ranges are calculated. Used a break on read to find the instructions at 08016f7a are suspicious.
If the second range nibble is NOT zero(most weapons) then it branches at 08016FE82. However, Mag/2 ranges are coded as 0x10, so it doesn’t branch,
It seems to assign 0x63 to r6 in the case of Mag/2… Uh, after it loops the inventory(I assume it’s getting the ranges it can target?) It jumps to 08016FB0… there it checks r6 against 0x63.
@the branch command from 80184B8 to 8016764 - I think this is finding equipped item? For staff ranges O.o(Edit: Oh, to grab the stat bonuses)?
I… think I found it? I suspect the bl at 80184C0(to 801707C) grabs the str bonus(if so, the corrisponding res routine starts at 801611C), and then line 80184C6 explicitly grabs str/mag.

Furthermore, the value is ASR’d five lines below(suggesting a division by two), and is compared against 4(is that a harcamp on minimum physic range?)

For now I’m trying to change 080184C0 to bl #0x801611C and 080184C4 to mov r1, #0x18

YAAAAAAAAAY it worked I gave Eliwood 20(+5 from aureola) Res and his range increased to… 12 spaces! Success!!!

Edit2: Now working on the offensive staves
08028BD0 r5 is hit?
Actual hit calculated before 0802C7A4.

Routine to lead edited Resistance it at 08018B90? Okay so changing the function all at 0802A672 from a call to 8018AD0 to 8018B90…
Yes this appears to work. The bytes to change added up top

To make heal/mend/fortify/physic run off of res, change the 4 bytes at 016CF4 from whatever they are(some bl command) into 18 21 40 56. I tested it and it doesn’t crash… immediately. I think it should work since r0-r3 are meant to be clobbered anyway.
The explanation is that it calls some branch routine that the game uses in other loops to fetch effective str/mag. Messing with that gave things negative bonuses.
–speaking of, this short-term hack doesn’t account for bonus res(I don’t believe) so…
It works well enough though when you aren’t equipping aureolas though…

–notes as I decipher their str-getting thing for how to grab res bonuses. At the end of the two branches, r1 appears to have the bonus… Though it’s returned from the second branch as r0…
080161C2 appears to be a check for a weapon. Either it’s finding the equipped item or only items default to giving stat bonuses… I think 0x8016764 is used to determine the equipped weapon… (Ugh I was looking for that code a long time ago to implement my modified steal) (Also I think this is the routine to change if you’re looking for non-equipped item buffs). Loads stat bonuses at 08016080(Routine starts at 0801606C, was called at 08018AE0). Then takes the strength only. So I have to write (or find!) a mirroring code for res. The get stat bonus codes seem to be arranged logically; right in order. So scrolling down to the one that grabs res… It appears to be at 0801611C

… the corresponding routine appears to be at 0x08018B90…

1 Like

I love you

Oh, I wouldn’t worry about that, I changed the Res stat in my hack to Mag. Thanks you so much @Crazycolorz5!

Since Hextator had a tantrum and took down all his doc, the hack was 404’d. I reuploaded it to my own Dropbox. Sorry to those who were affected. @Crazycolorz5 care to make an EA version of this thing?


Just a few notes about magic weapons with this.
0x41 makes the weapon use Str to calculate damage and it targets Res.
0x43 makes the weapon use Res to calculate damage and it targets Res, but it uses magic animations at close range

I’m not using the default magic weapon slots for this.
Is there any solution for this?

Yeah, could you send me a PM with the patch for his part of the hack? (or the whole thing, if you have that in one patch)

not as far as I know - sorry!

The Dropbox link is “404” again (Kinda makes you wish someone could just post the assembled hex in the thread itself.) Is there a place to find this patch or are my dreams of magic being a separate stat from str to be lost forever?

This may be what you’re looking for.

1 Like

Thank you!!!

(Now I see that there’s not a .dmp to copy paste on the board :confused: )

If you patch the .ups to a clean rom and compare the patched rom to a clean one to find out what you need to change, you can easily make an installer for it.

Can also automate that process with CUPS