Change combo after track vote
#1
Hey guys,

I've been trying for a few weeks to get this code going but I'm really struggling at the moment.
The goal would be to automatically load the character selection menu or (maybe simpler) to find a way for people to select their combo (funky+bb, funky+spear, daisy+mach and toadette+magik) via a button press after vote or something after the track has been picked.
Vega has created a very useful and powerful code that automatically chooses the optimal vehicle based on the track picked.  Sadly  some people would rather play the bowser bike than the spear on MC for example so the code isn't nearly as useful as I hoped it would be.
I've looked into how panels are setup and all that stuff and I've tried understanding MrBean's code but I cannot say I got far. As far as I know it seems like a very complex code to do since the vote selection panel instantly transitions to the track loading.


Do you have any suggestions/ideas on how to make this a thing?
Reply
#2
Well, firstly Bean has made a code to do this exact thing before the track vote (when it shows all the players in the lobby). I am very new to this as well but I'd say to try to re-code what bean has done so you can select on that screen.
~MarioKartWii.com #1~
Reply
#3
If you really want a customizeable version, I can make one. Something like the user fills in which combo they want for each track.
Reply
#4
(11-29-2020, 03:05 AM)Vega Wrote: If you really want a customizeable version, I can make one. Something like the user fills in which combo they want for each track.

Hmm your message got my thinking that I could maybe check the button pressed at the address of your code; since there are 4 combos viable, I could assign each one to a d-pad input.

