øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2245.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexaace-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.40e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexaace-2.html.zxv$h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0PdsEOKtext/htmlISO-8859-1gzip8:ÖsEÿÿÿÿÿÿÿÿTue, 10 Mar 2020 23:52:46 GMT0ó°° ®0®P®€§²ð®u$h^ÿÿÿÿÿÿÿÿ”9sE New bank C3 disassembly, and related docs

Author Topic: New bank C3 disassembly, and related docs  (Read 7303 times)

Novalia Spirit

  • Pandora's Masking Tape
  • *
  • Posts: 33
  • Gender: Male
    • View Profile
New bank C3 disassembly, and related docs
« on: July 12, 2016, 11:34:15 PM »
From the official description:

Quote
A set of fully commented disassemblies and complementary documents pertaining to bank C3 from the SNES versions of Final Fantasy VI. The bank handles all of the field menus, as well as ending scenes that are beyond the scope of the event program.

The archive includes:
  • A reassemblable, optimized disassembly of bank C3. As it stands, the bank is reduced by 26,021 bytes, and is consequently 42.3% smaller.
  • An alternative version of the optimized disassembly that sacrifices an insignificant amount of space in favor of definitions for global text arrays.
  • A reassemblable, unmodified disassembly of bank C3. Recommended for projects of limited scope or for testing purposes. Useful for reverting modifications, for locating data, or for determining loop points or entry points.
  • A basic disassembly of bank C3. The main purpose of this document is to provide the address of every instruction in an unmodified game.
  • A basic disassembly of bank D4, which acts as an extension of bank C3. A reassemblable, unmodified version is also included.
  • A basic disassembly of bank C2, a hodgepodge in terms of content, purged of code and data irrelevant to bank C3.
  • A complete memory map, one for the menus and one for the ending, that details the structure of both RAM and VRAM.
  • A character table required by the assembler to convert game text to hex.
  • Define-type directives that cover hard-coded and untypable characters, as well as global text arrays.
  • Release notes that include additional information such as abbreviations and compilation instructions.
The current plan is to produce an equivalent of each document for the Super Famicom version. Given the abundance of memory available, the implementation of labels for RAM addresses was dismissed as impractical. In the same vein, the size of every instruction is not explicitly specified at this time.

This project is the result of more than a thousand hours of effort. In order to address concerns regarding accuracy and consistency, all of the documents were written from scratch. My own contributions to the existing bank C3 disassembly, such as the long list of menu commands near the beginning of the document, were not even consulted.

As might be expected, my annotation system has evolved quite a bit over the years: comments are now denoted by a semicolon instead of parentheses, which arguably enhances readability, and are generally far more useful and accurate; they are also brief and concise, though admittedly terse in some areas; most functions are now divided into subsections, improving not only readability, but also comprehension, as the segment titles often compensate for the terseness. Oh, and yes, I still comment every single line individually... sorry if I got anyone's hopes up! :P

I might post a list of bug findings, content that has been cut, version differences, and other observations if the thread garners enough interest.

Download link: http://www.romhacking.net/documents/736/
« Last Edit: October 14, 2016, 01:59:40 PM by Novalia Spirit »

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: New bank C3 disassembly, and related docs
« Reply #1 on: July 13, 2016, 02:53:53 AM »
Yay, I get to be first to say "Welcome back!"

From looking over this, I can see that you have put a tremendous amount of thought and detail into these documents. It's also quite amazing in the timing of it -- I have just completed a pair of disassemblies for myself (one for upper C2 and one for C1+lower C2). The idea being similar: optimize and gather whatever possible info I can for commentary. But, as you always have, you have taken the attention to detail to the next level. I certainly will not be releasing mine any time soon, as they would look ridiculous next to these terrific examples of clean documentation.

Naturally, I am curious to see the similar treatment for the SFC version, as we all know it contains the config option whereby one may set specific actions to any selected controller button. While we did manage to make that work in PB, I am becoming more and more convinced that such a thing is needed for a standalone patch for FF3us.

I'm hoping this thread reaches your requisite attention level. :)
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.

magitek

  • Antlion
  • *
  • Posts: 67
  • Gender: Male
  • Juggler
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #2 on: July 13, 2016, 05:43:16 PM »
Glad to see you back in action, Novalia. This is amazing work! Thank you so much, this will help with figuring out some menu stuff I hit a wall on a while back, hopefully.
Don't feed the trolls. Use proper grammar, spelling, and punctuation. Eat your vegetables.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: New bank C3 disassembly, and related docs
« Reply #3 on: July 13, 2016, 08:12:06 PM »
I actually never expected to see such a detailed disassembly for any FF3us bank. This is really great work!  :whoa:

