Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;sa=topics;u=111e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa183.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;u=111e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa183.html.zx?h^@>lOKtext/htmlISO-8859-1gzip0|lWed, 11 Mar 2020 01:48:09 GMT0 0P?h^h7l Show Posts - LightPhoenix

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - LightPhoenix

Pages: 1 2 »
1
I have a (hopefully) easy question for the community that I'd like some confirmation on regarding AI scripts.

FF5 allocates 0x654 bytes in RAM for each monster's AI script.  This seems a bit like overkill, since by my calculations the longest AI script is 0x12D bytes.  Is this calculation correct?  Are there any known exceptions?  If so, significant amounts of RAM in the game could be freed up by reducing the amount of RAM allocated.  For reference, AI scripts are loaded at approximated C2/404D, and the amount of RAM is at 4056.

2
Game Modification Station / FF6 Bugfixes Only Patch?
« on: April 09, 2016, 05:58:42 PM »
I've tinkered with FF6 hacking in the past when I was first getting started, and some time later learned that my patch didn't play well with other patches.  I have some ideas I'd like to get back to with FF6, but I'd like to start with a "base" patch that covers the bugfixes.  I looked at the FF6 Improvement Project, and while it's cool I'm looking for something that is strictly bugfixes only, no interpretation.  Does this exist yet for FF6?  If not, would people be interested in something like this?

3
Final Fantasy V Research & Development / Amusing Bit of Timer Code
« on: April 03, 2016, 05:46:36 PM »
I've done this before for some CT code, but I came across this gem in the FF5 timer code:

Code: [Select]
C2/2085: A5 0C        LDA $0C (Are we looking at Stop?)
C2/2087: D0 00        BNE $2089 (uhhhh)
C2/2089: E6 08        INC $08 (return TRUE)

Nothing jumps directly to $2087.

4
Game Modification Station / Spell Animation Control Codes
« on: April 26, 2015, 04:45:47 PM »
This is based on the information Zeemis posted at http://www.ff6hacking.com/forums/showthread.php?tid=925.  Note that the addresses are different for the US version of the ROM.

The last bit of this post was a "control code,"  which had very little information.  This is similar (but not exactly the same) to animation details that I worked out on FF5.  It's a set of instructions to process how sprites act during the animation.  I've done a little work on it which I'm presenting here.  I'll probably come back to it from time to time, but I don't want to focus my energy on it.

So this is the code for 00C1, which is the Fire animation:

40 00Animation Speed
90 00Clear Sprite Flag #40, Set XX
EB 58 5D 5E 5D 65 5DBranch Based On Subsprite Number
C9 00Play Sound
80 3BSubcommand 3B (Show Target Mask)
83 99Move Sprite
8B 04While Loop XX Times
00Next frame?
80 3CSubcommand 3C (Clear Target Mask)
8CIterate While Loop
FFEnd Animation
83 79Move Sprite
8B 04While Loop XX Times
00Next frame?
8CIterate While Loop
FFEnd Animation

Running through it with brief notes:
1) First two bytes are animation speed and an unknown byte, higher is slower
2) 90: Handles setting bits #10 and #20 of 6F86,X.  Bit #20 controls transparency effect; clear means on, set means off)
3) EB: Jumps forward based on which subsprite we're on; Fire has three, so three branches
4) C9: Play sound; I believe 00 tells it to use the default
5) 80: Runs a subcommand based on the parameter.  3B masks the target with the spell palette.
6) 83: Moves the spell sprite; #1F is the amount, #E0 is the direction
7) 8B/8C: Does a while loop - loops over the code xx times.  89/8A is the for loop version.  The difference is that the for loop counts what loop we're on, the while loop does not.
8) 00: Not sure; numbers less than #80, like in FF5, seem to indicate frames to display.  I think 00 is short hand for "next frame."  However, it could just be a way of pausing with a while loop.
9) 80 3C: clears the target mask.
10) FF: Signals the end of the animation


