Modding => War of the Lions Hacking => Topic started by: formerdeathcorps on March 10, 2014, 03:25:07 am
Title: Code Documentation Thread
Post by: formerdeathcorps on March 10, 2014, 03:25:07 am
PLEASE STICKY.
The main code for WotL is located in BOOT.BIN. This thread is dedicated to its documentation.
Rafa / Malak New Hardcoding (found in 0xCF8CC in BOOT.BIN)
088d3878: 3c0408a7 lui r4,0x08a7 088d387c: 248464c0 addiu r4,r4,0x64c0 088d3880: 00853021 addu r6,r4,r5 //r6 = Ability Offset 088d3884: 90c50003 lbu r5,0x0003(r6) //r5 = Ability Flags 1 088d3888: 90d10009 lbu r17,0x0009(r6) //r17 = Ability X 088d388c: 3c04092f lui r4,0x092f 088d3890: 90d20008 lbu r18,0x0008(r6) //r18 = Ability Formula 088d3894: a085975c sb r5,-0x68a4(r4) //Store r5 in ability RAM. 088d3898: 324500ff andi r5,r18,0x00ff 088d389c: 24a4ffe2 addiu r4,r5,-0x001e 088d38a0: 2c810002 sltiu r1,r4,0x0002 088d38a4: 50200027 beql r1,r0,0x088d3944 //If not Rafa / Malak formulas, check for Formula 5E (Triple Thunder / Flame) 088d38a8: 2404005e addiu r4,r0,0x005e 088d38ac: 3c04092e lui r4,0x092e 088d38b0: 8c845b9c lw r4,0x5b9c(r4) 088d38b4: 14800022 bne r4,r0,0x088d3940 //If not during combat phase, check for Formula 5E 088d38b8: 00000000 nop 088d38bc: 3c1008a8 lui r16,0x08a8 088d38c0: 00002021 addu r4,r0,r0 088d38c4: 0e288700 jal 0x08a21c00 //Stores 0 (r4) into 0x097a7514 088d38c8: 2610b1f0 addiu r16,r16,-0x4e10 //r16 = Chance of N Hits Table Offset (see below) 088d38cc: 3c0408a8 lui r4,0x08a8 088d38d0: 2484b1fc addiu r4,r4,-0x4e04 088d38d4: 0e2886c0 jal 0x08a21b00 //Input r4 = 0x08a7b1fc, r5 = 0x155e into routine, but these values (which seem to be an offset containing a special RNG seed / multiplier) are not used 088d38d8: 2405155e addiu r5,r0,0x155e
08a21b00: 27bdfff0 addiu r29,r29,-0x0010 08a21b04: afbf000c sw r31,0x000c(r29) 08a21b08: 0e288ab0 jal 0x08a22ac0 //r2 = Word at (0x97a7114) 08a21b0c: 00000000 nop 08a21b10: 24030001 addiu r3,r0,0x0001 08a21b14: 14430010 bne r2,r3,0x08a21b58 //If r2 isn't 1, GOTO RNG Routine (Is this a multiplayer check?) 08a21b18: 00000000 nop 08a21b1c: 3c02097a lui r2,0x097a 08a21b20: 8c457514 lw r5,0x7514(r2) //ELSE, override r5 with value at 0x097a7514 (0) 08a21b24: 3c03097a lui r3,0x097a 08a21b28: 3c02097a lui r2,0x097a 08a21b2c: 2442744c addiu r2,r2,0x744c //r2 = 0x97a744c 08a21b30: 00052040 sll r4,r5,0x01 08a21b34: 00441021 addu r2,r2,r4 //r2 = r2 + r5 * 2 (0x097a744c) 08a21b38: 24a40001 addiu r4,r5,0x0001 //r4 = r5 + 1 (1) 08a21b3c: 84420000 lh r2,0x0000(r2) //r2 = halfword at the address of r2 (0 in my test run) 08a21b40: 28810064 slti r1,r4,0x0064 08a21b44: 14200006 bne r1,r0,0x08a21b60 //GOTO END if r4 < 100 and store r4 as value in 0x97a7514 08a21b48: ac647514 sw r4,0x7514(r3) 08a21b4c: 3c03097a lui r3,0x097a 08a21b50: 10000003 beq r0,r0,0x08a21b60 //ELSE, GOTO END and store 0 as value in 0x97a7514 08a21b54: ac607514 sw r0,0x7514(r3) //Pretty much, this whole thing means that if the value at 0x97a7114 is 1, let X be the value at 0x97a7514. X is incremented if less than 100 and set to 0 otherwise. Return the Xth entry in the halfword table of 100 entries starting at 0x97a744c. Since this is the RNG routine, we're talking about returning a fixed set of probabilities listed on that table. 08a21b58: 0e27c030 jal 0x089f00c0 //RNG routine
The meat of the RNG routine is performed not at 89f00c0, but at 880e338. All 89f00c0 does is reduce the output to a value between 0000-7FFF. 0880e338: 27bdfff0 addiu r29,r29,-0x0010 0880e33c: afbf0004 sw r31,0x0004(r29) 0880e340: 0e202dc0 jal 0x0880b700 //r2 = 08a71fe8 unless value at the address (r26 + 4) is non-zero, where r26 must be non-zero. 0880e344: afb00000 sw r16,0x0000(r29) 0880e348: 0e202dc0 jal 0x0880b700 //Routine run again for stupid reason, r16 = r2. 0880e34c: 00408021 addu r16,r2,r0 0880e350: 8c4800a8 lw r8,0x00a8(r2) //r8 = Previous RNG Seed's lower 32 bits 0880e354: 3c074c95 lui r7,0x4c95 0880e358: 34e77f2d ori r7,r7,0x7f2d //r7 = Fixed Multiplier Lower 0880e35c: 01070019 multu r8,r7 0880e360: 3c065851 lui r6,0x5851 0880e364: 34c6f42d ori r6,r6,0xf42d //r6 = Fixed Multiplier Upper 0880e368: 8c4900ac lw r9,0x00ac(r2) //r9 = Previous RNG Seed's upper 32 bits 0880e36c: 00002810 mfhi r5 //r5 = Upper 32 bits of r8 * r7 (erases input) 0880e370: 00002012 mflo r4 //r4 = Lower 32 bits of r8 * r7 (erases input) 0880e374: 00a00013 mtlo r5 //r5 -> LO 0880e378: 00c8001c madd r6,r8 // (HI, LO) = (r5, r5) + r6 * r8, where (rX, rY) designates a 64-bit number with rX in the upper 32 bits and rY in the lower 32 0880e37c: 24820001 addiu r2,r4,0x0001 0880e380: 0044202b sltu r4,r2,r4 //r4 = 1 if carry-over 0880e384: ae0200a8 sw r2,0x00a8(r16) //Store New RNG seed's lower 32-bits 0880e388: 00e9001c madd r7,r9 //(HI, LO) = (r5 + UPP32(r6 * r8), r5 + LOW32(r6 * r8)) + r7 * r9 0880e38c: 00003012 mflo r6 0880e390: 00861821 addu r3,r4,r6 0880e394: 0e202dc0 jal 0x0880b700 //More retarded calls (see above for why). 0880e398: ae0300ac sw r3,0x00ac(r16) //Store New RNG seed's upper 32-bits. 0880e39c: 8c4300ac lw r3,0x00ac(r2) 0880e3a0: 8fbf0004 lw r31,0x0004(r29) 0880e3a4: 8fb00000 lw r16,0x0000(r29) 0880e3a8: 00601021 addu r2,r3,r0 //r2 = RNG Upper 32-bits. 0880e3ac: 7c02ffc4 ins r2,r0,0x1f,0x01 //Erases the sign of r2. Equivalent to sll r2, r2, 0x01, srl r2, r2, 0x01 0880e3b0: 03e00008 jr r31 0880e3b4: 27bd0010 addiu r29,r29,0x0010
088d38dc: 00021880 sll r3,r2,0x02 088d38e0: 00622021 addu r4,r3,r2 088d38e4: 00041880 sll r3,r4,0x02 088d38e8: 00831821 addu r3,r4,r3 088d38ec: 00031880 sll r3,r3,0x02 //r3 = RN{0...7FFF} * 100 088d38f0: 04610003 bgez r3,0x088d3900 //This is guaranteed, GOTO 0x88d3900 and r5 = RN{0...99} 088d38f4: 00032bc3 sra r5,r3,0x0f 088d38f8: 24637fff addiu r3,r3,0x7fff //Ensures positivity, but this isn't necessary. 088d38fc: 00032bc3 sra r5,r3,0x0f 088d3900: 3c0308a8 lui r3,0x08a8 088d3904: 9064b1f0 lbu r4,-0x4e10(r3) //Starting at 0x08a7b1f0 (or BOOT.BIN 0x277244) is a table listing the probability of for getting N hits on Rafa / Malak formulas. There are 10 entries; thus, the maximum # of hits is hard-coded as 10. Hit 1 5% Hit 2 5% Hit 3 10% HIt 4 10% Hit 5 20% HIt 6 20% HIt 7 10% Hit 8 10% Hit 9 5% Hit 10 5% 088d3908: 0085082a slt r1,r4,r5 088d390c: 10200009 beq r1,r0,0x088d3934 //GOTO 0x88d3934 if failed on the first attempt 088d3910: 24110001 addiu r17,r0,0x0001 //r17 = 1 088d3914: 00a42823 subu r5,r5,r4 //ELSE (on success), reduce RN by the probability of the previous table entry 088d3918: 26100001 addiu r16,r16,0x0001 //Increment one slot on the failure table 088d391c: 26230001 addiu r3,r17,0x0001 088d3920: 92040000 lbu r4,0x0000(r16) 088d3924: 307100ff andi r17,r3,0x00ff //r17++ 088d3928: 0085182a slt r3,r4,r5 088d392c: 5460fffa bnel r3,r0,0x088d3918 //Keep going until number of hits is determined 088d3930: 00a42823 subu r5,r5,r4 088d3934: 3c03092e lui r3,0x092e 088d3938: 10000048 beq r0,r0,0x088d3a5c //GOTO OTHER CHECKS, store r17 as the number of hits 088d393c: a0715c4e sb r17,0x5c4e(r3)
Title: Re: Code Documentation Thread
Post by: formerdeathcorps on March 10, 2014, 09:50:41 pm
Changes to Unit Tables:
089b8fe8: 00161100 sll r2,r22,0x04 089b8fec: 00561023 subu r2,r2,r22 089b8ff0: 00021080 sll r2,r2,0x02 089b8ff4: 00561021 addu r2,r2,r22 089b8ff8: 000218c0 sll r3,r2,0x03 //r3 = Unit ID * 0x1e8 089b8ffc: 3c02092e lui r2,0x092e 089b9000: 24425cb4 addiu r2,r2,0x5cb4 089b9004: 00438821 addu r17,r2,r3 //r17 = 0x92e5cb4 + unit ID * 0x1e8
In other words, each unit's basic data is 0x1e8 long (0x28 longer than vanilla). It starts at 0x92e5cb4. For reference, this is vanilla's unit RAM table:
0x0000: Sprite Set 0x?? - Special Character 0x80 - Generic Male 0x81 - Generic Female 0x82 - Monster 0x0001: Unit ID (FF doesn't exist) 0x0002: Party ID (FE prevents HP/MP growth?) 0x0003: Job ID 0x0004: Palette 0x00 Default 0x01 Hokuten 0x02 Nanten 0x03 Death Corps 0x04 Glabados Church 0x05 No Palette? 0x0005: ENTD Flags 0x80 - Always Present 0x40 - Randomly Present 0x3X - Green Team 0x2X - Light Blue Team 0x1X - Red Team 0x0X - Blue Team 0x08 - Control 0x04 - Immortal 0x02 - (both set by Ramza when initialized) 0x01 - 0x0006: Gender Byte 0x80 - Male 0x40 - Female 0x20 - Monster 0x10 - Join after event 0x08 - Load Formation 0x04 - ??? Stats 0x02 - 0x01 - Save Formation 0x0007: Death Counter (3 for living units) 0x0008: Bithday (days, plus bit 0 from next byte) 0x000-0x01e - January 0x01f-0x03a - February 0x03b-0x059 - March 0x05a-0x077 - April 0x078-0x096 - May 0x097-0x0b4 - June 0x0b5-0x0d3 - July 0x0d4-0x0f2 - August 0x0f3-0x110 - September 0x111-0x12f - October 0x130-0x14d - November 0x14e-0x16c - December 0x0009: Zodiac Sign 0xf0 - 0xe0 - 0xd0 - 0xc0 - Serpentarius 0xb0 - Pisces 0xa0 - Aquarius 0x90 - Capricorn 0x80 - Sagittarius 0x70 - Scorpio 0x60 - Libra 0x50 - Virgo 0x40 - Leo 0x30 - Cancer 0x20 - Gemini 0x10 - Taurus 0x00 - Aries 0x000a - Innate Ability 1 0x000c - Innate Ability 2 0x000e - Innate Ability 3 0x0010 - Innate Ability 4 0x0012 - Primary Skillset 0x0013 - Secondary Skillset 0x0014 - Reaction Ability 0x0016 - Support Ability 0x0018 - Movement Ability 0x001a - Head 0x001b - Body 0x001c - Accessory 0x001d - Right Hand Weapon 0x001e - Right Hand Shield 0x001f - Left Hand Weapon 0x0020 - Left Hand Shield 0x0021 - Experience 0x0022 - Level 0x0023 - Original Brave 0x0024 - Brave 0x0025 - Original Faith 0x0026 - Faith 0x0027 - 1 = Unit's Turn? 0x0028 - HP 0x002a - Max HP 0x002c - MP 0x002e - Max MP 0x0030 - Original PA 0x0031 - Original MA 0x0032 - Original SP 0x0033 - Bonus PA (doubles as minimum (bonus + 1) stats?) 0x0034 - Bonus MA 0x0035 - Bonus SP 0x0036 - PA 0x0037 - MA 0x0038 - SP 0x0039 - CT 0x003a - Move 0x003b - Jump 0x003c - WP 1 0x003d - WP 2 0x003e - WEVA 1 0x003f - WEVA 2 0x0040 - Acc. PEV 0x0041 - RH Shield PEV 0x0042 - LH Shield PEV 0x0043 - C-Ev 0x0044 - Acc. MEV 0x0045 - RH Shield MEV 0x0046 - LH Shield MEV 0x0047 - X Coordinate 0x0048 - Y Coordinate 0x0049: 0x80 - Higher Elevation 0x40 - Stepping Stone 0x20 - 0x10 - 0x08 - 0x04 - 0x03 - Facing East 0x02 - Facing North 0x01 - Facing West 0x00 - Facing South 0x004a: Equippable Items 1 0x80 - Barehanded 0x40 - Knife 0x20 - Ninja Blade 0x10 - Sword 0x08 - Knight's Sword 0x04 - Katana 0x02 - Axe 0x01 - Rod 0x004b: Equippable Items 2 0x80 - Staff 0x40 - Flail 0x20 - Gun 0x10 - Crossbow 0x08 - Bow 0x04 - Instrument 0x02 - Book 0x01 - Polearm 0x004c: Equippable Items 3 0x80 - Pole 0x40 - Bag 0x20 - Cloth 0x10 - Shield 0x08 - Helmet 0x04 - Hat 0x02 - Hair Adornment 0x01 - Armor 0x004d: Equippable Items 4 0x80 - Clothing 0x40 - Robe 0x20 - Shoes 0x10 - Armguard 0x08 - Ring 0x04 - Armlet 0x02 - Cloak 0x01 - Perfume 0x004e: Innate Statuses 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x004f: Innate Statuses 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x0050: Innate Statuses 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x0051: Innate Statuses 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x0052: Innate Statuses 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x0053: Status Immunities 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x0054: Status Immunities 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x0055: Status Immunities 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x0056: Status Immunities 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x0057: Status Immunities 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x0058: Current Statuses 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x0059: Current Statuses 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x005a: Current Statuses 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x005b: Current Statuses 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x005c: Current Statuses 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x005d - Poison CT 0x005e - Regen CT 0x005f - Protect CT 0x0060 - Shell CT 0x0061 - Haste CT 0x0062 - Slow CT 0x0063 - Stop CT 0x0064 - Wall CT 0x0065 - Faith CT 0x0066 - Innocent CT 0x0067 - Charm CT 0x0068 - Sleep CT 0x0069 - Don't Move CT 0x006a - Don't Act CT 0x006b - Reflect CT 0x006c - Death Sentence CT 0x006d: Elemental Absorption 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x006e: Elemental Nullification 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x006f: Elemental Halving 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x0070: Elemental Weakness 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x0071: Elements Strengthened 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x0072 - Raw HP 0x0075 - Raw MP 0x0078 - Raw SP 0x007b - Raw PA 0x007e - Raw MA 0x0081 - HP Growth 0x0082 - HP Multiplier 0x0083 - MP Growth 0x0084 - MP Multiplier 0x0085 - SP Growth 0x0086 - SP Multiplier 0x0087 - PA Growth 0x0088 - PA Multiplier 0x0089 - MA Growth 0x008a - MA Multiplier 0x008b: Reactions 1 0x80 - PA Save 0x40 - MA Save 0x20 - Speed Save 0x10 - Sunken State 0x08 - Caution 0x04 - Dragon Spirit 0x02 - Regenerator 0x01 - Brave UP 0x008c: Reactions 2 0x80 - Face (Faith) UP 0x40 - HP Restore 0x20 - MP Restore 0x10 - Critical Quick 0x08 - Meatbone Slash 0x04 - Counter Magic 0x02 - Counter Tackle 0x01 - Counter Flood 0x008d: Reactions 3 0x80 - Absorb Used MP 0x40 - Gilgame Heart 0x20 - Reflect 0x10 - Auto Potion 0x08 - Counter 0x04 - 0x02 - Distribute 0x01 - MP Switch 0x008e: Reactions 4 0x80 - Damage Split 0x40 - Weapon Guard 0x20 - Finger Guard 0x10 - Abandon 0x08 - Catch 0x04 - Blade Grasp 0x02 - Arrow Guard 0x01 - Hamedo 0x008f: Support 1 0x80 - Equip Armor 0x40 - Equip Shield 0x20 - Equip Sword 0x10 - Equip Katana 0x08 - Equip Crossbow 0x04 - Equip Spear 0x02 - Equip Axe 0x01 - Equip Gun 0x0090: Support 2 0x80 - Half of MP 0x40 - Gained JP-UP 0x20 - Gained EXP-UP 0x10 - Attack UP 0x08 - Defense UP 0x04 - Magic Attack UP 0x02 - Magic Defense UP 0x01 - Concentrate 0x0091: Support 3 0x80 - Train 0x40 - Secret Hunt 0x20 - Martial Arts 0x10 - Monster Talk 0x08 - Throw Item 0x04 - Maintenance 0x02 - Two Hands 0x01 - Two Swords 0x0092: Support 4 0x80 - Monster Skill 0x40 - Defend 0x20 - Equip Change 0x10 - 0x08 - Short Charge 0x04 - Non-Charge 0x02 - 0x01 - 0x0093: Movement 1 0x80 - Move +1 0x40 - Move +2 0x20 - Move +3 0x10 - Jump +1 0x08 - Jump +2 0x04 - Jump +3 0x02 - Ignore Height 0x01 - Move-HP UP 0x0094: Movement 2 0x80 - Move-MP UP 0x40 - Move-Get EXP 0x20 - Move-Get JP 0x10 - Cannot Enter Water 0x08 - Teleport 0x04 - Teleport 2 0x02 - Any Weather 0x01 - Any Ground 0x0095: Movement 3 0x80 - Walk on Water 0x40 - Move in Water 0x20 - Move on Lava 0x10 - Move Underwater 0x08 - Float 0x04 - Fly 0x02 - Silent Walk 0x01 - Move-Find Item 0x0096 - Unlocked Jobs 1-8 (all of these start at 0x80 and count down) 0x0097 - Unlocked Jobs 9-16 0x0098 - Unlocked Jobs 17-20 0x0099 - Base Action Abilities 1-8 0x009a - Base Action Abilities 9-16 0x009b - Base R/S/M 1-6 0x009c - Chemist Action Abilities 1-8 0x009d - Chemist Action Abilities 9-16 0x009e - Chemist R/S/M 1-6 0x009F - Knight Action Abilities 1-8 0x00A0 - Knight Action Abilities 9-16 0x00A1 - Knight R/S/M 1-6 0x00A2 - Archer Action Abilities 1-8 0x00A3 - Archer Action Abilities 9-16 0x00A4 - Archer R/S/M 1-6 0x00A5 - Monk Action Abilities 1-8 0x00A6 - Monk Action Abilities 9-16 0x00A7 - Monk R/S/M 1-6 0x00A8 - Priest Action Abilities 1-8 0x00A9 - Priest Action Abilities 9-16 0x00AA - Priest R/S/M 1-6 0x00AB - Wizard Action Abilities 1-8 0x00AC - Wizard Action Abilities 9-16 0x00AD - Wizard R/S/M 1-6 0x00AE - Time Mage Action Abilities 1-8 0x00AF - Time Mage Action Abilities 9-16 0x00B0 - Time Mage R/S/M 1-6 0x00B1 - Summoner Action Abilities 1-8 0x00B2 - Summoner Action Abilities 9-16 0x00B3 - Summoner R/S/M 1-6 0x00B4 - Thief Action Abilities 1-8 0x00B5 - Thief Action Abilities 9-16 0x00B6 - Thief R/S/M 1-6 0x00B7 - Mediator Action Abilities 1-8 0x00B8 - Mediator Action Abilities 9-16 0x00B9 - Mediator R/S/M 1-6 0x00BA - Oracle Action Abilities 1-8 0x00BB - Oracle Action Abilities 9-16 0x00BC - Oracle R/S/M 1-6 0x00BD - Geomancer Action Abilities 1-8 0x00BE - Geomancer Action Abilities 9-16 0x00BF - Geomancer R/S/M 1-6 0x00C0 - Lancer Action Abilities 1-8 0x00C1 - Lancer Action Abilities 9-16 0x00C2 - Lancer R/S/M 1-6 0x00C3 - Samurai Action Abilities 1-8 0x00C4 - Samurai Action Abilities 9-16 0x00C5 - Samurai R/S/M 1-6 0x00C6 - Ninja Action Abilities 1-8 0x00C7 - Ninja Action Abilities 9-16 0x00C8 - Ninja R/S/M 1-6 0x00C9 - Calculator Action Abilities 1-8 0x00CA - Calculator Action Abilities 9-16 0x00CB - Calculator R/S/M 1-6 0x00CC - Bard Action Abilities 1-8 0x00CD - Bard Action Abilities 9-16 0x00CE - Bard R/S/M 1-6 0x00CF - Dancer Action Abilities 1-8 0x00D0 - Dancer Action Abilities 9-16 0x00D1 - Dancer R/S/M 1-6 0x00D2 - Base/Chemist Job Level 0x00D3 - Knight/Archer Job Level 0x00D4 - Monk/Priest Job Level 0x00D5 - Wizard/Time Mage Job Level 0x00D6 - Summoner/Thief Job Level 0x00D7 - Mediator/Oracle Job Level 0x00D8 - Geomancer/Lancer Job Level 0x00D9 - Samurai/Ninja Job Level 0x00DA - Calculator/Bard Job Level 0x00DB - Dancer/Mime Job Level 0x00DC - Base Job JP 0x00DE - Chemist Job JP 0x00E0 - Knight Job JP 0x00E2 - Archer Job JP 0x00E4 - Monk Job JP 0x00E6 - Priest Job JP 0x00E8 - Wizard Job JP 0x00EA - Time Mage Job JP 0x00EC - Summoner Job JP 0x00EE - Thief Job JP 0x00F0 - Mediator Job JP 0x00F2 - Oracle Job JP 0x00F4 - Geomancer Job JP 0x00F6 - Lancer Job JP 0x00F8 - Samurai Job JP 0x00FA - Ninja Job JP 0x00FC - Calculator Job JP 0x00FE - Bard Job JP 0x0100 - Dancer Job JP 0x0102 - Mime Job JP 0x0104 - Total Base Job JP 0x0106 - Total Chemist Job JP 0x0108 - Total Knight Job JP 0x010A - Total Archer Job JP 0x010C - Total Monk Job JP 0x010E - Total Priest Job JP 0x0110 - Total Wizard Job JP 0x0112 - Total Time Mage Job JP 0x0114 - Total Summoner Job JP 0x0116 - Total Thief Job JP 0x0118 - Total Mediator Job JP 0x011A - Total Oracle Job JP 0x011C - Total Geomancer Job JP 0x011E - Total Lancer Job JP 0x0120 - Total Samurai Job JP 0x0122 - Total Ninja Job JP 0x0124 - Total Calculator Job JP 0x0126 - Total Bard Job JP 0x0128 - Total Dancer Job JP 0x012A - Total Mime Job JP 0x012C - 0x013B Unit Name 0x013C - 0x014B Job Name 0x014C - 0x0153 Primary Skillset Name (first 8 bytes) 0x0154 - 0x015B Secondary Skillset Name (First 8 bytes) 0x015c - 0x015d - Current Ability CT 0x015e - Graphic 0x015f - Portrait 0x0160 - Palette 0x0161 - ENTD ID 0x0162 - Special Skillset? (Specials set their skillset here) 0x0163 - War Trophy 0x0164 - Bonus Money Mod (* 100 = Gil) 0x0165 - X Location? (For where AI tends to stay near) 0x0166 - Y Location? 0x0167 - 0x80 - Higher Elevation Flag (for location)? 0x40 - Focus on target? 0x20 - Stay near X/Y? (+0x08 = never move once there) 0x10 - more aggressive? 0x08 - Coward-like? 0x04 - 0x02 - 0x01 - 0x0168 - Prioritized Target 0x0169 - (ENTD) 0x016a - (ENTD) 0x04 - Save CT? (don't move unless needed?) 0x016b - (ENTD) 0x016c - Unit Name ID 0x00XX - Special 0x01XX - Generic Male 0x02XX - Generic Female 0x03XX - Generic Monster 0x016e - Attacker/Self ID? (this data for charging attacks?) 0x016f - Skillset of Last Attack Used 0x0170 - Last Attack Used ID 0x0172 - Calculator Type Ability ID 0x0174 - Calculator Multiplier Ability ID 0x0176 - Used Item/Equip ID?
0x0182: Mount Info 0x80 - Riding A Unit 0x40 - Being Ridden 0x20 - 0x1f - ID of unit Riding/Being ridden by this unit 0x0183 - Dealing with unit's ability to appear in battle? (FF if unit can't exist?) (01 if unit exists, 00 if not (but later can?)?) 0x80 - Was active, but is now disabled? 0x02 - Unit will be removed from party? (no longer exists, treas/cryst?) 0x0184: Equipped Flags? 0x80 - 0x40 - 0x20 - 0x10 - 0x08 - Sword Equipped 0x04 - Materia Blade Equipped 0x02 - 0x01 -
0x0186 - Character's turn (if 01)? 0x0187 - Movement Taken? 0x0188 - Action Taken? 0x0189 - 0x80 - 0x40 - 0x20 - 0x10 - 0x08 - 0x04 - (set to this (and only this) if in water at some point) 0x02 - In Water? 0x01 - Turn ended? (wait?) 0x018a - Unit ID (without "Unit Exists" check) 0x018b - Ability CT
CURRENT ACTION DATA
0x018c/0x00 - Hit Flag 0x00 - Miss 0x01 - Hit 0x018d/0x01 - Critical Hit Flag 0x018e/0x02 - Evade Type 0x00 - Hit 0x01 - Guarded (Accessory) (runs "Missed!"/"Guarded" check) 0x02 - 0x03 - (runs "Missed!"/"Guarded" check) 0x04 - Arrow Guard? 0x05 - Nullified 0x06 - Miss 0x07 - (runs "Missed!"/"Guarded" check) 0x08 - 0x09 - Reflected? 0x0a - 0x0b - Blade Grasp? (runs "Missed!"/"Guarded" check) 0x0c - 0x0d - "Caught" 0x0e - 0x0f - 0x018f/0x03 - Item to break/use 0x0190/0x04 - HP Damage 0x0192/0x06 - HP Recovery 0x0194/0x08 - MP Damage 0x0196/0x0a - MP Recovery 0x0198/0x0c - Gil Stolen/Lost 0x019a/0x0e - Reaction ID 0x019c/0x10 - Special Flags 1 0x80 - +1 Level 0x40 - Switch Team 0x20 - Poached 0x10 - Steal Item 0x08 - 0x04 - Break Item 0x02 - Malboro (moldball virus) 0x01 - Golem 0x019d/0x11 - Special Flags 2 0x80 - 0x40 - 0x20 - 0x10 - Katana Break? 0x08 - Weakness? 0x04 - Absorption? 0x02 - Nullification? (Disabled by nullification) 0x01 - -1 Level 0x019e/0x12 - SP Change 0x80 - Bonus Flag 0x019f/0x13 - CT Change 0xFF = "Quick" 0x7F = "CT0" 0x80 - Bonus Flag 0x01a0/0x14 - PA Change 0x80 - Bonus Flag 0x01a1/0x15 - MA Change 0x80 - Bonus Flag 0x01a2/0x16 - Brave Change 0x80 - Bonus Flag 0x01a3/0x17 - Faith Change 0x80 - Bonus Flag 0x01a4/0x18 - Status Change? 0x02 - ("Guarded"?) 0x01 - Failed status infliction? ("Missed!") 0x01a5/0x19 - Remove Equipment 0x80 - Remove Helmet 0x40 - Remove Armor 0x20 - Remove Accessory 0x10 - Remove Right Hand Weapon 0x08 - Remove Right Hand Shield 0x04 - Remove Left Hand Weapon 0x02 - Remove Left Hand Shield 0x01 - 0x01a6/0x1a - 0x01a7/0x1b - Attack's Status Infliction 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x01a8/0x1c - Attack's Status Infliction 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x01a9/0x1d - Attack's Status Infliction 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x01aa/0x1e - Attack's Status Infliction 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x01ab/0x1f - Attack's Status Infliction 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x01ac/0x20 - Attack's Status Removal 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x01ad/0x21 - Attack's Status Removal 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x01ae/0x22 - Attack's Status Removal 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x01af/0x23 - Attack's Status Removal 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x01b0/0x24 - Attack's Status Removal 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x01b1/0x25: Attack Type 0x80 - HP Damage 0x40 - HP Recovery 0x20 - MP Damage 0x10 - MP Recovery 0x08 - Status Change? 0x04 - ? 0x02 - ? 0x01 - Stat Change 0x01b2/0x26 - Last Attack On Self? 0x01b4/0x28 - Stolen Exp? 0x01b5/0x29 - Stolen JP? 0x01b6/0x2a - Hit % 0x01b8/0x2c - 0x01b9/0x2d - Main Target ID? 0x01ba/0x2e - Modified ENTD Flags 0x80 - Always Present 0x40 - Randomly Present 0x3X - Green Team 0x2X - Light Blue Team 0x1X - Red Team 0x0X - Blue Team 0x08 - Control 0x04 - Immortal 0x02 - 0x01 - 0x01bb/0x2f - Inflicted Status List 1 0x01bc/0x30 - Inflicted Status List 2 0x01bd/0x31 - Inflicted Status List 3 0x01be/0x32 - Inflicted Status List 4 0x01bf/0x33 - Inflicted Status List 5
At the most conservative, the following changes are necessary:
Head EQ (+1 byte) Body EQ (+1 byte) ACC EQ (+1 bytes) RH WPN (+1 byte) RH SHLD (+1 byte) LH WPN (+1 byte) LH SHLD (+1 byte) New EQ Types (+1 Byte) # of crystals eaten (+1 byte) Unlocked Jobs 17-23 (+3 Jobs, OK, DK, OK-M...but not enough to be an extra byte) Dark Knight A / R / S / M Abilities (+3 bytes) OK / DK Job Level (+1 Byte) OK / DK Job JP / Total Job JP (+8 bytes)
We see that there are 8 additional bytes between vanilla's current MP (0x2e) vs. WotL's (0x36). Assuming the same order as vanilla, 7 of the 8 bytes are accounted for with the changes to equip IDs, leaving 1 mystery byte. WE see that there are 10 additional bytes between vanilla's Half of MP (0x90) vs. WotL's (0x9a). Assuming the same order as vanilla, 8 of the 10 bytes are accounted for with the changes to equip IDs and types, leaving 2 mystery bytes. Assuming the number of crystals eaten per character is stored somewhere before current MP, that leaves one extra byte in WotL from curMP to Half of MP that doesn't exist in vanilla.
Innocent / EQ Sword / EQ Materia Blade Checks: 089b90d0: 9222005c lbu r2,0x005c(r17) 089b90d4: 30420040 andi r2,r2,0x0040 089b90d8: 14400047 bne r2,r0,0x089b91f8 //If caster is Always: Innocent, GOTO END 089b90dc: 00000000 nop 089b90e0: 90630006 lbu r3,0x0006(r3) 089b90e4: 30620008 andi r2,r3,0x0008 089b90e8: 50400007 beql r2,r0,0x089b9108 //If ability does not have EQ Sword flagged, GOTO Check Next 089b90ec: 30620004 andi r2,r3,0x0004 089b90f0: 922201a8 lbu r2,0x01a8(r17) 089b90f4: 30420008 andi r2,r2,0x0008 089b90f8: 14400009 bne r2,r0,0x089b9120 //ELSE IF Sword is equipped, GOTO Success 089b90fc: 00000000 nop 089b9100: 1000003d beq r0,r0,0x089b91f8 //ELSE, GOTO END 089b9104: 00000000 nop 089b9108: 10400005 beq r2,r0,0x089b9120 //If ability does not have EQ Materia Blade flagged, GOTO Success 089b910c: 00000000 nop 089b9110: 922201a8 lbu r2,0x01a8(r17) 089b9114: 30420004 andi r2,r2,0x0004 089b9118: 10400037 beq r2,r0,0x089b91f8 //ELSE IF Materia Blade is not equipped, GOTO END
This passage is also revealing in its own way. We see that innocent is also transposed 10 bytes (from 0x52 in vanilla to 0x5c here). This means we can narrow the bounds of the unknown byte mentioned above. It is located between curMP (0x2e) and innocent (0x5c). Similarly, the byte that detects if the unit is equipping a materia blade or sword has been transposed 36 bytes (from 0x184 in vanilla to 0x1a8 here). Out of these 36 bytes, only the 21 bytes given in the "obvious additions" list are accounted for, so there are 15 unknown bytes located between Half of MP (0x9a) and Equipped Items Check Byte (0x1a8).
Title: Re: Code Documentation Thread
Post by: formerdeathcorps on March 12, 2014, 09:48:53 am
0x0000: Sprite Set 0x?? - Special Character 0x80 - Generic Male 0x81 - Generic Female 0x82 - Monster 0x0001: Unit ID (FF doesn't exist) 0x0002: Party ID (FE prevents HP/MP growth?) 0x0003: Job ID 0x0004: Palette 0x00 Default 0x01 Hokuten 0x02 Nanten 0x03 Death Corps 0x04 Glabados Church 0x05 No Palette? 0x0005: ENTD Flags 0x80 - Always Present 0x40 - Randomly Present 0x3X - Green Team 0x2X - Light Blue Team 0x1X - Red Team 0x0X - Blue Team 0x08 - Control 0x04 - Immortal 0x02 - (both set by Ramza when initialized) 0x01 - 0x0006: Gender Byte 0x80 - Male 0x40 - Female 0x20 - Monster 0x10 - Join after event 0x08 - Load Formation 0x04 - ??? Stats 0x02 - 0x01 - Save Formation 0x0007: Death Counter (3 for living units) 0x0008: Bithday (days, plus bit 0 from next byte) 0x000-0x01e - January 0x01f-0x03a - February 0x03b-0x059 - March 0x05a-0x077 - April 0x078-0x096 - May 0x097-0x0b4 - June 0x0b5-0x0d3 - July 0x0d4-0x0f2 - August 0x0f3-0x110 - September 0x111-0x12f - October 0x130-0x14d - November 0x14e-0x16c - December 0x0009: Zodiac Sign 0xf0 - 0xe0 - 0xd0 - 0xc0 - Serpentarius 0xb0 - Pisces 0xa0 - Aquarius 0x90 - Capricorn 0x80 - Sagittarius 0x70 - Scorpio 0x60 - Libra 0x50 - Virgo 0x40 - Leo 0x30 - Cancer 0x20 - Gemini 0x10 - Taurus 0x00 - Aries 0x000a - Innate Ability 1 0x000c - Innate Ability 2 0x000e - Innate Ability 3 0x0010 - Innate Ability 4 0x0012 - Primary Skillset 0x0013 - Secondary Skillset 0x0014 - Reaction Ability 0x0016 - Support Ability 0x0018 - Movement Ability 0x001a - Head 0x001c - Body 0x001e - Accessory 0x0020 - Right Hand Weapon 0x0022 - Right Hand Shield 0x0024 - Left Hand Weapon 0x0026 - Left Hand Shield 0x0028 - Experience 0x0029 - Level 0x002a - Original Brave 0x002b - Brave 0x002c - Original Faith 0x002d - Faith 0x002e - 1 = Unit's Turn? 0x002f - ??? 0x0030 - HP 0x0032 - Max HP 0x0034 - MP 0x0036 - Max MP 0x0038 - Original PA 0x0039 - Original MA 0x003a - Original SP 0x003b - Bonus PA (doubles as minimum (bonus + 1) stats?) 0x003c - Bonus MA 0x003d - Bonus SP 0x003e - PA 0x003f - MA 0x0040 - SP 0x0041 - CT 0x0042 - Move 0x0043 - Jump 0x0044 - WP 1 0x0045 - WP 2 0x0046 - WEVA 1 0x0047 - WEVA 2 0x0048 - Acc. PEV 0x0049 - RH Shield PEV 0x004a - LH Shield PEV 0x004b - C-Ev 0x004c - Acc. MEV 0x004d - RH Shield MEV 0x004e - LH Shield MEV 0x004f - X Coordinate 0x0050 - Y Coordinate 0x0051: 0x80 - Higher Elevation 0x40 - Stepping Stone 0x20 - 0x10 - 0x08 - 0x04 - 0x03 - Facing East 0x02 - Facing North 0x01 - Facing West 0x00 - Facing South 0x0052: Equippable Items 1 0x80 - Barehanded 0x40 - Knife 0x20 - Ninja Blade 0x10 - Sword 0x08 - Knight's Sword 0x04 - Katana 0x02 - Axe 0x01 - Rod 0x0053: Equippable Items 2 0x80 - Staff 0x40 - Flail 0x20 - Gun 0x10 - Crossbow 0x08 - Bow 0x04 - Instrument 0x02 - Book 0x01 - Polearm 0x0054: Equippable Items 3 0x80 - Pole 0x40 - Bag 0x20 - Cloth 0x10 - Shield 0x08 - Helmet 0x04 - Hat 0x02 - Hair Adornment 0x01 - Armor 0x0055: Equippable Items 4 0x80 - Clothing 0x40 - Robe 0x20 - Shoes 0x10 - Armguard 0x08 - Ring 0x04 - Armlet 0x02 - Cloak 0x01 - Perfume 0x0056: Equippable Items 5 0x80 - ??? 0x40 - ??? 0x20 - ??? 0x10 - FellSword 0x08 - LipStick 0x04 - ??? 0x02 - ??? 0x01 - ??? 0x0057 - ??? 0x0058: Innate Statuses 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x0059: Innate Statuses 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x005a: Innate Statuses 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x005b: Innate Statuses 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x005c: Innate Statuses 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x005d: Status Immunities 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x005e: Status Immunities 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x005f: Status Immunities 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x0060: Status Immunities 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x0061: Status Immunities 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x0062: Current Statuses 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x0063: Current Statuses 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x0064: Current Statuses 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x0065: Current Statuses 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x0066: Current Statuses 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x0067 - Poison CT 0x0068 - Regen CT 0x0069 - Protect CT 0x006a - Shell CT 0x006b - Haste CT 0x006c - Slow CT 0x006d - Stop CT 0x006e - Wall CT 0x006f - Faith CT 0x0070 - Innocent CT 0x0071 - Charm CT 0x0072 - Sleep CT 0x0073 - Don't Move CT 0x0074 - Don't Act CT 0x0075 - Reflect CT 0x0076 - Death Sentence CT 0x0077: Elemental Absorption 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x0078: Elemental Nullification 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x0079: Elemental Halving 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x007a: Elemental Weakness 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x007b: Elements Strengthened 0x80 - Dark 0x40 - Holy 0x20 - Water 0x10 - Earth 0x08 - Wind 0x04 - Ice 0x02 - Lightning 0x01 - Fire 0x007c - Raw HP 0x007f - Raw MP 0x0082 - Raw SP 0x0085 - Raw PA 0x0088 - Raw MA 0x008b - HP Growth 0x008c - HP Multiplier 0x008d - MP Growth 0x008e - MP Multiplier 0x008f - SP Growth 0x0090 - SP Multiplier 0x0091 - PA Growth 0x0092 - PA Multiplier 0x0093 - MA Growth 0x0094 - MA Multiplier 0x0095: Reactions 1 0x80 - PA Save 0x40 - MA Save 0x20 - Speed Save 0x10 - Sunken State 0x08 - Caution 0x04 - Dragon Spirit 0x02 - Regenerator 0x01 - Brave UP 0x0096: Reactions 2 0x80 - Face (Faith) UP 0x40 - HP Restore 0x20 - MP Restore 0x10 - Critical Quick 0x08 - Meatbone Slash 0x04 - Counter Magic 0x02 - Counter Tackle 0x01 - Counter Flood 0x0097: Reactions 3 0x80 - Absorb Used MP 0x40 - Gilgame Heart 0x20 - Reflect 0x10 - Auto Potion 0x08 - Counter 0x04 - 0x02 - Distribute 0x01 - MP Switch 0x0098: Reactions 4 0x80 - Damage Split 0x40 - Weapon Guard 0x20 - Finger Guard 0x10 - Abandon 0x08 - Catch 0x04 - Blade Grasp 0x02 - Arrow Guard 0x01 - Hamedo 0x0099: Support 1 0x80 - Equip Armor 0x40 - Equip Shield 0x20 - Equip Sword 0x10 - Equip Katana 0x08 - Equip Crossbow 0x04 - Equip Spear 0x02 - Equip Axe 0x01 - Equip Gun 0x009a: Support 2 0x80 - Half of MP 0x40 - Gained JP-UP 0x20 - Gained EXP-UP 0x10 - Attack UP 0x08 - Defense UP 0x04 - Magic Attack UP 0x02 - Magic Defense UP 0x01 - Concentrate 0x009b: Support 3 0x80 - Train 0x40 - Secret Hunt 0x20 - Martial Arts 0x10 - Monster Talk 0x08 - Throw Item 0x04 - Maintenance 0x02 - Two Hands 0x01 - Two Swords 0x009c: Support 4 0x80 - Monster Skill 0x40 - Defend 0x20 - Equip Change 0x10 - 0x08 - Short Charge 0x04 - Non-Charge 0x02 - 0x01 - 0x009d: Movement 1 0x80 - Move +1 0x40 - Move +2 0x20 - Move +3 0x10 - Jump +1 0x08 - Jump +2 0x04 - Jump +3 0x02 - Ignore Height 0x01 - Move-HP UP 0x009e: Movement 2 0x80 - Move-MP UP 0x40 - Move-Get EXP 0x20 - Move-Get JP 0x10 - Cannot Enter Water 0x08 - Teleport 0x04 - Teleport 2 0x02 - Any Weather 0x01 - Any Ground 0x009f: Movement 3 0x80 - Walk on Water 0x40 - Move in Water 0x20 - Move on Lava 0x10 - Move Underwater 0x08 - Float 0x04 - Fly 0x02 - Silent Walk 0x01 - Move-Find Item 0x00a0 - Unlocked Jobs 1-8 (all of these start at 0x80 and count down) 0x00a1 - Unlocked Jobs 9-16 0x00a2 - Unlocked Jobs 17-24 0x00a3 - Base Action Abilities 1-8 0x00a4 - Base Action Abilities 9-16 0x00a5 - Base R/S/M 1-6 0x00a6 - Chemist Action Abilities 1-8 0x00a7 - Chemist Action Abilities 9-16 0x00a8 - Chemist R/S/M 1-6 0x00a9 - Knight Action Abilities 1-8 0x00aa - Knight Action Abilities 9-16 0x00ab - Knight R/S/M 1-6 0x00ac - Archer Action Abilities 1-8 0x00ad - Archer Action Abilities 9-16 0x00ae - Archer R/S/M 1-6 0x00af - Monk Action Abilities 1-8 0x00b0 - Monk Action Abilities 9-16 0x00b1 - Monk R/S/M 1-6 0x00b2 - Priest Action Abilities 1-8 0x00b3 - Priest Action Abilities 9-16 0x00b4 - Priest R/S/M 1-6 0x00b5 - Wizard Action Abilities 1-8 0x00b6 - Wizard Action Abilities 9-16 0x00b7 - Wizard R/S/M 1-6 0x00b8 - Time Mage Action Abilities 1-8 0x00b9 - Time Mage Action Abilities 9-16 0x00ba - Time Mage R/S/M 1-6 0x00bb - Summoner Action Abilities 1-8 0x00bc - Summoner Action Abilities 9-16 0x00bd - Summoner R/S/M 1-6 0x00be - Thief Action Abilities 1-8 0x00bf - Thief Action Abilities 9-16 0x00c0 - Thief R/S/M 1-6 0x00c1 - Mediator Action Abilities 1-8 0x00c2 - Mediator Action Abilities 9-16 0x00c3 - Mediator R/S/M 1-6 0x00c4 - Oracle Action Abilities 1-8 0x00c5 - Oracle Action Abilities 9-16 0x00c6 - Oracle R/S/M 1-6 0x00c7 - Geomancer Action Abilities 1-8 0x00c8 - Geomancer Action Abilities 9-16 0x00c9 - Geomancer R/S/M 1-6 0x00ca - Lancer Action Abilities 1-8 0x00cb - Lancer Action Abilities 9-16 0x00cc - Lancer R/S/M 1-6 0x00cd - Samurai Action Abilities 1-8 0x00ce - Samurai Action Abilities 9-16 0x00cf - Samurai R/S/M 1-6 0x00d0 - Ninja Action Abilities 1-8 0x00d1 - Ninja Action Abilities 9-16 0x00d2 - Ninja R/S/M 1-6 0x00d3 - Calculator Action Abilities 1-8 0x00d4 - Calculator Action Abilities 9-16 0x00d5 - Calculator R/S/M 1-6 0x00d6 - Bard Action Abilities 1-8 0x00d7 - Bard Action Abilities 9-16 0x00d8 - Bard R/S/M 1-6 0x00d9 - Dancer Action Abilities 1-8 0x00da - Dancer Action Abilities 9-16 0x00db - Dancer R/S/M 1-6 0x00dc - Mime Action Abilities 1-8 0x00dd - Mime Action Abilities 9-16 0x00de - Mime R/S/M 1-6 0x00df - Dark Knight Action Abilities 1-8 0x00e0 - Dark Knight Action Abilities 9-16 0x00e1 - Dark Knight R/S/M 1-6 0x00e2 - Onion Knight Action Abilities 1-8 0x00e3 - Onion Knight Action Abilities 9-16 0x00e4 - Onion Knight R/S/M 1-6 0x00e5 - Base/Chemist Job Level 0x00e6 - Knight/Archer Job Level 0x00e7 - Monk/Priest Job Level 0x00e8 - Wizard/Time Mage Job Level 0x00e9 - Summoner/Thief Job Level 0x00ea - Mediator/Oracle Job Level 0x00eb - Geomancer/Lancer Job Level 0x00ec - Samurai/Ninja Job Level 0x00ed - Calculator/Bard Job Level 0x00ee - Dancer/Mime Job Level 0x00ef - Dark Knight/Onion Knight Job Level 0x00f0 - Unknown1 (always mastered)/Master-Onion Knight Job Level (M-OK is always level 8) 0x00f1 - ??? 0x00f2 - Base Job JP 0x00f4 - Chemist Job JP 0x00f6 - Knight Job JP 0x00f8 - Archer Job JP 0x00fa - Monk Job JP 0x00fc - Priest Job JP 0x00fe - Wizard Job JP 0x0100 - Time Mage Job JP 0x0102 - Summoner Job JP 0x0104 - Thief Job JP 0x0106 - Mediator Job JP 0x0108 - Oracle Job JP 0x010a - Geomancer Job JP 0x010c - Lancer Job JP 0x010e - Samurai Job JP 0x0110 - Ninja Job JP 0x0112 - Calculator Job JP 0x0114 - Bard Job JP 0x0116 - Dancer Job JP 0x0118 - Mime Job JP 0x011a - Dark Knight Job JP 0x011c - Onion Knight (?) Job JP--Makes no sense since Onion Knight has no JP 0x011e - ??? Job JP 0x0120 - Total Base Job JP 0x0122 - Total Chemist Job JP 0x0124 - Total Knight Job JP 0x0126 - Total Archer Job JP 0x0128 - Total Monk Job JP 0x012a - Total Priest Job JP 0x012c - Total Wizard Job JP 0x012e - Total Time Mage Job JP 0x0130 - Total Summoner Job JP 0x0132 - Total Thief Job JP 0x0134 - Total Mediator Job JP 0x0136 - Total Oracle Job JP 0x0138 - Total Geomancer Job JP 0x013a - Total Lancer Job JP 0x013c - Total Samurai Job JP 0x013e - Total Ninja Job JP 0x0140 - Total Calculator Job JP 0x0142 - Total Bard Job JP 0x0144 - Total Dancer Job JP 0x0146 - Total Mime Job JP 0x0148 - Total Dark Knight Job JP 0x014a - Total Onion Knight (?) Job JP--Makes no sense since Onion Knight has no JP 0x014c - Total ??? Job JP 0x014e - 0x015d Unit Name 0x015e - 0x016d Job Name 0x016e - 0x0175 Primary Skillset Name (first 8 bytes) 0x0176 - 0x017d Secondary Skillset Name (First 8 bytes) 0x017e - # of times unit has been killed 0x017f - Current Ability CT 0x0180 - Graphic 0x0181 - Portrait 0x0182 - Palette 0x0183 - ENTD ID 0x0184 - Special Skillset? (Specials set their skillset here) 0x0185 - War Trophy 0x0186 - Bonus Money Mod (* 100 = Gil) 0x0??? - X Location? (For where AI tends to stay near) 0x0??? - Y Location? 0x0??? - 0x80 - Higher Elevation Flag (for location)? 0x40 - Focus on target? 0x20 - Stay near X/Y? (+0x08 = never move once there) 0x10 - more aggressive? 0x08 - Coward-like? 0x04 - 0x02 - 0x01 - 0x0??? - Prioritized Target 0x0??? - (ENTD) 0x0??? - (ENTD) 0x04 - Save CT? (don't move unless needed?) 0x0??? - (ENTD) 0x0??? - ??? (1 byte) 0x0??? - ??? (1 byte) 0x0190 - Unit Name ID 0x00XX - Special 0x01XX - Generic Male 0x02XX - Generic Female 0x03XX - Generic Monster 0x0192 - Attacker/Self ID? (this data for charging attacks?) 0x0193 - Skillset of Last Attack Used 0x0194 - Last Attack Used ID 0x0196 - Calculator Type Ability ID 0x0198 - Calculator Multiplier Ability ID 0x019a - Used Item/Equip ID?
0x01a2 - Target Y 0x01a3 - ??? 0x01a4 - ??? 0x01a5 - ??? 0x01a6: Mount Info 0x80 - Riding A Unit 0x40 - Being Ridden 0x20 - 0x1f - ID of unit Riding/Being ridden by this unit 0x01a7 - Dealing with unit's ability to appear in battle? (FF if unit can't exist?) (01 if unit exists, 00 if not (but later can?)?) 0x80 - Was active, but is now disabled? 0x02 - Unit will be removed from party? (no longer exists, treas/cryst?) 0x01a8: Equipped Flags? 0x80 - 0x40 - 0x20 - 0x10 - 0x08 - Sword Equipped 0x04 - Materia Blade Equipped 0x02 - 0x01 - 0x01a9: ??? 0x01aa - Character's turn (if 01)? 0x01ab - Movement Taken? 0x01ac - Action Taken? 0x01ad - 0x80 - 0x40 - 0x20 - 0x10 - 0x08 - 0x04 - (set to this (and only this) if in water at some point) 0x02 - In Water? 0x01 - Turn ended? (wait?) 0x01ae - Unit ID (without "Unit Exists" check) 0x01af - Ability CT
CURRENT ACTION DATA
0x01b0/0x00 - Hit Flag 0x00 - Miss 0x01 - Hit 0x01b1/0x01 - Critical Hit Flag 0x01b2/0x02 - Evade Type 0x00 - Hit 0x01 - Guarded (Accessory) (runs "Missed!"/"Guarded" check) 0x02 - 0x03 - (runs "Missed!"/"Guarded" check) 0x04 - Arrow Guard? 0x05 - Nullified 0x06 - Miss 0x07 - (runs "Missed!"/"Guarded" check) 0x08 - 0x09 - Reflected? 0x0a - 0x0b - Blade Grasp? (runs "Missed!"/"Guarded" check) 0x0c - 0x0d - "Caught" 0x0e - 0x0f - 0x01b3/0x03 - Item to break/use 0x01b4/0x04 - ??? (1 byte) 0x01b5/0x05 - ??? (1 byte) 0x01b6/0x06 - HP Damage 0x01b8/0x08 - HP Recovery 0x01ba/0x0a - MP Damage 0x01bc/0x0c - MP Recovery 0x01be/0x0e - Gil Stolen/Lost 0x01c0/0x10 - Reaction ID 0x01c2/0x12 - Special Flags 1 0x80 - +1 Level 0x40 - Switch Team 0x20 - Poached 0x10 - Steal Item 0x08 - 0x04 - Break Item 0x02 - Malboro (moldball virus) 0x01 - Golem 0x01c3/0x13 - Special Flags 2 0x80 - 0x40 - 0x20 - 0x10 - Katana Break? 0x08 - Weakness? 0x04 - Absorption? 0x02 - Nullification? (Disabled by nullification) 0x01 - -1 Level 0x01c4/0x14 - SP Change 0x80 - Bonus Flag 0x01c5/0x15 - CT Change 0xFF = "Quick" 0x7F = "CT0" 0x80 - Bonus Flag 0x01c6/0x16 - PA Change 0x80 - Bonus Flag 0x01c7/0x17 - MA Change 0x80 - Bonus Flag 0x01c8/0x18 - Brave Change 0x80 - Bonus Flag 0x01c9/0x19 - Faith Change 0x80 - Bonus Flag 0x01ca/0x1a - Status Change? 0x02 - ("Guarded"?) 0x01 - Failed status infliction? ("Missed!") 0x01cb/0x1b - Remove Equipment 0x80 - Remove Helmet 0x40 - Remove Armor 0x20 - Remove Accessory 0x10 - Remove Right Hand Weapon 0x08 - Remove Right Hand Shield 0x04 - Remove Left Hand Weapon 0x02 - Remove Left Hand Shield 0x01 - 0x01cc/0x1c - ??? (1 byte) 0x01cd/0x1d - Attack's Status Infliction 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x01ce/0x1e - Attack's Status Infliction 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x01cf/0x1f - Attack's Status Infliction 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x01d0/0x20 - Attack's Status Infliction 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x01d1/0x21 - Attack's Status Infliction 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x01d2/0x22 - Attack's Status Removal 1 0x80 - 0x40 - Crystal 0x20 - Dead 0x10 - Undead 0x08 - Charging 0x04 - Jump 0x02 - Defending 0x01 - Performing 0x01d3/0x23 - Attack's Status Removal 2 0x80 - Petrify 0x40 - Invite 0x20 - Darkness 0x10 - Confusion 0x08 - Silence 0x04 - Blood Suck 0x02 - Cursed 0x01 - Treasure 0x01d4/0x24 - Attack's Status Removal 3 0x80 - Oil 0x40 - Float 0x20 - Reraise 0x10 - Transparent 0x08 - Berserk 0x04 - Chicken 0x02 - Frog 0x01 - Critical 0x01d5/0x25 - Attack's Status Removal 4 0x80 - Poison 0x40 - Regen 0x20 - Protect 0x10 - Shell 0x08 - Haste 0x04 - Slow 0x02 - Stop 0x01 - Wall 0x01d6/0x26 - Attack's Status Removal 5 0x80 - Faith 0x40 - Innocent 0x20 - Charm 0x10 - Sleep 0x08 - Don't Move 0x04 - Don't Act 0x02 - Reflect 0x01 - Death Sentence 0x01d7/0x27: Attack Type 0x80 - HP Damage 0x40 - HP Recovery 0x20 - MP Damage 0x10 - MP Recovery 0x08 - Status Change? 0x04 - ? 0x02 - ? 0x01 - Stat Change 0x01d8/0x28 - Last Attack On Self? 0x01da/0x2a - Stolen Exp? 0x01db/0x2b - Stolen JP? 0x01dc/0x2c - Hit % 0x01dd/0x2d - ??? (1 byte) 0x01de/0x2e - Main Target ID? 0x01df/0x2f - ??? (1 byte) 0x01e0/0x30 - Modified ENTD Flags 0x80 - Always Present 0x40 - Randomly Present 0x3X - Green Team 0x2X - Light Blue Team 0x1X - Red Team 0x0X - Blue Team 0x08 - Control 0x04 - Immortal 0x02 - 0x01 - 0x01e1/0x31 - Inflicted Status List 1 0x01e2/0x32 - Inflicted Status List 2 0x01e3/0x33 - Inflicted Status List 3 0x01e4/0x34 - Inflicted Status List 4 0x01e5/0x35 - Inflicted Status List 5 0x01e6/0x36 - # of kills scored 0x01e7/0x37 - ID of the unit that killed this character.
After a review of how to unlock dark knight, it seems two bytes are needed to track the necessary data. 1) ID of the unit that killed this character. 2) # of kills scored (not the # of crystals eaten). EDIT: Found 'em! They were tacked onto the end of the unit RAM table.
092e5c44 - Target's Data Pointer 092e5c48 - Attacker's Data Pointer With these two pieces of data, WotL battle mechanics are now fully hackable! Have at it, FFH!
Title: Re: Code Documentation Thread
Post by: 3lric on March 13, 2014, 01:24:38 pm
Nicely done FDC!
Title: Re: Code Documentation Thread
Post by: Argy on March 13, 2014, 02:00:33 pm
Very impressive FDC!!
Title: Re: Code Documentation Thread
Post by: Quantumpencil on February 22, 2018, 03:20:45 am
WeaponXA() location in EBOOT.Bin are as follows:
Formula Pointers are at 0x08A7500C
0x88A54C0 - main routine, branches to all specific weapon type ID's, and includes the formula for fell swords at 0x88A5748
Specific XA calc locations:
PA -> 0x88A559C PA * Br/100 -> 0x88A5610 SP+PA/2 - > 0x88A55DC 1....PA -> 0x88A56BC PA*(100-FA)/100 -> 0x88A5748 PA + MA -> 0x88A5714
ElementalModifiers() is located at 0x88A6040 This handles oil, float, and elemental weak/half/null/absorb flag setting
SetStatusChanges() is located at 0x 88A4540 This reads from the status data and handles cancelling statuses, stackable/unstackable statuses, the immortal ENTD flag, and not inflicting statuses that a unit is immune to or already has.
A large damage modifiers function (which I am not totally done decoding yet) begins at 0x88AA180; it handles elemental strengthening, arcane defense, aracane strength, applies damage boosts due to toad and chicken, handles defend, and some more things. It calls both the elemental/status setting routines. I will update with more info once I have finished parsing it.
EDIT: The above function is the main magic damage formula; I have found/documented many of the formulas real locations in EBOOT.bin. I'll start porting hacks/writing some documentation for all of this in the coming weeks
Title: Re: Code Documentation Thread
Post by: deus-misereatur on March 20, 2018, 03:39:52 pm
281248: Ramza's starting stats and equipment. Can't find his level nor his Bravery/Faith, though.