Advertisement
Guest User

Shared Item Cheat Detection [Star]

a guest
Aug 17th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shared Item Cheat Detection [Star]
  2.  
  3. This code will detect when a player tries to obtain a Shared Item, but the item they intend to cheat already has it's maximum amount in play. The code will also detect when a player obtains impossible item combinations. It will display the slot of the offending player in the milliseconds of the timer, accompanied by a value denoting the reason.
  4.  
  5. (NTSC-U)
  6. C26593FC 00000005
  7. 907C0008 9421FFF0
  8. BFC10008 3FE08053
  9. 3FC080A1 63DE0024
  10. 93DF10A0 BBC10008
  11. 38210010 00000000
  12. C265EE14 0000000B
  13. 88030001 9421FFF0
  14. BFC10008 8BE30003
  15. 56CC103A 3D8C8168
  16. 2C1F0000 41A20010
  17. 2C1F0001 41820014
  18. 4800001C 3BC00014
  19. 9BCC0193 48000014
  20. 3BC00057 9BCC0193
  21. 48000008 980C0193
  22. BBC10008 38210010
  23. 60000000 00000000
  24. C265EE30 00000059
  25. 88100011 9421FFB0
  26. BDC10008 8BF00013
  27. 56CC103A 3D8C8168
  28. 2C1F0000 41A20010
  29. 2C1F0001 41820014
  30. 48000258 3BC00014
  31. 9BCC0193 48000284
  32. 3BC00057 9BCC0193
  33. 3FA08053 3F8038A0
  34. 8B700012 2C1B0010
  35. 41820018 2C1B0011
  36. 41820010 2C1B0012
  37. 41820008 4800001C
  38. 2C000010 41820224
  39. 2C000011 4182021C
  40. 2C000012 41820214
  41. 3B40000C 7F4903A6
  42. 3F208168 63390193
  43. 3F008168 63180133
  44. 8AF90000 2C170006
  45. 40A20014 8AD80000
  46. 3AD60001 9AD80000
  47. 480000D8 2C170007
  48. 40A20014 8AD80004
  49. 3AD60001 9AD80004
  50. 480000C0 2C170008
  51. 40A20014 8AD80008
  52. 3AD60001 9AD80008
  53. 480000A8 2C170009
  54. 40A20014 8AD8000C
  55. 3AD60001 9AD8000C
  56. 48000090 2C17000A
  57. 40A20014 8AD80010
  58. 3AD60001 9AD80010
  59. 48000078 2C17000B
  60. 40A20014 8AD80014
  61. 3AD60001 9AD80014
  62. 48000060 2C17000C
  63. 40A20014 8AD80018
  64. 3AD60001 9AD80018
  65. 48000048 2C17000D
  66. 40A20014 8AD8001C
  67. 3AD60001 9AD8001C
  68. 48000030 2C17000E
  69. 40A20014 8AD80020
  70. 3AD60001 9AD80020
  71. 48000018 2C17000F
  72. 40A20010 8AD80024
  73. 3AD60001 9AD80024
  74. 3B390004 4200FF0C
  75. 2C000006 40A20014
  76. 8AD80000 2C160003
  77. 408000E8 480000FC
  78. 2C000007 40A20014
  79. 8AD80004 2C160001
  80. 408000D0 480000E4
  81. 2C000008 40A20014
  82. 8AD80008 2C160001
  83. 408000B8 480000CC
  84. 2C000009 40A20014
  85. 8AD8000C 2C160003
  86. 408000A0 480000B4
  87. 2C00000A 40A20014
  88. 8AD80010 2C160002
  89. 40800088 4800009C
  90. 2C00000B 40A20014
  91. 8AD80014 2C160002
  92. 40800070 48000084
  93. 2C00000C 40A20014
  94. 8AD80018 2C160001
  95. 40800058 4800006C
  96. 2C00000D 40A20014
  97. 8AD8001C 2C160001
  98. 40800040 48000054
  99. 2C00000E 40A20014
  100. 8AD80020 2C160001
  101. 40800028 4800003C
  102. 2C00000F 40A20010
  103. 8AD80024 2C160001
  104. 40800010 48000024
  105. 980C0193 48000034
  106. 639C0064 48000008
  107. 639C012C 7F9CB214
  108. 3B9C0001 939D10A0
  109. 3AA00000 3B40000A
  110. 7F4903A6 9AB80000
  111. 3B180004 4200FFF8
  112. B9C10008 38210050
  113. 60000000 00000000
  114.  
  115. (PAL)
  116. C2661338 00000005
  117. 907C0008 9421FFF0
  118. BFC10008 3FE08053
  119. 3FC080A1 63DE0024
  120. 93DF5BE8 BBC10008
  121. 38210010 00000000
  122. C265E18C 0000000B
  123. 88030001 9421FFF0
  124. BFC10008 8BE30003
  125. 56CC103A 3D8C8168
  126. 2C1F0000 41A20010
  127. 2C1F0001 41820014
  128. 4800001C 3BC00014
  129. 9BCC0193 48000014
  130. 3BC00057 9BCC0193
  131. 48000008 980C0193
  132. BBC10008 38210010
  133. 60000000 00000000
  134. C265E1A8 00000059
  135. 88100011 9421FFB0
  136. BDC10008 8BF00013
  137. 56CC103A 3D8C8168
  138. 2C1F0000 41A20010
  139. 2C1F0001 41820014
  140. 48000258 3BC00014
  141. 9BCC0193 48000284
  142. 3BC00057 9BCC0193
  143. 3FA08053 3F8038A0
  144. 8B700012 2C1B0010
  145. 41820018 2C1B0011
  146. 41820010 2C1B0012
  147. 41820008 4800001C
  148. 2C000010 41820224
  149. 2C000011 4182021C
  150. 2C000012 41820214
  151. 3B40000C 7F4903A6
  152. 3F208168 63390193
  153. 3F008168 63180133
  154. 8AF90000 2C170006
  155. 40A20014 8AD80000
  156. 3AD60001 9AD80000
  157. 480000D8 2C170007
  158. 40A20014 8AD80004
  159. 3AD60001 9AD80004
  160. 480000C0 2C170008
  161. 40A20014 8AD80008
  162. 3AD60001 9AD80008
  163. 480000A8 2C170009
  164. 40A20014 8AD8000C
  165. 3AD60001 9AD8000C
  166. 48000090 2C17000A
  167. 40A20014 8AD80010
  168. 3AD60001 9AD80010
  169. 48000078 2C17000B
  170. 40A20014 8AD80014
  171. 3AD60001 9AD80014
  172. 48000060 2C17000C
  173. 40A20014 8AD80018
  174. 3AD60001 9AD80018
  175. 48000048 2C17000D
  176. 40A20014 8AD8001C
  177. 3AD60001 9AD8001C
  178. 48000030 2C17000E
  179. 40A20014 8AD80020
  180. 3AD60001 9AD80020
  181. 48000018 2C17000F
  182. 40A20010 8AD80024
  183. 3AD60001 9AD80024
  184. 3B390004 4200FF0C
  185. 2C000006 40A20014
  186. 8AD80000 2C160003
  187. 408000E8 480000FC
  188. 2C000007 40A20014
  189. 8AD80004 2C160001
  190. 408000D0 480000E4
  191. 2C000008 40A20014
  192. 8AD80008 2C160001
  193. 408000B8 480000CC
  194. 2C000009 40A20014
  195. 8AD8000C 2C160003
  196. 408000A0 480000B4
  197. 2C00000A 40A20014
  198. 8AD80010 2C160002
  199. 40800088 4800009C
  200. 2C00000B 40A20014
  201. 8AD80014 2C160002
  202. 40800070 48000084
  203. 2C00000C 40A20014
  204. 8AD80018 2C160001
  205. 40800058 4800006C
  206. 2C00000D 40A20014
  207. 8AD8001C 2C160001
  208. 40800040 48000054
  209. 2C00000E 40A20014
  210. 8AD80020 2C160001
  211. 40800028 4800003C
  212. 2C00000F 40A20010
  213. 8AD80024 2C160001
  214. 40800010 48000024
  215. 980C0193 48000034
  216. 639C0064 48000008
  217. 639C012C 7F9CB214
  218. 3B9C0001 939D5BE8
  219. 3AA00000 3B40000A
  220. 7F4903A6 9AB80000
  221. 3B180004 4200FFF8
  222. B9C10008 38210050
  223. 60000000 00000000
  224.  
  225. (NTSC-J)
  226. C26609A4 00000005
  227. 907C0008 9421FFF0
  228. BFC10008 3FE08053
  229. 3FC080A1 63DE0024
  230. 93DF5568 BBC10008
  231. 38210010 00000000
  232. C265D7F8 0000000B
  233. 88030001 9421FFF0
  234. BFC10008 8BE30003
  235. 56CC103A 3D8C8168
  236. 2C1F0000 41A20010
  237. 2C1F0001 41820014
  238. 4800001C 3BC00014
  239. 9BCC0193 48000014
  240. 3BC00057 9BCC0193
  241. 48000008 980C0193
  242. BBC10008 38210010
  243. 60000000 00000000
  244. C265D814 00000059
  245. 88100011 9421FFB0
  246. BDC10008 8BF00013
  247. 56CC103A 3D8C8168
  248. 2C1F0000 41A20010
  249. 2C1F0001 41820014
  250. 48000258 3BC00014
  251. 9BCC0193 48000284
  252. 3BC00057 9BCC0193
  253. 3FA08053 3F8038A0
  254. 8B700012 2C1B0010
  255. 41820018 2C1B0011
  256. 41820010 2C1B0012
  257. 41820008 4800001C
  258. 2C000010 41820224
  259. 2C000011 4182021C
  260. 2C000012 41820214
  261. 3B40000C 7F4903A6
  262. 3F208168 63390193
  263. 3F008168 63180133
  264. 8AF90000 2C170006
  265. 40A20014 8AD80000
  266. 3AD60001 9AD80000
  267. 480000D8 2C170007
  268. 40A20014 8AD80004
  269. 3AD60001 9AD80004
  270. 480000C0 2C170008
  271. 40A20014 8AD80008
  272. 3AD60001 9AD80008
  273. 480000A8 2C170009
  274. 40A20014 8AD8000C
  275. 3AD60001 9AD8000C
  276. 48000090 2C17000A
  277. 40A20014 8AD80010
  278. 3AD60001 9AD80010
  279. 48000078 2C17000B
  280. 40A20014 8AD80014
  281. 3AD60001 9AD80014
  282. 48000060 2C17000C
  283. 40A20014 8AD80018
  284. 3AD60001 9AD80018
  285. 48000048 2C17000D
  286. 40A20014 8AD8001C
  287. 3AD60001 9AD8001C
  288. 48000030 2C17000E
  289. 40A20014 8AD80020
  290. 3AD60001 9AD80020
  291. 48000018 2C17000F
  292. 40A20010 8AD80024
  293. 3AD60001 9AD80024
  294. 3B390004 4200FF0C
  295. 2C000006 40A20014
  296. 8AD80000 2C160003
  297. 408000E8 480000FC
  298. 2C000007 40A20014
  299. 8AD80004 2C160001
  300. 408000D0 480000E4
  301. 2C000008 40A20014
  302. 8AD80008 2C160001
  303. 408000B8 480000CC
  304. 2C000009 40A20014
  305. 8AD8000C 2C160003
  306. 408000A0 480000B4
  307. 2C00000A 40A20014
  308. 8AD80010 2C160002
  309. 40800088 4800009C
  310. 2C00000B 40A20014
  311. 8AD80014 2C160002
  312. 40800070 48000084
  313. 2C00000C 40A20014
  314. 8AD80018 2C160001
  315. 40800058 4800006C
  316. 2C00000D 40A20014
  317. 8AD8001C 2C160001
  318. 40800040 48000054
  319. 2C00000E 40A20014
  320. 8AD80020 2C160001
  321. 40800028 4800003C
  322. 2C00000F 40A20010
  323. 8AD80024 2C160001
  324. 40800010 48000024
  325. 980C0193 48000034
  326. 639C0064 48000008
  327. 639C012C 7F9CB214
  328. 3B9C0001 939D5568
  329. 3AA00000 3B40000A
  330. 7F4903A6 9AB80000
  331. 3B180004 4200FFF8
  332. B9C10008 38210050
  333. 60000000 00000000
  334.  
  335. (NTSC-K)
  336. C264F650 00000005
  337. 907C0008 9421FFF0
  338. BFC10008 3FE08052
  339. 3FC080A1 63DE0024
  340. 93DF3C40 BBC10008
  341. 38210010 00000000
  342. C264C4A4 0000000B
  343. 88030001 9421FFF0
  344. BFC10008 8BE30003
  345. 56CC103A 3D8C8168
  346. 2C1F0000 41A20010
  347. 2C1F0001 41820014
  348. 4800001C 3BC00014
  349. 9BCC0193 48000014
  350. 3BC00057 9BCC0193
  351. 48000008 980C0193
  352. BBC10008 38210010
  353. 60000000 00000000
  354. C264C4C0 00000059
  355. 88100011 9421FFB0
  356. BDC10008 8BF00013
  357. 56CC103A 3D8C8168
  358. 2C1F0000 41A20010
  359. 2C1F0001 41820014
  360. 48000258 3BC00014
  361. 9BCC0193 48000284
  362. 3BC00057 9BCC0193
  363. 3FA08052 3F8038A0
  364. 8B700012 2C1B0010
  365. 41820018 2C1B0011
  366. 41820010 2C1B0012
  367. 41820008 4800001C
  368. 2C000010 41820224
  369. 2C000011 4182021C
  370. 2C000012 41820214
  371. 3B40000C 7F4903A6
  372. 3F208168 63390193
  373. 3F008168 63180133
  374. 8AF90000 2C170006
  375. 40A20014 8AD80000
  376. 3AD60001 9AD80000
  377. 480000D8 2C170007
  378. 40A20014 8AD80004
  379. 3AD60001 9AD80004
  380. 480000C0 2C170008
  381. 40A20014 8AD80008
  382. 3AD60001 9AD80008
  383. 480000A8 2C170009
  384. 40A20014 8AD8000C
  385. 3AD60001 9AD8000C
  386. 48000090 2C17000A
  387. 40A20014 8AD80010
  388. 3AD60001 9AD80010
  389. 48000078 2C17000B
  390. 40A20014 8AD80014
  391. 3AD60001 9AD80014
  392. 48000060 2C17000C
  393. 40A20014 8AD80018
  394. 3AD60001 9AD80018
  395. 48000048 2C17000D
  396. 40A20014 8AD8001C
  397. 3AD60001 9AD8001C
  398. 48000030 2C17000E
  399. 40A20014 8AD80020
  400. 3AD60001 9AD80020
  401. 48000018 2C17000F
  402. 40A20010 8AD80024
  403. 3AD60001 9AD80024
  404. 3B390004 4200FF0C
  405. 2C000006 40A20014
  406. 8AD80000 2C160003
  407. 408000E8 480000FC
  408. 2C000007 40A20014
  409. 8AD80004 2C160001
  410. 408000D0 480000E4
  411. 2C000008 40A20014
  412. 8AD80008 2C160001
  413. 408000B8 480000CC
  414. 2C000009 40A20014
  415. 8AD8000C 2C160003
  416. 408000A0 480000B4
  417. 2C00000A 40A20014
  418. 8AD80010 2C160002
  419. 40800088 4800009C
  420. 2C00000B 40A20014
  421. 8AD80014 2C160002
  422. 40800070 48000084
  423. 2C00000C 40A20014
  424. 8AD80018 2C160001
  425. 40800058 4800006C
  426. 2C00000D 40A20014
  427. 8AD8001C 2C160001
  428. 40800040 48000054
  429. 2C00000E 40A20014
  430. 8AD80020 2C160001
  431. 40800028 4800003C
  432. 2C00000F 40A20010
  433. 8AD80024 2C160001
  434. 40800010 48000024
  435. 980C0193 48000034
  436. 639C0064 48000008
  437. 639C012C 7F9CB214
  438. 3B9C0001 939D3C40
  439. 3AA00000 3B40000A
  440. 7F4903A6 9AB80000
  441. 3B180004 4200FFF8
  442. B9C10008 38210050
  443. 60000000 00000000
  444.  
  445. #============================================================#
  446. #                          Source                            #
  447. #============================================================#
  448.  
  449. #============================================================#
  450. #                    Local SELECT Record                     #
  451. #============================================================#
  452. # Original Address Ports:                                    #
  453. # RMCE - 0x806593FC                                          #
  454. # RMCP - 0x80661338                                          #
  455. # RMCJ - 0x806609A4                                          #
  456. # RMCK - 0x8064F650                                          #
  457. #============================================================#
  458.  
  459. .set region, ''
  460.  
  461. .if     (region == 'E' || region == 'e') # RMCE
  462.        .set millisecondsDisplayAddress, 0x805310A0
  463. .elseif (region == 'P' || region == 'p') # RMCP
  464.        .set millisecondsDisplayAddress, 0x80535BE8
  465. .elseif (region == 'J' || region == 'j') # RMCJ
  466.        .set millisecondsDisplayAddress, 0x80535568
  467. .elseif (region == 'K' || region == 'k') # RMCK
  468.        .set millisecondsDisplayAddress, 0x80523C40
  469. .else # Invalid Region
  470.        .abort
  471. .endif
  472.  
  473. # Original instruction
  474. stw r3, 8(r28)
  475.  
  476. # Function Prologue...
  477. stwu r1, -16(r1)
  478. stmw r30, 8(r1)
  479.  
  480. lis r31, millisecondsDisplayAddress@ha
  481.  
  482. # Default Millisecond Display Opcode
  483. lis r30, 0x80A1
  484. ori r30, r30, 0x0024
  485.  
  486. stw r30, millisecondsDisplayAddress@l(r31)
  487.  
  488. # Function Epilogue...
  489. lmw r30, 8(r1)
  490. addi r1, r1, 16
  491.  
  492. #============================================================#
  493. #                Local Player's ITEM Record                  #
  494. #============================================================#
  495. # Original Address Ports:                                    #
  496. # RMCE - 0x8065EE14                                          #
  497. # RMCP - 0x8065E18C                                          #
  498. # RMCJ - 0x8065D7F8                                          #
  499. # RMCK - 0x8064C4A4                                          #
  500. #============================================================#
  501.  
  502. # Original instruction
  503. lbz r0, 1(r3) # Load the Local Player's Held Item into r0
  504.  
  505. # Function Prologue...
  506. stwu r1, -16(r1)
  507. stmw r30, 8(r1)
  508.  
  509. lbz r31, 3(r3) # Load the Local Player's Activation Mode into r31
  510.  
  511. # Calculate a unique address using the Local Player's Slot
  512. slwi r12, r22, 2
  513. subis r12, r12, 32408
  514.  
  515. #============================================================#
  516. #                         Purpose                            #
  517. #------------------------------------------------------------#
  518. # Find the Activation Mode of the Local Player.              #
  519. #============================================================#
  520.  
  521. cmpwi r31, 0
  522. beq+ branch_handshake_stage_0
  523. cmpwi r31, 1
  524. beq- branch_handshake_stage_1
  525. b branch_handshake_stage_2_or_greater
  526.  
  527. #============================================================#
  528. #                         Purpose                            #
  529. #------------------------------------------------------------#
  530. # Store the Local Player's Held Item to Item Spy.            #
  531. #                                                            #
  532. # To prevent false positives from occuring (Caused by the    #
  533. # Item Value switching before the Activation Mode), store    #
  534. # the No Item value to the Item Spy.                         #
  535. #                                                            #
  536. # Activation Mode:                                           #
  537. # 0 - No Item                                                #
  538. #============================================================#
  539.  
  540. branch_handshake_stage_0:
  541.  
  542. li r30, 0x14
  543. stb r30, 0x193(r12)
  544.  
  545. b branch_finished
  546.  
  547. #============================================================#
  548. #                         Purpose                            #
  549. #------------------------------------------------------------#
  550. # This code will not detect if the Local Player is using the #
  551. # Shared Item code.                                          #
  552. #                                                            #
  553. # To prevent false positives from occuring (Caused by the    #
  554. # Item Value switching before the Activation Mode), store    #
  555. # garbage to the Item Spy.                                   #
  556. #                                                            #
  557. # Handshake Value:                                           #
  558. # 1 - Item Local Player wants                                #
  559. #============================================================#
  560.  
  561. branch_handshake_stage_1:
  562.  
  563. li r30, 0x57
  564. stb r30, 0x193(r12)
  565.  
  566. b branch_finished
  567.  
  568. #============================================================#
  569. #                         Purpose                            #
  570. #------------------------------------------------------------#
  571. # Store the Local Player's Held Item to Item Spy.            #
  572. #                                                            #
  573. # Activation Modes >= 2 mean the Item the Local Player will  #
  574. # receive is confirmed.                                      #
  575. #                                                            #
  576. # Activation Mode:                                           #
  577. # 2 - Item Local Player will receive                         #
  578. # 3 - ?                                                      #
  579. # 4 - Ready to fire Triple Items                             #
  580. # 5 - ?                                                      #
  581. # 6 - Ready to fire Item                                     #
  582. # 7 - No Item Available                                      #
  583. #============================================================#
  584.  
  585. branch_handshake_stage_2_or_greater:
  586.  
  587. stb r0, 0x193(r12) # Store the Local Player's Held Item to the Item Spy
  588.  
  589. branch_finished:
  590.  
  591. # Function Epilogue...
  592. lmw r30, 8(r1)
  593. addi r1, r1, 16
  594.  
  595. #============================================================#
  596. #                   Players ITEM Record                      #
  597. #============================================================#
  598. # Original Address Ports:                                    #
  599. # RMCE - 0x8065EE30                                          #
  600. # RMCP - 0x8065E1A8                                          #
  601. # RMCJ - 0x8065D814                                          #
  602. # RMCK - 0x8064C4C0                                          #
  603. #============================================================#
  604.  
  605. .set region, ''
  606.  
  607. .if     (region == 'E' || region == 'e') # RMCE
  608.         .set millisecondsDisplayAddress, 0x805310A0
  609. .elseif (region == 'P' || region == 'p') # RMCP
  610.         .set millisecondsDisplayAddress, 0x80535BE8
  611. .elseif (region == 'J' || region == 'j') # RMCJ
  612.         .set millisecondsDisplayAddress, 0x80535568
  613. .elseif (region == 'K' || region == 'k') # RMCK
  614.         .set millisecondsDisplayAddress, 0x80523C40
  615. .else # Invalid Region
  616.         .abort
  617. .endif
  618.  
  619. # Original instruction
  620. lbz r0, 17(r16) # Load the Player's Held Item into r0
  621.  
  622. # Function Prologue...
  623. stwu r1, -80(r1)
  624. stmw r14, 8(r1)
  625.  
  626. lbz r31, 19(r16) # Load the Player's Activation Mode into r31
  627.  
  628. # Calculate a unique address using the Player's Slot
  629. slwi r12, r22, 2
  630. subis r12, r12, 32408
  631.  
  632. #============================================================#
  633. #                         Purpose                            #
  634. #------------------------------------------------------------#
  635. # Find the Activation Mode of the Player.                    #
  636. #============================================================#
  637.  
  638. cmpwi r31, 0
  639. beq+ branch_handshake_stage_0
  640. cmpwi r31, 1
  641. beq- branch_handshake_stage_1
  642. b branch_handshake_stage_2_or_greater
  643.  
  644. #============================================================#
  645. #                         Purpose                            #
  646. #------------------------------------------------------------#
  647. # Store the Player's Held Item to Item Spy.                  #
  648. #                                                            #
  649. # To prevent false positives from occuring (Caused by the    #
  650. # Item Value switching before the Activation Mode), store    #
  651. # the No Item value to the Item Spy.                         #
  652. #                                                            #
  653. # Activation Mode:                                           #
  654. # 0 - No Item                                                #
  655. #============================================================#
  656.  
  657. branch_handshake_stage_0:
  658.  
  659. li r30, 0x14
  660. stb r30, 0x193(r12)
  661.  
  662. b branch_finished
  663.  
  664. #============================================================#
  665. #                         Purpose                            #
  666. #------------------------------------------------------------#
  667. # Detect Players trying to obtain impossible Shared Items    #
  668. # using a variety of methods.                                #
  669. #                                                            #
  670. # To prevent false positives from occuring (Caused by the    #
  671. # Item Value switching before the Activation Mode), store    #
  672. # garbage to the Item Spy.                                   #
  673. #                                                            #
  674. # Handshake Value:                                           #
  675. # 1 - Item Player wants                                      #
  676. #============================================================#
  677.  
  678. branch_handshake_stage_1:
  679.  
  680. li r30, 0x57
  681. stb r30, 0x193(r12)
  682.  
  683. lis r29, millisecondsDisplayAddress@ha
  684. lis r28, 0x38A0 # Milliseconds Display Value
  685. lbz r27, 18(r16) # Load the Player's Trailed Item into r27
  686.  
  687. #============================================================#
  688. #                         Purpose                            #
  689. #------------------------------------------------------------#
  690. # Check the if the current Player has impossible             #
  691. # Items trailing them, according to their current Item.      #
  692. #                                                            #
  693. # It is impossible for a Player to obtain another set of     #
  694. # Triple Items if they are currently trailing a set.         #
  695. #============================================================#
  696.  
  697. cmpwi r27, 0x10 # Compare the Player's Trailed Item to 0x10 (Triple Green Shells)
  698. beq- branch_impossible_trailed_items_check
  699. cmpwi r27, 0x11 # Compare the Player's Trailed Item to 0x11 (Triple Red Shells)
  700. beq- branch_impossible_trailed_items_check
  701. cmpwi r27, 0x12 # Compare the Player's Trailed Item to 0x12 (Triple Bananas)
  702. beq- branch_impossible_trailed_items_check
  703.  
  704. b branch_skip_impossible_trailed_items_check
  705.  
  706. branch_impossible_trailed_items_check:
  707.  
  708. cmpwi r0, 0x10 # Compare the Player's Held Item to 0x10 (Triple Green Shells)
  709. beq- branch_impossible_triple_item_combination_detected
  710. cmpwi r0, 0x11 # Compare the Player's Held Item to 0x11 (Triple Red Shells)
  711. beq- branch_impossible_triple_item_combination_detected
  712. cmpwi r0, 0x12 # Compare the Player's Held Item) to 0x12 (Triple Bananas)
  713. beq- branch_impossible_triple_item_combination_detected
  714.  
  715. #============================================================#
  716. #                         Purpose                            #
  717. #------------------------------------------------------------#
  718. # Store the amount of each Item currently in play,           #
  719. # not including the Player's pending Item.                   #
  720. #============================================================#
  721.  
  722. branch_skip_impossible_trailed_items_check:
  723.  
  724. li r26, 12
  725. mtctr r26
  726.  
  727. # Address to all Player's Items
  728. lis r25, 0x8168
  729. ori r25, r25, 0x0193
  730.  
  731. # Address to the Number of Items in Play
  732. lis r24, 0x8168
  733. ori r24, r24, 0x0133
  734.  
  735. branch_item_amount_loop:
  736.  
  737. lbz r23, 0(r25) # Load the nth Player's Item into r23
  738.  
  739. cmpwi r23, 0x6 # Compare the Player's Item to 0x6 (Bob-omb)
  740. bne+ branch_item_not_bob_omb
  741. lbz r22, 0(r24) # Load the Number of Bob-ombs in play into r22
  742. addi r22, r22, 1 # Add 1 to the number of Bob-ombs in play
  743. stb r22, 0(r24) # Store the updated Number of Bob-ombs in play
  744. b branch_item_found # Branch to check the next player since we found the item this player is holding
  745.  
  746. branch_item_not_bob_omb:
  747.  
  748. cmpwi r23, 0x7
  749. bne+ branch_item_not_blue_shell
  750. lbz r22, 4(r24)
  751. addi r22, r22, 1
  752. stb r22, 4(r24)
  753. b branch_item_found
  754.  
  755. branch_item_not_blue_shell:
  756.  
  757. cmpwi r23, 0x8
  758. bne+ branch_item_not_lightning
  759. lbz r22, 8(r24)
  760. addi r22, r22, 1
  761. stb r22, 8(r24)
  762. b branch_item_found
  763.  
  764. branch_item_not_lightning:
  765.  
  766. cmpwi r23, 0x9
  767. bne+ branch_item_not_star
  768. lbz r22, 12(r24)
  769. addi r22, r22, 1
  770. stb r22, 12(r24)
  771. b branch_item_found
  772.  
  773. branch_item_not_star:
  774.  
  775. cmpwi r23, 0xA
  776. bne+ branch_item_not_golden_mushroom
  777. lbz r22, 16(r24)
  778. addi r22, r22, 1
  779. stb r22, 16(r24)
  780. b branch_item_found
  781.  
  782. branch_item_not_golden_mushroom:
  783.  
  784. cmpwi r23, 0xB
  785. bne+ branch_item_not_mega_mushroom
  786. lbz r22, 20(r24)
  787. addi r22, r22, 1
  788. stb r22, 20(r24)
  789. b branch_item_found
  790.  
  791. branch_item_not_mega_mushroom:
  792.  
  793. cmpwi r23, 0xC
  794. bne+ branch_item_not_blooper
  795. lbz r22, 24(r24)
  796. addi r22, r22, 1
  797. stb r22, 24(r24)
  798. b branch_item_found
  799.  
  800. branch_item_not_blooper:
  801.  
  802. cmpwi r23, 0xD
  803. bne+ branch_item_not_pow_block
  804. lbz r22, 28(r24)
  805. addi r22, r22, 1
  806. stb r22, 28(r24)
  807. b branch_item_found
  808.  
  809. branch_item_not_pow_block:
  810.  
  811. cmpwi r23, 0xE
  812. bne+ branch_item_not_thunder_cloud
  813. lbz r22, 32(r24)
  814. addi r22, r22, 1
  815. stb r22, 32(r24)
  816. b branch_item_found
  817.  
  818. branch_item_not_thunder_cloud:
  819.  
  820. cmpwi r23, 0xF
  821. bne+ branch_item_not_bullet_bill
  822. lbz r22, 36(r24)
  823. addi r22, r22, 1
  824. stb r22, 36(r24)
  825.  
  826. branch_item_not_bullet_bill:
  827.  
  828. branch_item_found:
  829.  
  830. addi r25, r25, 4 # Get the next Player's Item
  831. bdnz+ branch_item_amount_loop # Check the next Item
  832.  
  833. #============================================================#
  834. #                         Purpose                            #
  835. #------------------------------------------------------------#
  836. # Now that we have the amount of each Item in play,          #
  837. # we can compare them to their hardcoded limits.             #
  838. #                                                            #
  839. # If the amount in play is equal (or greater) to the max,    #
  840. # the current Player must be trying to cheat one. This is    #
  841. # because they are trying obtain one when the game would     #
  842. # not normally allow it due to hardcoded limits.             #
  843. #                                                            #
  844. # This is possible because during Activation Mode 1, the     #
  845. # Player will report the Item they would like to receive as  #
  846. # their Held Item.                                           #
  847. #============================================================#
  848.  
  849. cmpwi r0, 0x6 # Compare the Player's Held Item to 0x6 (Bob-omb)
  850. bne+ branch_not_checking_bob_omb_limit
  851. lbz r22, 0(r24) # Load the Number of Bob-ombs in play into r22
  852. cmpwi r22, 3 # Compare the Number of Bob-ombs in play to 0x3 (Maximum Number of Bob-ombs that can be in play at once)
  853. bge- branch_impossible_shared_item_detected
  854. b branch_impossible_shared_item_not_detected
  855.  
  856. branch_not_checking_bob_omb_limit:
  857.  
  858. cmpwi r0, 0x7
  859. bne+ branch_not_checking_blue_shell_limit
  860. lbz r22, 4(r24)
  861. cmpwi r22, 1
  862. bge- branch_impossible_shared_item_detected
  863. b branch_impossible_shared_item_not_detected
  864.  
  865. branch_not_checking_blue_shell_limit:
  866.  
  867. cmpwi r0, 0x8
  868. bne+ branch_not_checking_lightning_limit
  869. lbz r22, 8(r24)
  870. cmpwi r22, 1
  871. bge- branch_impossible_shared_item_detected
  872. b branch_impossible_shared_item_not_detected
  873.  
  874. branch_not_checking_lightning_limit:
  875.  
  876. cmpwi r0, 0x9
  877. bne+ branch_not_checking_star_limit
  878. lbz r22, 12(r24)
  879. cmpwi r22, 3
  880. bge- branch_impossible_shared_item_detected
  881. b branch_impossible_shared_item_not_detected
  882.  
  883. branch_not_checking_star_limit:
  884.  
  885. cmpwi r0, 0xA
  886. bne+ branch_not_checking_golden_mushroom_limit
  887. lbz r22, 16(r24)
  888. cmpwi r22, 2
  889. bge- branch_impossible_shared_item_detected
  890. b branch_impossible_shared_item_not_detected
  891.  
  892. branch_not_checking_golden_mushroom_limit:
  893.  
  894. cmpwi r0, 0xB
  895. bne+ branch_not_checking_mega_mushroom_limit
  896. lbz r22, 20(r24)
  897. cmpwi r22, 2
  898. bge- branch_impossible_shared_item_detected
  899. b branch_impossible_shared_item_not_detected
  900.  
  901. branch_not_checking_mega_mushroom_limit:
  902.  
  903. cmpwi r0, 0xC
  904. bne+ branch_not_checking_blooper_limit
  905. lbz r22, 24(r24)
  906. cmpwi r22, 1
  907. bge- branch_impossible_shared_item_detected
  908. b branch_impossible_shared_item_not_detected
  909.  
  910. branch_not_checking_blooper_limit:
  911.  
  912. cmpwi r0, 0xD
  913. bne+ branch_not_checking_pow_block_limit
  914. lbz r22, 28(r24)
  915. cmpwi r22, 1
  916. bge- branch_impossible_shared_item_detected
  917. b branch_impossible_shared_item_not_detected
  918.  
  919. branch_not_checking_pow_block_limit:
  920.  
  921. cmpwi r0, 0xE
  922. bne+ branch_not_checking_thunder_cloud_limit
  923. lbz r22, 32(r24)
  924. cmpwi r22, 1
  925. bge- branch_impossible_shared_item_detected
  926. b branch_impossible_shared_item_not_detected
  927.  
  928. branch_not_checking_thunder_cloud_limit:
  929.  
  930. cmpwi r0, 0xF
  931. bne+ branch_not_checking_bullet_bill_limit
  932. lbz r22, 36(r24)
  933. cmpwi r22, 1
  934. bge- branch_impossible_shared_item_detected
  935.  
  936. branch_not_checking_bullet_bill_limit:
  937.  
  938. b branch_impossible_shared_item_not_detected
  939.  
  940. #============================================================#
  941. #                         Purpose                            #
  942. #------------------------------------------------------------#
  943. # Store the Player's Held Item to Item Spy.                  #
  944. #                                                            #
  945. # Activation Modes >= 2 mean the Item the Player will        #
  946. # receive is confirmed.                                      #
  947. #                                                            #
  948. # Activation Mode:                                           #
  949. # 2 - Item Player will receive                               #
  950. # 3 - ?                                                      #
  951. # 4 - Ready to fire Triple Items                             #
  952. # 5 - ?                                                      #
  953. # 6 - Ready to fire Item                                     #
  954. # 7 - No Item Available                                      #
  955. #============================================================#
  956.  
  957. branch_handshake_stage_2_or_greater:
  958.  
  959. stb r0, 0x193(r12) # Store the Player's Held Item to the Item Spy
  960.  
  961. b branch_finished
  962.  
  963. #============================================================#
  964. #                         Purpose                            #
  965. #------------------------------------------------------------#
  966. # The first digit of the milliseconds will denote the        #
  967. # detection reason. The last two digits will denote the      #
  968. # Player's Slot (01-12).                                     #
  969. #                                                            #
  970. # Possible Detection Reasons:                                #
  971. # 1SS - Impossible Shared Item Detected                      #
  972. # 3SS - Impossible Triple Item Combination Detected          #
  973. #============================================================#
  974.  
  975. branch_impossible_shared_item_detected:
  976.  
  977. ori r28, r28, 100
  978.  
  979. b branch_modify_timer
  980.  
  981. branch_impossible_triple_item_combination_detected:
  982.  
  983. ori r28, r28, 300
  984.  
  985. branch_modify_timer:
  986.  
  987. add r28, r28, r22 # Add the Player's Slot to the value in Milliseconds Display Value
  988. addi r28, r28, 1 # Have the milliseconds display 1-12 rather than 0-11 for the Player's Slot
  989. stw r28, millisecondsDisplayAddress@l(r29)
  990.  
  991. #============================================================#
  992. #                         Purpose                            #
  993. #------------------------------------------------------------#
  994. # Clear the amount of Items in play.                         #
  995. #============================================================#
  996.  
  997. branch_impossible_shared_item_not_detected:
  998.  
  999. li r21, 0
  1000.  
  1001. li r26, 10
  1002. mtctr r26
  1003.  
  1004. branch_clear_item_amount_loop:
  1005.  
  1006. stb r21, 0(r24)
  1007. addi r24, r24, 4
  1008.  
  1009. bdnz+ branch_clear_item_amount_loop
  1010.  
  1011. branch_finished:
  1012.  
  1013. # Function Epilogue...
  1014. lmw r14, 8(r1)
  1015. addi r1, r1, 80
  1016.  
  1017. Notes:
  1018. - If a detection occurs, the milliseconds will return to normal when the next race begins.
  1019. - This code relies on a specific value in the ITEM Packet. Due to the nature of how network traffic is sent, it is recommended to have all P2P connections set up (NATNEG complete).
  1020.  
  1021. Code Creator: Star
  1022. Code Credits: Bully@WiiPlaza (USB Gecko Spy Items, Millisecond Display Modifier)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement