• Welcome to Final Fantasy Hacktics. Please login or sign up.
 

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.

Messages - Glain

461
Help! / Re: Formula 2D gain elemental
January 14, 2012, 02:00:37 pm
I just coincidentally did a hack that I've been testing that was essentially a rewrite of [2d], [2f], and [30], mainly to give the Dark/Night Sword abilities the same properties as Holy Sword (allow elemental, strengthen, status proc, etc), but one of the changes was also to allow elemental strengthening even if it's on the ability and not the weapon. It should work with the flag under Hit Allies that fdc mentioned.

If you have a patch changing these formulas already, it could overwrite something.

(Edited patch out due to newer version below)
462
I could look at making a patch to change which flags are for which counter abilities. I'm not promising results or anything, but I may look into it. It sounds interesting.

I was hoping, when I looked into the question of "Where does Counter Tackle figure out which ability to counter with?" that it would be something associated with the ability, but from what I saw of the code, it might be hardcoded to ability ID, which would make the second part a lot harder.

(Hardcoded as in, Is my Ability ID [Counter Tackle's Ability ID]? If so, use [Dash's Ability ID])
463
PSX FFT Hacking / Re: ASM Collective BATTLE.BIN Map
January 13, 2012, 11:04:07 am
Here's a few battle.bin routines I made notes on while checking out crystal inheriting (The forum seems to hate my formatting).



ROUTINE: FIND UNIT AT SPECIFIED COORDINATES

   PARAMETERS:
      r4 = X-Coordinate
      r5 = Y-Coordinate
      r6 = Is on Upper Level
      r7 = Flags to specify which units to find (Example 0x41 = Crystal and Treasure units)
         0x80 : Chocobo
         0x40 : Crystal
         0x10 : Transparent
         0x01 : Treasure
      
   RETURNS:
      r2    =    -2, If coordinates invalid;
            -1, If no unit found at coordinates with any of the specified flags;
            >=0, If unit found at coordinates with at least one specified flag; Value = [index of unit found]

SECTION 1 : SET UP ROUTINE

0017dca8: 27bdffd0 addiu r29,r29,0xffd0
0017dcac: afb40020 sw r20,0x0020(r29)
0017dcb0: 0080a021 addu r20,r4,r0            #   r20 = r4 (X)
0017dcb4: afb50024 sw r21,0x0024(r29)
0017dcb8: 00a0a821 addu r21,r5,r0            #    r21 = r5 (Y)
0017dcbc: afb60028 sw r22,0x0028(r29)
0017dcc0: 00c0b021 addu r22,r6,r0            #    r22 = r6 (Is on Upper Level)
0017dcc4: afb20018 sw r18,0x0018(r29)   
0017dcc8: 00e09021 addu r18,r7,r0            #    r18 = r7 (Flags)
0017dccc: afbf002c sw r31,0x002c(r29)
0017dcd0: afb3001c sw r19,0x001c(r29)
0017dcd4: afb10014 sw r17,0x0014(r29)

SECTION 2 : INTEGRITY CHECK ON COORDINATES

0017dcd8: 0680002c bltz r20,0x0017dd8c         #    IF (X < 0)
0017dcdc: afb00010 sw r16,0x0010(r29)         #      RETURN -2
0017dce0: 3c03800e lui r3,0x800e
0017dce4: 90634e9c lbu r3,0x4e9c(r3)         #   r3 = [Map MAX X]      
0017dce8: 00000000 nop
0017dcec: 0283102a slt r2,r20,r3            #   IF (X >= [Map MAX X])
0017dcf0: 10400026 beq r2,r0,0x0017dd8c         #      RETURN -2
0017dcf4: 00000000 nop
0017dcf8: 06a0006a bltz r21,0x0017dea4         #   IF (Y < 0)
0017dcfc: 2402fffe addiu r2,r0,0xfffe         #      RETURN -2
0017dd00: 3c02800e lui r2,0x800e
0017dd04: 90424ea0 lbu r2,0x4ea0(r2)         
0017dd08: 00000000 nop
0017dd0c: 02a2102a slt r2,r21,r2            #   IF (Y >= [Map MAX Y])
0017dd10: 1040001e beq r2,r0,0x0017dd8c         #      RETURN -2
0017dd14: 2ec20002 sltiu r2,r22,0x0002         #   IF (r22 >= 2)
0017dd18: 1040001c beq r2,r0,0x0017dd8c         #      RETURN -2
0017dd1c: 02a30018 mult r21,r3               
0017dd20: 00161200 sll r2,r22,0x08            
0017dd24: 00001812 mflo r3                  
0017dd28: 00431021 addu r2,r2,r3
0017dd2c: 00541021 addu r2,r2,r20            
0017dd30: 000210c0 sll r2,r2,0x03
0017dd34: 3c038019 lui r3,0x8019
0017dd38: 2463f8cc addiu r3,r3,0xf8cc
0017dd3c: 00431821 addu r3,r2,r3            #   r3 = [Tile data for current tile specified by (X,Y)]
0017dd40: 90620006 lbu r2,0x0006(r3)
0017dd44: 00000000 nop
0017dd48: 30420003 andi r2,r2,0x0003         #   IF (current tile unselectable and/or cannot target)
0017dd4c: 14400055 bne r2,r0,0x0017dea4         #      RETURN -2
0017dd50: 2402fffe addiu r2,r0,0xfffe
0017dd54: 30e20002 andi r2,r7,0x0002         #   r17 = 0; IF (?) (TRUE for r7=65)
0017dd58: 10400010 beq r2,r0,0x0017dd9c         #      JUMP to [SECTION 3]
0017dd5c: 00008821 addu r17,r0,r0            
0017dd60: 90620003 lbu r2,0x0003(r3)
0017dd64: 00000000 nop
0017dd68: 304200e0 andi r2,r2,0x00e0         #   IF (tile depth >= 2)
0017dd6c: 1440004d bne r2,r0,0x0017dea4         #      RETURN -2
0017dd70: 2402fffe addiu r2,r0,0xfffe
0017dd74: 90620003 lbu r2,0x0003(r3)
0017dd78: 00000000 nop
0017dd7c: 3042001f andi r2,r2,0x001f
0017dd80: 28420003 slti r2,r2,0x0003         #   IF (tile height < 3) ??
0017dd84: 14400006 bne r2,r0,0x0017dda0         #      JUMP to [SECTION 3]
0017dd88: 00009821 addu r19,r0,r0
0017dd8c: 0805f7a9 j 0x0017dea4
0017dd90: 2402fffe addiu r2,r0,0xfffe         #   RETURN -2
0017dd94: 0805f7a9 j 0x0017dea4
0017dd98: 3082001f andi r2,r4,0x001f         #   RETURN r4 (low 5 bits)
0017dd9c: 00009821 addu r19,r0,r0            #   r19 = 0 (Offset to current unit in loop)

# SECTION 3 : LOOP THROUGH IN-BATTLE UNITS

#   SECTION 3.0 : START OF LOOP : BEGIN FLAG CHECKS : CRYSTAL=0x40

