Difference between revisions of "Compare Set Highest Unit Target Priority (00196fc4)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00196ef4: 3c02801a lui r2,0x801a 00196ef8: 90420d7b lbu r2,0x0d7b(r2) 00196efc: 27bdffe8 addiu r29,r29,0xffe8 00196f00: afb00010 sw r16,0x0010(...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''BATTLE.BIN''' :  -  Compare and Set Highest Unit Target Priority
 +
Insert Current Action outcome (AI 0x34) in Recorded Actions Outcome (AI 0x54 to AI 0x134). AI 0x54 has the higher outcome
 +
------------------------------------------------------------------------------------------
 +
Parameter : Nothing
 +
Return : Nothing
 +
------------------------------------------------------------------------------------------
 +
00196fc4: 27bdffd8 addiu r29,r29,-0x0028    |
 +
00196fc8: afb40020 sw r20,0x0020(r29)        |
 +
00196fcc: 3c14801a lui r20,0x801a            |
 +
00196fd0: 2694f3c4 addiu r20,r20,0xf3c4      |{{f/adr|0x8019f3c4}}
 +
00196fd4: 26840050 addiu r4,r20,0x0050      |{{f/adr|0x8019f3c4 + 0x50}}
 +
00196fd8: 26850170 addiu r5,r20,0x0170      |{{f/adr|0x8019f3c4 + 0x170}}
 +
00196fdc: afbf0024 sw r31,0x0024(r29)        |
 +
00196fe0: afb3001c sw r19,0x001c(r29)        |
 +
00196fe4: afb20018 sw r18,0x0018(r29)        |
 +
00196fe8: afb10014 sw r17,0x0014(r29)        |
 +
00196fec: 0c065b6c jal 0x00196db0            |{{f/jal|Compare Target Priority and Hit Rate|Compare Target Priority and Hit Rate}} {{f/std|Compare AI 0x50 ad 0x170}}
 +
00196ff0: afb00010 sw r16,0x0010(r29)        |
 +
00196ff4: 34030002 ori r3,r0,0x0002          |
 +
00196ff8: 14430025 bne r2,r3,0x00197090      {{f/Cond|if AI 0x50 has higher outcome  than AI 0x170}} {{f/std|Else Exit ? (corrupted data ?)}}
 +
00196ffc: 26840034 addiu r4,r20,0x0034          |{{f/std|0x8019f3c4 + 0x34}}
 +
00197000: 0c065b88 jal 0x00196e20                |{{f/jal|Set Highest Target Priority|Set Highest Target Priority}} {{f/std|Check AI 0x50 Vs AI 0x150}}
 +
00197004: 26850134 addiu r5,r20,0x0134          |{{f/std|0x8019f3c4 + 0x134}}
 +
00197008: 10400021 beq r2,r0,0x00197090          {{f/Cond|if AI 0x34 is not better then AI 0x134 :}} {{f/loc|Reset AI 0x34 and Exit}} {{f/std|Ignore this weak outcome}}
 +
0019700c: 34100054 ori r16,r0,0x0054            |{{f/adr|Prepare dynamic pointer to AI action data}}
 +
00197010: 00009821 addu r19,r0,r0                |{{f/std|initialize counter}}
 
   
 
   
  00196ef4: 3c02801a lui r2,0x801a
+
  {{f/sec|<nowiki>=== Check if current considered action has a better outcome than previous simulation ===</nowiki>}}
00196ef8: 90420d7b lbu r2,0x0d7b(r2)
+
                                                {{f/bloop|LOOP}}
  00196efc: 27bdffe8 addiu r29,r29,0xffe8
+
  00197014: 26840034 addiu r4,r20,0x0034              |{{f/std|Static pointer to AI 0x34}}
  00196f00: afb00010 sw r16,0x0010(r29)
+
  00197018: 0c065b88 jal 0x00196e20                    |{{f/jal|Set Highest Target Priority|Set Highest Target Priority}} {{f/std|Check Current action score Vs best previous results}}
  00196f04: 3c10801a lui r16,0x801a
+
  0019701c: 02902821 addu r5,r20,r16                   |{{f/std|Dynamic pointer (AI 0x54 to AI 0x134)}}
  00196f08: 2610f3c4 addiu r16,r16,0xf3c4
+
  00197020: 14400006 bne r2,r0,0x0019703c              {{f/Cond|If better score : }} {{f/loc|Exit loop and reorder action data}}
  00196f0c: 10400008 beq r2,r0,0x00196f30
