Author Topic: Challenge  (Read 2001 times)

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Challenge
« on: May 26, 2008, 11:42:16 pm »
Hey all I got a challenge for y'all.  Throughout the game there were what I called the "TP" enemies.  Enemies that quickly locked the techs and items and then if you beat them fast enough you got alot of TP.  I always thought it was their first attack that locked tech/items but after switching their AI to a new enemy I learned that techs and items still weren't usable.  There is somewhere else in the rom saying that this enemy doesn't allow items/techs...

Using Chrono Tweaker I haven't found a way to change this.  I was wondering if another pair of eyes could give it a shot.

--JP

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Challenge
« Reply #1 on: May 27, 2008, 02:24:14 pm »
Lots of fun with searching through memory addresses

If 7EA0D1 is 1, PC1 has lock status
If bit 0x08 in 7E5E4B is set, set 7EA0D1 to 1
In the routines right before the value is written to 7E5E4B, the value in the accumulator is loaded from 7E0018
After searching backwards some more, the value from 7EAEE8 is stored to 7E0018
And scrolling up some more, the value stored to 7EAEE8 was obtained from CC:7F4B (for enemy $5F, Rubble).  That's in the "12 byte attack data" sets.

But now there's a problem.  Changing the byte from 08 to 00 seems to have no effect.  There must be two kinds of Lock status. This one only seems to gray out the Techs in the Tech menu.  The real lock prevents even opening Tech or Item menu.

Now trying a PAR code search, comparing a non-lock monster $5E Hetake with $5F Rubble in battle

Success...when 01 is stored to 7EA0A7, lock status enabled.

Now a write breakpoint on 7EA0A7

And in the routines right above that it shows loading from a table.
E1DE02 and compare with 5F Rubble = E1DE1E

Well, how about that.  It's the Enemy Special Death data, which contained known bit settings that weren't figured out.

03 = Lock enabled.  Change to 00 to disable

21DE1E - set to 00 to disable lock for Rubble
21DE22 - set to 00 to disable lock for Turret
21DE26 - set to 00 to disable lock for Side Kick (Boss Orb's helper)

Have fun

edit: fixed address error
« Last Edit: May 28, 2008, 04:22:24 am by JLukas »

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Challenge
« Reply #2 on: May 27, 2008, 05:26:12 pm »
Record timing JLukas  :D

I to repeat it myself....opened up unheadered rom with hex editor and went to address 21DE22  and it wasn't 03.  It's 01 for me?   


Also (this isn't worth it unless you know off the top of your head that it is really easy).  Would it be possible to give this "locked tech" effect to an enemy of my choosing.  If you remember correctly there was a problem I had awhlie ago where I was trying to make an area where there were no techs.  It would also be awesome as a "handicapped" fight in the coliseum.  The only solution I could think of was to actually copy over their current techs to my own memory, forget the techs and then copy them back after the area was over.   

This would be a much more elegant solution.  If worse comes to worse I could just throw one of these guys in every fight.

--JP

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Challenge
« Reply #3 on: May 28, 2008, 04:40:40 am »
oops, updated the original post with the correction.

Yes, you can choose any enemy.  The data at 21DE00-21DE2B is the 4 byte data sets.  The first byte is the enemy index, and the third byte is the newly disovered lock setting.  Rubble is 5F 00 03 00 as you can see.  You can change the 5F to any other monster index, for example.

With a little more work, you could add additional enemies if you wanted to.  Just add 4 bytes using the above format.  Just make sure that the entire block is terminated with FFFF FFFF.  There's some free space after that block for expansion, but I'm not sure if Geiger added that free space to TF or not.  For now, you should probably leave it alone, but it's good to know that it's something that can easily be expanded and relocated later.

Also, I forgot to mention, that the lock setting only disables clicking tech and item menus.  If you want the "Lock All/Can't use Techs!" textbox to appear and the blue sphere, that's in the enemy AI as far as I can tell.

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Challenge
« Reply #4 on: May 28, 2008, 01:38:50 pm »
Awesome.  I figured it was in the AI, who would have thought it was all just for show.

This is pretty cool and I'm Definately going to have to implement this as a "handicapped" fight in the coliseum. 

I'll also explore it more it seems weird that they would have a whole byte just for locking techs and items.  Maybe one bit is techs and one bit is items....who knows maybe a bit is for regular attack?

--JP

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Challenge
« Reply #5 on: May 28, 2008, 02:55:31 pm »
I'll also explore it more it seems weird that they would have a whole byte just for locking techs and items.  Maybe one bit is techs and one bit is items....who knows maybe a bit is for regular attack?

--JP

I don't have the log handy from yesterday to check, but IIRC it was checking for 03 as an all-or-nothing.  I wouldn't be surprised if the rest of the byte was wasted.  The game is checking a small block of data for special case enemies and stops when it hits the terminate command described above.

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Challenge
« Reply #6 on: May 28, 2008, 03:35:12 pm »
Yup, you're right.  Putting other values in there did make cyclone work really weird though (the screen flashed really fast and there was a strange red border).  But I can just attribute that to glitching up.

It was worth a shot though.

Thanks for all the help.

--JP

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Challenge
« Reply #7 on: June 29, 2008, 08:53:29 pm »
OK, I got another challenge for the advanced people.

I'm working on making an enemy AI editor.  One thing I learned from the Tech editor is that an editor is next to useless unless you know the number of bytes per command.  I know that there is a trick to figure out the number of bytes per command I'm guessing that through geigers debugger you can keep track of the "program counter" (that's what it's called for computers maybe it's something else in snes).  I.E. (example from techs)


03 1A 20 04 60 10 10 10

Is just a random bunch of bytes but if you know how long each command is it's easy to translate it to

03 1A
20 04
60 10 10 10

which is one step away to making it the english version of

Loadanimation(1A)
Pause(04)
ChangePallette(10, 10, 10).

The way I was able to figure this out was cause ChickenLup had somehow figured out the lengths of each command.  getting this thread back on track and talking about "PC" im hoping that somehow with the debugger you can watch the program counter....so using the above example

PC = 0
Command = 03

(next step)

PC=2  //this means that the 03 command is 2 bytes!
command = 20

(next step)

PC = 4 //this means the 20 command is 2 bytes!
command = 60

(next step)
PC = 7 //this means the 60 command is 3 bytes


OK hopefully you get the jist of what I need.  So if someone can help me figure out how I can use the debugger to do what I need I dont mind doing the rest.  I'm mainl y worried cause even if I set the debugger to break point at the enemy I'm currently working on and I copy over the command I want to see the length of doesn't the snes copy it into memory first?  So that means I'd have to set a breakpoint in the RAM and I'm not sure how to figure out where it copied it to in order to set the break point there...

OK....I'll stop rambling I think I got the point across.

--JP

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1765
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Challenge
« Reply #8 on: June 30, 2008, 02:17:30 pm »
I played around with it last night without any luck.

I'd be glad to help even if you don't find anything - I'll just go with trial and error.

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Challenge
« Reply #9 on: June 30, 2008, 02:38:18 pm »
AI looks like it has a somewhat different format than described above.  Gato is a good starting point for research, and is only $28 bytes.  The AI is at CCA77B-CCA7A2 from CL's AI list.  Set a read breakpoint on the first byte (CCA77B) and enter battle with Gato.  It stops at C1AFFD.

Now, if you were to set C1AFFD as an execute breakpoint,  assuming that it used a format like event commands, it would stop on each new command and you could figure out the lengths easily from that.  However, it only triggers for that one byte, so we're out of luck there?

But there's a lot of helpful info starting from that breakpoint.  Press Step Into and follow what's going on.  The first AI byte is stored to 7EB239, then x2, then a transfer to x reg, so it can be used as an index for a pointer table starting at C1B80D.  The pointer for index $00 is 8EA7 and it jumps to those routines at C18EA7.  From there it's looking at more AI bytes and loops until it hits a $FE terminate command.

That should help get you started.  The C1B80D pointer table will probably be the main key for this.

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Re: Challenge
« Reply #10 on: June 30, 2008, 05:14:17 pm »
Hm I'm afraid that my experience with debuggers is pretty limited to Visual Studios and even then I'm sure I've only scratched the surface.  I'm going to ask a few general questions:

You say you set a "read break point" so I'm assuming this is copying all of gato's AI into ram.  Then you say it stops?  I'm not really sure what that means (I'm at work right now so I can't follow along myself).  Are you saying it copied the $28 bytes to C1AFFD?  Is this like a one time case or would all enemy AI go there (or just gatos.....or does it depend on a number of factors?) 

Then you say you set an execute break point.  So would this be when the "Program Counter" is on this address? 

That's really surprising that it doesn't follow along sequentially.  CL has definately made custom AI that seemed to just sequentially go through the commands.  JLukas I'm going to send you a PM in order to make sure I don't accidently give away a spoiler for CE.

Thanks for investigating this.

--JP

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Challenge
« Reply #11 on: July 01, 2008, 01:27:18 am »
You say you set a "read break point" so I'm assuming this is copying all of gato's AI into ram.  Then you say it stops?  I'm not really sure what that means (I'm at work right now so I can't follow along myself).  Are you saying it copied the $28 bytes to C1AFFD?  Is this like a one time case or would all enemy AI go there (or just gatos.....or does it depend on a number of factors?) 

Then you say you set an execute break point.  So would this be when the "Program Counter" is on this address? 

No, all the AI data isn't being copied to RAM, it doesn't have to be.  Things that are compressed, like location event data, do because it has to be decompressed to somewhere.

When you set a read breakpoint, the debugger will stop whenever it reads that specific address.  In this case, the first byte of Gato's AI data.  This breakpoint would only trigger for Gato.

With the execute breakpoint, it stops when the address is executed.  Unless there's some special cases, it should stop on C1AFFD which are the routines to read the first byte of ANY enemy AI data, not just Gato's.