Author Topic: Steal/Sneak Command  (Read 8242 times)

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Steal/Sneak Command
« Reply #15 on: October 02, 2013, 12:23:55 AM »
I don't know if stats are static or not, but regardless, they should play some role in determining steal success rate.

119 bugs fixed and counting.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #16 on: October 02, 2013, 01:38:15 PM »
Hmm, maybe base it on Agility vs. Enemy's Speed and increase the base percentage to 65?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #17 on: October 02, 2013, 04:23:24 PM »
Fixes to make to Steal...

1. Alter it to be 65 Base rather than 50.
2.  Base it on Agility vs. Enemy Speed.

$03/E1F0   A9 32   LDA #$32   A:0035   X:0000   Y:0000   P:envMxdizc - Load 32 into A (50?)
$03/E1F2   6D 82 26   ADC $2682  [$7E:2682]   A:0032   X:0000   Y:0000   P:envMxdizc - + Caster's Level.
$03/E1F5   38    SEC   A:003C   X:0000   Y:0000   P:envMxdizc - Set Carry Flag
$03/E1F6   ED 2F 27   SBC $272F  [$7E:272F]   A:003C   X:0000   Y:0000   P:envMxdizC - - Target's Steal Prevention.

To...

$03/E1F0   A9 41   LDA #$41   A:0011   X:0000   Y:0000   P:eNvMxdizc
$03/E1F2   6D 95 26   ADC $2695  [$7E:2695]   A:0041   X:0000   Y:0000   P:envMxdizc
$03/E1F5   38    SEC   A:004B   X:0000   Y:0000   P:envMxdizc
$03/E1F6   ED 15 27   SBC $2715  [$7E:2715]   A:004B   X:0000   Y:0000   P:envMxdizC

3. Make it so you can only steal once from any given enemy.

That... I thought would be easy enough. Set the Enemy's Item Byte to 00 and erase the check for C0. Unfortunately it seems that stealing is done after the game has already put back what it used in the 7E2700 area and any changes made to it do not carry over. I could change it using a Slot Check, but I can't use that either because it doesn't seem I have enough room to work with.

It's a difficult conundrum to be certain.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Steal/Sneak Command
« Reply #18 on: October 02, 2013, 04:56:13 PM »
Enough room as in space to rewrite the subroutine, or enough room as in a place in RAM to set an "already stolen from" flag?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #19 on: October 02, 2013, 09:32:38 PM »
Enough Space in the subroutine yes, because I don't believe the routine ever takes slots into account, and to make it do so seems quite difficult. I tried making a plain "STZ 7E2773" in 7E2773, but the game carries no changes done to the Target back to their normal stats. I wonder if it's a commonly used subroutine that I've ignored by any chance... If so there might be enough room in that regard.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Steal/Sneak Command
« Reply #20 on: October 02, 2013, 10:58:19 PM »
You could always JSL to somewhere else if you need more subroutine space...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #21 on: October 02, 2013, 11:43:25 PM »
That's true. But is there any place with free room enough to do this? I wish I could figure out just how the game takes the data change to 7E2700 section and turns it back into real data for the enemy.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Steal/Sneak Command
« Reply #22 on: October 03, 2013, 05:15:48 AM »
There's plenty of free space in the ROM, and expanding further (you'd never need it for code) it is painless.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Steal/Sneak Command
« Reply #23 on: October 03, 2013, 08:26:30 AM »
Yeah, the Steal routine is relatively long, but it's still only about 11 (hex) lines. you could, in theory, open your hex editor and just search for
Code: [Select]
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
(a couple extra lines for your custom code)
I know from my summon research that this occurs at least twice among monster image data, but I wouldn't be surprised if you found several other instances as well.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #24 on: October 03, 2013, 09:19:44 AM »
I had thought extending the Rom would throw off the CRC or something like that? Also I believe that Command Formulas are only revolved around 03XXXX, mainly because of this table I've found...

Starting 03B37C

