øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.msg20399e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0255.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.285e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0255.html.zxÇg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0P.±eOKtext/htmlISO-8859-1gzip@øÕ±eÿÿÿÿÿÿÿÿTue, 10 Mar 2020 05:20:29 GMT0ó°° ®0®P®€§²ð®Æg^ÿÿÿÿÿÿÿÿ°6±e Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)

Author Topic: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)  (Read 78668 times)

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
Grimoire LD:  your work is impressive to say the least!!!

One thing that I wanted to do for my Playable Golbez hack was give Golbez a Pressure command.  The idea was to take the broken command that Cid was apparently supposed to have, and make it cast Hold on all enemies (kind of like what Golbez does when you fight him at the Dwarf Castle).  I was never clear on how to edit commands but it looks like you've pretty much mastered it.  Is this something that could be done?

Thanks!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Hey, fedorajoe (where you goin' with that gun in your hand) (sorry)
I know you didn't ask me, but it is absolutely possible.
Question, though... Do you want this command to simply target all enemies and cast Hold?
That could, theorhetically, be done simply by manipulating existing commands in FF4kster (I'm lookin at you, Gird and Pray).
It is, with a bit of hacking wizardry, possible to do more than that though. It could be made to have a better success rate than Hold, I can even think of a way for it to be permanent and successful against monsters that are immune to hold status (but that would probably be too cheap).

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
LOL  Hey chillyfeez, what's up?

I really didn't want to change one of the "normal" commands into Pressure.  I would only proceed if I could use the unused/broken command, since all of the other commands are in fact used in my hack, and I don't think it's worth dropping one of them just to put another gimmicky command onto Golbez (he's already got Dark Wave plus every Black Magic spell).

To answer your question though, yes, my intent was simply to have Golbez cast Hold on all enemies, at no MP cost.  I might have made adjustments to the accuracy/duration of the hold effect, but that was a secondary concern, because I don't want the command to be overly cheap.

Thanks!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
I should be able to whip that up... given the five letter command name limit, what would you like the command to be called?

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
Oh wow neat!!! :omg:

I would probably just go with Press.  Actually I think I already changed the name of that command from Dummy to Press a long time ago, if memory serves!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Hey Fedorajoe! I recall playing your Golbez patch a while ago, I absolutely loved it! And to think you did the vast majority of it without FF4kster's extremely helpful system! Now it looks like Chillyfeez is handling this part for you but it's actually a very simple process. You go to the location of the Command Pointers (LoRom- 03B37C), look for These values before and after it....

14 - 53E1 (03E153 - Peep)
15 - 0000 (030000 - Crash)
16 - 4CE3 (03E34C - Throw)

You change the 0000's snuggled in between there to...

(05 1E39D-1E3B6   (enemy runs away) 3E1B2-3E1CB) - (This is an unused command that might have been intended for lowering an enemy's "Steal Evade" to 00 Similar to FFI-III with a "fear" amount. It does nothing in the final game, instead there is a special exception made for Retreat within the Spell Routine code to change the sound of "dying" enemy, (and something small to do with graphics)
and the code to rob the player of the Exp. they would have earned had they defeated the foe. That makes this go completely unused.

For all intents and purposes we will change the 0000 to B2E1.

Now let's view the routine itself...

Quote
$03/E1B2   A9 04   LDA #$04   A:0003   X:0028   Y:0000   P:envMxdizc - Load 04 into A.
$03/E1B4   8D E6 38   STA $38E6  [$7E:38E6]   A:0004   X:0028   Y:0000   P:envMxdizc - Store A in 7E38E6
$03/E1B7   A6 A6   LDX $A6    [$00:00A6]   A:0004   X:0028   Y:0000   P:envMxdizc - Load X from A6
$03/E1B9   BD 03 20   LDA $2003,x[$7E:2003]   A:0004   X:0000   Y:0000   P:envMxdiZc - Load Indexed Slot's Status Byte 1 into A.
$03/E1BC   09 80   ORA #$80   A:0000   X:0000   Y:0000   P:envMxdiZc - Add 80 (Death) if applicable.
$03/E1BE   9D 03 20   STA $2003,x[$7E:2003]   A:0080   X:0000   Y:0000   P:eNvMxdizc - Store A in Indexed Slot's Status Byte 1.
$03/E1C1   A9 05   LDA #$05   A:0080   X:0000   Y:0000   P:eNvMxdizc - Load 05 into A. (Ran Away)
$03/E1C3   8D CA 34   STA $34CA  [$7E:34CA]   A:0005   X:0000   Y:0000   P:envMxdizc  - Store A in 7E34CA.
$03/E1C6   EE 0A 39   INC $390A  [$7E:390A]   A:0005   X:0000   Y:0000   P:envMxdizc - +1 to 7E390A.
$03/E1C9   4C 9B 85   JMP $859B  [$03:859B]   A:0005   X:0000   Y:0000   P:envMxdizc - Jump to Subroutine
-------------------------------------------------------------------------------------------------------
$03/859B   A9 F8   LDA #$F8   A:0005   X:0000   Y:0000   P:envMxdizc - Load F8 into A.
$03/859D   8D C2 33   STA $33C2  [$7E:33C2]   A:00F8   X:0000   Y:0000   P:eNvMxdizc - Store A in 7E33C2.
$03/85A0   A9 03   LDA #$03   A:00F8   X:0000   Y:0000   P:eNvMxdizc - Load 03 into A.
$03/85A2   8D C3 33   STA $33C3  [$7E:33C3]   A:0003   X:0000   Y:0000   P:envMxdizc - Store A in 7E33C3.
$03/85A5   60    RTS   A:0003   X:0000   Y:0000   P:envMxdizc - Return

Now to change this to just cast Hold is a well known matter now.

You would change this...
$03/E1B2   A9 04   LDA #$04   A:0003   X:0028   Y:0000   P:envMxdizc - Load 04 into A.
$03/E1B4   8D E6 38   STA $38E6  [$7E:38E6]   A:0004   X:0028   Y:0000   P:envMxdizc - Store A in 7E38E6
$03/E1B7   A6 A6   LDX $A6    [$00:00A6]   A:0004   X:0028   Y:0000   P:envMxdizc - Load X from A6


To this...


$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   4C 3E CD   JMP $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Spell Routine.

There is still a decent amount of free room here since this only takes 8 of the 19 (25) Bytes. You might even be able to get away with an item or stat conditional to increase the power of the command beyond just "Hold". I forget if Pressure was multi-targeted but the unused command by default is. 

Also I had created Taunt as well (which works on one enemy by reversing the functionality of Search), it would cost you Search though (which is used by... two enemies.)
« Last Edit: January 31, 2014, 07:42:54 PM by Grimoire LD »

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
Wow!  So I just tried that code and it works well.

One thing I noticed.  When you use the command, Golbez goes into his "about to do something" pose, as you would expect.  But, then he stays like that until his next turn, which looks odd.  It makes it look like he didn't do anything, especially if the command fails.  Would there be a way to change this so that he goes into, maybe, his "use item" pose while executing the command, and then returns to a normal waiting stance?

Also, since the command is basically just casting Hold, a text box comes up with the name of the spell.  Would there be any way to change this so that instead a message box comes up with text in it, like happens with some other commands?  (I don't know if this is really feasible, but thought I would ask, what the hell!  Not a big deal.)

Lastly, thank you for your kind comments on the Golbez hack!  I worked very hard on it!!!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
We most certainly can. If you change the 3ECD (this is part way through the magic routine. It is past the Spell Casting Poses) to 46CC you would have the entire spell casting pose (including the White Magic squares, which you might not want) but there is a way around that as well, but it will take a few more bytes... first before we get ahead of ourselves lets look at how messages are input... that too is a sequence of 8 bytes.

From my Dragon Speech hack...

A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (The Dragon is Prideful!)
8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
20 A6 85   JSR $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input
60    RTS   A:0003   X:000E   Y:0000   P:envMxdizc - Return

I am afraid though we'd be cutting it close for a defined Sprite Animation change Unless you also want it tied to the message. (Command 07 is Recall which shows a special animation so the two would go hand in hand.

Here is how your routine would ideally look now...

$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   20 3E CD   JSR $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Start of Spell Routine
$03/E1BA   A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (unused, feel free to use it)
$03/E1BC   8D C4 33 STA $33C4  [$7E:33C4]   A:00C0   X:0046   Y:FFFF   P:eNvMxdizc - Store A in Audio/visual commands.
$03/E1BF  8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
$03/E1C2 4C A6 85   JMP $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input Routine.





chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Just got home from work. Looks like you don't need me to make a patch anymore?
My plan was to (mostly) copy the code from Gird into the big empty space at (LoROM) ~3FEFF.
The Gird code includes the instructions to display a battle message, so you could essentially make it say whatever you want.

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
chillyfeez and Grimoire LD:  a big thank you to both of you for your assistance!

chillyfeez:  I would still be very interested in seeing what you would come up with, if you're still willing to give it a go.  Right now I want to get a handle on how this bit of the code works.  I've never looked at command editing before and it's quite interesting!

Grimoire LD:  I tried using the code that you provided.  It does come up with the blank message window and all.  But, it plays the animation for Slow before playing the animation for Hold, and I don't understand what is causing that.  Also, making the 3ECD/46CC substitution does not seem to affect the pose issue.

Thanks again!!!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
If I can pull myself out of bed early enough tomorrow I'll put one together for you before I go to work. What I have planned shouldn't take too long.

Writing custom commands seems like such a daunting proposition, but once you read up on how they're put together in this game (which is all here, in great detail, thanks to Grimoire), and try it out a bit, you'll get the hang of it I'm sure. It's kinda nice that every little bit of game data is independently controlled, so you really can make a command that does whatever you can imagine with enough time and research.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Oh, I wasn't feeling very well last night and I forgot a clear basic, haha! Sorry about that. 07 is the Slow graphic.... C7 is the Recall Command, sorry. I've been feeling a bit under the weather and forgot that step.

Let's see then... the Routine can go up until CB so...


$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   20 3E CD   JSR $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Start of Spell Routine
$03/E1BA   A9 C7   LDA #$C7   A:0003   X:0046   Y:FFFF   P:envMxdizc - Load Recall Pose into A.
$03/E1BC   8D C4 33   STA $33C4  [$7E:33C4]   A:00C0   X:0046   Y:FFFF   P:eNvMxdizc - Store A in Audio/visual commands.
$03/E1BF   A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (unused, feel free to use it)
$03/E1C1  8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
$03/E1C4 4C A6 85   JMP $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input Routine.

That should do it!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Oh, I wasn't feeling very well last night and I forgot a clear basic, haha! Sorry about that...

It's ok; we still love you anyway!  :wink:

Seriously though - this is an impressive body of work. I'm glad that the forum is a standing fixture for reference; this is certainly the kind of wizardry that makes perfect sense when it is presented in class but then come homework time is like...huh??

I've much enjoyed watching these ideas develop and the continual expansion of what is possible! Praise now given time for a noob question: given what I've seen in looking at live dissasemblies everything in memory while the game is running is addressed BK:8000 - FFFF (BK= bank) - as was confirmed by Dragonsbrethren**:

That's just how LoROM works. There's nothing mapped to xx0000-xx7FFFF. That's the major difference between LoROM and HiROM, from a non-hardware standpoint...
This is the simplest reference I've found: http://romhack.wikia.com/wiki/SNES_ROM_layout (yes, on Wikia  :sad:)

My question (again, noob-alert) is how do I write up code to go in the ROM? My first attempts (with hooking into the map updating code around Mist) was done with the assembly kit making the changes as I went along (since it wasn't a long stretch) - but for what I am getting ready to try and code for my experience mod the obvious location for such a brick of code would be where the table is currently: 7B728-7C5C8...right? But if I'm understanding things correctly that ROM location would put me at 0F/B728-0F/C5C8 <-- does that work / is it a good idea or should I leave that area alone only for static reference data and have the work-horse code elsewhere? The second part to my question (even noobier) is how do I write it: When specifying addresses for loads would it be written in reference to where it is, or where it will be when the game is running?


 **A possible alternative reference is on Bazz's webpage; it's where I first read up in trying to figure this all out:

http://www.cs.umb.edu/~bazz/snes/lorom.html   

 :offtopic: What's wrong with Wikipedia? Obviously it shouldn't be cited professionally - but otherwise it's fine (as long as you check it yourself to make sure it hasn't changed). I once had a technician (age 65) as me how to spell 'Wikipedia' since I mentioned it as where I was able to look up info so quickly - I was about to tell him but stopped when I say him poised to write it in his lab notebook - then the spelling became "N...o...n...o...n...o"  :tongue:

Also funny: turns out Bazz isn't too far from me in Boston - Perhaps it's time to build the "Bazz-Signal" - lol  :happy:
"Now I know; and knowing makes it even more confusing..."

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Fedorajoe, at this point, whether it's identical code or not, what Grimoire's presented you with here would yield the same result as what I would have come up with. Geez, does this guy ever sleep?
 :laugh:

LordGarmonde, it's safe to use any space in the ROM, as long as you KNOW you won't need it for anything else. Whatever code or data is/are right before that, any chance any future modifications might necessitate using that space? If not, you're good to go.
Another thing to consider, though, would be the limitations of jumping and subroutines presented by picking an arbitrary empty space. You're planning on using space in the LoROM 0F's. That means any JSR or JMP would have to reference another offset within the 0F's - that's the way those commands work. They have sister commands, JSL and JML, which allow you to specify a long address, but those require an extra byte to use. Also, the return code from a JSL (RTL) is different from that of a JSR (RTS). If you jump to an existing subrotine using a long address it will crash the game if it tries to return with an RTS. There may also be references that are impossible within a different chapter of ROM (block of 0xXX0000). Some or all of this might not matter at all depending on the code you're planning. Just some things to consider.

You would reference the in-game (LoROM) address, by the way. Those are the offsets the game recognizes. We tend to speak mostly in ROM addresses because those are universally recognized by hex editors. An unfortunate and highly obnoxious (imh and completely irrelevant o) but unavoidable fact of hacking...

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
You would reference the in-game (LoROM) address, by the way. Those are the offsets the game recognizes. We tend to speak mostly in ROM addresses because those are universally recognized by hex editors. An unfortunate and highly obnoxious (imh and completely irrelevant o) but unavoidable fact of hacking...

Good deal; thanks chillyfeez. That's what made the most sense to me - hence my worry - making sense to me =/= making sense - lol

...it's safe to use any space in the ROM, as long as you KNOW you won't need it for anything else. Whatever code or data is/are right before that, any chance any future modifications might necessitate using that space? If not, you're good to go.
Another thing to consider, though, would be the limitations of jumping and subroutines presented by picking an arbitrary empty space. You're planning on using space in the LoROM 0F's. That means any JSR or JMP would have to reference another offset within the 0F's - that's the way those commands work. They have sister commands, JSL and JML, which allow you to specify a long address, but those require an extra byte to use. Also, the return code from a JSL (RTL) is different from that of a JSR (RTS). If you jump to an existing subrotine using a long address it will crash the game if it tries to return with an RTS. There may also be references that are impossible within a different chapter of ROM (block of 0xXX0000). Some or all of this might not matter at all depending on the code you're planning. Just some things to consider...

Very good advice, sir; my thanks! Also, given that warning I say up front that I'm willing to bet that if I get into coding more - enough so that I'm frequently using short and long calls that my inadvertently interchanging them will become a contender for the "LordGarmonde Most-Common-Error" title: current champion: Infinite-Loop-Because-I-Forgot-To-Increment-the-Count  :tongue:
"Now I know; and knowing makes it even more confusing..."