Novalia Spirit

  • Pandora's Masking Tape
  • *
  • Posts: 33
  • Gender: Male
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #4 on: July 15, 2016, 05:18:23 AM »
Thanks for the warm reception and the kind words, all of you. :)

Quote
It's also quite amazing in the timing of it -- I have just completed a pair of disassemblies for myself (one for upper C2 and one for C1+lower C2). The idea being similar: optimize and gather whatever possible info I can for commentary.

I wish you the best with this project, and strange timing indeed. If you don't mind, I'm really curious to know how much space you have managed to free up so far, even if it's likely a small amount at this point.

My ultimate goal, which is probably far too ambitious and unrealistic, is to get every single code bank fully commented, and make a reassemblable version of each completed or nearly completed bank in the process. I currently have a fully cleaned up disassembly of every bank, and could easily convert them using the various scripts I wrote for bank C3 (it's mostly a matter of marking data tables so the script knows how to present the hex values), but I'd rather wait until I've made significantly more progress. Once I'm done with C3, I'm going to rewrite and hopefully finish my bank E5 disassembly, only because it's such a small bank. After that, I'll probably move on to bank C0, as I've already decoded half of it back in 2009, though I do intend to start from scratch once again. The same goes with bank C2, which is likely going to be the next victim on my list. :P

Quote
Naturally, I am curious to see the similar treatment for the SFC version, as we all know it contains the config option whereby one may set specific actions to any selected controller button. While we did manage to make that work in PB, I am becoming more and more convinced that such a thing is needed for a standalone patch for FF3us.

There's also the SwdTech renaming menu. Producing a standalone patch would be child's play at this point, but this would require so much free space that I'm not sure it would actually be worth it. One idea that I have been considering recently would be to create a fork of the optimized disassembly that would restore content from the SFC version. I know this isn't what you had in mind, but I think this solution could be regarded as a decent compromise.

Regarding the SFC disassembly, I've only been working on it for about a week, but things are progressing surprisingly fast. I have yet to decode anything exclusive to that version, but I've managed to import all of the comments via a script, and I'm almost done making corrections here and there to account for version differences, such as window layouts. It took me a year and a half to optimize the SNES disassembly, and since I'm definitely not going to spend so much time on the SFC version, I'm seriously contemplating using the optimized SNES disassembly as a base for the SFC counterpart. Naturally, the biggest drawback would be that the labels would reflect the SNES addresses, but the tradeoff would definitely be worth it.
« Last Edit: July 15, 2016, 06:19:19 AM by Novalia Spirit »

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: New bank C3 disassembly, and related docs
« Reply #5 on: July 15, 2016, 02:00:51 PM »
Always nice to see a legend return to the scene! And great work. :)

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: New bank C3 disassembly, and related docs
« Reply #6 on: July 15, 2016, 06:23:09 PM »
For optimization, I actually got much more done in C1 than in C2. For somewhat obvious reasons, I am considering C1 and the lower part of C2 as one project, and the upper part of C2 as a different project. That itself presents some issues, notably that I don't know where some of the data in lower C2 is loaded from, to I have to place ORGs there to keep it from moving.

There is opportunity for optimizing in (upper) C2, as is evident from almost any bug fix patch for that bank, but I am a bit conflicted on whether to do a "pure" optimization with no bug fixes (which was my original intent) or to do one with bug fixes included.

The overall goal is actually to have the original and bugfiix versions to coexist in one ROM, and to that end, I have a map of how I want to progress. Unfortunately, testing such a thing is very tedious and my time is not what it used to be.
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: New bank C3 disassembly, and related docs
« Reply #7 on: July 16, 2016, 09:52:49 AM »
The overall goal is actually to have the original and bugfiix versions to coexist in one ROM, and to that end, I have a map of how I want to progress. Unfortunately, testing such a thing is very tedious and my time is not what it used to be.

I also like the idea of being able to generate a custom ROM with different expansions from ASM files and data / graphic binary files. My share for this would be to rewrite part of ZoneDoctor/FF6LE, finish my monster expansion editor and add to it part of a rewritten FF3usME that cover various data expansion. Right now the expansions support I was imagining can all be done but some are highly tedious to manage and do edits after because of the lack of proper tools.

