Thunder Cloud Effect Modifier [Unnamed]
#1
Thunder Cloud Effect Modifier [Unnamed]

This code is the generalization of the “Mega Cloud” code from JoshuaMK. I have fixed the Item Loss bug and now you can choose the Item effect you want. If you choose Shock, POW or Blooper, then it will be like if you fired the Item when the TC zaps you.


NTSC-U
C2579DCC 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FFEE20 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
396000II 1D6B001C
3D80809B 618CEEB0
7D8C582E 7D8803A6
4E800021 80010008
7C0803A6 BB61000C
38210020 00000000

PAL
C2580630 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FF3618 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
396000II 1D6B001C
3D80809C 618C36B8
7D8C582E 7D8803A6
4E800021 80010008
7C0803A6 BB61000C
38210020 00000000

NTSC-J
C257FFB0 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FF2678 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
396000II 1D6B001C
3D80809C 618C2718
7D8C582E 7D8803A6
4E800021 80010008
7C0803A6 BB61000C
38210020 00000000

NTSC-K
C256E688 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809B
83FF1C58 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
396000II 1D6B001C
3D80809B 618C1CF8
7D8C582E 7D8803A6
4E800021 80010008
7C0803A6 BB61000C
38210020 00000000


Values
II: Item Values
04 = Mushroom
08 = Shock
09 = Star
0B = Mega
0C = Blooper
0D = Pow
0F = Bullet



Source:
##################################################

#### Hook Adresses #####
### 80579DCC  (NTSC-U)
### 80580630  (PAL)
### 8057FFB0  (NTSC-J)
### 8056E688  (NTSC-K)

### PlayerHolder ###
## 809BEE20 (NTSC-U)
## 809C3618 (PAL)
## 809C2678 (NTSC-J)
## 809B1C58 (NTSC-K)

### ItemFunctions ###
## 809BEEB0 (NTSC-U)
## 809C36B8 (PAL)
## 809C2718 (NTSC-J)
## 809B1CF8 (NTSC-K)

#################################################

stwu r1, -0x20(r1)
stmw r27, 0xC(r1)
srwi r27, r0, 2
mflr r0
stw r0, 8(r1)
lis r31, PlayerHolder_upper
lwz r31, PlayerHolder_lower
lbz r30, 0x10(r31)
cmpw r27, r30
bge skip
mulli r0, r27, 0x248
lwz r12, 0x14(r31)
add r3, r12, r0
lwz r11, 0x90(r3)
addi r11, r11, 1
stw r11, 0x90(r3) # Add 1 to the Item count, to avoid Item loss
li r11, 0xII      # Our Item
mulli r11, r11, 0x1C
lis r12, ItemFunctions_upper
ori r12, r12, ItemFunctions_lower
lwzx r12, r12, r11
mtlr r12
blrl
skip:
lwz r0, 8(r1)
mtlr r0
lmw r27, 0xC(r1)
addi r1, r1, 0x20

##############################################

Code Creator: Unnamed
Code Credits: JoshuaMK (found Hook adress)
Reply
#2
I have an idea:
It's possible a randomized tc, where every time the tc give a different effect?
Reply
#3
Not impossible. Basically a C0 code that sets a random value (would have to obviously be an acceptable value) in EV. Then make the original code load the value from EV.
~MarioKartWii.com #1~
Reply
#4
Here's the randomizer code (C0 source, this will work for all regions)

It works by cycling a number from 0 thru 6 per every frame of the game (good enough for randomization for what we need).

Based on that random number, it uses that as an offset to load from an item table. This table holds all the applicable items. The appropriate item value gets loaded and then stored to the EVA

We solely cannot use the random cycled number to be the item value itself because some item values are skipped.

Code:
#Directives
.set mushroom, 4
.set shock, 8
.set star, 9
.set mega, 0xB
.set blooper, 0xC
.set pow, 0xD
.set bullet, 0xF
.set random_int_amt, 6

#Save C0 LR
mflr r12

#Set EVA Upper
lis r11, 0x8000

#Make LUT
bl item_value_table
.byte mushroom
.byte shock
.byte star
.byte mega
.byte blooper
.byte pow
.byte bullet
.align 2
item_value_table:
mflr r10

