Handle Memory Card Menu
Jump to navigation
Jump to search
# ROUTINE: HANDLE MEMORY CARD MENU # Handles the memory card menu. # Parameters: # r4 = (type) (1 if from World Map, 0 if from Titlescreen) # Returns: # r2 = *0x801cc808 8012f0f8: 3408ccd8 ori r8,r0,0xccd8 # 0xccd8 8012f0fc: 03a8e823 subu r29,r29,r8 # sp = sp - 0xccd8 8012f100: 011d4821 addu r9,r8,r29 # old sp 8012f104: ad30fff0 sw r16,-0x0010(r9) 8012f108: 00808021 addu r16,r4,r0 # type 8012f10c: 3404c820 ori r4,r0,0xc820 # 0xc820 8012f110: 27a30068 addiu r3,r29,0x0068 # sp + 0x68 8012f114: 00642021 addu r4,r3,r4 # sp + 0x68 + 0xc820 8012f118: 3405c620 ori r5,r0,0xc620 # 0xc620 8012f11c: 00652821 addu r5,r3,r5 # sp + 0x68 + 0xc620 8012f120: 00003021 addu r6,r0,r0 # 0 8012f124: 00003821 addu r7,r0,r0 # 0 8012f128: 34020040 ori r2,r0,0x0040 # 0x40 8012f12c: ad3ffff8 sw r31,-0x0008(r9) 8012f130: ad31fff4 sw r17,-0x000c(r9) 8012f134: 3c01801d lui r1,0x801d 8012f138: a422d224 sh r2,-0x2ddc(r1) # *0x801cd224 = 0x40 8012f13c: 34020258 ori r2,r0,0x0258 # 0x258 8012f140: 3408000a ori r8,r0,0x000a # 10 8012f144: 3c01801d lui r1,0x801d 8012f148: a422d1a0 sh r2,-0x2e60(r1) # *0x801cd1a0 = 0x258 8012f14c: 3402001e ori r2,r0,0x001e # 30 8012f150: 3c01801d lui r1,0x801d 8012f154: a422d510 sh r2,-0x2af0(r1) # *0x801cd510 = 30 8012f158: 3c01801d lui r1,0x801d 8012f15c: a422d434 sh r2,-0x2bcc(r1) # *0x801cd434 = 30 8012f160: 3402bb80 ori r2,r0,0xbb80 # 0xbb80 8012f164: 00621021 addu r2,r3,r2 # sp + 0x68 + 0xbb80 8012f168: 3c01801d lui r1,0x801d 8012f16c: a420d840 sh r0,-0x27c0(r1) # *0x801cd840 = 0 8012f170: 3c01801d lui r1,0x801d 8012f174: a420d194 sh r0,-0x2e6c(r1) # *0x801cd194 = 0 8012f178: 3c01801d lui r1,0x801d 8012f17c: a420d84c sh r0,-0x27b4(r1) # *0x801cd84c = 0 8012f180: 3c01801d lui r1,0x801d 8012f184: a420d848 sh r0,-0x27b8(r1) # *0x801cd848 = 0 8012f188: 3c01801d lui r1,0x801d 8012f18c: a420d19c sh r0,-0x2e64(r1) # *0x801cd19c = 0 8012f190: 3c01801d lui r1,0x801d 8012f194: a420d850 sh r0,-0x27b0(r1) # *0x801cd850 = 0 8012f198: 3c01801d lui r1,0x801d 8012f19c: a420d1ac sh r0,-0x2e54(r1) # *0x801cd1ac = 0 8012f1a0: 3c01801d lui r1,0x801d 8012f1a4: a420d178 sh r0,-0x2e88(r1) # *0x801cd178 = 0 8012f1a8: 3c01801d lui r1,0x801d 8012f1ac: a420d17c sh r0,-0x2e84(r1) # *0x801cd17c = 0 8012f1b0: 3c01801d lui r1,0x801d 8012f1b4: a420d188 sh r0,-0x2e78(r1) # *0x801cd188 = 0 8012f1b8: 3c01801d lui r1,0x801d 8012f1bc: a420d180 sh r0,-0x2e80(r1) # *0x801cd180 = 0 8012f1c0: 3c01801d lui r1,0x801d 8012f1c4: a420d184 sh r0,-0x2e7c(r1) # *0x801cd184 = 0 8012f1c8: 3c01801d lui r1,0x801d 8012f1cc: a420d18c sh r0,-0x2e74(r1) # *0x801cd18c = 0 8012f1d0: 3c01801d lui r1,0x801d 8012f1d4: a428d438 sh r8,-0x2bc8(r1) # *0x801cd438 = 10 8012f1d8: 3c01801d lui r1,0x801d 8012f1dc: a420d554 sh r0,-0x2aac(r1) # *0x801cd554 = 0 8012f1e0: 3c01801d lui r1,0x801d 8012f1e4: a420d5dc sh r0,-0x2a24(r1) # *0x801cd5dc = 0 8012f1e8: 3c01801d lui r1,0x801d 8012f1ec: a420d6e8 sh r0,-0x2918(r1) # *0x801cd6e8 = 0 8012f1f0: 3c01801d lui r1,0x801d 8012f1f4: a420d930 sh r0,-0x26d0(r1) # *0x801cd930 = 0 8012f1f8: 3c01801d lui r1,0x801d 8012f1fc: a420d1d4 sh r0,-0x2e2c(r1) # *0x801cd1d4 = 0 8012f200: 3c01801d lui r1,0x801d 8012f204: a420d210 sh r0,-0x2df0(r1) # *0x801cd210 = 0 8012f208: 3c01801d lui r1,0x801d 8012f20c: a428d228 sh r8,-0x2dd8(r1) # *0x801cd228 = 10 8012f210: afa00010 sw r0,0x0010(r29) # sp.0x10 = 0 8012f214: afa30014 sw r3,0x0014(r29) # sp.0x14 = sp + 0x68 8012f218: afa00018 sw r0,0x0018(r29) # sp.0x18 = 0 8012f21c: afa0001c sw r0,0x001c(r29) # sp.0x1c = 0 8012f220: afa00020 sw r0,0x0020(r29) # sp.0x20 = 0 8012f224: afa00024 sw r0,0x0024(r29) # sp.0x24 = 0 8012f228: afa00028 sw r0,0x0028(r29) # sp.0x28 = 0 8012f22c: afa0002c sw r0,0x002c(r29) # sp.0x2c = 0 8012f230: afa00030 sw r0,0x0030(r29) # sp.0x30 = 0 8012f234: afa20040 sw r2,0x0040(r29) # sp.0x40 = sp + 0x68 + 0xbb80 8012f238: 3402bcc0 ori r2,r0,0xbcc0 # 0xbcc0 8012f23c: 00621021 addu r2,r3,r2 # sp + 0x68 + 0xbcc0 8012f240: afa2005c sw r2,0x005c(r29) # sp.0x5c = sp + 0x68 + 0xbcc0 8012f244: 3402c530 ori r2,r0,0xc530 # 0xc530 8012f248: 00621021 addu r2,r3,r2 # sp + 0x68 + 0xc530 8012f24c: afa20060 sw r2,0x0060(r29) # sp.0x60 = sp + 0x68 + 0xc530 8012f250: 3402c260 ori r2,r0,0xc260 # 0xc260 8012f254: 00621821 addu r3,r3,r2 # sp + 0x68 + 0xc260 8012f258: afa00034 sw r0,0x0034(r29) # sp.0x34 = 0 8012f25c: afa00038 sw r0,0x0038(r29) # sp.0x38 = 0 8012f260: afa0003c sw r0,0x003c(r29) # sp.0x3c = 0 8012f264: afa00044 sw r0,0x0044(r29) # sp.0x44 = 0 8012f268: afa00048 sw r0,0x0048(r29) # sp.0x48 = 0 8012f26c: afa0004c sw r0,0x004c(r29) # sp.0x4c = 0 8012f270: afa00050 sw r0,0x0050(r29) # sp.0x50 = 0 8012f274: afa00054 sw r0,0x0054(r29) # sp.0x54 = 0 8012f278: afa00058 sw r0,0x0058(r29) # sp.0x58 = 0 8012f27c: 0c049816 jal 0x80126058 # 0x126058 (sp + 0x68 + 0xc820, sp + 0x68 + 0xc620, 0, 0, 0, sp + 0x68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sp + 0x68 + 0xbb80, 0, 0, 0, 0, 0, 0, sp + 0x68 + 0xbcc0, sp + 0x68 + 0xc530, 0); 8012f280: afa30064 sw r3,0x0064(r29) # sp.0x64 = 0 8012f284: 0c044c57 jal 0x8011315c # 0x11315c (); 8012f288: 00000000 nop 8012f28c: 00002021 addu r4,r0,r0 8012f290: 3c05801d lui r5,0x801d 8012f294: 24a5d5ec addiu r5,r5,-0x2a14 8012f298: 0c04843a jal 0x801210e8 # result_0x121038 = ? 0x1210e8 (0, 0x801cd5ec, 0); // 0x801cd5ec is the Formation unit reference array 8012f29c: 00003021 addu r6,r0,r0 8012f2a0: 3c01801d lui r1,0x801d 8012f2a4: a022d788 sb r2,-0x2878(r1) # *0x801cd788 = result_0x121038 8012f2a8: 3c028019 lui r2,0x8019 8012f2ac: 24423cf0 addiu r2,r2,0x3cf0 # 0x80193cf0 8012f2b0: 3c01801d lui r1,0x801d 8012f2b4: ac22d910 sw r2,-0x26f0(r1) # *0x801cd910 = 0x80193cf0 8012f2b8: 0c04b5ed jal 0x8012d7b4 # 0x12d7b4 (3); 8012f2bc: 34040003 ori r4,r0,0x0003 8012f2c0: 3c01801d lui r1,0x801d 8012f2c4: a020c800 sb r0,-0x3800(r1) # *0x801cc800 = 0 8012f2c8: 3c01801d lui r1,0x801d 8012f2cc: a430c814 sh r16,-0x37ec(r1) # *0x801cc814 = type 8012f2d0: 0c010d98 jal 0x80043660 # result_0x43660 = 0x43660 (0x29); 8012f2d4: 34040029 ori r4,r0,0x0029 8012f2d8: 00408821 addu r17,r2,r0 # result_0x43660 # do { 8012f2dc: 0c010dc2 jal 0x80043708 # result_0x43708 = 0x43708 (); 8012f2e0: 00000000 nop 8012f2e4: 1440fffd bne r2,r0,0x8012f2dc # } while (result_0x43708 != 0); 8012f2e8: 00112400 sll r4,r17,0x10 8012f2ec: 00042403 sra r4,r4,0x10 # result_0x43660 8012f2f0: 3405007f ori r5,r0,0x007f 8012f2f4: 0c010ea4 jal 0x80043a90 # 0x43a90 (result_0x43660, 0x7f, 0); 8012f2f8: 00003021 addu r6,r0,r0 8012f2fc: 0c04c977 jal 0x801325dc # 0x1325dc (); 8012f300: 00000000 nop 8012f304: 3402ca70 ori r2,r0,0xca70 # 0xca70 8012f308: 03a21021 addu r2,r29,r2 # sp + 0xca70 8012f30c: 3c01801d lui r1,0x801d 8012f310: ac22c824 sw r2,-0x37dc(r1) # *0x801cc824 = sp + 0xca70 8012f314: 0c04c226 jal 0x80130898 # 0x130898 (); 8012f318: 00000000 nop 8012f31c: 3c058011 lui r5,0x8011 8012f320: 24a58f9c addiu r5,r5,-0x7064 # 0x80108f9c 8012f324: 0c03ff5c jal 0x800ffd70 # 0xffd70 (2, 0x80108f9c); 8012f328: 34040002 ori r4,r0,0x0002 8012f32c: 34040002 ori r4,r0,0x0002 8012f330: 00002821 addu r5,r0,r0 8012f334: 00003021 addu r6,r0,r0 8012f338: 0c03ffc2 jal 0x800fff08 # Store Thread Function Parameters (WORLD.BIN) (2, 0, 0, 0); 8012f33c: 00003821 addu r7,r0,r0 # while (true) { 8012f340: 0c04b56f jal 0x8012d5bc # result_0x12d5bc = 0x12d5bc (); 8012f344: 00000000 nop 8012f348: 1040008c beq r2,r0,0x8012f57c 8012f34c: 34040002 ori r4,r0,0x0002 # if (result_0x12d5bc == 0) break; 8012f350: 00002021 addu r4,r0,r0 8012f354: 3c018019 lui r1,0x8019 8012f358: a020e48c sb r0,-0x1b74(r1) # *0x8018e48c = 0 8012f35c: 0c04973f jal 0x80125cfc # 0x125cfc (0, 0); 8012f360: 00002821 addu r5,r0,r0 8012f364: 0c04bbf3 jal 0x8012efcc # 0x12efcc (); 8012f368: 00000000 nop 8012f36c: 0c04b530 jal 0x8012d4c0 # 0x12d4c0 (); 8012f370: 00000000 nop 8012f374: 3c048019 lui r4,0x8019 8012f378: 24843df4 addiu r4,r4,0x3df4 # 0x80193df4 8012f37c: 3c058019 lui r5,0x8019 8012f380: 24a5ba04 addiu r5,r5,-0x45fc # 0x8018ba04 8012f384: 00003021 addu r6,r0,r0 8012f388: 0c04af6f jal 0x8012bdbc # 0x12bdbc (0x80193df4, 0x8018ba04, 0, 0); 8012f38c: 00003821 addu r7,r0,r0 8012f390: 3c03801d lui r3,0x801d 8012f394: 9063c800 lbu r3,-0x3800(r3) # 0x801cc800 8012f398: 34020003 ori r2,r0,0x0003 # input = 0 8012f39c: 14620007 bne r3,r2,0x8012f3bc # if ((0x801cc800 == 3) 8012f3a0: 00002021 addu r4,r0,r0 8012f3a4: 0c03ffbb jal 0x800ffeec # && (Check Thread Running Status (WORLD.BIN) (5) == 0)) 8012f3a8: 34040005 ori r4,r0,0x0005 8012f3ac: 14400003 bne r2,r0,0x8012f3bc 8012f3b0: 00002021 addu r4,r0,r0 # { 8012f3b4: 3c04801d lui r4,0x801d 8012f3b8: 9484d52c lhu r4,-0x2ad4(r4) # input = *0x801cd52c # } 8012f3bc: 3c02801d lui r2,0x801d 8012f3c0: 9042c800 lbu r2,-0x3800(r2) # *0x801cc800 8012f3c4: 00000000 nop 8012f3c8: 2442fffd addiu r2,r2,-0x0003 # *0x801cc800 - 3 8012f3cc: 2c420003 sltiu r2,r2,0x0003 8012f3d0: 10400003 beq r2,r0,0x8012f3e0 # if ((*0x801cc800 - 3) < 3) { 8012f3d4: 00000000 nop 8012f3d8: 0c04c5de jal 0x80131778 # 0x131778 (input); 8012f3dc: 00000000 nop # } 8012f3e0: 3c03801d lui r3,0x801d 8012f3e4: 9063c800 lbu r3,-0x3800(r3) # testValue = *0x801cc800 8012f3e8: 00000000 nop 8012f3ec: 14600005 bne r3,r0,0x8012f404 8012f3f0: 34020002 ori r2,r0,0x0002 # if (testValue == 0) { 8012f3f4: 0c04bd78 jal 0x8012f5e0 # 0x12f5e0 (); 8012f3f8: 00000000 nop 8012f3fc: 0804bd2c j 0x8012f4b0 8012f400: 00000000 nop # } else if (testValue == 2) { 8012f404: 14620005 bne r3,r2,0x8012f41c 8012f408: 34020001 ori r2,r0,0x0001 8012f40c: 0c04c28e jal 0x80130a38 # 0x130a38 (); 8012f410: 00000000 nop 8012f414: 0804bd2c j 0x8012f4b0 8012f418: 00000000 nop # } else if (testValue == 1) { 8012f41c: 14620005 bne r3,r2,0x8012f434 8012f420: 34020004 ori r2,r0,0x0004 8012f424: 0c04bdc0 jal 0x8012f700 # 0x12f700 (); 8012f428: 00000000 nop 8012f42c: 0804bd2c j 0x8012f4b0 8012f430: 00000000 nop # } else if (testValue == 4) { 8012f434: 14620007 bne r3,r2,0x8012f454 8012f438: 34020005 ori r2,r0,0x0005 8012f43c: 3c04801d lui r4,0x801d 8012f440: 8484c81c lh r4,-0x37e4(r4) 8012f444: 0c04be65 jal 0x8012f994 # Handle Load Game (*0x801cc81c); // Load from memcard 8012f448: 00000000 nop 8012f44c: 0804bd2c j 0x8012f4b0 8012f450: 00000000 nop # } else if (testValue == 5) { 8012f454: 14620007 bne r3,r2,0x8012f474 8012f458: 34020009 ori r2,r0,0x0009 8012f45c: 3c04801d lui r4,0x801d 8012f460: 8484c81c lh r4,-0x37e4(r4) 8012f464: 0c04bed0 jal 0x8012fb40 # Handle Save Game (*0x801cc81c); // Save to memcard 8012f468: 00000000 nop 8012f46c: 0804bd2c j 0x8012f4b0 8012f470: 00000000 nop # } else if (testValue == 9) { 8012f474: 1462000e bne r3,r2,0x8012f4b0 8012f478: 00000000 nop 8012f47c: 00002021 addu r4,r0,r0 8012f480: 0c010efa jal 0x80043be8 # 0x43be8 (0, 0xf0); 8012f484: 340500f0 ori r5,r0,0x00f0 8012f488: 2410ffff addiu r16,r0,-0x0001 # -1 # do { 8012f48c: 0c04caa6 jal 0x80132a98 # result_0x132a98 = 0x132a98 (); 8012f490: 00000000 nop 8012f494: 1050fffd beq r2,r16,0x8012f48c # } while (result_0x132a98 == -1); 8012f498: 00000000 nop 8012f49c: 0c04b523 jal 0x8012d48c # 0x12d48c (); 8012f4a0: 00000000 nop 8012f4a4: 340200ff ori r2,r0,0x00ff 8012f4a8: 3c01801d lui r1,0x801d 8012f4ac: a022c800 sb r2,-0x3800(r1) # 0x801cc800 = 0xff # } 8012f4b0: 3c02801d lui r2,0x801d 8012f4b4: 8c42d528 lw r2,-0x2ad8(r2) # *0x801cd528 8012f4b8: 00000000 nop 8012f4bc: 8c440000 lw r4,0x0000(r2) # *(*0x801cd528) 8012f4c0: 0c042282 jal 0x80108a08 # 0x108a08 (*(*0x801cd528) + 4); 8012f4c4: 24840004 addiu r4,r4,0x0004 8012f4c8: 3c02801d lui r2,0x801d 8012f4cc: 8c42d528 lw r2,-0x2ad8(r2) # *0x801cd528 8012f4d0: 00000000 nop 8012f4d4: 8c420000 lw r2,0x0000(r2) # *(*0x801cd528) 8012f4d8: 00000000 nop 8012f4dc: 244200f0 addiu r2,r2,0x00f0 # *(*0x801cd528) + 240 8012f4e0: 3c01801d lui r1,0x801d 8012f4e4: ac22d814 sw r2,-0x27ec(r1) # *0x801cd814 = *(*0x801cd528) + 240 8012f4e8: 0c038a2b jal 0x800e28ac # 0xe28ac (); 8012f4ec: 00000000 nop 8012f4f0: 0c0076d6 jal 0x8001db58 # result_0x1db58 = 0x1db58 (0); 8012f4f4: 00002021 addu r4,r0,r0 8012f4f8: 3050f000 andi r16,r2,0xf000 # result_0x1db58 & 0xf000 8012f4fc: 3c02801d lui r2,0x801d 8012f500: 9442d838 lhu r2,-0x27c8(r2) # *0x801cd838 8012f504: 34040001 ori r4,r0,0x0001 8012f508: 30420fff andi r2,r2,0x0fff # *0x801cd838 & 0x0fff 8012f50c: 0c03ffbb jal 0x800ffeec # status = Check Thread Running Status (WORLD.BIN) (1); 8012f510: 02028025 or r16,r16,r2 # input = (result_0x1db58 & 0xf000) | (*0x801cd838 & 0x0fff) 8012f514: 1440000b bne r2,r0,0x8012f544 # if ((status == 0) 8012f518: 02002821 addu r5,r16,r0 8012f51c: 0c03ffbb jal 0x800ffeec 8012f520: 34040005 ori r4,r0,0x0005 8012f524: 14400007 bne r2,r0,0x8012f544 # && (Check Thread Running Status (WORLD.BIN) (5) == 0) 8012f528: 02002821 addu r5,r16,r0 8012f52c: 0c03ffbb jal 0x800ffeec 8012f530: 3404000f ori r4,r0,0x000f 8012f534: 14400003 bne r2,r0,0x8012f544 # && (Check Thread Running Status (WORLD.BIN) (15) == 0)) 8012f538: 02002821 addu r5,r16,r0 # { 8012f53c: 3210ff00 andi r16,r16,0xff00 8012f540: 02002821 addu r5,r16,r0 # input = ((result_0x1db58 & 0xf000) | (*0x801cd838 & 0x0fff)) & 0xff00 # } 8012f544: 3c06801d lui r6,0x801d 8012f548: 94c6d1d8 lhu r6,-0x2e28(r6) # *0x801cd1d8 8012f54c: 3c02801d lui r2,0x801d 8012f550: 8c42d528 lw r2,-0x2ad8(r2) # *0x801cd528 8012f554: 2cc60001 sltiu r6,r6,0x0001 # (*0x801cd1d8 == 0) ? 1 : 0 8012f558: 00063023 subu r6,r0,r6 # -((*0x801cd1d8 == 0) ? 1 : 0) 8012f55c: 8c440000 lw r4,0x0000(r2) # *(*0x801cd528) 8012f560: 30c600f0 andi r6,r6,0x00f0 # (-((*0x801cd1d8 == 0) ? 1 : 0)) & 0x00f0 8012f564: 0c044a38 jal 0x801128e0 # 0x1128e0 ((*(*0x801cd528)) & 0x00f0, input, (-((*0x801cd1d8 == 0) ? 1 : 0)) & 0x00f0) 8012f568: 248400f0 addiu r4,r4,0x00f0 # (*(*0x801cd528)) & 0x00f0 8012f56c: 0c044f75 jal 0x80113dd4 # 0x113dd4 (); 8012f570: 00000000 nop 8012f574: 0804bcd0 j 0x8012f340 8012f578: 00000000 nop # } 8012f57c: 00002821 addu r5,r0,r0 8012f580: 2406ffff addiu r6,r0,-0x0001 8012f584: 0c03ffc2 jal 0x800fff08 # Store Thread Function Parameters (WORLD.BIN) (2, 0, -1, 0); 8012f588: 00003821 addu r7,r0,r0 8012f58c: 0c04c243 jal 0x8013090c # 0x13090c (); 8012f590: 00000000 nop 8012f594: 0c04c975 jal 0x801325d4 # 0x1325d4 (); 8012f598: 00000000 nop 8012f59c: 00112400 sll r4,r17,0x10 8012f5a0: 0c010e70 jal 0x800439c0 # 0x439c0 (result_0x43660); 8012f5a4: 00042403 sra r4,r4,0x10 8012f5a8: 0c041a66 jal 0x80106998 # 0x106998 (); 8012f5ac: 00000000 nop 8012f5b0: 0c042248 jal 0x80108920 # 0x108920 (); 8012f5b4: 00000000 nop 8012f5b8: 3c02801d lui r2,0x801d 8012f5bc: 9042c808 lbu r2,-0x37f8(r2) # *0x801cc808 8012f5c0: 3408ccd8 ori r8,r0,0xccd8 # 0xccd8 8012f5c4: 011d4821 addu r9,r8,r29 # sp + 0xccd8 8012f5c8: 8d3ffff8 lw r31,-0x0008(r9) 8012f5cc: 8d31fff4 lw r17,-0x000c(r9) 8012f5d0: 8d30fff0 lw r16,-0x0010(r9) 8012f5d4: 03a8e821 addu r29,r29,r8 # sp = sp + 0xccd8 8012f5d8: 03e00008 jr r31 # return *0x801cc808; 8012f5dc: 00000000 nop