Starting from an optimized and bugfree FF3us would be a huge plus.

Novalia Spirit

  • Pandora's Masking Tape
  • *
  • Posts: 33
  • Gender: Male
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #8 on: October 14, 2016, 02:12:32 PM »
It took much longer than expected, but the SFC documents are finally out.

I initially hit a snag upon discovering that the compiler only accepts documents encoded in ANSI format, which does not support Japanese characters. Ultimately, this issue was resolved by including a set of tools and scripts that will first convert all pipe-delimited strings to raw hex values, before changing the encoding and finally invoking the compiler. The nice thing about this approach is that it allows for multicharacter encoding such as control codes, but it does come with a number of inherent downsides as well.

I was unhappy with the optimized disassembly's lack of user-friendliness, so I made the optimized SFC disassembly from scratch, and took the time to make one for the SNES version at the same time. This is naturally the main reason why the whole process took so long. The new version saves far less space, but is superior in every other aspect, and is generally preferable. Given how the original SFC bank has nearly no free space at all, the optimizations should come in handy.

The archive now includes a folder that contains two copies of bank C3, one for each version of the game, that are specially annotated and formatted for side-by-side comparison. The folder also contains a list of noteworthy version differences, which can also be found at the bottom of this post.

All of the existing documents were updated to correct mistakes or consistency issues, or to incorporate minor changes. In addition, pretty much all of the lists in the release notes contain new entries, and the document now also contains a list of bugs that were introduced by the optimized disassembly, and provides instructions for manually fixing them in the original copy.

Quote
Noteworthy local differences:
 - SNS: Actor classes were removed.
 - SNS: Button Settings menu was removed.
 - SNS: SwdTech naming menu was removed.
 - SNS: Various oversights led to new bugs.
 - SFC: Party gear overview lists body parts.
 - SFC: Actor naming menu has two pages of choices.
 - SFC: No "Please enter a name." in the actor naming menu.
 - SNS: Most narrow windows were expanded to accommodate for longer strings.
 - SFC: Buy menu adds a separator between item list and quantities on hand.
 - SNS: Cursor in gear menus points at body parts rather than equipped items.
 - SNS: Partial bug fix for lingering mosaic when switching members with L or R.
 - SNS: Magic and rare item lists have two columns rather than three.
 - SNS: Mastery percentages in Magic menu are preceded by an ellipsis.
 - SFC: Magic list separates spell types with a blank row.
 - SNS: Rare item list has fewer slots as a result of having fewer columns.
 - SNS: Inventory and Lore list have one column rather than two.
 - SNS: Inventory lists item classes to fill the void caused by the above.
 - SNS: Description window in Skills menu allows for two lines instead of one.
 - SNS: The above causes scrollable skill lists to contain one less onscreen row.
 - SNS: Title window in skill menus is moved to the other side and is shorter.
 - SNS: Changes made to Skills menu affect the bottom position of the scrollbar.
 - SFC: List of available equipment displays quantities owned.
 - SFC: Equip menu lists Gauntlet, Genji Glove, and Merit Award effects in use.
 - SNS: Actor name in Equip and Relic menus is drawn onto the portrait.
 - SFC: Config menu indents the battle-related categories after Bat.Mode.
 - SNS: Spell types in Config menu are preceded by a magic icon.
 - SNS: Spell types in Config menu are preceded by A, B, C rather than 1, 2, 3.
 - SNS: Two-dot leader is replaced with an ellipsis in some menus.
 - SFC: Spell elements are depicted using kanji instead of icons.
 - SFC: "Time" in the main menu and save file menus is fully capitalized.
 - SFC: "Empty" on blank save files is fully capitalized.
 - SNS: Portrait in Status menu is lower.
 - SNS: Status info in Status menu is displayed where the actor class would be.
 - SNS: Inconsistent spacing around two-dot leaders in the Status menu.
 - SNS: Changes "rate" to "%" after "Evade" and "MBlock" (redundant in Status menu).
 - SFC: Gear data menu appends "OK" to "SwdTech," "Runic," and "2-hand."
 - SNS: Some actor names in the ending differ, such as "Terra" instead of "Tina."
 - SNS: Translator's name was added to the credits.
 - SNS: List of special thanks in the ending differs, which affects the timing.
 - SNS: The small font for the credits is thicker.
 - SNS: "coordinater" is now "coordinator" in the credits.