0017dda0: 3c028019 lui r2,0x8019            #    DO {
0017dda4: 244208cc addiu r2,r2,0x08cc         #      
0017dda8: 02628021 addu r16,r19,r2            #      r16 = [Current unit in loop]
0017ddac: 92030001 lbu r3,0x0001(r16)
0017ddb0: 340200ff ori r2,r0,0x00ff
0017ddb4: 10620036 beq r3,r2,0x0017de90         #       IF (current unit doesn't exist)
0017ddb8: 32420051 andi r2,r18,0x0051         #         CONTINUE
0017ddbc: 10400018 beq r2,r0,0x0017de20         #      (Check r18 = fourth parameter) : bits 0x40, 0x10, 0x01
0017ddc0: 32420040 andi r2,r18,0x0040         #      IF (Checked bits) == 0
0017ddc4: 10400007 beq r2,r0,0x0017dde4         #         r2 = (Check r18 bit 0x01); JUMP to [SECTION 3.1]
0017ddc8: 32420001 andi r2,r18,0x0001         
0017ddcc: 92020058 lbu r2,0x0058(r16)         
0017ddd0: 00000000 nop
0017ddd4: 30420040 andi r2,r2,0x0040         #      IF (current unit is crystal)
0017ddd8: 14400012 bne r2,r0,0x0017de24         #         r2 = (Check r18 bit 0x80); JUMP TO [SECTION 3.3]
0017dddc: 32420080 andi r2,r18,0x0080
0017dde0: 32420001 andi r2,r18,0x0001         #      r2 = (Check r18 bit 0x01)

#   SECTION 3.1 : FLAG CHECKS SUBSECTION 1 : TREASURE=0x01

0017dde4: 10400007 beq r2,r0,0x0017de04         #      IF (Check r18 bit 0x01) == 0
0017dde8: 32420010 andi r2,r18,0x0010         #         r2 = (Check r18 bit 0x10); JUMP to [SECTION 3.2]
0017ddec: 92020059 lbu r2,0x0059(r16)
0017ddf0: 00000000 nop
0017ddf4: 30420001 andi r2,r2,0x0001         #      IF (current unit is treasure)
0017ddf8: 1440000a bne r2,r0,0x0017de24         #         r2 = (Check r18 bit 0x80); JUMP to [SECTION 3.3]
0017ddfc: 32420080 andi r2,r18,0x0080
0017de00: 32420010 andi r2,r18,0x0010         #      r2 = (Check r18 bit 0x10)

#   SECTION 3.2 : FLAG CHECKS SUBSECTION 2 : TRANSPARENT=0x10

0017de04: 10400022 beq r2,r0,0x0017de90         #      IF (Check r18 bit 0x10) == 0
0017de08: 00000000 nop                     #         CONTINUE
0017de0c: 9202005a lbu r2,0x005a(r16)               
0017de10: 00000000 nop
0017de14: 30420010 andi r2,r2,0x0010
0017de18: 1040001d beq r2,r0,0x0017de90         #       IF (current unit is not transparent)
0017de1c: 00000000 nop                     #         CONTINUE
0017de20: 32420080 andi r2,r18,0x0080         #      r2 = (Check r18 bit 0x80)

#   SECTION 3.3 : FLAG CHECKS SUBSECTION 3 : CHOCOBO=0x80

0017de24: 10400005 beq r2,r0,0x0017de3c         #       IF (Check r18 bit 0x80) == 0
0017de28: 00000000 nop                     #         JUMP to [SECTION 3.4]
0017de2c: 0c05d0f2 jal 0x001743c8            #      Routine: Chocobo check? (r4 = current unit pointer)
0017de30: 02002021 addu r4,r16,r0
0017de34: 10400016 beq r2,r0,0x0017de90         #      IF (Chocobo check result == 0)
0017de38: 00000000 nop                     #         CONTINUE

#   SECTION 3.4 : UNIT CHECKS

0017de3c: 92020047 lbu r2,0x0047(r16)
0017de40: 00000000 nop
0017de44: 14540012 bne r2,r20,0x0017de90      #      IF (current unit X-coord != X)
0017de48: 00000000 nop                     #         CONTINUE
0017de4c: 92020048 lbu r2,0x0048(r16)         
0017de50: 00000000 nop
0017de54: 1455000e bne r2,r21,0x0017de90      #      IF (current unit Y-coord != Y)
0017de58: 00000000 nop                     #         CONTINUE
0017de5c: 96020048 lhu r2,0x0048(r16)
0017de60: 00000000 nop
0017de64: 000213c2 srl r2,r2,0x0f            #      IF (current unit IsOnUpperLevel != IsOnUpperLevel)
0017de68: 14560009 bne r2,r22,0x0017de90      #         CONTINUE
0017de6c: 00000000 nop
0017de70: 92040182 lbu r4,0x0182(r16)
0017de74: 00000000 nop
0017de78: 308200ff andi r2,r4,0x00ff
0017de7c: 2c420080 sltiu r2,r2,0x0080         #      IF (current unit is riding a unit?)
0017de80: 1040ffc4 beq r2,r0,0x0017dd94         #         RETURN (??)
0017de84: 02201021 addu r2,r17,r0            #       
0017de88: 0805f7a9 j 0x0017dea4               #      RETURN (current unit index)
0017de8c: 00000000 nop

#    SECTION 3.5 : END OF LOOP

0017de90: 26310001 addiu r17,r17,0x0001
0017de94: 2a220015 slti r2,r17,0x0015
0017de98: 1440ffc1 bne r2,r0,0x0017dda0         #    } WHILE (r17 (current unit index) < 21)
0017de9c: 267301c0 addiu r19,r19,0x01c0
0017dea0: 2402ffff addiu r2,r0,0xffff         #   r2 (Return result) = -1 (No unit found)

# SECTION 4 : RETURN r2

0017dea4: 8fbf002c lw r31,0x002c(r29)
0017dea8: 8fb60028 lw r22,0x0028(r29)
0017deac: 8fb50024 lw r21,0x0024(r29)
0017deb0: 8fb40020 lw r20,0x0020(r29)
0017deb4: 8fb3001c lw r19,0x001c(r29)
0017deb8: 8fb20018 lw r18,0x0018(r29)
0017debc: 8fb10014 lw r17,0x0014(r29)
0017dec0: 8fb00010 lw r16,0x0010(r29)
0017dec4: 27bd0030 addiu r29,r29,0x0030
0017dec8: 03e00008 jr r31
0017decc: 00000000 nop




ROUTINE : GENERATE CRYSTAL/TREASURE

   PARAMETERS:
      r4 = [In-battle unit index of moving unit]
      
   RETURNS:
      r2               =   0x8006623c (Pointer);
      MEMORY[0x8006623c]    =    -1, If no crystal/treasure unit found; 0, If no abilities to inherit from a crystal; 1, Otherwise;
      MEMORY[0x80066254]   =    [Crystal abilities: List of flags by skillset (1-8,9-16,17-24) for which ability slots are contained in crystal];
      MEMORY[0x8006628d]    =    [In-battle unit index of unit found], if a unit was found;
      MEMORY[0x8006628e]    =    [Treasure item ID], if unit is obtaining treasure; 2, Otherwise;
      MEMORY[0x8006628f]    =    ?

# SECTION 1 : SET UP ROUTINE

00180530: 27bdff70 addiu r29,r29,0xff70
00180534: afb20070 sw r18,0x0070(r29)
00180538: 00809021 addu r18,r4,r0         #    r18 = (Moving unit)
0018053c: 34070041 ori r7,r0,0x0041         #    r7 = 0x41 = (Flags for find-unit-at-coords routine: Crystal, Treasure)
00180540: afbf008c sw r31,0x008c(r29)
00180544: afbe0088 sw r30,0x0088(r29)
00180548: afb70084 sw r23,0x0084(r29)
0018054c: afb60080 sw r22,0x0080(r29)
00180550: afb5007c sw r21,0x007c(r29)
00180554: afb40078 sw r20,0x0078(r29)
00180558: afb30074 sw r19,0x0074(r29)
0018055c: afb1006c sw r17,0x006c(r29)
00180560: afb00068 sw r16,0x0068(r29)

# SECTION 2 : FIND APPROPRIATE UNIT, BEGIN LIST?

00180564: 92440047 lbu r4,0x0047(r18)      #    Load in coordinates (X,Y,IsOnUpperLevel) of moving unit
00180568: 96460048 lhu r6,0x0048(r18)
0018056c: 92450048 lbu r5,0x0048(r18)
00180570: 0c05f72a jal 0x0017dca8         #    Routine: Find unit at coordinates (Flags: Crystal, Treasure)
00180574: 000633c2 srl r6,r6,0x0f         
00180578: 00401821 addu r3,r2,r0         #    r3 = r2 (Index of unit found)
0018057c: 04610006 bgez r3,0x00180598      #    IF (No unit found) {
00180580: 000310c0 sll r2,r3,0x03
00180584: 3c028006 lui r2,0x8006
00180588: 2442623c addiu r2,r2,0x623c
0018058c: 2403ffff addiu r3,r0,0xffff            MEM[0x06623c] = -1 (Code for empty?)
00180590: 08060234 j 0x001808d0                  RETURN 0x8006623c
00180594: ac430000 sw r3,0x0000(r2)         #   }
00180598: 3c118006 lui r17,0x8006
0018059c: 2631623c addiu r17,r17,0x623c      #    r17 = 0x8006623c
001805a0: 00431023 subu r2,r2,r3
001805a4: 00021180 sll r2,r2,0x06
001805a8: ae200000 sw r0,0x0000(r17)      #    MEM[0x06623c] = 0
001805ac: 3c018006 lui r1,0x8006
001805b0: a023628d sb r3,0x628d(r1)         #    MEM[0x06628d] = [Coordinate routine result?]
001805b4: 3c038019 lui r3,0x8019
001805b8: 246308cc addiu r3,r3,0x08cc      
001805bc: 00438021 addu r16,r2,r3         #    r16 = (Found unit)
001805c0: 92020059 lbu r2,0x0059(r16)   
001805c4: 00000000 nop
001805c8: 30420001 andi r2,r2,0x0001      
001805cc: 10400008 beq r2,r0,0x001805f0      #    IF (Found unit is treasure status) {
001805d0: 02002021 addu r4,r16,r0
001805d4: 34020004 ori r2,r0,0x0004
001805d8: 0c060282 jal 0x00180a08               Routine: Generate treasure from treasure unit
001805dc: ae220000 sw r2,0x0000(r17)
001805e0: 3c018006 lui r1,0x8006
001805e4: a022628e sb r2,0x628e(r1)               MEM[0x6628e] = [Routine result]
001805e8: 08060232 j 0x001808c8                  RETURN 0x8006623c
001805ec: 00000000 nop                  #   }
001805f0: 34020002 ori r2,r0,0x0002
001805f4: ae220000 sw r2,0x0000(r17)      #    MEM[0x6628e] = 2
001805f8: 924b0006 lbu r11,0x0006(r18)      
001805fc: 00000000 nop
00180600: 31620020 andi r2,r11,0x0020
00180604: afab0040 sw r11,0x0040(r29)      #    STACK[0x40] = [Gender/monster flags of moving unit]
00180608: 92030006 lbu r3,0x0006(r16)
0018060c: 144000ae bne r2,r0,0x001808c8      #    IF (Moving unit or found unit is monster), RETURN 0x8006623c
00180610: 30620020 andi r2,r3,0x0020
00180614: 144000ac bne r2,r0,0x001808c8
00180618: 00000000 nop
0018061c: 26240053 addiu r4,r17,0x0053      #    r4 = 0x800662e1
00180620: 34050040 ori r5,r0,0x0040         #    r5 = 0x40 (64)
00180624: 27aa0010 addiu r10,r29,0x0010
00180628: 27ab0018 addiu r11,r29,0x0018
0018062c: 0240b021 addu r22,r18,r0         #    r22 = (Moving unit)
00180630: afa00028 sw r0,0x0028(r29)      #    STACK[0x28] = 0      
00180634: afaa0058 sw r10,0x0058(r29)      #    STACK[0x58] = (Pointer to stack) + 0x10
00180638: afab0050 sw r11,0x0050(r29)      #    STACK[0x50] = (Pointer to stack) + 0x18
0018063c: afb00060 sw r16,0x0060(r29)      #    STACK[0x60] = (Found unit)
00180640: 92c20096 lbu r2,0x0096(r22)      #    r2 = [Moving unit jobs unlocked 1]   
00180644: 92c30097 lbu r3,0x0097(r22)      #    r3 = [Moving unit jobs unlocked 2]
00180648: 92c60098 lbu r6,0x0098(r22)      #    r6 = [Moving unit jobs unlocked 3]
0018064c: 00021400 sll r2,r2,0x10
00180650: 00031a00 sll r3,r3,0x08
00180654: 00431021 addu r2,r2,r3
00180658: 00461021 addu r2,r2,r6
0018065c: afa20048 sw r2,0x0048(r29)      #    STACK[0x48] = [Moving unit unlocked job info]
00180660: 92ca0000 lbu r10,0x0000(r22)      #    r10 = [Moving unit base job]
00180664: 0000a821 addu r21,r0,r0         #    r21 = 0
00180668: afaa0030 sw r10,0x0030(r29)      #    STACK[0x30] = [Moving unit base job]
0018066c: 920b0000 lbu r11,0x0000(r16)      #    r11 = [Found unit base job]
00180670: 26370018 addiu r23,r17,0x0018      #    r23 = 0x66254 (Starting list position?)
00180674: 0c017991 jal 0x0005e644         #    Routine: Clear (zero out) array (pointer=0x6628F, size=0x40=64)
00180678: afab0038 sw r11,0x0038(r29)      #    STACK[0x38] = [Found unit base job]

SECTION 3 : START OF LOOP

0018067c: 27a40020 addiu r4,r29,0x0020      #   DO {
00180680: 26c60099 addiu r6,r22,0x0099      #       r6 = [Moving unit's action abilities for current class]
00180684: 02e01821 addu r3,r23,r0         #       r3 = [list position]
00180688: 27a90023 addiu r9,r29,0x0023
0018068c: 8faa0060 lw r10,0x0060(r29)      #       r10 = [Found unit]
00180690: 8fa70050 lw r7,0x0050(r29)      #       r7 = (Pointer to stack) + 0x18
00180694: 8fa50058 lw r5,0x0058(r29)      #       r5 = (Pointer to stack) + 0x10
00180698: 25480099 addiu r8,r10,0x0099      #       r8 = [Found unit's action abilities for current class]

