Coding Questions and other Quandaries
(11-06-2023, 12:36 PM)Hackwiz Wrote: SpongeBob's Truth or Square - Wii (USA) "Moon Jump"

Press A & B to activate. Press A to release.

I was searching for "jump" in the symbol code map and found this:

ApexCheck__16zPlayerJumpBoardFP15xAnimTransitionP11xAnimSingle:
8005ef20 ApexCheck__16zPlayerJumpBoardF lfs f1, 0x0010 (r3)
8005ef24 ApexCheck__16zPlayerJumpBoardF lfs f0, 0x0020 (r3)
8005ef28 ApexCheck__16zPlayerJumpBoardF fcmpo cr0,f1,f0
8005ef2c ApexCheck__16zPlayerJumpBoardF cror 2, 1, 2
8005ef30 ApexCheck__16zPlayerJumpBoardF mfcr r3
8005ef34 ApexCheck__16zPlayerJumpBoardF rlwinm r3, r3, 3, 31, 31 (20000000)
8005ef38 ApexCheck__16zPlayerJumpBoardF blr

Gee, I wonder what their doing here???

This function is returning a bool. True (1) is returned if f1 is greater than or equal to f0. Otherwise False (0) is returned. Check the Parent function (what this function returns to) and you should see a check/comparison of r3 against 0 or 1. Try tinkering with that check and see what you find.

fcmpo cr0, f1, f0 #This does the comparison of f1 vs f0. the result of this comparison is placed into cr0.
cror 2,1,2 #This does a logical OR of the cr0 gt flag with cr0 eq flag. The result of the logical OR is placed back into the cr0 eq bit slot.
mfcr r3 #This simply copies over the entire CR to r3
rlwinm r3, r3, 3, 31, 31 #This is an extract instruction. It extracts only the eq bit of cr0 (result of the cror instruction) and right justifies it to the far right in the r3 register. That way r3 and only equal 0 or 1.

Btw nice code!
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Vega - 11-07-2023, 02:35 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)