Noteworthy global differences:
 - SNS: 256th inventory slot was made inaccessible to fix equip bugs.
 - SNS: The black and gray magic icons are mirrored horizontally.
 - SFC: No real VWF; all large characters in a string share the same width.
 - SNS: Monospaced digit characters are retained, but were touched up.
 - SNS: Monospaced capital letters are retained, but were touched up.
 - SFC: Monospaced font has no ellipsis.

I intend to release standalone patches to restore some of those features, but for the time being, I'm focusing on the restoration-type fork of the moderately optimized disassembly.

Edit: Added indentation in Config menu to list of version differences.
« Last Edit: October 19, 2016, 07:18:22 PM by Novalia Spirit »

Novalia Spirit

  • Pandora's Masking Tape
  • *
  • Posts: 33
  • Gender: Male
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #9 on: October 19, 2016, 07:36:22 PM »


It is, by and large, a fairly literal translation, except for the replacement of "Normal" with "Default." The original title actually translates as "Button Settings," but that covers about half of the screen, which looks terrible. The change is in line with the other titles, which are limited to a single word. On a related note, the title is now centered vertically, which looks better and is consistent with the Config menu.

I've included a standalone patch as an attachment. It optimizes an existing code section related to the Config menu, freeing up the space it needs for the new code, which is reduced to about a third of its original size. Source code is included to allow for customization.

magitek

  • Antlion
  • *
  • Posts: 67
  • Gender: Male
  • Juggler
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #10 on: October 20, 2016, 06:57:03 AM »
Pretty cool. A nice example of things that can come out of having the entire menu bank laid bare. :)
Don't feed the trolls. Use proper grammar, spelling, and punctuation. Eat your vegetables.

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: New bank C3 disassembly, and related docs
« Reply #11 on: October 20, 2016, 11:51:07 PM »
Nice, thanks for that patch, Novalia Spirit. I was wanting to add that functionality to the US version (again) but was not looking forward to digging into the code.
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: New bank C3 disassembly, and related docs
« Reply #12 on: October 21, 2016, 01:34:10 PM »
Pretty sick patch! Well done!

It occurs to me that there are some people in the Classroom whose lines should probably be affected by the new button mappings, though. Also, what happens if someone decides not to assign any buttons to "OK"? Seems like they'd be screwed, no?

:edit:
Never mind, there's a protocol in place to ensure that doesn't happen.
« Last Edit: October 21, 2016, 04:51:33 PM by 13375K31C43R »
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

Novalia Spirit

  • Pandora's Masking Tape
  • *
  • Posts: 33
  • Gender: Male
    • View Profile
Re: New bank C3 disassembly, and related docs
« Reply #13 on: October 21, 2016, 04:25:02 PM »
Thanks for the comments, everyone. :)

magitek: Yep, it definitely helped ease things. The heavily optimized disassembly, which I prefer to regard as an optimization repository now, certainly came in handy as well. By the way, feel free to ask if you still need help with what you mentioned in your previous post.

Desjogelmo (did I get it right?  :wink:): You're welcome. You actually deserve some credit for originally expressing your interest in a standalone patch. I immediately dismissed that as impossible without sacrificing a lot of space, but eventually took my own words as a challenge to prove myself wrong. :P

13375K31C43R: Not a bad idea, but changing the scholar dialogue (and the recurring tutorial about switching parties with Y) would likely require implementing control codes for the button names, which seems like more trouble than it's worth.

I took a small break from the restoration process to address something that has always bothered me about the game. Suppose that Mog is equipped with a Moogle Charm and a Merit Award, and you decide to replace the former with something more useful for a boss fight, such as a Ribbon. You then try to exit the menu... but you can't, because the darn Reequip function activates, forcing you to review the rest of his equipment.

As it stands, reequipping occurs whenever equipment is changed, and any of the original or current relics is a Gauntlet, Genji Glove, or Merit Award. The attached patch fixes that by analyzing both the gained and the lost relic effects instead. I've included an alternative patch that triggers Reequip only when mandatory. In other words, it removes Gauntlet entirely from the equation, and will only activate following the loss, but not the gain, of the Genji Glove or Merit Award effect.

Ports for the SFC version, and possibly the GBA versions as well, will be added later.

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: New bank C3 disassembly, and related docs
« Reply #14 on: October 21, 2016, 04:51:41 PM »
Another question, though...the button config menu shows assignments for "Row" and "Def". How do these work? Because I can't find that code anywhere.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings