Handle Simple Selection Menu (WORLD.BIN)
Jump to navigation
Jump to search
# ROUTINE: Handle Simple Selection Menu (WORLD.BIN) (0x11241c) # Displays a simple selection menu that contains only one column per row. # This function is rather similar to Display Simple Selection Menu in BATTLE.BIN. # This function is called in a new thread to handle menus (referenced by menu data). Example: Order Unit menu in the formation screen. 8011241c: 27bdfec0 addiu r29,r29,-0x0140 80112420: 00002021 addu r4,r0,r0 80112424: afbf013c sw r31,0x013c(r29) 80112428: afbe0138 sw r30,0x0138(r29) 8011242c: afb70134 sw r23,0x0134(r29) 80112430: afb60130 sw r22,0x0130(r29) 80112434: afb5012c sw r21,0x012c(r29) 80112438: afb40128 sw r20,0x0128(r29) 8011243c: afb30124 sw r19,0x0124(r29) 80112440: afb20120 sw r18,0x0120(r29) 80112444: afb1011c sw r17,0x011c(r29) 80112448: 0c03f68d jal 0x800fda34 # buttonInput = Get Menu Controller Input (WORLD.BIN) (0); 8011244c: afb00118 sw r16,0x0118(r29) 80112450: 3c01801c lui r1,0x801c 80112454: ac220524 sw r2,0x0524(r1) # *0x801c0524 = buttonInput 80112458: 0c040024 jal 0x80100090 # menuData = Get First Thread Parameter (WORLD.BIN) (); 8011245c: 00000000 nop 80112460: 27b10018 addiu r17,r29,0x0018 # sp + 0x18 80112464: 00408021 addu r16,r2,r0 # menuData 80112468: 9602000a lhu r2,0x000a(r16) # menuData.screenY 8011246c: 86030038 lh r3,0x0038(r16) # menuData.selectedIndex 80112470: 3042fffe andi r2,r2,0xfffe # menuData.screenY & 0xfffe // Forces even number (Subtracts one from odd number). 80112474: a602000a sh r2,0x000a(r16) # menuData.screenY = menuData.screenY & 0xfffe 80112478: 2402ffff addiu r2,r0,-0x0001 8011247c: 14620002 bne r3,r2,0x80112488 80112480: afa30110 sw r3,0x0110(r29) # selectedIndex = menuData.selectedIndex # if (menuData.selectedIndex == -1) { 80112484: afa00110 sw r0,0x0110(r29) # selectedIndex = 0 # } 80112488: 27a40010 addiu r4,r29,0x0010 8011248c: 02002821 addu r5,r16,r0 80112490: 0c03b042 jal 0x800ec108 # 0xec108 (sp + 0x10, menuData, sp + 0x18); 80112494: 02203021 addu r6,r17,r0 80112498: 27a40094 addiu r4,r29,0x0094 8011249c: 02202821 addu r5,r17,r0 801124a0: 0c03fd14 jal 0x800ff450 # 0xff450 (sp + 0x94, sp + 0x18, 0x7c); 801124a4: 3406007c ori r6,r0,0x007c 801124a8: 0000a021 addu r20,r0,r0 # 0 801124ac: 00009021 addu r18,r0,r0 # count = 0 801124b0: 34170001 ori r23,r0,0x0001 # 1 801124b4: 3c168015 lui r22,0x8015 801124b8: 26d6328c addiu r22,r22,0x328c # 0x8015328c 801124bc: 0220f021 addu r30,r17,r0 # sp + 0x18 801124c0: 8e150030 lw r21,0x0030(r16) # menuData.0x30 801124c4: 34020001 ori r2,r0,0x0001 801124c8: a6a20000 sh r2,0x0000(r21) # *(menuData.0x30) = 1 # while (true) { 801124cc: 86a20000 lh r2,0x0000(r21) # *(menuData.0x30) 801124d0: 00000000 nop 801124d4: 14570018 bne r2,r23,0x80112538 801124d8: 32430001 andi r3,r18,0x0001 # count % 2 # if (*(menuData.0x30) == 1) { 801124dc: 27a60010 addiu r6,r29,0x0010 801124e0: 34070001 ori r7,r0,0x0001 801124e4: a6a00000 sh r0,0x0000(r21) # *(menuData.0x30) = 0 801124e8: 86040004 lh r4,0x0004(r16) 801124ec: 86050006 lh r5,0x0006(r16) 801124f0: 0c03fe6b jal 0x800ff9ac # result_0xff9ac = 0xff9ac (menuData.innerWidth, menuData.innerHeight, sp + 16, 1); 801124f4: 34140001 ori r20,r0,0x0001 # v20 = 1 801124f8: 34040008 ori r4,r0,0x0008 801124fc: 34050009 ori r5,r0,0x0009 80112500: 86030004 lh r3,0x0004(r16) # menuData.innerWidth 80112504: 00409821 addu r19,r2,r0 # result_0xff9ac 80112508: 0c03f6e2 jal 0x800fdb88 # 0xfdb88 (8, 9); 8011250c: aec30000 sw r3,0x0000(r22) # *0x8015328c = menuData.innerWidth 80112510: 02602821 addu r5,r19,r0 80112514: 8604001c lh r4,0x001c(r16) 80112518: 3c018015 lui r1,0x8015 8011251c: ac203270 sw r0,0x3270(r1) # *0x80153270 = 0 80112520: 0c03f9dd jal 0x800fe774 # Display Menu Text Entry (WORLD.BIN) (menuData.0x1c, result_0xff9ac, 0x80153284); 80112524: 26c6fff8 addiu r6,r22,-0x0008 80112528: 27a40010 addiu r4,r29,0x0010 8011252c: 0c00923f jal 0x800248fc # ? 0x248fc (sp + 0x10, result_0xff9ac); 80112530: 02602821 addu r5,r19,r0 80112534: 32430001 andi r3,r18,0x0001 # } 80112538: 00031140 sll r2,r3,0x05 # (count % 2) * 32 8011253c: 00431023 subu r2,r2,r3 # (count % 2) * 31 80112540: 00021080 sll r2,r2,0x02 # (count % 2) * 124 80112544: 0c03ffd4 jal 0x800fff50 # Switch To Next Thread (WORLD.BIN) (); 80112548: 03c28821 addu r17,r30,r2 # sp + 0x18 + ((count % 2) * 124) 8011254c: 16970004 bne r20,r23,0x80112560 # if (v20 == 1) { 80112550: 00000000 nop 80112554: 0c038ca6 jal 0x800e3298 # 0xe3298 (result_0xff9ac); 80112558: 02602021 addu r4,r19,r0 8011255c: 0000a021 addu r20,r0,r0 # v20 = 0 # } 80112560: 97a20110 lhu r2,0x0110(r29) # selectedIndex 80112564: 3c04801c lui r4,0x801c 80112568: 8c840524 lw r4,0x0524(r4) 8011256c: 0c03afe3 jal 0x800ebf8c # result_0xebf8c = 0xebf8c (*0x801c0524); // Selecting menu options / cancel menu related 80112570: a6020038 sh r2,0x0038(r16) # menuData.selectedIndex = selectedIndex 80112574: 14400014 bne r2,r0,0x801125c8 # if (result_0xebf8c == 0) break; 80112578: 02002021 addu r4,r16,r0 8011257c: 0c03af73 jal 0x800ebdcc # Menu Scroll Related (0xebdcc) (menuData, selectedIndex); 80112580: 27a50110 addiu r5,r29,0x0110 80112584: 8fa50110 lw r5,0x0110(r29) 80112588: 0c03aec2 jal 0x800ebb08 # Handle Menu Action (WORLD.BIN) (menuData, selectedIndex); 8011258c: 02002021 addu r4,r16,r0 80112590: 0c03af9f jal 0x800ebe7c # 0xebe7c (menuData); // Related to menu cancel 80112594: 02002021 addu r4,r16,r0 80112598: 0c03b121 jal 0x800ec484 # 0xec484 (sp + 0x18 + ((count % 2) * 124)); // Menu color related 8011259c: 02202021 addu r4,r17,r0 801125a0: 02002021 addu r4,r16,r0 801125a4: 02202821 addu r5,r17,r0 801125a8: 02403021 addu r6,r18,r0 801125ac: 8fa70110 lw r7,0x0110(r29) 801125b0: 0c03b16e jal 0x800ec5b8 # 0xec5b8 (menuData, sp + 0x18 + ((count % 2) * 124), count, selectedIndex); // Cursor related 801125b4: 26520001 addiu r18,r18,0x0001 # count = count + 1 801125b8: 0c03b2d6 jal 0x800ecb58 # 0xecb58 (sp + 0x18 + ((count % 2) * 124)); // Menu display related 801125bc: 02202021 addu r4,r17,r0 801125c0: 08044933 j 0x801124cc # } 801125c4: 00000000 nop 801125c8: 0c03ffd4 jal 0x800fff50 # Switch To Next Thread (WORLD.BIN) (); 801125cc: 00000000 nop 801125d0: 0c03ff8a jal 0x800ffe28 # Stop Current Thread (WORLD.BIN) (); 801125d4: 00000000 nop 801125d8: 8fbf013c lw r31,0x013c(r29) 801125dc: 8fbe0138 lw r30,0x0138(r29) 801125e0: 8fb70134 lw r23,0x0134(r29) 801125e4: 8fb60130 lw r22,0x0130(r29) 801125e8: 8fb5012c lw r21,0x012c(r29) 801125ec: 8fb40128 lw r20,0x0128(r29) 801125f0: 8fb30124 lw r19,0x0124(r29) 801125f4: 8fb20120 lw r18,0x0120(r29) 801125f8: 8fb1011c lw r17,0x011c(r29) 801125fc: 8fb00118 lw r16,0x0118(r29) 80112600: 27bd0140 addiu r29,r29,0x0140 80112604: 03e00008 jr r31 80112608: 00000000 nop