So instead of automatically assigning the combo, it would check which dpad is pressed (wouldn't change the combo or would default to funky flame if no press).
That seems like a possible solution, I'll look some more into it, thanks to you both.

EDIT: problem would be that lottery needs to be finished before the player can know which dpad input to press; so the perfect combo selection address would need to be called even after the lottery animation is done; well just have to test that I guess

EDIT 2: Came up with this:

C2661890 00000014
2C1F0002 40A20090
88B8003C 28050020
40800084 3C60809C
8063D70C A0A30032
88631917 2C030007
41820028 2C050008
41A20044 2C050001
41820044 2C050002
41820044 2C050004
41820044 48000048
2C050001 41A20020
2C050002 41820020
28058000 41820020
28054000 41820020
48000024 38A01617
48000018 38A00F16
48000010 38A01620
48000008 38A00D1E
B0B8001C 807D20D8
807DD918 00000000

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Vega's address = 80661890 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Lottery Byte (r31) Check #
# 1 = Waiting #
# 2 = Occuring #
#~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpwi r31, 0x2 #Address gets called a lot, we only want to do checks when lottery is occurring
bne+ default_instruction

#~~~~~~~~~~~~~~~~~~~~~#
# Load Selected Track #
#~~~~~~~~~~~~~~~~~~~~~#

lbz r5, 0x003C (r24)

#~~~~~~~~~~~~~~~~~~~~~~~#
# Check If Battle Track #
#~~~~~~~~~~~~~~~~~~~~~~~#

cmplwi r5, 0x20 #Battle Track Values range from 0x20 thru 0x29
bge- default_instruction #If 0xFF, sequence has not begun; if 20 or more, skip

#~~~~~~~~~~~~~~~~~~~~~~~#
# Load INPUTDATA #
#~~~~~~~~~~~~~~~~~~~~~~~#
lis r3, 0x809C
lwz r3, 0xffffd70c(r3)
lhz r5, 0x32(r3) #Get the button currently pressed
lbz r3, 0x1917 (r3) #Get the current controller

cmpwi r3, 0x7
beq- classic

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# D-Pad buttons attribution #
# Order: up left right down #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
cmpwi r5, 0x8
beq+ flame
cmpwi r5, 0x1
beq- mach
cmpwi r5, 0x2
beq- spear
cmpwi r5, 0x4
beq- magik
b default_instruction #If none of the dpad buttons are pressed, skip

classic:
cmpwi r5, 0x1
beq+ flame
cmpwi r5, 0x2
beq- mach
cmplwi r5, 0x8000
beq- spear
cmplwi r5, 0x4000
beq- magik
b default_instruction #If none of the dpad buttons are pressed, skip

#~~~~~~~~~~~~~~~#
# Combos labels #
#~~~~~~~~~~~~~~~#
flame:
li r5, 0x1617
b end

mach:
li r5, 0x0f16
b end

spear:
li r5, 0x1620
b end

magik:
li r5, 0x0d1e

#~~~~~#
# end #
#~~~~~#
end:
sth r5, 0x001C (r24) #Store the character/vehicle halfword value to spot in memory

#~~~~~~~~~~~~~~~~~~~~~#
# default instruction #
#~~~~~~~~~~~~~~~~~~~~~#
default_instruction:
lwz r3, 0x20D8 (r29)


Just tested it and it works just fine. This is obviously heavily based on Vega's code (full credit to him) and on Seeky's work on inputdata.h (not my 1st code that uses it, very useful findinds). Might want to add a "default" button for rooms, to come back to the combo selected at the start of the GP, most notably for karters, since this current solution only allows 4combos for now. Not sure how I would cleanly store said combo.
Reply
#5
Thumbs Up 
Code works fine but other racers do not always see the right combo; say I change from flame runner to mach bike by pressing dpad left, some people might still see the flame runner when race starts. Seems like it allows people to change their combo (using the dpad) "too late" and some other players do not receive the updated SELECT packet with the right combo but I'm just grasping at straws there since I have no idea how the game's netcode works. 

Might be that the only correct solution would be to load the full character selection menu after track has been selected though this "cheap" solution almost worked.

At least it gave me a funny gif with a baby booster going at the speed of spear which made the whole thing worth it.
Reply
#6
IIRC, that address gets executed quite a bit in between races. So that would make sense if the button was pressed too late and the SELECT packet wasn't updated for everyone in the room.
Reply
#7
Best solution would probably be to make the lottery animation instanteneous (since it currently depends on the amount of players roughly), to count the number of select packets sent (by just counting how many times 0x80661288 is called I guess) between the time the tracks gets selected and the last time a packet is sent. 
No idea how the animation is handled, so in the meantime I'll only let players change their combos for a set amount of time after track gets selected (though it"ll be very short in 12p rooms).
Currently looks like this
Reply
#8
What if this code was used with High Data Rate? Maybe that would fix the Select Packet Problem
Reply
#9
(11-29-2020, 03:05 AM)Vega Wrote: If you really want a customizeable version, I can make one. Something like the user fills in which combo they want for each track.

I would very much like that
Reply
#10
(11-29-2020, 10:02 AM)Melg Wrote:
(11-29-2020, 03:05 AM)Vega Wrote: If you really want a customizeable version, I can make one. Something like the user fills in which combo they want for each track.

Hmm your message got my thinking that I could maybe check the button pressed at the address of your code; since there are 4 combos viable, I could assign each one to a d-pad input.

So instead of automatically assigning the combo, it would check which dpad is pressed (wouldn't change the combo or would default to funky flame if no press).
That seems like a possible solution, I'll look some more into it, thanks to you both.

EDIT: problem would be that lottery needs to be finished before the player can know which dpad input to press; so the perfect combo selection address would need to be called even after the lottery animation is done; well just have to test that I guess

EDIT 2: Came up with this:

C2661890 00000014
2C1F0002 40A20090
88B8003C 28050020
40800084 3C60809C
8063D70C A0A30032
88631917 2C030007
41820028 2C050008
41A20044 2C050001
41820044 2C050002
41820044 2C050004
41820044 48000048
2C050001 41A20020
2C050002 41820020
28058000 41820020
28054000 41820020
48000024 38A01617
48000018 38A00F16
48000010 38A01620
48000008 38A00D1E
B0B8001C 807D20D8
807DD918 00000000

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Vega's address = 80661890  #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Lottery Byte (r31) Check #
#      1 = Waiting        #
#      2 = Occuring      #
#~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpwi r31, 0x2 #Address gets called a lot, we only want to do checks when lottery is occurring
bne+ default_instruction

#~~~~~~~~~~~~~~~~~~~~~#
# Load Selected Track #
#~~~~~~~~~~~~~~~~~~~~~#

lbz r5, 0x003C (r24)

#~~~~~~~~~~~~~~~~~~~~~~~#
# Check If Battle Track #
#~~~~~~~~~~~~~~~~~~~~~~~#

cmplwi r5, 0x20 #Battle Track Values range from 0x20 thru 0x29
bge- default_instruction #If 0xFF, sequence has not begun; if 20 or more, skip

#~~~~~~~~~~~~~~~~~~~~~~~#
# Load INPUTDATA        #
#~~~~~~~~~~~~~~~~~~~~~~~#
lis r3, 0x809C
lwz r3, 0xffffd70c(r3)
lhz r5, 0x32(r3) #Get the button currently pressed
lbz r3, 0x1917 (r3) #Get the current controller

cmpwi r3, 0x7
beq- classic

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# D-Pad buttons attribution #
# Order: up left right down #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
cmpwi r5, 0x8
beq+ flame
cmpwi r5, 0x1
beq- mach
cmpwi r5, 0x2
beq- spear
cmpwi r5, 0x4
beq- magik
b default_instruction #If none of the dpad buttons are pressed, skip

classic:
cmpwi r5, 0x1
beq+ flame
cmpwi r5, 0x2
beq- mach
cmplwi r5, 0x8000
beq- spear
cmplwi r5, 0x4000
beq- magik
b default_instruction #If none of the dpad buttons are pressed, skip

#~~~~~~~~~~~~~~~#
# Combos labels #
#~~~~~~~~~~~~~~~#
flame:
li r5, 0x1617
b end

mach:
li r5, 0x0f16
b end

spear:
li r5, 0x1620
b end

magik:
li r5, 0x0d1e

#~~~~~#
# end #
#~~~~~#
end:
sth r5, 0x001C (r24) #Store the character/vehicle halfword value to spot in memory

#~~~~~~~~~~~~~~~~~~~~~#
# default instruction #
#~~~~~~~~~~~~~~~~~~~~~#
default_instruction:
lwz r3, 0x20D8 (r29)


Just tested it and it works just fine. This is obviously heavily based on Vega's code (full credit to him) and on Seeky's work on inputdata.h (not my 1st code that uses it, very useful findinds). Might want to add a "default" button for rooms, to come back to the combo selected at the start of the GP, most notably for karters, since this current solution only allows 4combos for now. Not sure how I would cleanly store said combo.

The code literally doesn't work though...

Steps to reproduce: Enable this gecko code and the wiimmfi patcher gecko code. Join a wiimmfi room. Choose flame runner. Hold down on the d-pad when a track is selected. Observe that you still have flame runner instead of magikruiser.

Am I doing something wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)