Advertisement
fishguy6564

[MKW] Drop Any Item -Fishguy6564-

Aug 20th, 2019
1,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Code Description: Drops items as if you were getting squished by holding down a button. Please note that gecko code types are used to handle buttons. The source above is for the main code itself. Please note that you will need the code located here: https://pastebin.com/NsrpbwqB in order to make it work online.
  2.  
  3. Instructions start at: 0x8079093C:          add       r3, r3, r0
  4. ;Using macros to make function calling cleaner
  5. .macro CALL symbol
  6. lis     r18,\symbol@h
  7. ori     r18,r18,\symbol@l
  8. mtctr   r18
  9. bctrl
  10. .endm
  11. .set dropItemEquip, 0x8078FA24
  12.  
  13. code:
  14.     .include "push.s"
  15.     mr      r15, r0             ;Backup r0
  16.     mr      r16, r3             ;Backup r3
  17.     mr      r17, r4             ;Backup r4
  18.    
  19.     lis     r18, 0x8000        
  20.     ori     r18, r18, 0x1500    ;r18 now contains 0x80001500
  21.     lwz     r18, 4(r18)         ;Get our player index from 0x80001504
  22.     cmpw    r27, r18            ;The code is being iterated, so we check the current counter which is in r27
  23.     bne     DoNotDrop           ;Skip rest of code if it does not equal our player index
  24.     lwz     r3, 0x14(r30)       ;Load the pointer needed for the dropItemEquip function
  25.     add     r3, r3, r0          ;r0 contains the calculated offset based on the counter, so we add it to the pointer obtained above
  26.     lwz     r18,0x10(r3)        ;We will use a buffer so items will not drop every frame
  27.                                 ;Thus we keep a counter and obtain it from a location in memory that is not in use
  28.     addi    r18, r18, 1         ;Increment the counter
  29.     stw     r18,0x10(r3)        ;Store the counter back into the same location
  30.     cmpwi   r18, 15             ;Check counter if it has reached a certain value (change this to increase or decrease the drop speed)
  31.     blt     DoNotDrop           ;Skip the function call if it is less than the value above
  32.     li      r18, 0              ;Reset counter
  33.     stw     r18,0x10(r3)        ;Store counter back into memory
  34.     li      r4, 12              ;arg2 is always 12 it seems
  35.     CALL    dropItemEquip       ;Call the dropItemEquip function
  36. DoNotDrop:
  37.     mr      r0, r15             ;Restore r0
  38.     mr      r3, r16             ;Restore r3
  39.     mr      r4, r17             ;Restore r4
  40. .include "pop.s"
  41.     add     r3, r3, r0          ;Original instruction
  42.  
  43. Finished product:
  44. Drop Any Item -Fishguy6564- [NTSC-U]
  45. 0479093C 7C630214
  46. 28XXXXXX YYYYYYYY
  47. C279093C 00000010
  48. 9421FFB0 BDC10008
  49. 7C0F0378 7C701B78
  50. 7C912378 3E408000
  51. 62521500 82520004
  52. 7C1B9000 4082003C
  53. 807E0014 7C630214
  54. 82430010 3A520001
  55. 92430010 2C12000F
  56. 41800020 3A400000
  57. 92430010 3880000C
  58. 3E408078 6252FA24
  59. 7E4903A6 4E800421
  60. 7DE07B78 7E038378
  61. 7E248B78 B9C10008
  62. 38210050 7C630214
  63. 60000000 00000000
  64. E0000000 80008000
  65.  
  66. XX = Button Address
  67. YY = Button State
  68.  
  69. Drop Any Item -Fishguy6564- [PAL]
  70. 04799948 7C630214
  71. 28XXXXXX YYYYYYYY
  72. C2799948 00000010
  73. 9421FFB0 BDC10008
  74. 7C0F0378 7C701B78
  75. 7C912378 3E408000
  76. 62521500 82520004
  77. 7C1B9000 4082003C
  78. 807E0014 7C630214
  79. 82430010 3A520001
  80. 92430010 2C12000F
  81. 41800020 3A400000
  82. 92430010 3880000C
  83. 3E408079 62528A30
  84. 7E4903A6 4E800421
  85. 7DE07B78 7E038378
  86. 7E248B78 B9C10008
  87. 38210050 7C630214
  88. 60000000 00000000
  89. E0000000 80008000
  90.  
  91. XX = Button Address
  92. YY = Button State
  93.  
  94. To change the speed of items being dropped, edit 2C12000F.
  95. Replace the Z values as seen here:
  96. 2C12ZZZZ
  97. where 0 <= Z <= 0x7FFF
  98. The larger the value, the slower it drops.
  99. The smaller the value, the faster it drops.
  100. If anyone is interested to port and test, then I will be happy to include it on this paste. You will be credited if ported correctly.
  101. Anyways, Enjoy the code!
  102.  
  103. Current available regions:
  104. NTSC-U:
  105. NTSC-J: X
  106. NTSC-K: X
  107. PAL: ✓ ported by D3A01000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement