		       FF4h: SRAM editor
	           Coded by Lord J & Jumper

                         Version 3b

Lord J's
		     _/_/_/  _/_/_/  _/_/_/_/_/_/_/_/_/
		    _/      _/        _/  _|      _/
		   _/_/    _/_/      _/   _|    _/ 
		  _/      _/        _/    _|  _/  
		 _/      _/      _/_/_/_/__|_/_/_/ 

							SRAM hacking kit

Programmers/decipherers: Lord J
			 Jumper
E-mail:			 lord_j@hotmail.com
Web site:		 http://www.angelfire.com/pq/jumparound/index.html

		-------------------------
		|	A G E N D A	|
		-------------------------

Project started March 29th 1999
Project consist of hacking the .srm of Final Fantasy 4e / 2us.

Compatibility list:
Final Fantasy 4 japanese hard type
Final Fantasy 4 japanese hard type, translated by the J2E group
Final Fantasy 2 (american), version 1.0
Final Fantasy 2 (american), version 1.1


Not tested
Final Fantasy 4 japanese easy type (never seen it)


What it does:
-corrects a bad checksum
-renames all players, both fonts support (FF2 or FF4e)
-change, boost all player's vitals and numeric attributes
 (HP/MP/EP/specs/status/ect.)
-change timer, gold points/gils
-change equipements
-changes party member and formation
-changes presence and xy location of party and airships
-xy pos of ships/team
-item list, chocobo list
-learned magic


What it may hack in the future:
-deeds
-chests states


Bugs:
-the bugs that have been found are solved, as part of the 
 program's evolution


Not decoded:
-3 uppers bits for sprite offset of each caracters
-most uppers bits of offsets such as presence of airship
-some bytes caracterizing each caracters


What we don't understand yet:
the vital stats are repeated: ah yes, one set when not equiped,
					 and one with enhancement of equipement,
					 weird coding isn't it?
-numbers of names... 14?, 16 would be nice... it would fill the 12 blanks
 after the name list
number of total players: ok, 5 players, 5 backups when members are kidnaped


Whats on the agenda:
magic spells editor
make the xy location method
remove the corrected checksum warning
make a 'best equip' method for class player
display, in someway, all of the item & code for equ. editor(2 sep. func.)
make the "canva"
organise the raster and waiting list handling (rank value)
make the copy/paste function
decode item for both FF4e and FF2US
display and modifie extra bits of actor and sprite bytes
make debugger function as a gameslot method
finish & test the FF4e/2us char chart generator(rename method)
make the arg[2]/arg[1] detector 


What was planned and not likely to be coded:
-some extra macros for spell edition
-make chart generator for letters and items for both FF4e and FF2US,
 for printing and consulting purposes.
 (the letters gen. is here, but not reflecting what should've been made)
-maybe display current battle and/or menu commands? (actor edition)
-in rename menu, make name ASCII (with switch for us or e fonts)
 and hex editable (though their is no space to display signification
 of bytes values... chart generator?)
 (whats the point???)

========================================================================

		--------------------------------------
		|   P R O G R A M M E R ' S   L O G  |
		--------------------------------------

Version 1: programmer's edition

revision 1a: Finding the checksum algo, no realy, just that is enough!!
	     Luck, intuition, calculator and Karnaugh tables have proven
             to be usefull to crack down this EVIL checksum. Off by one 
	     errors may not be completely cleared, only time will tell.

revision 1b: Making character, actor and sprite decoder.
	     Implementing menus, decipherating needed hex/binary data from
	     scratch. Using modified .TBL files to make the rename menu.
	     Project is stalling due to exams, and other projects deadlines.


Version 2: beta edition (May 6th)

revision 2a: Main source file too big: making seperate file for decoders,
	     classes and main. Working only on slot no.1 for now.
	     The players editor is almost complete: the item decoder is
	     being made for both FF4e and FF2US.
	     May 10th: a big part of the program, player class, is finished
	     May 17th:  recap: defence, attack and magic attributes are removed
			from FF4H, they are calculated by the game itself, when
			going into the equip menu or into a battle.
	     No incident with the checksum algo encountered yet.


Version 3: final edition (May 21)

revision 3a: 'Backbone'/'engine' of program is ready. Just a few menu ajustments left.
	     In this version, completion of class gameslot's interface is being 
	     made. Among the planned methods to be coded are: item menu (much
	     like equipement editor, long to code, but a plus to the apearance)
	     magic spell editor, xy position of team and airship and other 
	     knick-knacks that may come up.
	     Beta testing undergoing.
	     First release will be made with revision 3b.
	     June 1st:  Last usefull information, magic spells lists
			has been found. 60% of the slot has been decoded.
	     June 3rd:  Made a decoder generator: extract magic spells
			names from ROM, with letters decoder of ff4h_dec.cpp,
			and generates an ASCII file strucured as a cpp source.
			(mag_mkr.cpp). Hand decoding was just too long.
			Only the spell menu remains to code.
	     June 5th:  Jumper has found a server for the homepage.
			Come visit us at www.angelfire.com/pq/jumparound/index.html !

revision 3b: June 8th:  Every planned functions are finished. Last battery of
			tests are being made. Just the documentation remains.

========================================================================
========================================================================

Disclamer:

"Final Fantasy 2"(R), "Final Fantasy 4"(R) and all occurence of related context
to their sotfwares are registered trademarks of Square Co., Ltd.
The programmers of this utility are not affiliated with Square Co. and
are not responsible for any loss or damage of material/sofware of the user.

If you do not agree with this disclaimer, do not use this utility (FF4h)


========================================================================
========================================================================

		------------------------------
		|   I N S T R U C T I O N S  |
		------------------------------

Intro:
FF4h is a DOS utility that manage the battery backup (.srm file) of the 
Final Fantasy 2us/4e, generated by various emulators.




Steps:


1. How do you use FF4h?

a)

