Handle Load Game

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: Handle Load Game
#       Handles loading game data.
#       Parameters:
#           r4 = (p1) ? (Sometimes *0x801cc81c)

8012f994: 3c038019 lui r3,0x8019
8012f998: 90634060 lbu r3,0x4060(r3)                    #   *0x80194060
8012f99c: 27bdffe0 addiu r29,r29,-0x0020
8012f9a0: afb10014 sw r17,0x0014(r29)
8012f9a4: 00808821 addu r17,r4,r0                       #   p1
8012f9a8: afbf0018 sw r31,0x0018(r29)
8012f9ac: 14600013 bne r3,r0,0x8012f9fc
8012f9b0: afb00010 sw r16,0x0010(r29)
                                                        #   if (*0x80194060 == 0) {
8012f9b4: 3c058019 lui r5,0x8019
8012f9b8: 24a53f70 addiu r5,r5,0x3f70                   #       0x80193f70
8012f9bc: 34020001 ori r2,r0,0x0001
8012f9c0: 3c018019 lui r1,0x8019
8012f9c4: a0224060 sb r2,0x4060(r1)                     #       *0x80194060 = 1
8012f9c8: 3c01801d lui r1,0x801d
8012f9cc: a020c7cc sb r0,-0x3834(r1)                    #       *0x801cc7cc = 0
8012f9d0: 3c01801d lui r1,0x801d
8012f9d4: a020c7d0 sb r0,-0x3830(r1)                    #       *0x801cc7d0 = 0
8012f9d8: 0c04ab11 jal 0x8012ac44                       #       0x12ac44 (6, 0x80193f70);
8012f9dc: 34040006 ori r4,r0,0x0006
8012f9e0: 340500ff ori r5,r0,0x00ff
8012f9e4: 3c04801d lui r4,0x801d
8012f9e8: 8c84d1ec lw r4,-0x2e14(r4)
8012f9ec: 0c0088bf jal 0x800222fc                       #       memset (0x801cd1ec, 0xff, 0x1e80);
8012f9f0: 34061e80 ori r6,r0,0x1e80
8012f9f4: 0804beca j 0x8012fb28                         #       return;
8012f9f8: 00000000 nop                                  #   }
8012f9fc: 2c620002 sltiu r2,r3,0x0002
8012fa00: 10400005 beq r2,r0,0x8012fa18                 #   if (*0x80194060 < 2) {
8012fa04: 24620001 addiu r2,r3,0x0001
8012fa08: 3c018019 lui r1,0x8019
8012fa0c: a0224060 sb r2,0x4060(r1)                     #       *0x80194060 = *0x80194060 + 1
8012fa10: 0804beca j 0x8012fb28                         #       return;
8012fa14: 00000000 nop                                  #   }
8012fa18: 3c02801d lui r2,0x801d
8012fa1c: 9042c7cc lbu r2,-0x3834(r2)                   #   *0x801cc7cc
8012fa20: 00000000 nop
8012fa24: 10400016 beq r2,r0,0x8012fa80
8012fa28: 00111080 sll r2,r17,0x02
                                                        #   if (*0x801cc7cc != 0) {
8012fa2c: 3c058019 lui r5,0x8019
8012fa30: 24a53fe8 addiu r5,r5,0x3fe8
8012fa34: 0c04ab11 jal 0x8012ac44                       #       0x12ac44 (6, 0x80193fe8);
8012fa38: 34040006 ori r4,r0,0x0006
8012fa3c: 3c03801d lui r3,0x801d
8012fa40: 8c63d52c lw r3,-0x2ad4(r3)                    #       *0x801cd52c
8012fa44: 00000000 nop
8012fa48: 30620020 andi r2,r3,0x0020                    #       *0x801cd52c & 0x20
8012fa4c: 14400003 bne r2,r0,0x8012fa5c                 #       if (((*0x801cd52c & 0x20) == 0)
8012fa50: 30620040 andi r2,r3,0x0040
8012fa54: 10400034 beq r2,r0,0x8012fb28                 #           && ((*0x801cd52c & 0x40) == 0)) return;
8012fa58: 00000000 nop
8012fa5c: 0c04aac7 jal 0x8012ab1c                       #       0x12ab1c (6);
8012fa60: 34040006 ori r4,r0,0x0006
8012fa64: 34020002 ori r2,r0,0x0002                     #       2
8012fa68: 3c018019 lui r1,0x8019
8012fa6c: a0204060 sb r0,0x4060(r1)                     #       *0x80194060 = 0
8012fa70: 3c01801d lui r1,0x801d
8012fa74: a022c800 sb r2,-0x3800(r1)                    #       *0x8019c800 = 2
8012fa78: 0804beca j 0x8012fb28                         #       return;
8012fa7c: 00000000 nop                                  #   }
8012fa80: 3c018019 lui r1,0x8019
8012fa84: 00220821 addu r1,r1,r2
8012fa88: 8c243cb4 lw r4,0x3cb4(r1)                     #   *(0x80193cb4 + (p1 * 4))
8012fa8c: 3c05801d lui r5,0x801d
8012fa90: 8ca5d1ec lw r5,-0x2e14(r5)                    #   *0x801cd1ec
8012fa94: 0c04cc7f jal 0x801331fc                       #   result_0x1331fc = 0x1331fc (*(0x80193cb4 + (p1 * 4)), *0x801cd1ec, 0x1e00);
8012fa98: 34061e00 ori r6,r0,0x1e00
8012fa9c: 34040006 ori r4,r0,0x0006
8012faa0: 0c04aac7 jal 0x8012ab1c                       #   0x12ab1c (6);
8012faa4: 00408021 addu r16,r2,r0                       #   result_0x1331fc
8012faa8: 34021e00 ori r2,r0,0x1e00
8012faac: 16020016 bne r16,r2,0x8012fb08
8012fab0: 340200ff ori r2,r0,0x00ff
                                                        #   if ((result_0x1331fc == 0x1e00)
8012fab4: 0c04c0ce jal 0x80130338
8012fab8: 00002021 addu r4,r0,r0
8012fabc: 10400014 beq r2,r0,0x8012fb10                 #       && (Load Game (0) != 0))                             // Load from memcard?
8012fac0: 34040051 ori r4,r0,0x0051
                                                        #   {
8012fac4: 34020001 ori r2,r0,0x0001
8012fac8: 3c01801d lui r1,0x801d
8012facc: a022c808 sb r2,-0x37f8(r1)                    #       *0x801cc808 = 1
8012fad0: 34020009 ori r2,r0,0x0009
8012fad4: 3c018019 lui r1,0x8019
8012fad8: a0204060 sb r0,0x4060(r1)                     #       *0x80194060 = 0
8012fadc: 3c01801d lui r1,0x801d
8012fae0: a022c800 sb r2,-0x3800(r1)                    #       *0x801cc800 = 9
8012fae4: 0c03bc97 jal 0x800ef25c                       #       Set Script Variable (WORLD.BIN) (0x51, 1);      // Set Current Map == 1
8012fae8: 34050001 ori r5,r0,0x0001
8012faec: 34020085 ori r2,r0,0x0085
8012faf0: 3c018019 lui r1,0x8019
8012faf4: a022bacc sb r2,-0x4534(r1)                    #       *0x8018bacc = 0x85
8012faf8: 3c018005 lui r1,0x8005
8012fafc: a0317c69 sb r17,0x7c69(r1)                    #       *0x80057c69 = p1
8012fb00: 0804beca j 0x8012fb28
8012fb04: 00000000 nop                                  #   } else {
8012fb08: 3c018005 lui r1,0x8005
8012fb0c: a0227c69 sb r2,0x7c69(r1)                     #       if (result_0x1331fc == 0x1e00) *0x80057c69 = 0xff;
8012fb10: 34020001 ori r2,r0,0x0001
8012fb14: 3c01801d lui r1,0x801d
8012fb18: a022c7cc sb r2,-0x3834(r1)                    #       *0x801cc7cc = 1
8012fb1c: 34020030 ori r2,r0,0x0030
8012fb20: 3c018019 lui r1,0x8019
8012fb24: a022bacc sb r2,-0x4534(r1)                    #       *0x8018bacc = 0x30
                                                        #   }
8012fb28: 8fbf0018 lw r31,0x0018(r29)
8012fb2c: 8fb10014 lw r17,0x0014(r29)
8012fb30: 8fb00010 lw r16,0x0010(r29)
8012fb34: 27bd0020 addiu r29,r29,0x0020
8012fb38: 03e00008 jr r31
8012fb3c: 00000000 nop