Author Topic: Tech Editor - Period  (Read 29419 times)

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1774
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Tech Editor - Period
« Reply #180 on: February 27, 2009, 10:26:43 pm »
I'm 100% sure they don't.

It might be possible to make a hack that gives them MP though, as the in-battle data leaves room for MP. You'd have to do a few things though.

- Relocate enemy stats to another place in the ROM. One more byte would be needed per enemy (Two if you wanted to max them at 999/65535).
- Rewrite the routines to copy enemy data so the MP byte is placed at the proper point.
- Most importantly, have a reason for doing this. That would probably involve rewriting enemy AI to have a failure condition on techs, and adding a list of MP costs for the techs.

Hmm, I kinda want to do this now. Maybe after I finish another hack I'm attempting.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #181 on: March 01, 2009, 01:48:18 pm »
Here's some news to me: turns out that the ability to use techs like Black Hole, Delta Storm, Hexagon Mist, and others that I thought required "special coding" last summer is actually a function of the tech animation byte.

This might mean we'll soon be using the likes of Geyser, Hexagon Mist, etc., etc. It's just a matter of finding the right values for one byte, silly me! I'm about 75% sure of this based on recent tests.

EDIT: Yesss, after some additional tests, I'm even more sure of this. Duplicating any tech, and mixing and matching, is merely a matter of getting the correct first byte (animation), sprite spell effects, and layer 3 effects.

json, does the first animation byte under "Properties" just refer to the code that shows up in the middle window of the main editor? Probably already well-known, but I'm just now realizing that (if it's true to begin with).


Mauron, how did you go about identifying enemy techs? That'll be the fastest way to attach labels to animations and sprite spell effects.


EDIT AGAIN: Actually, I just realized that enemies always have 0x80 for their first animation byte. Well, that's just craptacular.
« Last Edit: March 01, 2009, 02:52:29 pm by FaustWolf »

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #182 on: March 01, 2009, 03:02:50 pm »
Unless you're using a pretty old version of the editor I don't think so.  The animation header is viewable under View=> properties.  The stuff in the middle is the actual objects of the tech (not the header of the tech).

Just so you know if you get new enemies you can make them editable w/o me releasing a new version of the editor (I'm pretty proud of this and when i make the TF plugin I'd like for it to be like this  for PC techs as well).   It's tab delimited:

[enemy index] [tab] [description/name] [tab] [first byte of header] [tab] [last byte of tech] [tab] [not applicable] [tab] [start of tech properties] [tab] [n/a] [tab] [n/a] [tab] [n/a] [tab] [n/a]
0   Weird flash?   890618   890650   0   817865   0   0   0   0

n/a above means put 0 in the file (it sitll has to be there).  It's stuff like MP cost and such.

--JP

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #183 on: March 01, 2009, 03:28:09 pm »
Sweet, so it's just a matter of editing enemytech.txt then.

Oh, I might have misspoken earlier -- it's the tech index I was talking about, not the first animation byte, now that I see there's an animation header for each tech. Changing the tech index automatically changes things like ShowDamage and CallSound(), which is what was making me curious. I suppose it's perfectly natural.

Man, enemy techs seem to work completely differently from player techs, so that'll take some getting used to.

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #184 on: March 01, 2009, 03:32:45 pm »
Changing Tech Index in my experience changes everything animation wise (not properties)....like swapping Slash/cyclone was as easy as decreasing the tech index if i remember correctly...

Not sure if it's the same for enemies but changing that value doesn't really help decode how to make things happen because it's no longer running the code for that tech.

--JP

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1774
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Tech Editor - Period
« Reply #185 on: March 01, 2009, 03:34:25 pm »
Here's what I posted a few pages back.

Locating enemy techs:

1) Set Exec breakpoint C14CC4.
2) Wait for enemy to attack.
3) Note the offset given. Spekkio returned this:
Code: [Select]
$C1/4CC4 B7 E6 LDA [$E6],y[$CD:AD2B]
The attack Spekkio used has the animation data start at $CD:AD2B.
4) The fastest way to resume is to disable the breakpoint, as it will step through the entire animation if you just hit run.
5) Note the attack used. Spekkio cast ice in this case.
6) Open the AI editor and find what attacks the enemy has.
7) The AI editor lists Spekkio's Killwala form as having the attacks 25, 2A, and 2B.
8) The encyclopedia's attack list explains what those are: http://www.chronocompendium.com/Term/Attacks.html Spekkio used attack 2A.

It would probably be easier to edit whatever form of Spekkio you have access to so he does the attacks in order. Then you can have him perform the next three techs you're looking for.

jsondag added this bit:

Mauron...if you do have the time while debugging out enemy techs it's be incredibly helpful if you could take the following extra steps:

1)  Debugger gives you address
2)  Load up address in hex editor
3)  Note current address...for example D[XX][YY] where XX YY are any hexadecimal number
4)  The bytes before this address are object pointers you want to find the object pointer to the this point.  so scan the bytes before for [YY][XX]] (note they are reversed)
5)  This is sthe true "beginning of the tech".  It would save me time....however that's very selfish of me.  So don't worry about it unless you have free time.

--JP

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #186 on: March 01, 2009, 04:39:54 pm »
Yes the break point gives the beginning of the first object you have to backtrace it to the beginning of the header.

--JP

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #187 on: March 01, 2009, 10:18:58 pm »
Thanks Mauron!

Hey json, I'm reading the first enemy tech's Properties @0xC7AC9 in an unheadered ROM. What I see in the ROM is this:

03
00
00
3A
3B
04
3E
F0
00
03
00
00

But the tech editor reads this:

00
03
3A
3B
04
3E
F0
00
03
00
00

I just wanted to make sure the slight mismatch is intentional, and bytes are being skipped because they're always 00 or something.

I'm trying to find some kind of pointer table to some facet of all the enemy techs, but I haven't found anything pointing to the data Mauron's found yet.

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #188 on: March 01, 2009, 10:34:01 pm »
the property grid (the component i use to display the data to you) is alphabatizing the properties.....At first it was totally random then I was a genius and added byte_XX before each name of the property...then it turned out I was an idiot and put byte_01 twice so the alphabatizing is swapping the two I guess? 

Byte 3 of the tech properties is actually the "status" byte.  I made an entire new section for status because it is at the granularity of "bits" instead of bytes.  So i made 8 "true/false" sections cause i thought it'd be more userfriendly.  Also note that there's two sections for status (good/bad) but you're actually affecting hte same byte in the rom so changing a bit in the good status change the same bit in the bad status.

http://chronocompendium.com/Term/Tech_Data_Notes.html

The tech properties section in there explains it more.

--JP

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #189 on: March 01, 2009, 10:45:39 pm »
Okay, yeah, you made a note about the alphabetization earlier. Next question: the seven-byte graphical properties for enemy techs currently all read the same values:

80
5B
82
3C
2C
82
F7

Is our current understanding of the enemy tech graphical properties that they don't need this section at all? There should definitely be some changes in the seventh byte position if these behave anything like player techs (which I'm not sure of at all, really).

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #190 on: March 01, 2009, 10:56:46 pm »
IIRC all of those are garbage.  They are probably just reading the 0th byte of the ROM sinc ethat's what we put there in the enemy tech file.  I didn't disable it because I wanted to be able to just put the right value in there later if we did find it.

--JP

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #191 on: March 02, 2009, 01:29:27 am »
I think we've got it guys!

Enemy tech 7-byte graphics sets are in the range 0xD552D ~ 0xD5C11. Or thereabouts. Could be 0xD5526 starting, since that coincides with a 0x00 tech index.

For example, Lavos' "Crying Heavens" lightning attack starts at 0xD594E in an unheadered ROM.

I've got jury duty potentially starting tomorrow and I'm not sure how long I'll be out of it. Someone wanna double check my findings in the meantime? To find these I did a relative search on both tech indices (first byte out of every seven) and Layer 3 graphics packs (7th byte out of every seven) in WinHex. Any hex editor will do now, though, since it's just a matter of making sure things check out now that we've zero'd in on an address range.

Use the following as a marker of sorts and count back from there to double check. I'll do the math myself to make sure eventually, but I wanted to leave some notes here in case I can't work on anything else for awhile.

Starting addresses for enemy techs 0x98 through 0x9B...
Lavos' "Crying Heavens" 0xD594E
"Evil Star" 0xD5955
"Destruction Rains from the Heavens" 0xD595C
"Grand Stone" 0xD5963