00 - 99C4 (03C499 - Location of Fight)
01 - 9DEB (03EB9D - Item?
02 - 46CC (03CC46 - General Spell Call - White
03 - 0000 (Blank) - (Placeholder for Black)
04 - 0000 (Blank) - (Placeholder for Call)
05 - E9E9 (03E9E9 - DarkWave)
06 - 54E9 (03E954 - Jump)
07 - 1AEA (03EA1A - Recall)
08 - 00E9 (03E900 - Sing)
09 - 76E8 (03E876 - Hide)
0A - DCE2 (03E2DC - Salve)
0B - 52E8 (03E852 - Pray)
0C - 36E8 (03E836 - Aim)
0D - F0E7 (03E7F0 - Focus)
0E - B4E6 (03E6B4 - Kick)
0F - 96E6 (03E696 - Gird)
10 - 3EE4 (03E43E - Twin)
11 - C3EA (03EAC3 - Bluff)
12 - E6EA (03EAE6 - Cry)
13 - 0FE6 (03E60F - Cover)
14 - 53E1 (03E153 - Peep)
15 - 0000 (030000 - Crash)
16 - 4CE3 (03E34C - Throw)
17 - CCE1 (03E1CC - Steal)
18 - 0000 (Blank) - (Placeholder for Ninja)
19 - FAE3 (03E3FA - Regen)
1A - D1E3 (03E3D1 - Change)
1B - DEE9 (03E9DE - Parry)
1C - BBE8 (03E8BB - Show)
1D - 53E6 (03E653 - Off)
1E - A2E9 (03E9A2 - Jump's Return)
1F - 23E8 (03E823 - Focus's Return)
20 - E3E4 (03E4E3 - Spell Casting Portion of Twin)
21 - 4FB3 (03B34F - ??)
22 - 38E4 (03E438 - Something to do with the very end of Regen Routine?)
23 - 0000 (Blank) - ??
24 - B2E1 (03E1B2 - Something to do with the very end of "Enemy runs away" Routine?)
25 - 2002 (030220 - ??)
26 - BC20 (03BC20 - ??)
27 - 22BC (03BC22 - ??)
28 - 38A5 (03A538 - ??)
29 - D2E9 (03E9D2 - Something to do with the very end of Jump Routine?
2A - 058D (038D05 - ??)
2B - 1C36 (0336C1 - ??)
2C - AD77 (0377AD - ??

And so on...

But I see what you're getting at, using JSR's in unoccupied space in order to get what I need done, done.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Steal/Sneak Command
« Reply #25 on: October 03, 2013, 11:14:39 AM »
You'd have to use a JSL instead of a JSR because that allows you to specify a three-byte address. The commands are all kept within the 3XXXX range for that exact reason (it takes one less byte of code to execute a JSR or a JMP versus a JSL or a JML). There's no reason, though, that you can't JSL to some random empty space outside of the 3XXXX range as long as you're just inserting an extra piece of linear code - you just RTL at the end and you'll be back in the 3XXXX range where you started.

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Steal/Sneak Command
« Reply #26 on: October 03, 2013, 11:31:25 AM »
I had thought extending the Rom would throw off the CRC or something like that?
Making any kind of a change will throw off the CRC. If you're paranoid about it, recalculate the CRC when you're done making changes. :cycle:

119 bugs fixed and counting.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Steal/Sneak Command
« Reply #27 on: October 03, 2013, 12:37:59 PM »
One thing I'd be concerned with regarding expanding the ROM would be the effect that doing so might have on its compatibility with FF4kster (at this point it's probably safe to say your research here is intended to supplement edits you'll be making with FF4kster).
I've made far less significant changes that caused it to no longer recognize my ROM. I guess you could make a patch to apply after all FF4kster edits are finished, though...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Steal/Sneak Command
« Reply #28 on: October 03, 2013, 11:25:03 PM »
Hmm, yes that is a real danger. I'd rather not make any of the hacks I make be incompatible with the best FFIV Editor there is. I'll probably just have to use blank space already in the ROM itself, where ever that may be. It's a minor issue though. The real issue is to find how slots are recorded.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Steal/Sneak Command
« Reply #29 on: October 04, 2013, 01:59:15 PM »
In its current state, FF4kster is not a fan of nonstandard rom sizes. In fact, file size is currently how it checks whether the rom has a header.
Let's dance!