5
Game Modification Station / FF6Hacking Down?
« on: March 28, 2015, 05:13:17 PM »
Posting this here since I think it's the most pertinent to people that post in this subforum.  My apologies if it's in the wrong place.

Does anyone know what happened to ff6hacking.com?  It looks like the site got deleted by some sort of keyword search.  Are there plans to get the site back up?  I don't post there often but I pop in and read threads every so often.

6
Game Modification Station / FF6 isn't the only poorly coded game...
« on: December 27, 2014, 04:23:48 PM »
Normally, FF6 is touted as one of the shoddier coded games out there, and with good reason (likely a poor compiler).  However, if you're ever looking at the code for CT, you'll be routinely presented with such gems as this:

Code: [Select]
$C1/BB53 20 60 BC    JSR $BC60

$C1/BC60 80 7E       BRA $BCE0

$C1/BCE0 60          RTS

I think we should all take a moment to appreciate this pinnacle of assembly coding.   :laugh:

7
Final Fantasy V Research & Development / SNES Ability Expansion Patch
« on: February 09, 2014, 02:58:53 PM »
Hey everyone.

So I took a bit of a break with FF5.  Frankly, I got a little burned out and frustrated with it.  However, I picked it up this weekend and banged out this patch. 

It does what it says - provides a very basic framework for adding additional abilities to the game.  You'll need asar to compile it, and I used the original ROM with RPGe's 1.1 patch applied.  However, any ROM expanded to 20MB (providing the E4 bank) should work.  It's not extensively tested, but I am planning on using it in a further project so I will probably be updating it as I go.

Just to be clear, here's what it does not do:
  • It doesn't free up any RAM space.  But at least it doesn't use any extra.
  • It doesn't add more RAM to save abilities.  What's there is there, but there is some free space.
  • It doesn't add new jobs.  You'd need more RAM space or to rework how jobs are saved.
  • It doesn't add new spells, though you can use whatever assets exist.
  • It also doesn't add new spell animations, though you can use whatever assets exist.
  • It also doesn't add new sounds, though you can use whatever assets exist.
  • With those last three said, there is a lot that you can do with those assets and some coding.
  • It doesn't include *every* function used for effects or animations.  If you find something you want to mimic, look at the original code and use that as a base.
  • It's not a guide to adding new abilities.  I'm happy to help people if they ask, but a complete guide would take much longer than a weekend.  I have a couple other posts/docs here that should help.

8
Game Modification Station / FF6 Selectable Blitz/SwdTech Patch
« on: December 14, 2013, 04:26:15 PM »
There's not overly much to say here - the patch does exactly what it says in the title.  Ronnen's original MenuBlitz patch contained a fatal error - it overwrote pointers (3B/3C) used in the in-battle text display code.  This patch avoids that.  Additionally, it allows for SwdTech to be selected as well.

I think the more interesting thing I've done here is made the code more generic.  A lot of the menu code is duplicated between skills, using different pointers.  I made an effort here not just to copy functions, but make them generic.  With a little work, this could be extended to free up more ROM in C1 and C3 by converting similar skills (Dance, Tools, Magitek) to use this system.  It is for all intents and purposes completely inline, so it shouldn't conflict with most other patches.

There is one minor bug: if you have Gogo equipped with Blitz and Tools, the might be some minor recall issues with the cursor.  This shouldn't affect the actual usability of Gogo or either skill.  I have not tested this extensively.

I've included the assembly, and an IPS patch for versions with and without a header.  IPS patches were created with Final Fantasy III (U) (V1.0), CRC32: A27F1C7A.  I'll be keeping an eye on the thread, so let me know if there are any issues.

[UPDATE] Fixed a bug in which I foolishly forgot to uncomment something.  As a result, Dance probably would crash the game.  Oops.  Please redownload and make sure you have version 1.1.  Also, please leave any bugs here, I do check this thread.