For everyone's convenience I'm attaching my tech data values spreadsheet, which is a real mess. For now, just look at the "Layer 3 Graphic" tab for the rundown on which Layer 3 graphics pack indices do what.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #192 on: March 02, 2009, 09:04:25 pm »
As long as the enemy techs start with an index of 0x00, I'm very confident in saying that the 7-byte graphics portion of the enemy tech data goes from 0xD5526 ~ 0xD5C1F, with the last (useful) enemy tech -- index 0xFE -- beginning @ 0xD5C18.

Earlier Jlukas listed the following PAR codes to get Crono to use Hallation correctly:

C145A600
7EAE93B4
CC1BFE0E
CC1ACD08
CC1ACE00

So we know that player characters can use enemy character techs. Question is, how do we hardcode such things? The enemy tech index doesn't help (unless I'm uninformed) because it would just point to a player character tech's code. For the same reason, we can't make enemies use player techs with the tech index byte alone.

Given the proximity of the Player 7-byte graphics tech data to the enemy 7-byte graphics tech data, should we expect a similar proximity for all other tech elements? I can put labels to addresses for most aspects of a tech in a spreadsheet, but first I'll need to know how you guys went about finding the execution code (the stuff that appears in the middle window of json's editor) for the enemy techs listed so far.


EDIT: Ahaaaa, I see now that the header to the tech code (what shows up in the middle window) consists of or otherwise contains a series of two-byte pointers to each object in the tech. I'll try to backtrace this to a pointer table for player character techs, then do the same for enemy character techs.

json, have you guys found the starting addresses for all enemy tech code yet? At least, as an example, the Naga-Ette slow spell tech code is actually the Naga-ette slow spell tech code and not garbage, right? We should be able to find the tech code for every enemy tech now. I'll whip up a spreadsheet for this. Hopefully I'll find a pointer table to easy-fy all this.


The major roadblock now is just figuring out how to hardcode what JLukas accomplished through PAR codes. Any ideas anybody?



EDIT: Fascinating! The pre-tech-code object pointers for Magus' "Lightning 2" all point to the objects in Crono's "Lightning 2." This might just mean that if we can find an enemy that uses the code from a character tech, we can run a search on the object pointers to find the enemy tech code in general. That's if the enemy tech code hasn't been found yet. Guess I should look into that right now.
« Last Edit: March 02, 2009, 11:52:26 pm by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Tech Editor - Period
« Reply #193 on: March 03, 2009, 12:47:15 am »
Ha! Found the pointer table to the enemy tech code. Starts at 0xD61F0.

Format is a two byte stride, relative to address 0xD0000


You already knew this, but just to record this somewhere, the tech code format for enemies is virtually identical to that of player characters:

Target Header: 4 bytes
Pointers to tech objects
Tech code


To run through a few quick examples, at 0xD61F0, we have the pointer 0xFA 96, which points to addy 0xD96FA, the target header of the "Weird flash" enemy tech. That's enemy attack 0x00.


Here's the really interesting thing -- the tech code pointers for enemy techs are relative to address 0xD0000; the tech code pointers for player techs are relative to address 0xE0000. That's why player techs and enemy techs can have the same index values and point to way different locations in the ROM.

I'll get started on a spreadsheet detailing the starting address of all enemy techs, and maybe we can just load those addresses into json's tech editor. Enemy techs will be fully editable in a couple days.

However, knowing all this, is there any hope for making player techs point to enemy tech code on an individual basis? I personally have no clue how to do this. Seems like it would require either ASM hacking or just physically porting enemy tech code into player tech slots, which could get messy. Maybe doable though.
« Last Edit: March 03, 2009, 12:56:03 am by FaustWolf »

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Tech Editor - Period
« Reply #194 on: March 03, 2009, 02:37:05 am »
Phew...lots of updates haha.

a) It'd probably be easier to port the raw data over (tech editor supports copy/paste)
b) yea the magus pointing to the tech objects of crono is the main warning that I give everyone who edits techs.....editig one tech can affect any number of other techs.
c) The most significant byte is hardcoded in the tech editor I believe something like if enemy tech use E0, else use D0 so I think if you repointed it you would be able to use my editor.

--JP