#Grab, increment, and check randomized int
lbz r9, 0x1500 (r11)
addi r9, r9, 1
cmplwi r9, random_int_amt
ble+ store_random_int

#Reset random int
li r9, 0

#Store random int
store_random_int:
stb r9, 0x1500 (r11)

#Based on int set item in EVA
lbzx r3, r9, r10
stb r3, 0x1501 (r11)

#Restore C0 LR
mtlr r12

#End
#blr #uncomment for Assemblers that can't do C0 codes correctly


You will also need to slightly modify Unnamed's code (its source) to load the item value that resides in the EVA

This part here..

Code:
li r11, 0xII      # Our Item

Needs to be...

Code:
lis r11, 0x8000
lbz r11, 0x1501 (r11)      # Our Item

.. then reassemble the code.

All of this is untested
Reply
#5
Can someone post the assembled code of atleast the PAL version of randomizer please?
Reply
#6
As a complete noob I've tried to convert Vega's randomizer code using asm>wiird but I can't seem to make it work.

So this is the converted randomizer code and I'm assuming this part is correct.

C2000000 00000008
7D8802A6 3D608000
4800000D 0408090B
0C0D0F00 7D4802A6
892B1500 39290001
28090006 40A10008
39200000 992B1500
7C6950AE 986B1501
7D8803A6 00000000

But this:
(PAL)
C2580630 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FF3618 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
3D608000 896B1501
1D6B001C 3D80809C
618C36B8 7D8C582E
7D8803A6 4E800021
80010008 7C0803A6
BB61000C 38210020
00000000 00000000

I've probably got this side of things all wrong, combining the two codes together simply causes Dolphin to freeze as TC zaps the player, it just freezes not even an error message.
I have no idea what I'm doing but it was nice to experiment and try to learn something.
Reply
#7
(8 hours ago)JerryHatrick Wrote: As a complete noob I've tried to convert Vega's randomizer code using asm>wiird but I can't seem to make it work.

So this is the converted randomizer code and I'm assuming this part is correct.

C2000000 00000008
7D8802A6 3D608000
4800000D 0408090B
0C0D0F00 7D4802A6
892B1500 39290001
28090006 40A10008
39200000 992B1500
7C6950AE 986B1501
7D8803A6 00000000

But this:
(PAL)
C2580630 0000000E
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FF3618 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
3D608000 896B1501
1D6B001C 3D80809C
618C36B8 7D8C582E
7D8803A6 4E800021
80010008 7C0803A6
BB61000C 38210020
00000000 00000000

I've probably got this side of things all wrong, combining the two codes together simply causes Dolphin to freeze as TC zaps the player, it just freezes not even an error message.
I have no idea what I'm doing but it was nice to experiment and try to learn something.

Change C2000000 to C0000000 and add BLR at the end

C0000000 00000008
7D8802A6 3D608000
48000009 090B0F00
7D4802A6 892B1500
39290001 28090006
40A10008 39200000
992B1500 7C6950AE
986B1501 7D8803A6
4E800020 00000000

Untested
Reply
#8
(8 hours ago)_Ro Wrote: Change C2000000 to C0000000 and add BLR at the end

C0000000 00000008
7D8802A6 3D608000
48000009 090B0F00
7D4802A6 892B1500
39290001 28090006
40A10008 39200000
992B1500 7C6950AE
986B1501 7D8803A6
4E800020 00000000

Untested

Legend, thank you.
If I have these two codes as two separate codes:

C0000000 00000008
7D8802A6 3D608000
48000009 090B0F00
7D4802A6 892B1500
39290001 28090006
40A10008 39200000
992B1500 7C6950AE
986B1501 7D8803A6
4E800020 00000000

and

(PAL)
C2580630 0000000F
9421FFE0 BF61000C
541BF0BE 7C0802A6
90010008 3FE0809C
83FF3618 8BDF0010
7C1BF000 40800038
1C1B0248 819F0014
7C6C0214 81630090
396B0001 91630090
3D608000 896B1501
1D6B001C 3D80809C
618C36B8 7D8C582E
7D8803A6 4E800021
80010008 7C0803A6
BB61000C 38210020
60000000 00000000

It would seem there is something that stops this code from working fully.
The star and the mega mushroom works, something else causes Dolphin the crash. I will do some more testing later when I have more time to see if any other items work and narrow it down via process of elimination.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)