+
  00197024: 34020008 ori r2,r0,0x0008                      |
  00196f10: afbf0014 sw r31,0x0014(r29)
+
  00197028: 26730001 addiu r19,r19,0x0001              |{{f/std|counter +1}}
  00196f14: 3c02801a lui r2,0x801a
+
  0019702c: 2a620008 slti r2,r19,0x0008                |
  00196f18: 9042029b lbu r2,0x029b(r2)
+
  00197030: 1440fff8 bne r2,r0,0x00197014          {{f/eloop|loop 8 times}}
  00196f1c: 00000000 nop
+
  00197034: 26100020 addiu r16,r16,0x0020              |{{f/std|Action data offset (+0x20 each iteration)}}
  00196f20: 10400009 beq r2,r0,0x00196f48
+
  00197038: 34020008 ori r2,r0,0x0008                  |
  00196f24: 00000000 nop
+
  0019703c: 12620014 beq r19,r2,0x00197090        {{f/Cond|If AI 0x34 did not beat any previous record : branch to }} {{f/loc|Reset AI 0x34 and Exit}} {{f/std|Ignore this weak outcome (2nd check)}}
00196f28: 08065be3 j 0x00196f8c
+
  00197040: 2a620007 slti r2,r19,0x0007            |
  00196f2c: 00000000 nop
+
  00197044: 1040000c beq r2,r0,0x00197078          |
00196f30: 0c066d3d jal 0x0019b4f4
+
  00197048: 34100007 ori r16,r0,0x0007            |{{f/std|Initialize counter (backward counter)}}
00196f34: 26040e30 addiu r4,r16,0x0e30
+
  0019704c: 34120114 ori r18,r0,0x0114            |{{f/adr|Prepare dynamic backward pointer (origin)}}
  00196f38: 1040000a beq r2,r0,0x00196f64
+
  00197050: 34110134 ori r17,r0,0x0134            |{{f/adr|Prepare dynamic backward pointer (destination)}}
  00196f3c: 34020001 ori r2,r0,0x0001
+
   
  00196f40: 3c01801a lui r1,0x801a
+
  {{f/sec|<nowiki>=== Re-order recorded action outcome (and insert current action) ===</nowiki>}}
  00196f44: a022f3d8 sb r2,-0x0c28(r1)
+
                                                {{f/bloop|LOOP- reorder action result }}
  00196f48: 0c0674c2 jal 0x0019d308
+
  00197054: 02912021 addu r4,r20,r17                  |
  00196f4c: 00000000 nop
+
  00197058: 02922821 addu r5,r20,r18                  |
00196f50: 2403ffff addiu r3,r0,0xffff
+
  0019705c: 0c066ac2 jal 0x0019ab08                    |{{f/jal|Transfer Halfword Values|Transfer Halfword Values}}
  00196f54: 14430003 bne r2,r3,0x00196f64
+
  00197060: 34060020 ori r6,r0,0x0020                  |{{f/std|copy 0x20 bytes}}
  00196f58: 2402ffff addiu r2,r0,0xffff
+
  00197064: 2652ffe0 addiu r18,r18,-0x0020            |{{f/std|AI action data offset}}
  00196f5c: 08065bec j 0x00196fb0
+
  00197068: 2610ffff addiu r16,r16,-0x0001            |{{f/std|Counter - 0x1}}
  00196f60: a2000ed7 sb r0,0x0ed7(r16)
+
  0019706c: 0270102a slt r2,r19,r16                    |
  00196f64: 8e030018 lw r3,0x0018(r16)
+
  00197070: 1440fff8 bne r2,r0,0x00197054          {{f/eloop|Loop while r19 < r16}}
  00196f68: 8e020e30 lw r2,0x0e30(r16)
+
  00197074: 2631ffe0 addiu r17,r17,-0x20              |{{f/std|AI action data offset}}
  00196f6c: 00000000 nop
+
  00197078: 00102140 sll r4,r16,0x05              |{{f/std|Entry counter * 0x20}}
00196f70: 1062000f beq r3,r2,0x00196fb0
+
  0019707c: 24840054 addiu r4,r4,0x0054            |
  00196f74: 00001021 addu r2,r0,r0
+
  00197080: 02842021 addu r4,r20,r4                |{{f/adr|New entry pointer}}
  00196f78: 0c066d3d jal 0x0019b4f4
+
  00197084: 26850034 addiu r5,r20,0x0034          |{{f/adr|Current data pointer (AI 0x34)}}
  00196f7c: 26040018 addiu r4,r16,0x0018
+
  00197088: 0c066ac2 jal 0x0019ab08                |{{f/jal|Transfer Halfword Values|Transfer Halfword Values}} {{f/std|Insert current action result in recorded results}}
  00196f80: 1040000b beq r2,r0,0x00196fb0
+
  0019708c: 34060020 ori r6,r0,0x0020              |
  00196f84: 00001021 addu r2,r0,r0
+
   
  00196f88: a2000014 sb r0,0x0014(r16)
+
00197090: 0c0657db jal 0x00195f6c            |{{f/jal|Reset_Highest_Target_Priority|Reset_Highest_Target_Priority}}
  00196f8c: 0c0674c2 jal 0x0019d308
+
  00197094: 26840034 addiu r4,r20,0x0034
  00196f90: 00000000 nop
+
  00197098: 8fbf0024 lw r31,0x0024(r29)
00196f94: 2403ffff addiu r3,r0,0xffff
+
  0019709c: 8fb40020 lw r20,0x0020(r29)
  00196f98: 14430004 bne r2,r3,0x00196fac
+
  001970a0: 8fb3001c lw r19,0x001c(r29)
  00196f9c: 34020001 ori r2,r0,0x0001
+
  001970a4: 8fb20018 lw r18,0x0018(r29)
  00196fa0: a2020ed7 sb r2,0x0ed7(r16)
+
  001970a8: 8fb10014 lw r17,0x0014(r29)
  00196fa4: 08065bec j 0x00196fb0
+
  001970ac: 8fb00010 lw r16,0x0010(r29)
  00196fa8: 2402ffff addiu r2,r0,0xffff
+
  001970b0: 27bd0028 addiu r29,r29,0x0028
  00196fac: 00001021 addu r2,r0,r0
+
  001970b4: 03e00008 jr r31
  00196fb0: 8fbf0014 lw r31,0x0014(r29)
+
  001970b8: 00000000 nop
  00196fb4: 8fb00010 lw r16,0x0010(r29)
+
===Return locations===
  00196fb8: 27bd0018 addiu r29,r29,0x0018
+
'''BATTLE.BIN'''
  00196fbc: 03e00008 jr r31
+
  00196090: [[Set_or_Remove_Charging_(00195f8c)]]
  00196fc0: 00000000 nop
+
  0019b2e8: [[AI_ability_use_control_routine]]
</font>
+
  0019b4dc: [[Check_if_any_units_are_in_range_(0019b30c)]]
 +
  0019bb00: [[AI_Targeting_Matrix_Analysis_(0019b7b8)]]
 +
  0019bebc: [[Math_Skill_Targeting]]

Latest revision as of 15:12, 15 June 2024

BATTLE.BIN :  -  Compare and Set Highest Unit Target Priority
Insert Current Action outcome (AI 0x34) in Recorded Actions Outcome (AI 0x54 to AI 0x134). AI 0x54 has the higher outcome
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : Nothing
------------------------------------------------------------------------------------------
00196fc4: 27bdffd8 addiu r29,r29,-0x0028     |
00196fc8: afb40020 sw r20,0x0020(r29)        |
00196fcc: 3c14801a lui r20,0x801a            |
00196fd0: 2694f3c4 addiu r20,r20,0xf3c4      |0x8019f3c4
00196fd4: 26840050 addiu r4,r20,0x0050       |0x8019f3c4 + 0x50
00196fd8: 26850170 addiu r5,r20,0x0170       |0x8019f3c4 + 0x170
00196fdc: afbf0024 sw r31,0x0024(r29)        |
00196fe0: afb3001c sw r19,0x001c(r29)        |
00196fe4: afb20018 sw r18,0x0018(r29)        |
00196fe8: afb10014 sw r17,0x0014(r29)        |
00196fec: 0c065b6c jal 0x00196db0            |-->Compare Target Priority and Hit Rate Compare AI 0x50 ad 0x170
00196ff0: afb00010 sw r16,0x0010(r29)        |
00196ff4: 34030002 ori r3,r0,0x0002          |
00196ff8: 14430025 bne r2,r3,0x00197090      #if AI 0x50 has higher outcome  than AI 0x170 Else Exit ? (corrupted data ?)
00196ffc: 26840034 addiu r4,r20,0x0034           |0x8019f3c4 + 0x34
00197000: 0c065b88 jal 0x00196e20                |-->Set Highest Target Priority Check AI 0x50 Vs AI 0x150
00197004: 26850134 addiu r5,r20,0x0134           |0x8019f3c4 + 0x134
00197008: 10400021 beq r2,r0,0x00197090          #if AI 0x34 is not better then AI 0x134 : Reset AI 0x34 and Exit Ignore this weak outcome
0019700c: 34100054 ori r16,r0,0x0054             |Prepare dynamic pointer to AI action data
00197010: 00009821 addu r19,r0,r0                |initialize counter

=== Check if current considered action has a better outcome than previous simulation ===
                                                @LOOP
00197014: 26840034 addiu r4,r20,0x0034               |Static pointer to AI 0x34
00197018: 0c065b88 jal 0x00196e20                    |-->Set Highest Target Priority Check Current action score Vs best previous results
0019701c: 02902821 addu r5,r20,r16                   |Dynamic pointer (AI 0x54 to AI 0x134)
00197020: 14400006 bne r2,r0,0x0019703c              #If better score :  Exit loop and reorder action data
00197024: 34020008 ori r2,r0,0x0008                      |
00197028: 26730001 addiu r19,r19,0x0001              |counter +1
0019702c: 2a620008 slti r2,r19,0x0008                |
00197030: 1440fff8 bne r2,r0,0x00197014          Λ loop 8 times
00197034: 26100020 addiu r16,r16,0x0020              |Action data offset (+0x20 each iteration)
00197038: 34020008 ori r2,r0,0x0008                  |
0019703c: 12620014 beq r19,r2,0x00197090         #If AI 0x34 did not beat any previous record : branch to  Reset AI 0x34 and Exit Ignore this weak outcome (2nd check)
00197040: 2a620007 slti r2,r19,0x0007            |
00197044: 1040000c beq r2,r0,0x00197078          |
00197048: 34100007 ori r16,r0,0x0007             |Initialize counter (backward counter)
0019704c: 34120114 ori r18,r0,0x0114             |Prepare dynamic backward pointer (origin)
00197050: 34110134 ori r17,r0,0x0134             |Prepare dynamic backward pointer (destination)

=== Re-order recorded action outcome (and insert current action) ===
                                                @LOOP- reorder action result 
00197054: 02912021 addu r4,r20,r17                   |
00197058: 02922821 addu r5,r20,r18                   |
0019705c: 0c066ac2 jal 0x0019ab08                    |-->Transfer Halfword Values
00197060: 34060020 ori r6,r0,0x0020                  |copy 0x20 bytes
00197064: 2652ffe0 addiu r18,r18,-0x0020             |AI action data offset
00197068: 2610ffff addiu r16,r16,-0x0001             |Counter - 0x1
0019706c: 0270102a slt r2,r19,r16                    |
00197070: 1440fff8 bne r2,r0,0x00197054          Λ Loop while r19 < r16
00197074: 2631ffe0 addiu r17,r17,-0x20               |AI action data offset
00197078: 00102140 sll r4,r16,0x05               |Entry counter * 0x20
0019707c: 24840054 addiu r4,r4,0x0054            |
00197080: 02842021 addu r4,r20,r4                |New entry pointer
00197084: 26850034 addiu r5,r20,0x0034           |Current data pointer (AI 0x34)
00197088: 0c066ac2 jal 0x0019ab08                |-->Transfer Halfword Values Insert current action result in recorded results
0019708c: 34060020 ori r6,r0,0x0020              |

00197090: 0c0657db jal 0x00195f6c            |-->Reset_Highest_Target_Priority
00197094: 26840034 addiu r4,r20,0x0034
00197098: 8fbf0024 lw r31,0x0024(r29)
0019709c: 8fb40020 lw r20,0x0020(r29)
001970a0: 8fb3001c lw r19,0x001c(r29)
001970a4: 8fb20018 lw r18,0x0018(r29)
001970a8: 8fb10014 lw r17,0x0014(r29)
001970ac: 8fb00010 lw r16,0x0010(r29)
001970b0: 27bd0028 addiu r29,r29,0x0028
001970b4: 03e00008 jr r31
001970b8: 00000000 nop

Return locations

BATTLE.BIN
 00196090: Set_or_Remove_Charging_(00195f8c)
 0019b2e8: AI_ability_use_control_routine
 0019b4dc: Check_if_any_units_are_in_range_(0019b30c)
 0019bb00: AI_Targeting_Matrix_Analysis_(0019b7b8)
 0019bebc: Math_Skill_Targeting