SECTION 4 : LOOP THROUGH BASE ACTION ABILITIES

0018069c: a0600000 sb r0,0x0000(r3)         #       FOR (i=1; i < 3; i++) {
001806a0: a0a00000 sb r0,0x0000(r5)         #          MEM[r3] = 0; STACK[r5] = 0
001806a4: 90c20000 lbu r2,0x0000(r6)      #          r2 = (i-th Moving unit base action abilities)
001806a8: 24c60001 addiu r6,r6,0x0001      #          r6++
001806ac: 24a50001 addiu r5,r5,0x0001      #          r5++
001806b0: 24630001 addiu r3,r3,0x0001      #          r3++
001806b4: a0e20000 sb r2,0x0000(r7)         #          STACK[r7] = (i-th Moving unit base action abilities)
001806b8: 91020000 lbu r2,0x0000(r8)      #          r2 = (i-th Found unit base action abilities)
001806bc: 25080001 addiu r8,r8,0x0001      #          r8++
001806c0: a0820000 sb r2,0x0000(r4)         #          STACK[r4] = (i-th Found unit base action abilities)
001806c4: 24840001 addiu r4,r4,0x0001      #          r4++; r7++
001806c8: 0089102a slt r2,r4,r9            #       }
001806cc: 1440fff3 bne r2,r0,0x0018069c
001806d0: 24e70001 addiu r7,r7,0x0001      

SECTION 5 : BASE JOB CHECK

                                 #       r3 = r21 + 0x4A (NOTE: Start of generic jobs? Job 0x4A = Squire)
001806d4: 16a0000b bne r21,r0,0x00180704   #       IF (r21 != 0)
001806d8: 26a3004a addiu r3,r21,0x004a      #         JUMP to [SECTION 6]
001806dc: 8fab0030 lw r11,0x0030(r29)      #       r11 = [Moving unit base job]
001806e0: 8faa0038 lw r10,0x0038(r29)      #       r10 = [Found unit base job]
001806e4: 00000000 nop                  #       IF (r11 != r10)
001806e8: 156a0065 bne r11,r10,0x00180880   #         JUMP to [SECTION 14]
001806ec: 29620080 slti r2,r11,0x0080      #       IF (r11 >= 0x80)
001806f0: 1040000a beq r2,r0,0x0018071c      #         JUMP to [SECTION 7]
001806f4: 34020011 ori r2,r0,0x0011
001806f8: 8fa30030 lw r3,0x0030(r29)      #       r3 = [Moving unit base job]
001806fc: 080601c7 j 0x0018071c            #       JUMP to [SECTION 7]
00180700: 00000000 nop

SECTION 6 : JOB UNLOCKED CHECK

00180704: 3c020080 lui r2,0x0080
00180708: 8fab0048 lw r11,0x0048(r29)      #       r11 = [Moving unit unlocked job info]
0018070c: 02a21007 srav r2,r2,r21
00180710: 01621024 and r2,r11,r2         #       IF (Moving unit doesn't have this job unlocked)
00180714: 1040005a beq r2,r0,0x00180880      #         Jump to [SECTION 14]
00180718: 34020011 ori r2,r0,0x0011

SECTION 7 : BARD CHECK

0018071c: 16a20006 bne r21,r2,0x00180738   #       IF (r21 != 0x11 (BARD))
00180720: 34020012 ori r2,r0,0x0012         #         Jump to [SECTION 8]
00180724: 8faa0040 lw r10,0x0040(r29)      #       r10 = [Gender/monster flags of moving unit]
00180728: 00000000 nop
0018072c: 31420040 andi r2,r10,0x0040      
00180730: 14400053 bne r2,r0,0x00180880      #       IF (Moving unit is female)
00180734: 34020012 ori r2,r0,0x0012         #         JUMP to [SECTION 14]

SECTION 8 : DANCER CHECK

                                 #       r17 = 0 (NULL?)
00180738: 16a20006 bne r21,r2,0x00180754   #       IF (r21 != 0x12 (DANCER))
0018073c: 00008821 addu r17,r0,r0         #         Jump to [SECTION 9]
00180740: 8fab0040 lw r11,0x0040(r29)      #       r11 = [Gender/monster flags of moving unit]
00180744: 00000000 nop
00180748: 31620080 andi r2,r11,0x0080      #       IF (Moving unit is male)
0018074c: 1440004c bne r2,r0,0x00180880      #         JUMP to [SECTION 14]
00180750: 00000000 nop

SECTION 9 : FIND SKILLSET ID

00180754: 00031040 sll r2,r3,0x01
00180758: 00431021 addu r2,r2,r3
0018075c: 3c038006 lui r3,0x8006
00180760: 8c636194 lw r3,0x6194(r3)         
00180764: 00021100 sll r2,r2,0x04
00180768: 00431021 addu r2,r2,r3         
0018076c: 905e0000 lbu r30,0x0000(r2)      #       r30 = [Skillset ID of current job]      

SECTION 10 : BEGIN INNER LOOP : LOOP THROUGH ABILITIES OF SKILLSET?

00180770: 06210002 bgez r17,0x0018077c      #      DO
00180774: 02201821 addu r3,r17,r0         #      {
00180778: 26230007 addiu r3,r17,0x0007      #          r3 = [Ability index]   NOTE: Calculation is: r3 =(r17 >= 0) ? r17 : (r17 + 7)

SECTION 11

0018077c: 000390c3 sra r18,r3,0x03
00180780: 001218c0 sll r3,r18,0x03
00180784: 02231823 subu r3,r17,r3         #         r3 = Offset?
00180788: 8faa0050 lw r10,0x0050(r29)      #         r10 = (Pointer to stack) + 0x18
0018078c: 34040080 ori r4,r0,0x0080         #         r4 = 0x80
00180790: 01521021 addu r2,r10,r18         #         r2 = Offset?
00180794: 90420000 lbu r2,0x0000(r2)      #         r2 = STACK[0x18+r18]
00180798: 00649807 srav r19,r4,r3
0018079c: 00531024 and r2,r2,r19         #         r2 = (Stack pointer offset?); IF (???)
001807a0: 14400029 bne r2,r0,0x00180848      #            JUMP to [SECTION 12]
001807a4: 03b21021 addu r2,r29,r18               
001807a8: 90420020 lbu r2,0x0020(r2)      #         r2 = MEM[r2+0x20]
001807ac: 00000000 nop
001807b0: 00531024 and r2,r2,r19         #         r2 = Offset?
001807b4: 10400024 beq r2,r0,0x00180848      #         IF (???)
001807b8: 03c02021 addu r4,r30,r0         #            Jump to [SECTION 12]
001807bc: 0c01695a jal 0x0005a568         #         Routine : Get Ability ID (r4=[Skillset ID]; r5=[Ability index])
001807c0: 02202821 addu r5,r17,r0
001807c4: 0040a021 addu r20,r2,r0         
001807c8: 3290ffff andi r16,r20,0xffff      #         r16 = (Routine result)
001807cc: 1200001e beq r16,r0,0x00180848   #         IF (r16 == 0) JUMP to [SECTION 12]
001807d0: 001010c0 sll r2,r16,0x03         #         
001807d4: 3c018006 lui r1,0x8006
001807d8: 00220821 addu r1,r1,r2         
001807dc: 9025ebf2 lbu r5,-0x140e(r1)      #         r5 = (Ability's Chance to Learn?)
001807e0: 0c017833 jal 0x0005e0cc         #          Routine: Pass/Fail Roll (Possibilities=100, Threshold=r5)
001807e4: 34040064 ori r4,r0,0x0064
001807e8: 14400017 bne r2,r0,0x00180848      #         IF (Roll was a Fail)
001807ec: 00000000 nop                  #            JUMP to [SECTION 12]
001807f0: 8fab0058 lw r11,0x0058(r29)      #         r11 = (Pointer to stack) + 0x10
001807f4: 00000000 nop
001807f8: 01721021 addu r2,r11,r18         #         r2 = Offset?
001807fc: 8faa0028 lw r10,0x0028(r29)      #         
00180800: 90430000 lbu r3,0x0000(r2)      #         r3 = MEM[r2]
00180804: 254a0001 addiu r10,r10,0x0001      #         
00180808: 02631825 or r3,r19,r3            #         r3 = ?
0018080c: afaa0028 sw r10,0x0028(r29)      #         STACK[0x28]++
00180810: a0430000 sb r3,0x0000(r2)         #         MEM[r2] = r3
00180814: 2e020200 sltiu r2,r16,0x0200      #         IF (r16 >= 0x200)
00180818: 1040000b beq r2,r0,0x00180848      #            JUMP to [SECTION 12]
0018081c: 001020c2 srl r4,r16,0x03
00180820: 32850007 andi r5,r20,0x0007      #         r5 = r20 + 7
00180824: 34020001 ori r2,r0,0x0001         #         r2 = 1
00180828: 3c018006 lui r1,0x8006
0018082c: 00240821 addu r1,r1,r4
00180830: 9023628f lbu r3,0x628f(r1)      #         r3 = (Element of list)
00180834: 00a21004 sllv r2,r2,r5
00180838: 00431025 or r2,r2,r3
0018083c: 3c018006 lui r1,0x8006
00180840: 00240821 addu r1,r1,r4
00180844: a022628f sb r2,0x628f(r1)         #         (Save new element to list)

SECTION 12 : END OF INNER LOOP

00180848: 26310001 addiu r17,r17,0x0001
0018084c: 2a220018 slti r2,r17,0x0018
00180850: 1440ffc7 bne r2,r0,0x00180770      #      } WHILE (r17 < 0x18)
00180854: 26e50003 addiu r5,r23,0x0003
00180858: 02e01821 addu r3,r23,r0
0018085c: 8fa40058 lw r4,0x0058(r29)   

SECTION 13 : WRITE ELEMENTS TO LIST
      
00180860: 00000000 nop                  #      DO {
00180864: 90820000 lbu r2,0x0000(r4)      
00180868: 00000000 nop
0018086c: a0620000 sb r2,0x0000(r3)         #         LIST[r23 + i] = STACK[0x10 + i]
00180870: 24630001 addiu r3,r3,0x0001      #         r3++; r4++
00180874: 0065102a slt r2,r3,r5            
00180878: 1440fff9 bne r2,r0,0x00180860      #      } WHILE (r3 < r5)
0018087c: 24840001 addiu r4,r4,0x0001

SECTION 14 : END OF OUTER LOOP : INCREMENT APPROPRIATE COUNTERS/VARIABLES

00180880: 26f70003 addiu r23,r23,0x0003      #       r23 += 3            NOTE: r23 = (Position in list?)
00180884: 26d60003 addiu r22,r22,0x0003      #       r22 += 3            NOTE: r22 = [Moving unit offset]
00180888: 26b50001 addiu r21,r21,0x0001      #       r21++                NOTE: r21 = (Current job ID) - 0x4A (Loop counter)
0018088c: 8fab0060 lw r11,0x0060(r29)      
00180890: 2aa20013 slti r2,r21,0x0013      #       STACK[0x60] += 3      NOTE: STACK[0x60] = [Found unit offset]
00180894: 256b0003 addiu r11,r11,0x0003   
00180898: 1440ff78 bne r2,r0,0x0018067c      #    } WHILE (r21 < 0x13)
0018089c: afab0060 sw r11,0x0060(r29)

SECTION 15

001808a0: 8faa0028 lw r10,0x0028(r29)
001808a4: 00000000 nop
001808a8: 11400007 beq r10,r0,0x001808c8   #    IF (STACK[0x28] == 0)
001808ac: 00000000 nop                  #      RETURN 0x8006623c
001808b0: 3c038006 lui r3,0x8006
001808b4: 2463623c addiu r3,r3,0x623c
001808b8: 8c620000 lw r2,0x0000(r3)
001808bc: 00000000 nop
001808c0: 34420001 ori r2,r2,0x0001
001808c4: ac620000 sw r2,0x0000(r3)         #   MEM[0x6623c]++

SECTION 16 : RETURN 0x8006623c (Pointer to list?)

001808c8: 3c028006 lui r2,0x8006
001808cc: 2442623c addiu r2,r2,0x623c      #   RETURN 0x8006623c
001808d0: 8fbf008c lw r31,0x008c(r29)
001808d4: 8fbe0088 lw r30,0x0088(r29)
001808d8: 8fb70084 lw r23,0x0084(r29)
001808dc: 8fb60080 lw r22,0x0080(r29)
001808e0: 8fb5007c lw r21,0x007c(r29)
001808e4: 8fb40078 lw r20,0x0078(r29)
001808e8: 8fb30074 lw r19,0x0074(r29)
001808ec: 8fb20070 lw r18,0x0070(r29)
001808f0: 8fb1006c lw r17,0x006c(r29)
001808f4: 8fb00068 lw r16,0x0068(r29)
001808f8: 27bd0090 addiu r29,r29,0x0090
001808fc: 03e00008 jr r31
00180900: 00000000 nop




ROUTINE : CHOCOBO CHECK

   PARAMETERS:
      r4 = Unit
   
   RETURNS:
      r2   =   0, If proper statuses not found and/or unit is not a chocobo
            1, If unit is a chocobo with proper status and riding check was not passed
            2, If unit is a chocobo with proper status and riding check was passed

SECTION 1 : SET UP ROUTINE AND CALL OTHER ROUTINE

001743c8: 27bdffe8 addiu r29,r29,0xffe8
001743cc: afb00010 sw r16,0x0010(r29)
001743d0: 00808021 addu r16,r4,r0
001743d4: afbf0014 sw r31,0x0014(r29)
001743d8: 92020003 lbu r2,0x0003(r16)         #   r2 = [Current job ID of unit]
001743dc: 00000000 nop
001743e0: 2442ffa2 addiu r2,r2,0xffa2         #   r2 = r2 - 0x5E (94)
001743e4: 2c420003 sltiu r2,r2,0x0003         #   IF (Unit is not a chocobo)   Note: Condition is (UNSIGNED r2 < 3); can only happen for jobs 0x5E - 0x60
001743e8: 10400005 beq r2,r0,0x00174400         #      RETURN 0
001743ec: 02002021 addu r4,r16,r0         
001743f0: 0c01786c jal 0x0005e1b0            #   Routine: Check status flags (r4 = current unit, r5 = 10)
001743f4: 3405000a ori r5,r0,0x000a            
001743f8: 10400003 beq r2,r0,0x00174408         #   IF (Routine result == 0)
001743fc: 00000000 nop                     #      JUMP to [SECTION 2]
00174400: 0805d107 j 0x0017441c               #   RETURN 0
00174404: 00001021 addu r2,r0,r0

SECTION 2 : CHECK RIDDEN UNIT

00174408: 92030182 lbu r3,0x0182(r16)
0017440c: 00000000 nop
00174410: 14600002 bne r3,r0,0x0017441c         #   IF (Something to do with riding?)
00174414: 34020002 ori r2,r0,0x0002            #      RETURN 2
00174418: 34020001 ori r2,r0,0x0001            #    RETURN 1

SECTION 3 : RETURN r2

0017441c: 8fbf0014 lw r31,0x0014(r29)
00174420: 8fb00010 lw r16,0x0010(r29)
00174424: 27bd0018 addiu r29,r29,0x0018
00174428: 03e00008 jr r31
0017442c: 00000000 nop




ROUTINE : GENERATE TREASURE FOR TREASURE CHEST

   PARAMETERS:
      r4    =   [Treasure unit]
      
   RETURNS:
      r2   =   [Item]

SECTION 1 : SET UP
      
00180a08: 3c028019 lui r2,0x8019
00180a0c: 8c42f5fc lw r2,-0x0a04(r2)            #   r2 = MEM[0x18f5fc]
00180a10: 27bdffe0 addiu r29,r29,0xffe0
00180a14: afbf001c sw r31,0x001c(r29)            #   IF (r2 != 0)
00180a18: 14400033 bne r2,r0,0x00180ae8            #      RETURN r2
00180a1c: afb00018 sw r16,0x0018(r29)
00180a20: 00008021 addu r16,r0,r0               #   r16 = 0   [Count of valid items]
00180a24: 00003021 addu r6,r0,r0               #   r6 = 0    [Current equipment slot index]
00180a28: 27a50010 addiu r5,r29,0x0010            #   r5 =    [Valid item array pointer]

SECTION 2 : FIND VALID ITEMS ON TREASURE UNIT (EQUIPMENT)

                                       #   DO {
00180a2c: 00861021 addu r2,r4,r6               #      
00180a30: 9042001a lbu r2,0x001a(r2)            #      r2 = MEM[r4+r6+0x1a) [Equip] (Equipment in current slot of treasure unit)
00180a34: 00000000 nop
00180a38: a0a20000 sb r2,0x0000(r5)               #      ValidItems[i-th] (MEM[r5]) = [Equip]
00180a3c: 90a30000 lbu r3,0x0000(r5)
00180a40: 00000000 nop                        #      r6++ (LoopCount++)
00180a44: 2c6200fe sltiu r2,r3,0x00fe            #      IF ([Equip] >= 0xFE) (empty)
00180a48: 10400005 beq r2,r0,0x00180a60            #         CONTINUE (skip this item)
00180a4c: 24c60001 addiu r6,r6,0x0001
00180a50: 10600004 beq r3,r0,0x00180a64            #      IF ([Equip] == 0x00)
00180a54: 28c20007 slti r2,r6,0x0007            #         CONTINUE (skip this item)
00180a58: 24a50001 addiu r5,r5,0x0001            #      r5++
00180a5c: 26100001 addiu r16,r16,0x0001            #      r16++ (ValidItemCount++)
00180a60: 28c20007 slti r2,r6,0x0007
00180a64: 1440fff1 bne r2,r0,0x00180a2c            #   } WHILE (r6 < 7)
00180a68: 00000000 nop

SECTION 3 : NO VALID ITEMS : FIND USABLE ITEM? (POTION, ETC?)

00180a6c: 16000014 bne r16,r0,0x00180ac0         #   IF ([Valid item count] = 0)
00180a70: 00000000 nop                        #   {   
00180a74: 0c0088c3 jal 0x0002230c               #       r2 = [Random number]
00180a78: 00000000 nop
00180a7c: 00021840 sll r3,r2,0x01
00180a80: 00621821 addu r3,r3,r2
00180a84: 00031880 sll r3,r3,0x02
00180a88: 00621021 addu r2,r3,r2               
00180a8c: 04410002 bgez r2,0x00180a98            
00180a90: 00000000 nop                        
00180a94: 24427fff addiu r2,r2,0x7fff            
00180a98: 000213c3 sra r2,r2,0x0f               
00180a9c: 2442fff0 addiu r2,r2,0xfff0            #      r2 = [Random usable item]
00180aa0: a3a20010 sb r2,0x0010(r29)            #      ValidItems[0] (STACK[0x10]) = r2
00180aa4: 93a30010 lbu r3,0x0010(r29)            #      r3 = r2
00180aa8: 00000000 nop                        #      IF (r3 >= 0xf5) (We found a usable item?)
00180aac: 2c6200f5 sltiu r2,r3,0x00f5            #      {   
00180ab0: 14400003 bne r2,r0,0x00180ac0            #         ValidItemCount (r16) = 1
00180ab4: 34100001 ori r16,r0,0x0001            #         r2 = r3 + 1
00180ab8: 24620001 addiu r2,r3,0x0001            #         ValidItems[0] = r2
00180abc: a3a20010 sb r2,0x0010(r29)            #      }

SECTION 4 : RETURN RANDOM ITEM FROM VALID ITEMS LIST

00180ac0: 0c0088c3 jal 0x0002230c               #    r2 = [Random number]
00180ac4: 00000000 nop
00180ac8: 00500018 mult r2,r16
00180acc: 00001012 mflo r2                     #   r2 = [Random index]
00180ad0: 04410003 bgez r2,0x00180ae0
00180ad4: 000233c3 sra r6,r2,0x0f
00180ad8: 24427fff addiu r2,r2,0x7fff
00180adc: 000233c3 sra r6,r2,0x0f
00180ae0: 03a61021 addu r2,r29,r6               
00180ae4: 90420010 lbu r2,0x0010(r2)            #   r2 = ValidItems[RandomIndex]
00180ae8: 8fbf001c lw r31,0x001c(r29)
00180aec: 8fb00018 lw r16,0x0018(r29)
00180af0: 27bd0020 addiu r29,r29,0x0020
00180af4: 03e00008 jr r31                     #   RETURN r2
00180af8: 00000000 nop




#    ROUTINE : LEARN FROM CRYSTAL ?

#      PARAMETERS:
#         r4 = [In-battle unit pointer]
#         r5 = ?

#      RETURNS:
#         r2   =   0?

#    SECTION 1 : CHECKS AND SET UP

00180904: 27bdffe0 addiu r29,r29,0xffe0
00180908: afb00010 sw r16,0x0010(r29)
0018090c: 00808021 addu r16,r4,r0               #   r16 = r4
00180910: afb10014 sw r17,0x0014(r29)
00180914: 00a08821 addu r17,r5,r0               #   r17 = r5
00180918: afbf0018 sw r31,0x0018(r29)
0018091c: 0c062f5d jal 0x0018bd74               #   Routine: clear some temp in-battle unit data?
00180920: 2604018c addiu r4,r16,0x018c   
00180924: 34020008 ori r2,r0,0x0008               #    Temp in-battle data offsets : read/write
00180928: a202018e sb r2,0x018e(r16)
0018092c: 32220004 andi r2,r17,0x0004            #   r2 = (r17 bit 0x04 check)
00180930: 10400007 beq r2,r0,0x00180950            #   IF (r2 != 0)
00180934: a200018c sb r0,0x018c(r16)            #    {
00180938: 3c058006 lui r5,0x8006
0018093c: 90a5628e lbu r5,0x628e(r5)            #      r5 = MEM[0x8006628e]
00180940: 0c063a7a jal 0x0018e9e8               #      Routine: ? (r4=[In-battle unit pointer])
00180944: 02002021 addu r4,r16,r0
00180948: 0806027c j 0x001809f0                  #      RETURN r2
0018094c: 00000000 nop                        #   }
00180950: 32220002 andi r2,r17,0x0002            #   r2 = (r17 bit 0x02 check)
00180954: 1040000d beq r2,r0,0x0018098c            #   IF (r2 != 0)
00180958: 34020001 ori r2,r0,0x0001               #   {
0018095c: a202018c sb r2,0x018c(r16)            #      (Mess with temp data)   
00180960: 34020050 ori r2,r0,0x0050
00180964: a20201b1 sb r2,0x01b1(r16)
00180968: 9602002a lhu r2,0x002a(r16)
0018096c: 96040028 lhu r4,0x0028(r16)
00180970: 9603002e lhu r3,0x002e(r16)
00180974: 9605002c lhu r5,0x002c(r16)
00180978: a200018e sb r0,0x018e(r16)
0018097c: 00441023 subu r2,r2,r4
00180980: 00651823 subu r3,r3,r5
00180984: a6020192 sh r2,0x0192(r16)
00180988: a6030196 sh r3,0x0196(r16)            #   }
0018098c: 32220001 andi r2,r17,0x0001            #   r2 = (r17 bit 0x01 check)
00180990: 10400017 beq r2,r0,0x001809f0            #   IF (r2 == 0), RETURN 0
00180994: 00001021 addu r2,r0,r0               #   r2 = 0
00180998: 00004821 addu r9,r0,r0               #   r9 = 0
0018099c: 3c088006 lui r8,0x8006               
001809a0: 25086254 addiu r8,r8,0x6254            #   r8 = MEM[0x80066254]
001809a4: 02002021 addu r4,r16,r0               #   r4 = [Unit]

#   SECTION 2 : BEGIN OUTER LOOP

001809a8: 24850099 addiu r5,r4,0x0099            #   DO
001809ac: 01003021 addu r6,r8,r0               #   {
001809b0: 2487009c addiu r7,r4,0x009c            #      r6 = r8

#    SECTION 3 : BEGIN INNER LOOP

001809b4: 90a20000 lbu r2,0x0000(r5)            #      DO {
001809b8: 90c30000 lbu r3,0x0000(r6)            #         r2 = [Unit Action abilities]    (r5th)
001809bc: 00000000 nop                        #         r3 = [Crystal action abilities]   (r6th)
001809c0: 00431025 or r2,r2,r3
001809c4: a0a20000 sb r2,0x0000(r5)               #         [Unit action abilities] = (Combination of r2 and r3)   NOTE : r2 | r3
001809c8: 24a50001 addiu r5,r5,0x0001            #         r5++
001809cc: 00a7102a slt r2,r5,r7                  #         r6++
001809d0: 1440fff8 bne r2,r0,0x001809b4            #      } WHILE (r5 < r7)
001809d4: 24c60001 addiu r6,r6,0x0001            #      
001809d8: 25080003 addiu r8,r8,0x0003            #      r8++
001809dc: 25290001 addiu r9,r9,0x0001            #      r9++
001809e0: 29220013 slti r2,r9,0x0013            #      r4 += 3
001809e4: 1440fff0 bne r2,r0,0x001809a8            #   } WHILE (r9 < 0x13)
001809e8: 24840003 addiu r4,r4,0x0003

#   SECTION 4 : RETURN

001809ec: 00001021 addu r2,r0,r0               #   RETURN 0
001809f0: 8fbf0018 lw r31,0x0018(r29)
001809f4: 8fb10014 lw r17,0x0014(r29)
001809f8: 8fb00010 lw r16,0x0010(r29)
001809fc: 27bd0020 addiu r29,r29,0x0020
00180a00: 03e00008 jr r31
00180a04: 00000000 nop
464
Help! / Re: Editing ''Attack''
January 12, 2012, 08:52:14 pm
Rfh, try this patch... it should make those formulas subject to elemental cancel (but only cancel). It'll also affect formula [3e], which is labelled Dmg_(TarMaxHP-1) NS, though I believe that's a mistake and it's actually TarCurHP-1, because it uses the same routine as [17].


 <Patch name="Formulas [17], [3e], and [44] can be elementally canceled">
   <Description>
     Formulas [17], [3e], and [44] can be elementally canceled
   </Description>
   <Location file="BATTLE_BIN" offset="11fe54">
     1980023C
     982D428C
     1980033C
     902D638C
     2C004494
     80000234
     250062A0
     FE1B0608
     040064A4
   </Location>
   <Location file="BATTLE_BIN" offset="11f6ec">
     1980033C
     982D638C
     80000434
     28006294
     00000000
     FFFF4224
     2A284000
     1980033C
     902D638C
     21104500
     040062A4
     FE1B0608
     250064A0
   </Location>
 </Patch>
465
I know we talked about this on IRC, but as a general answer, it should be magic damage and be subject to everything that entails. I used formula [4e] as a base and it uses the same magic damage calculation routine, which should take all that into account, or at least I assumed it did. I should probably test that.
466
We may need to think about some of these labels a bit, because in some cases the original names didn't make any sense either.

"Normal Attack?": This is fine, except I'm trying to avoid question marks, but we could use "Normal Attack" or keep "Normal Attack?" if there's really nothing better.

"Countergrasp":
Affected by Blade Grasp as the counter ability?
Having Blade Grasp equipped causes a counter strike?
Counters Blade Grasp with a counter strike?
Can't be affected by Blade Grasp, because the ability counters it?
Who knows!

Any way to make this better? Are Counter and Blade Grasp the only abilities affected? "Counterable" is really vague but we don't have much space. Maybe we need a tooltip or something. Or "Counterable (ALSO BLADE GRASP)" :)

"Persevere":
The only thing this flag name suggests is that you would continue charging the ability even if you get attacked. However... that's how all abilities work (Attacks don't interrupt you; you just take more damage). I tried changing it to "Channel" because at least an ability being flagged as channeled would imply that it uses up your action... however, as you say, that label still isn't necessarily great at describing what it does. I contend that "Persevere" is worse ("I had to persevere through the adversity of having turns in order to keep charging/channeling my ability?" I would never guess that it means that).

Continuous? Perform? Performing? Continue Through Turns? I played around with "Skip Turns" but it's ambiguous whether it skips the caster's turns or the target's, and in what situation. I don't know... we should be able to find something that makes sense here.
467
FFT+ / Re: Counter Throw stone?
January 04, 2012, 10:30:46 am
Exactly. You counter with whatever ability ID is at that location in BATTLE.BIN. You can get the ability ID from the gameshark handbook or from just counting down the list in FFTPatcher and just converting the number to hex (<Nothing> is 0, the next ability is 1, etc). (Maybe we should add the IDs into FFTPatcher's list?)
468
It simply wouldn't be relevant to an FFT board.
469
FFT+ / Re: Counter Throw stone?
January 02, 2012, 06:35:19 pm
The ability index that it uses for the counter for Counter Tackle seems to be hardcoded at 0x117318 in BATTLE.BIN (0x0093 = Dash).

EDIT: Ability ID is actually a two byte value, so it's 0x117318 (low byte) and 0x117319 (high byte). For ability 015E (Grand Cross), it would be "5E 01" starting at 0x117318. The command is: XXXX0634.
470
Help! / Re: Implementing Custom Formulas
January 01, 2012, 09:50:15 pm
Sure, by ASM hacking the formulas; they're hardcoded into the game code. There's a listing of the code for the formulas in the first few posts in this thread (Click on the "Part 1", "Part 2", etc of fdc's posts).

If you don't feel like foraying into ASM hacking, you could request someone who does to write a custom formula, or something of that nature.
471
Help! / Re: Spreadsheet functions
January 01, 2012, 05:56:19 pm
I couldn't seem to find row 3 in the attached spreadsheet. It seemed like there were a ton of rows that were hidden between 2 and 33 but I couldn't unhide them; I don't know.

Honestly, as a developer, we don't memorize all the standard functions and things in progamming languages; that's what google is for, and it's the same sort of deal when doing spreadsheets, I'd think.

I don't think you're going to learn proficiency in programming languages by doing anything with spreadsheets, but if there's one thing to take from it, the concept of expression evaluation is very important in programming languages... which is basically all spreadsheets do. In a program, every command is basically an expression to be evaluated; it's just that evaluating that expression might also result in something actually being done (a variable being incremented, memory being changed, something appearing on the screen, etc.) If you've done anything with lisp or scheme you might be familiar with this idea.

A traditional programming language isn't just going to be an evaluation loop though, so you have to know commands that do things. Regardless, it's... rather different from a spreadsheet.

In the case of something like (C++ here) "printf("%d", (10 + (++x)));", it's going to increment the value of x first (innermost expression) then add the result to 10 (one expression outward) and finally evaluate printf() to actually print the result to the screen. So, in evaluating an expression (printf), more than one thing was done: We incremented a variable, figured out a temporary math result, and printed something to the screen.

If you want to learn a programming language, I'd find a good compiler (GCC/G++ is a good bet; native on linux), IDE (Dev-C++ ?); or if you want, just use gedit/vi/emacs or something, and do a Hello World program and just start doing more complex things after that.

472
Oops, I forgot to include the DLLs that it needs to run, so you might still see the old labels if you just run the program. Try this file instead; I've included the right DLLs in it.

EDIT - These changes are in the latest attachment. Removing from this post.
473
Hacking/Patching Tools / Re: FFT Patcher .478 Source Code
December 31, 2011, 09:24:33 pm
All right, I made a few changes, namely:

* Updated flag titles so that they're like the post above, with my own changes in some places (in an effort to make things clearer). In some cases, if I had already renamed a flag and it was similar to what fdc showed in the image, I didn't change it.
* Redid ENTD descriptions. Many events were listed as the wrong ENTD, some were unlisted. Many names were too long and got cut off, so those were shortened.
* Updated formula descriptions to include evasion type.

I'm calling this "0.479" to differentiate from previous versions, even though it doesn't really correspond to an SVN check-in or anything like that. This is basically a candidate for what we could end up using for "0.479".

Anyhow, this should work the same as before. Hopefully this update makes things a bit clearer. I'm attaching it to the bottom of the post.

EDIT: Unattached rar file because it didn't include the needed DLLs; see my post below for the new version.
474
Hacking/Patching Tools / Re: FFT Patcher .478 Source Code
December 30, 2011, 12:27:37 pm
I think I fixed it.

There was a variable that determined whether or not any store inventory patches were made... but it didn't update properly, because the "Store Inventory" checkbox on the Patch PSX ISO form didn't have an event handler. I added it in and I'm getting results.

I'm attaching my new version of FFTPatcher. Let me know if it works (i.e. you can edit shop inventories with it).

EDIT - This is in the latest attachment. Removing from this post.
475
Hacking/Patching Tools / Re: FFT Patcher .478 Source Code
December 30, 2011, 11:05:47 am
One of my first thoughts was that the Sectors.WORLD_WORLD_BIN constant could be set to the wrong number (It's set to 84261; I have no clue if that would be right or not, or exactly what it even means)... however, that same constant seems to be used for TacText and I'm pretty sure that patches WORLD.BIN properly.

So I'm not really sure what the problem is, but finding out that WORLD.BIN isnt getting patched should be really useful. I'll try running my copy of his code through my local debugger and see what I can come up with.
476
Hacking/Patching Tools / Re: FFT Patcher .478 Source Code
December 30, 2011, 02:54:28 am
fdc, I believe that method, GenerateCodes(), is actually for generating the Gameshark codes, so the RAM address, and not the WORLD.BIN file address, would be correct. Not sure why it's off by 4, though.

melonhead seems to refer to gameshark codes as "Codes" throughout the FFTPatcher source, and actually writing to the game files as "patches", so we'd need to look at the analogous method for "Patches", which seems to be GetPatches() (StoreInventory.cs:213), where we see:

result.Add(PatcherLib.Iso.PsxIso.StoreInventories.GetPatchedByteArray(bytes));
(StoreInventory.cs:223)

PsxIso.StoreInventory is of type KnownPosition, which is made up of sector, start location, and length (the constructor for this type of object takes arguments in that order), and defined like this:

StoreInventories = new KnownPosition( Sectors.WORLD_WORLD_BIN, 0xAD844, 0x200 );
(PsxIso.cs:100)

So it looks like it's already looking at 0xAD844 in WORLD.BIN for patching.
477
Help! / Re: Help with FFTpatcher Problem?
December 15, 2011, 11:33:30 am
Doesn't even mention how he fixed it either; that should be worth some kind of bonus points.
478
Bugs and Suggestions / Re: Subforum Proposal
December 09, 2011, 10:04:46 am
Rules may be a little rigid for the recruitment subforum; I can see why they're there, but they may deter people from doing anything with it. If it works though, then it sounds like a good idea. I like the idea of the learning subforum... it may encourage people to get more involved.
479
I believe I've got a fix for this (Discussed this on IRC with fdc). Strange logic for maintaining the program counter. Uploading a new version with the fix.
480
PSX FFT Hacking / Re: Formula Hack v0.37
December 07, 2011, 04:50:12 pm
I think if we go cross-platform, we can just have a single code base in C++ that uses GCC or the like. Still, doing that port would be really time consuming.