9
Final Fantasy V Research & Development / Smaller Inventory Patch
« on: September 29, 2013, 06:50:26 PM »
A while back, I was thinking about ways to free up more RAM space for modding use in FF5.  The method I had settled on was reducing the size of the inventory.  I'm happy to announce that this patch is finally (mostly) ready!

I had thought it would be a relatively simple matter of replacing a few values indicating the size of the list.  That was a naively optimistic assumption.  Since there are 256 items, and 256 slots, there are a number of instances where it's assumed there will always be somewhere to put an item.  Interestingly, there are also some bits of code that actually account for a disparity between the number of items and number of slots.  So it wasn't a complete rewrite, but it wasn't completely inline like I wanted.  It's not 100% finished, but the rest of the things that need to be done are cosmetic and don't affect the function.  Right now it's hard-coded for 128 items; I would like to make this a something you can define when it's assembled.

Speaking of assembly, I have only uploaded the ASM file.  I'm not planning on making an IPS patch for this, though I don't mind if others do.  Why no IPS?  Frankly, this is a patch for experienced modders - if you can't handle assembly (or at least patching asm files) yet, you really don't need this.  Use xkas 0.6 or (preferably) asar to compile it.  When testing, I used the ROM with RPGe's patch already added; the CRC32 value is 17444605.  It should work with most expanded ROMs, although I doubt it will work with the original Japanese ROM.  I haven't tested it.

This has mostly been a labor of learning and love (except the optimize function - fuck that code).  I mostly started this for two reasons: to learn ASM coding with asar, and to open up some RAM space for the mod I'm working on.  Honestly, 128 slots is probably overkill; I'm not sure I really need 256 bytes of RAM.  Anyway, if there are any questions, bugs, comments, whatever, feel free to let me know!

10
Final Fantasy V Research & Development / Character Glow and Palettes
« on: February 15, 2013, 07:21:02 PM »
Another minor thing, but could be useful.  I was screwing around with palette information mainly to create a new status.  I eventually coded up a rough FF6-style glow effect.

All character palette information (afaik) is handled by a function located at C1/B1AC.  This function is relatively straightforward.  First, it checks to see if the character is Wounded; if so it uses the default character palette.  Otherwise, it loads the class palette.  Then it runs two sets of checks; one for Status 0/1 (palette changes) and a second for Status 2 (glowing effects).  As coded, once a palette change effect is handled, the function skips to the glow effect.  In order: Stone, Zombie, Poison, Aging, Berserk.  Similarly, once a glow effect is set, the function skips to the end.  In order: Wall, Armor, Shell, Stop, Haste, Slow.  There's no reason multiple palette changes couldn't be applied with simple code changes, and some relatively simple coding could even allow multiple glow colors.

Palette information is stored at 7E/7F89,Y for each character, and is 0x20 bytes long (16 2-byte values).  Note that "glow" effects are really just changing the palette outline (at 7F8B) in a simple on/off manner.  I have a basic list of what each 16-bit value controls, but not with me: I'll update this post when I can grab the notebook.

[EDIT]My list isn't as detailed as I thought it was, but for the sake of reference:
Code: [Select]
7F8B: Outline (ie Glow)
7F8F: Eyes
7F91: Skin A (see Berserk/Zombie)
7F93: Hair A (see Old)
7F99: Skin B
7F9B: Hair B (shadow)
7F9D: Hair C (highlight)

11
This is a minor bit of information that anyone modding spells will find useful.  Again, this was just sitting around, and I figured I should share it.

The determination of what spells can be used in battle is performed whenever the equipped commands change.  This code can be found at C2/E6E0, and is relatively straight-forward.  The code loops over the character's equipped abilities, sets the level for each magic type, and then saves this data in three bytes per character (see below).  There is special handling for Red and X-Magic that sets both the White and Black magic levels.  This data is saved to 7E/053D-3F and copied to 7E/203D-3F for use in battle.

Code: [Select]
7E053D XX          1st Player Sword/White Display                                     
7E053E XX          1st Player Black/Dimen Display                                     
7E053F XX          1st Player Summon/Misc Display
(Layout borrowed from samurai goroh's FFV document)

This data is further parsed in battle menus at a beefy bit of code that starts (I think) at C2/4287.  I haven't quite deciphered it yet, but the basic mechanism of action is that the spell level (7E/203D-F) and learned spells (7E/0950) mask the spells you can't cast.

The determination of what spells can be used out of battle is contained in a three byte lookup table starting at C0/EEF4.  I have not verified everything, but the data format appears to be as follows: Spell Number/Index, Magic Type, Row * 3.  I do not know if the second and third bytes actually perform any function.  It's very simple: if the Spell Number is in this list, it can be cast outside of battle.

12
Hey everyone.  I have a bunch of stuff that I've researched to varying degrees that I wanted to share.  Most of it is minor but useful stuff.  However, I wanted to share my research on the FF5 menus with everyone.  I haven't seen this info readily available anywhere, although I'm sure it's been looked into before.  It's not complete by any means, but it's been sitting around for a month or two without being worked on.

Menu drawing seems to start at subroutine C2/C16A.  The chosen menu ID (MID) is one byte stored in $43.  The enumeration of menus starts at 01, not 00.  The values range from 01 to 0D; no sanity checks are run on the value, so you can crash the game changing it.  The MID is used as the index for a lookup table at C0/F5E7, which gets the address for a MVN for the menu data.  The menu data is a set of twelve addresses stored at C0/F601, grouped into three sets of four.  I've provided this data below.  Each group of three uses a separate function, as indicated in the column headers.  The numbers in the header indicate the destination in RAM (bank 7E) where the data is written to.

Code: [Select]
         | Fxn C2/C1B8         | Fxn C2/C1F7         | Fxn C2/C1A6
         | 2000 3000 4000 5000 | 7000 7080 7100 7180 | 7200 7280 7600 7500 
Menu ID  | BG1  BG2  BG3  BG4  | ???  ???  ???  ???  | Msk1 Msk2 Ctrl Sett   
--------------------------------------------------------------------------
01 Main  | 0000 0000 AD3F AD65 | 0000 0000 B816 B822 | AC86 AC98 A300 ABBA
02 Abil  | 0000 ADE3 ADF4 AE5E | 0000 B82C B82F B84F | ACCE 0000 A382 ABCB
03 Job   | 0000 0000 AEEA AF0F | 0000 0000 B85C B862 | 0000 0000 A434 ABDC
04 Equip | 0000 AF3C AF4D B02B | 0000 B868 B87A B88C | ACDA 0000 A4EE ABED
05 Stats | 0000 0000 B095 B0D3 | 0000 0000 B89A B8A0 | ACE6 0000 A598 ABFE
06 Store | 0000 B19F B1EB B237 | 0000 B8B0 B8BB B8D1 | ACF2 0000 A5A2 AC0F
07 Item  | 0000 0000 B363 B3B7 | 0000 0000 B8C9 B8D1 | ACF2 AD01 A73C AC20
08 Magic | 0000 0000 B3D6 B3F3 | 0000 0000 B8E0 B8E6 | 0000 0000 A856 AC31
09 Confg | 0000 0000 B66E 0000 | 0000 0000 B93E 0000 | 0000 0000 AA38 AC75
0A Find  | 0000 0000 B636 0000 | 0000 0000 B919 0000 | 0000 0000 AA26 AC64
0B Save  | 0000 B536 AD3F 0000 | 0000 B8FD B816 B905 | AD1F 0000 A978 AC42
0C Load  | 0000 B56A AD3F 0000 | 0000 B8FD B816 B905 | AD1F 0000 A9AA AC42
0D Name  | 0000 0000 B5F5 B620 | 0000 0000 B90F 0000 | AD10 0000 A9E4 AC53

Each address is a location in the C3 bank that indicates the data to get for use in the functions.  A value of 0000 indicates no data; this iteration of the function will be skipped.

The first set of four draws the actual windows to the background layers.  The data is a list of instructions on how to draw the menu windows.  The data format is one byte for the instruction with a number of parameter bytes following, depending on the instruction.  The lookup for number of bytes per instruction is located at C3/AD31.  There are 7 instructions, 00 through 06.  I don't know the exact differences between some instructions, but a rough guide:

Code: [Select]
00 | End of Inst. List  | 0b |
01 | Fill Current Layer | 2b | Char#, Color
02 | Draw Box           | 6b | Char#, Color, X, Y, Width, Height
03 | Draw Bordered Box  | 6b | Char#, Color, X, Y, Width, Height
04 | Draw Text          | 5b | String#, Color, X, Y, Removed (Note: Color non-functional)
05 | Change Layer       | 2b |
06 | Draw Indented Box  | 6b | Char#, Color, X, Y, Width, Height (Calls 03/02)

The second set of four I have not as of yet decoded.  The data is parsed into what seems like a longer instruction set, but I have not discovered how it works.

The third set of four control, in order, window masks one and two, menu control, and window mask settings.  See Anomie's register doc for information on the window masks.

The interesting bit is the presumptive cursor control and selection handling.  There is a two byte header indicating the length in bytes of the data set, followed by a set of eight byte instructions.  Each instruction has the following format (based on the item menu):

Code: [Select]
00 | Instruction Type
01 | Instruction Parameter
02 | Cursor Position X
03 | Cursor Position Y
04 | Up Button Parameter
05 | Down Button Parameter
06 | Left Button Parameter
07 | Right Button Parameter

The instruction set is implicitly enumerated (ie, order matters).  The Up/Down/Left/Right parameters go to the indicated instruction.  Cursor position is self-explanatory.  The instruction type and parameter indicate what to do.  In the case of a cursor selection, it indicates what to do when the accept button is pressed.  In the case of a special instruction (for example, scrolling the menu up/down), it indicates a passed parameter.

13
Pandora's Box / Issue With Patching, Could Use Some Help
« on: October 13, 2011, 12:47:39 AM »
I was hoping to try PB, but I can't get xdelta to patch the game.  I've confirmed with NRST and the readme file that I have the correct ROM - both the CDC32 and MD5 match.  I downloaded the 2b patch from the website.  When I run either xdelta program listed in the readme, it gives me the following error: xdelta3: target window checksum mismatch: XD3_INVALID_INPUT.  I don't have much experience with the XDelta format, but I'm assuming this means the ROM is incorrect?  Any advice would be welcome, as I'm eager to see what's been done.

14
Final Fantasy V Research & Development / Replacing Command Abilities
« on: December 24, 2010, 08:59:54 PM »
(Merry Christmas!)

There are up to six things we have to do in order to replace an ability with a new one:

1) Spell Entry
2) Animation Entry
3) Effect Code (in C2)
4) Animation Code (in C1)
5) Text
6) Job Info

As an example, I will be replacing the command "Pray" with "Psych" and giving it to a Black Mage at JLvl 4.  For simplicity, the ability will function almost exactly like the spell.  The one change will be the MP cost, which will be 0.

Note: I'll be assuming people reading this will be familiar with the basics of the data format.  All that information is on the site here.  Please feel free to share this information.

1) Spell Entry

Many abilities in the game are actually spells that are called via code (see Part 3).  In fact, the code interpreting these is for all intents and purposes identical.  We could simply copy the spell data for Psych to the ability data for Pray, change the MP cost, and skip straight to editing text.  In fact, for this simple change, that's pretty much what we're going to do.  That won't always be the case, as I'll demonstrate with a subsequent example.

So, copy the Psych data to D1/5AE8 (where the Pray ability is located), and change the MP to 0.  Easy!  You'll want to note the ability offset as well, which is 21.

2) Animation Entry

We don't just want our Psych ability to act like Psych, we want it to look like it as well.  Luckily, we're using an animation that already exists, so we don't actually have to do much here.  However, if you wanted to add a new animation, you could do so by editing the animation data table.

We do want to know the offset of our animation though; it's 35.

3) Effect Code

All abilities call a snippet of code that sets up the animation and effect.  This uses indirect addressing; there's a lookup table at C2/4A92 that is a list of addresses.  This maps to the list of command abilities, with one big caveat: subtract one from the ability number to get the offset.  I don't know why they skip ability number 00 (Nothing), but it does.  So, Pray is ability number 21, so we want entry 0x20.  Our Pray code is at C2/1169.  NOTE: If you have InstructrTrepe's function offset list, several of the addresses for the commands are wrong.  I've verified this in code and with breakpoints.  Use the lookup table to be certain.