You specify the SRAM file you want to hack on the DOS command prompt like this:

FF4h FF2.srm (or any other name your game's SRAM file has)


Additionaly, you can specify the version your using like this:

FF4h FF2.srm /us
or
FF4h FF4.srm /4e

but this can be toggled within the utility.



b)

To browse throug the menus, type the appropriate letter/number showed in brackets.
Note that all command are CASE SENSITIVE.



c)

Whence finished hacking the SRAM file, the program will update your .srm file,
and copy your original file, with the extension .bk (not .bak, if you already
have backups of SMCs). Unlike FF3h, you do not have .hak files.

Ex. You modified ff4.srm, the hacked file will be named ff4.srm, the old file will be
    named ff4.bk.





The menus:

a) Main menu
	choice [1] : change the number of the slot you want to hack
	choice [2] : toggles game versions: japanese traducted, or american
	choice [3] : access the sub menu, to hack players and informations
	choice [4] : directly hex-edit selected slot (offsets are relative)
	choice [s] or [q] : saves the file and quit the utility
	choice [c] : cancel modifications


b) sub menu [3]: slot edition (you can toggle slot selection with + or -)

	choice [a] : enter player editor ( read section c) )
	choice [b] : change the amount of gold/gils
	choice [c] : rename players (fonts that are used are based on game version)
	choice [d] : change the time played
	choice [e] : access the item editor ( read section d) )
	choice [f] : access the spells editor ( read section d) )
	choice [g] : access the chocobo item editor ( read section d) )
	choice [h] : access the xy editor for airship & team
	choice [C] : copy whole slot to buffer
	choice [P] : paste copied slot
	choice [space] : directly hex-edit current slot (offsets are relative)
	choice [q] : return to previous menu


c) sub menu [a]: players specs edition (you can switch players with + or -)

** Some notes:
Players are sorted by rank position: #1 is topmost player, #5 downmost player.
Backups (#1 to #5) are used by the game to store players that leaves and
come back later (Kain, Rosa, Yang...). The canva is your temporary space to swap
players with the copy function or to create your own character from scratch.

	choice [a] : change actor: this byte impose the battle commands and
			the name pointer to be used. You can also fix right,
			left or both handed.
	choice [b] : change sprite: changes the way the player looks. This byte
			also impose menu commands, mug, class and pointers 
			to used spell lists. 3 bits are still undecoded.
	choice [S] : Toggle status ailments
	choice [c] to [k] : change numerical attributes
	choice [v] to [z] : access equipment editor (read section d) )
	choice [C] : copy player to buffer
	choice [P] : paste player
	choice [space] : level, hp, mp, exp maxed out
	choice [tab] : all numerical attributes maxed out
	choice [Z] : best equip, depending on player's class


d) item list, chocobo list, equipment and spell editors

** Some notes:
These menus were designed to edit one or many elements in lists, while being able to
see current content and encoding charts. So here are the steps to change an item
or spell:

1) Spot the "adress" to be modified by visualizing current content (type [l] to [m] 
   for items, [f] to [l] for spells) of list. Type the adress and enter.

2) Spot the "code" of the new item/spell by consulting encodings charts (type [a] 
   to [k] for items, [a] to [f] for spells) of list. Type the code and enter.

3) Some menus will ask for quantity to be holded, just enter a number from 1 to 99.

Then again you could do quick changes with the macros (type [s] to consult hotkeys).




That's all for now!

Feel free to send comments to lord_j@hotmail.com
and...
drop by http://www.angelfire.com/pq/jumparound/index.html, the home of this util.

Happy hacking!! (good God, was that Golbez fighting alongside Cecil? yes indeed!!)
