Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1958.msg21597e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0410-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;u=237e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0410-2.html.zxih^0Pd0OKtext/htmlISO-8859-1gzip0|0Wed, 11 Mar 2020 04:48:26 GMT0 0Pih^10 Any way to change the sword in Sword Tech?

Author Topic: Any way to change the sword in Sword Tech?  (Read 2681 times)

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Any way to change the sword in Sword Tech?
« on: October 14, 2014, 09:10:29 PM »
Been struggling with this one for years off and on, resulting in throwing in the towel every time. But I realized it is kinda crucial in my hack to change, so, I'm reaching out for some help:
does anyone happen to know if there is a byte in some spell animation code that is telling which weapon graphic (the katana in this case) to use/show in the sword tech animations like dispatch etc.? I'd like to do just that, change the katana to another weapon graphic. I've noticed it is using the same katana as the weapon, so it would seem like it's coded to do that somewhere. Any help would be great!

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Any way to change the sword in Sword Tech?
« Reply #1 on: October 15, 2014, 12:52:04 PM »
I doubt it's as easy as "one byte," although that would be awesome if it was.

119 bugs fixed and counting.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #2 on: October 15, 2014, 01:45:48 PM »
Hell yeah it would! But, you're probably right. It's gotta be handled somewhere though, somehow... pointing to the katana sword graphic to use.
« Last Edit: October 15, 2014, 02:54:24 PM by TheNattak »

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: Any way to change the sword in Sword Tech?
« Reply #3 on: October 24, 2014, 09:01:00 PM »
I was bored, so I did a little research that should get you well on your way.

The annotated C1 lists SwdTech Animation at C1/B98D.  This calls a C1/9CB3 which is notated as loading graphics.  This appears to load a 14 byte data structure of three words, three bytes, one byte, and some other bytes.  Per the annotation (which is per Mnrogar) appear to be three animation pointers, three palettes, sound effects.  Changing the first word removes the sword strike, so presumably this points to that animation - though not the graphic itself, since Cyan didn't jump forward when I changed it.  Changing the first byte changes the palette of the sword, supporting this.

For reference, this data struct is located at $D07FB2,X - SwdTech starts at X = 55 and apparently adds a parameter (in the case of Dispatch, 0 * $#0E) to get the data offset.  The data itself is CF 01 3B 00 FF FF 18 00 00 60 9D FF FF 10.

Anyway, following the code at C1/9CE1 with X = 01CF the should lead you to the actual graphic used.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #4 on: December 10, 2014, 03:57:39 PM »
Anyway, following the code at C1/9CE1 with X = 01CF the should lead you to the actual graphic used.

Thank you very much for the detailed help. Unfortunately I'm not very fluent in assembly or any programming language, and on top of that my math skills are pretty bleak... So naturally I am confused about this last line here that explains what I need to do. I understood the rest of what you were saying for the most part and understand how the bytes work for the sword tech animations a lot more now, but I'm still not exactly sure what to do to get to changing the graphic in question, and my usual asm buddies who would help me are unable to currently, so at risk of embarrassment I figured I'd ask for some further help to understand what you are saying.

Following the code at C1/9CE1 (okay) with X = 01CF (I'm not sure what you are saying X is here - I doubt you are saying to add 1CF to C1/9CE1 or somewhere in that C1/9CE1 - C1/9D00 code to get to the graphic in question...?)

Again, sorry for my ignorance and I appreciate the help on this!
« Last Edit: December 10, 2014, 04:33:09 PM by TheNattak »

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: Any way to change the sword in Sword Tech?
« Reply #5 on: December 10, 2014, 06:16:37 PM »
Following the code at C1/9CE1 (okay) with X = 01CF (I'm not sure what you are saying X is here - I doubt you are saying to add 1CF to C1/9CE1 or somewhere in that C1/9CE1 - C1/9D00 code to get to the graphic in question...?)

01CF is the value of the X register. It's the first two bytes of the data he mentionned. If you set a breakpoint at C1/9CE1 when using Dispatch, you should have that value for the X register in the debugger.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #6 on: December 11, 2014, 01:20:09 AM »
Ah I see, thank ya. Okay so I am working with the debugger now, and I set a breakpoint for C19CE1, which apparently is also used right at the start of battle and every other battle animation, and yes it did stop right before the sword tech animation and I see the 01CF there in the X register:

$C1/9CE1 AE 73 62    LDX $6273  [$7E:6273]   A:0000 X:0550 Y:000E P:envMxdIZC
$C1/9CE4 E0 FF FF    CPX #$FFFF              A:0000 X:01CF Y:000E P:envMxdIzC
$C1/9CE7 F0 17       BEQ $17    [$9D00]      A:0000 X:01CF Y:000E P:envMxdIzc
$C1/9CE9 20 8B A1    JSR $A18B  [$C1:A18B]   A:0000 X:01CF Y:000E P:envMxdIzc
$C1/A18B C2 20       REP #$20                A:0000 X:01CF Y:000E P:envMxdIzc
$C1/A18D 8A          TXA                     A:0000 X:01CF Y:000E P:envmxdIzc
$C1/A18E 29 FF 7F    AND #$7FFF              A:01CF X:01CF Y:000E P:envmxdIzc
$C1/A191 0A          ASL A                   A:01CF X:01CF Y:000E P:envmxdIzc
$C1/A192 8D EA 7A    STA $7AEA  [$7E:7AEA]   A:039E X:01CF Y:000E P:envmxdIzc
$C1/A195 0A          ASL A                   A:039E X:01CF Y:000E P:envmxdIzc
$C1/A196 18          CLC                     A:073C X:01CF Y:000E P:envmxdIzc
$C1/A197 6D EA 7A    ADC $7AEA  [$7E:7AEA]   A:073C X:01CF Y:000E P:envmxdIzc
$C1/A19A AA          TAX                     A:0ADA X:01CF Y:000E P:envmxdIzc
$C1/A19B 7B          TDC                     A:0ADA X:0ADA Y:000E P:envmxdIzc
$C1/A19C A8          TAY                     A:0000 X:0ADA Y:000E P:envmxdIZc
$C1/A19D BF 00 D0 D4 LDA $D4D000,x[$D4:DADA] A:0000 X:0ADA Y:0000 P:envmxdIZc
$C1/A1A1 99 EA 7A    STA $7AEA,y[$7E:7AEA]   A:3204 X:0ADA Y:0000 P:envmxdIzc
$C1/A1A4 E8          INX                     A:3204 X:0ADA Y:0000 P:envmxdIzc
$C1/A1A5 E8          INX                     A:3204 X:0ADB Y:0000 P:envmxdIzc
$C1/A1A6 C8          INY                     A:3204 X:0ADC Y:0000 P:envmxdIzc
$C1/A1A7 C8          INY                     A:3204 X:0ADC Y:0001 P:envmxdIzc
$C1/A1A8 C0 06 00    CPY #$0006              A:3204 X:0ADC Y:0002 P:envmxdIzc
$C1/A1AB D0 F0       BNE $F0    [$A19D]      A:3204 X:0ADC Y:0002 P:eNvmxdIzc

etc.

Following this code though I still am not sure what to be looking for, or what to change... according to the disassembly it seems to jump to some code [$C1:A18B] that copies 6 bytes of spell pointer(s) and then returns, not sure if/where the sword graphic is being loaded during this process. I'll continue to poke around with this now that I got the debugger up and running again, but if you guys can spot something in there I should be looking for or are able to offer any further assistance, that'd be great! I figured it'd be re-pointing an address(es) where the katana sword graphic is located to another address of a different weapon, or changing a byte like in MDE from 1D (katana) to another weapon value, but I'm not seeing that. Perhaps it's further in?

Thanks guys, and happy holidays.
« Last Edit: December 14, 2014, 05:11:40 PM by TheNattak »

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #7 on: December 12, 2014, 03:10:23 PM »
Okay it seems that $C1/A19D BF 00 D0 D4 LDA $D4D000,x[$D4:DADA] is the one I am seeking. Going there I did some experimenting and before I knew it I had cataloged them. I've still yet to successfully change the graphic to another weapon, but that should be a matter of time now, trial and error style. Here is the data in question (data is from my ROM hack, original could be slightly different.):

D4/DADA - Sword Tech 1; Dispatch - 12 bytes
04 32 B6 08 03 03
04 32 BA 08 03 03

D4/DAE6 - Sword Tech 2; Retort - 12 bytes
04 32 BE 08 03 03
81 3B C2 08 10 0A (this one is normally D4/DAEC - Sword Tech 3; Slash, in clean ROM - 6 bytes)

D4/DAF2 - Sword Tech 4; Quadra Slam - 18 bytes (shares with Sword Tech 7; Quadra Slice)
08 32 C3 08 03 03
08 32 CB 08 03 03
01 58 D3 08 10 0A

D4/DB04 - Sword Tech 6; Stunner - 12 bytes (shares with Sword Tech 3; Slash, for my hack.)
0A 32 D4 08 03 03
01 32 DE 08 04 03

D4/DB010 - Sword Tech 5; Empowerer - 6 bytes
04 32 DF 08 03 03

D4/DB16 = Sword tech 8; Cleave, 6 bytes
07 32 E3 08 03 03

Initial notes:
1st byte, not sure...
The second byte is the graphic used. (32 in this case, = katana)
The 3rd byte seems to be the molde(s) used to house the graphic and/or how the weapon graphic is assembled, since they are scattered about in pieces. Also maybe determines what angle to point the weapon.
the 4th byte (08) seems to be...not sure, changing it crashed the game.
03, 03 (the last 2 bytes) is the positioning of the weapon graphic.

POST UPDATE:
After spending many hours, it seems like the structure is coded to only allow the katana sword to work right - I changed the graphic value to as close to the weapon I wanted as I could get (84 seemed to be the best) and tried all the moulds for it (0-FF), and while getting close, it is not working like it does for the Katana - I couldn't really get any weapon to be soloed out perfect like the katana is. This leads me to believe that the katana and I think the Knife graphic also for the Capture animation, are the only ones that are coded/assembled to work right, so I would need to basically code in another weapon graphic to work right and I have no idea how to do that. They seem to be like battle event animations, how you can really only use the ones that are programmed to work, you can't go outside of that and do anything totally custom without programming some new actions... Hopefully I'm wrong though and I'm still not doing it/understanding right =/

How close I came...:
« Last Edit: December 16, 2014, 09:11:39 PM by TheNattak »

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: Any way to change the sword in Sword Tech?
« Reply #8 on: December 14, 2014, 04:34:35 PM »
I'm glad to see you've made progress!  I wouldn't give up just yet, for the simple reason that you don't know what all the bytes in that data do yet.

What weapon is that being tested?  I don't recognize the sprite offhand.  Is it custom?

The fact that changing the 08 crashes stuff (as well as the sequential numbers) suggests to me that the third and fourth bytes are actually a single word that is possibly an offset to something.  Have you tried tracing it?

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #9 on: December 14, 2014, 04:51:45 PM »
It's a custom one yeah, a Buster Sword. Replaces the Scimitar. And thank you for the help and words of encouragement! I believe I will take another crack at it, I admit I may have shut the door on this too soon, without figuring out exactly what those other bytes are doing like you say. I have not traced the 08 byte yet but that sounds like a good next step. I assume you mean using the 'Trace' feature in the debugger? I've never used it before, is it a pretty basic process?

That 08 byte very well might be the key. More study is definitely warranted. It would be really nice to fully understand some of this animation stuff better. =)

Pics of Buster Sword (made by Poco Loco) in action, as a regular weapon:



Cloud, here, uses Sword Tech (called Limit), so that's the reasoning behind wanting/needing to change it.

EDIT:
The fourth byte (08) does seem to be tied to the graphic after all! So there is yet hope. It does now seem like bytes 2 3 and 4 are all tied together. Changing the value of the fourth byte past 0F, however, does result in a game freeze. But 0-0F seems to adjust the graphic. Off hand I'd say the 3 bytes choose which pieces of graphic to load, how to assemble it so it looks right, and what direction/angle to point it. Without knowing exactly how it's done though it will be like finding a needle in a hey stack or winning the lottery, trying to get any other weapon graphic done right.
« Last Edit: December 15, 2014, 12:28:31 AM by TheNattak »

Drakkhen

  • Wing Raptor
  • *
  • Posts: 6
    • View Profile
    • Drakkhen's Patch Pages
Re: Any way to change the sword in Sword Tech?
« Reply #10 on: December 15, 2014, 05:04:55 PM »
Try 04 84 68 01 03 03, these are the values for the Scimitar weapon.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #11 on: December 15, 2014, 06:17:25 PM »
  :whoa:

That did it alright, thank you Drakkhen!!

So I must ask how did you know these values? I'm now trying the same out for the other Sword Tech animations and they are still tricky as they're obviously a little different from one another. By some chance might you know what to change them also to now in order for them to work correctly? It's that 3rd byte I'm wondering about - It looks to me like it basically just increases, but it varies and trying to mirror the value increase with our new one doesn't seem to be doing it. I'd like to understand what's going on if possible. Actually, putting them all to 84 68 01 did yield the best results so far, but it's not perfect the weapon kinda blinks in and out on some and breaks the molde, and most noticeable the positioning is off, so I'm thinking that byte must increase as well or something per the original code. I am able to re-position the weapon by changing the last 2 bytes (03, 03), but I don't know if that is needed if the 3rd byte has something going on with it.

Thanks again, this really made my week!
« Last Edit: December 16, 2014, 03:22:05 AM by TheNattak »

Drakkhen

  • Wing Raptor
  • *
  • Posts: 6
    • View Profile
    • Drakkhen's Patch Pages
Re: Any way to change the sword in Sword Tech?
« Reply #12 on: December 16, 2014, 08:15:25 AM »
This thread from the FF6Hacking forum explains a lot of the animation data and how it's used.
It doesn't really touch on the 8-byte weapon/specials animation data, but they pretty much work the same way.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Any way to change the sword in Sword Tech?
« Reply #13 on: December 16, 2014, 12:54:22 PM »
Ah yes thank you, I was skimming through this document the other day thinking that this does look a lot like what I am asking questions about lol. The 'Effect Property' section in particular is indeed what we are doing here. I'm now trying to just figure out still how you got the correct values, and also how you know 84 was the chipset number to use for the Scimitar? I'm following that document now, but I'm still not seeing how you got 68 01 (animation pattern). Once I realize how, hopefully the other ones will fall in place for me.

Could you please elaborate a bit, alongside this document to help me understand how to get said values kind sir?

My trials thus far trying to understand & follow the doc:
So I take the value of Effect 1 of Dispatch, which is CF 01, so 1CF, multiply it by 6, add 14D000, and I get 14DADA which is the offset of the Effect property of Dispatch, which we managed to find out here already. So moving on to the next one; Image chip pointer, it says to multiply the chipset number by 40, but how exactly do we know what the chipset number is? I more or less guessed it was 84 for the Scimitar just by getting as close to the graphic as I thought trial and error style, but since it really is 84, how do we/you know that? I'm not seeing that in this doc. Anyways, we know the chipset number so no matter. So: 84 * 40 + 120000 = 122100, this is the pointer. But the pointer to what? Doesn't look like anything worthwhile there. And I believe right after this is as far as I need to go for what I am trying to do? Please correct me if I'm wrong about that.

Then I see in the next part it says "Example: 50 02 (value 120700 from the previous example" so it looks like 120700 got turned into 50 02, but how is that done if you don't mind me asking? Does our Dispatch 122100 "pointer" somehow translate into 68 01? Is there some math I am not grasping going on to attain these values? I do plan on brushing up my math skills at some point, but for now in this case a direct explanation on how to get said values would be a great Christmas gift! ;)
« Last Edit: December 16, 2014, 02:03:17 PM by TheNattak »

Drakkhen

  • Wing Raptor
  • *
  • Posts: 6
    • View Profile
    • Drakkhen's Patch Pages
Re: Any way to change the sword in Sword Tech?
« Reply #14 on: December 16, 2014, 02:23:32 PM »
The values for Scimitar in the 8-byte weapon animation data are: 61 61 2A 05 32 00 A4 00
The important value here would be 61(In this case the same value in both the right and left hand slot), this would be the "Effect 1" for the Scimitar. Multiply by 6, add 14D000 and we get 14D246 at which we find the 6 bytes I listed before: 04 84 68 01 03 03