Here's our Pray code.  I've noted the functions of each subroutine.
Code: [Select]
C2/1169: A9 21        LDA #$21
C2/116B: 20 AA 16     JSR $16AA   Load Ability Parameters
C2/116E: 20 5F 17     JSR $175F   Get Selection
C2/1171: 20 A9 02     JSR $02A9   Separate Enemy/Ally Targets
C2/1174: 20 C2 02     JSR $02C2   Count Targets
C2/1177: A9 21        LDA #$21
C2/1179: 20 FA 16     JSR $16FA   Queue Banner
C2/117C: A9 20        LDA #$20
C2/117E: 20 E1 16     JSR $16E1   Queue Ability Animation
C2/1181: 20 1A 17     JSR $171A   Get Attack Type
C2/1184: 20 35 17     JSR $1735   Increment Effect Counter
C2/1187: 4C E3 98     JMP $98E3   Run Effect

As you can see, there are three functions that take a parameter (16AA, 16FA, 16E1).  We don't need to change the ability or the banner.  Now, you may be thinking we need to change the input for Queue Ability Animation.  It makes sense, right?  Unfortunately, it's also incorrect.  We'll leave it at #20.

4) Animation Code

So why exactly did we leave the input for QAA at #20?  The detailed answer is a little complex, and not strictly necessary to understand for this basic example.  However, that parameter actually indicates the value for a lookup table at C1/8D88, which leads to the following code:
Code: [Select]
C1/9909 20 93 9D    JSR $9D93   
C1/990C A9 0B       LDA #$0B
C1/990E 20 EC 96    JSR $96EC
C1/9911 A2 D8 00    LDX #$00D8 Anim: Pray
C1/9914 20 9C B6    JSR $B69C Run Animation
C1/9917 7B          TDC       
C1/9918 4C EC 96    JMP $96EC    Continue Animations

The important lines are the LDX and subroutine $B69C.  All abilities call bits of code like this, which are animation handlers.  For Pray, this is pretty simple.  Go ahead and change that #00D8 to #0035.

5) Text

This is relatively straight-forward.  Change the ability name at E0/1237; this also changes the text for the menu and the banner.  Change the description at D1/776A, but make sure to keep it at 24 bytes (use padding if needed).  The lookup table for description addresses starts at D1/716C.

If you went on to Part 6, then pulled up the menu, you'd notice that the job level information is still indicating Chemist L4.  Interestingly, this is not text, but a byte value that indicates job and level.  This data is located at C0/F739, and uses the same ability offset.  Bytes 0-4 indicate the job number, and bytes 5-7 indicate the level.  So we go to offset 21 at C0/F75A, which is currently set at #90.  Parsing that code, it's job number 10 (Chemist) and level 4.  We're going to change that to 8A (job A, level 4).

6) Job Info

If you've made it this far, you shouldn't have a problem with this next part.  Calculate or lookup the offset for the job info table (38), go to the data, and change the learned ability to #21.  Now you're ready to go!

15
Submissions / FF5 Doc: Spell Animation Guide v0.8
« on: October 24, 2010, 11:24:44 PM »
Not much to say, standard txt file.  More info on the FF5 forum.

[attachment deleted by admin]

Pages: 1 2 »