Call POW Function Anytime [Vega]
#1
Call POW Function Anytime [Vega]

NOTE: Outdated by 1superchip's Use POW Anytime Code

May not work 100% on Wii Console. Works fine on Dolphin.

This code will allow you (at any time during the live race) to press your activator to initiate a POW. You can set what 'graphic mode' the POW Block will be during the time it is on the screen, and you can set the time it takes for the POW to spin you out if you decided to not dodge it.

Works online and offline, if used online, others will see you spinout as long as the S value is filled in correctly and you are in proper position to get spunout. If used in TT's, you will freeze.

S = Slot (tells the game which player slot threw the POW)
0 = Telling the game you threw the POW, slot numbers 1 thru B are for the CPUs.

M = Graphic Mode
1 = POW fully expanded
2 = POW slightly squished
3 = POW squished all the way

Any other values for M will make the POW graphic not appear at all.

The TTTT values is the time it takes for the POW to spin you out once the graphic appears.

Example TTTT values:
009F = Default
002F = Instant POW
FFFF, 0000 = No POW appears

XXXX is for the controller address and ZZZZ is your button activtor. When pressing the activator, do not press/hold any other buttons.

Final NOTE: This code makes use of memory addresses 0x81430000 thru 0x81430003. Make sure no other codes in your GCT/Cheat-Manager are using those addresses!

NTSC-U
027D9826 0000TTTT
C2790878 00000002
80633660 3D808143
906C0000 00000000
C0000000 0000000F
3D808034 618CXXXX
A18C0000 3960ZZZZ
7D606038 7C005800
40A2005C 3D808143
818C0000 2C0C0000
4182004C 9421FF80
7D6802A6 BC610008
7D836378 7C7D1B78
3880000S 3FE0807D
63EC9808 7D8803A6
4E800021 7FA3EB78
3880000M 63EC9940
7D8803A6 4E800021
B8610008 7D6803A6
38210080 4E800020

PAL
027B1DD2 0000TTTT
C2799884 00000002
80633660 3D808143
906C0000 00000000
C0000000 0000000F
3D808034 618CXXXX
A18C0000 3960ZZZZ
7D606038 7C005800
40A2005C 3D808143
818C0000 2C0C0000
4182004C 9421FF80
7D6802A6 BC610008
7D836378 7C7D1B78
3880000S 3FE0807B
63EC1DB4 7D8803A6
4E800021 7FA3EB78
3880000M 63EC1EEC
7D8803A6 4E800021
B8610008 7D6803A6
38210080 4E800020

NTSC-J
027B143E 0000TTTT
C2798EF0 00000002
80633660 3D808143
906C0000 00000000
C0000000 0000000F
3D808034 618CXXXX
A18C0000 3960ZZZZ
7D606038 7C005800
40A2005C 3D808143
818C0000 2C0C0000
4182004C 9421FF80
7D6802A6 BC610008
7D836378 7C7D1B78
3880000S 3FE0807B
63EC1420 7D8803A6
4E800021 7FA3EB78
3880000M 63EC1558
7D8803A6 4E800021
B8610008 7D6803A6
38210080 4E800020

NTSC-K
027A0192 0000TTTT
C2787C44 00000002
80633660 3D808143
906C0000 00000000
C0000000 0000000F
3D808033 618CXXXX
A18C0000 3960ZZZZ
7D606038 7C005800
40A2005C 3D808143
818C0000 2C0C0000
4182004C 9421FF80
7D6802A6 BC610008
7D836378 7C7D1B78
3880000S 3FE0807A
63EC0174 7D8803A6
4E800021 7FA3EB78
3880000M 63EC02AC
7D8803A6 4E800021
B8610008 7D6803A6
38210080 4E800020



Code creator: Vega
Code credits: NoHack2Win (POW Block Blocker)



List of Sources:

#16 bit RAM Write

#Address Ports
#NTSC-U = 0x807D9826
#PAL = 0x807B1DD2
#NTSC-J = 0x807B143E
#NTSC-K = 0x807A0192

Change '0x009F' to '0xTTTT' (part of li r0, 0x009F instruction)

==========

#1st C2 ASM

#Address Ports
#NTSC-U = 0x80790878
#PAL = 0x80799884
#NTSC-J = 0x80798EF0
#NTSC-K = 0x80787C44

.set region, '' #Set to e,p,j, or k

#Default Instruction, load the r3 arg pointer for the POW_Check function

.if (region == 'E' || region == 'e') # RMCE
    lwz r3, 0xFFFFF798 (r3)
.elseif (region == 'P' || region == 'p') # RMCP
    lwz r3, 0x3660 (r3)
.elseif (region == 'J' || region == 'j') # RMCJ
    lwz r3, 0x26C0 (r3)
.elseif (region == 'K' || region == 'k') # RMCK
    lwz r3, 0x1CA0 (r3)
.else # Invalid Region
    .err
.endif

lis r12, 0x8143
stw r3, 0 (12) #Store pointer to Mem 81

==========

#C0 ASM

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Compilation Region Setting #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

.set region, '' #set this to e,p,j, or k for compilation region

#~~~~~~~~#
# Macros #
#~~~~~~~~#

.macro set_pow_addr address
    lis r31, \address@h
.endm

.macro call_pow address
    ori r12, r31, \address@l
    mtlr r12
    blrl
.endm

.macro push_stack
    stwu sp, -0x0080 (sp)
    mflr r11 #r12 being used when this macro is called
    stmw r3, 0x8 (sp)
.endm

.macro pop_stack
    lmw r3, 0x8 (sp)
    mtlr r11
    addi sp, sp, 0x0080
.endm

#~~~~~~~~~~~~#
# Statements #
#~~~~~~~~~~~~#

#POW_Check is not used here, it's here just for personal preference
#You're suppose to call Check instead of GMode (Check auto calls GMode within), but we want the ability to spam the button activator w/o freezing

.if (region == 'E' || region == 'e') # RMCE
    .set POW_Init, 0x807D9808
    .set POW_GMode, 0x807D9940
    .set POW_Check, 0x807D9D4C
.elseif (region == 'P' || region == 'p') # RMCP
    .set POW_Init, 0x807B1DB4
    .set POW_GMode, 0x807B1EEC
    .set POW_Check, 0x807B22F8
.elseif (region == 'J' || region == 'j') # RMCJ
    .set POW_Init, 0x807B1420
    .set POW_GMode, 0x807B1558
    .set POW_Check, 0x807B1964
.elseif (region == 'K' || region == 'k') # RMCK
    .set POW_Init, 0x807A0174
    .set POW_GMode, 0x807A02AC
    .set POW_Check, 0x807A06B8
.else # Invalid Region
    .err
.endif

#~~~~~~~~~~~~#
# Start Code #
#~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Check Button Activator #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
    lis r12, 0x8034
.elseif (region == 'P' || region == 'p') # RMCP
    lis r12, 0x8034
.elseif (region == 'J' || region == 'j') # RMCJ
    lis r12, 0x8034
.elseif (region == 'K' || region == 'k') # RMCK
    lis r12, 0x8033
.else # Invalid Region
    .err
.endif

ori r12, r12, 0x3E80 #NTSC-U GCN Port 1 used just for compilation purposes, edit this to your liking
lhz r12, 0 (r12)
li r11, 0x0880 #GCN Y-Button used just for compilation purposes, edit this to your liking
and r0, r11, r12
cmpw r0, r11
bne+ the_end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load 'Status Word' From Mem 81 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8143
lwz r12, 0 (r12)
cmpwi r12, 0
beq- the_end #If null, the pointer wasn't set (not in race), don't execute code

push_stack #Backup LR and GPR's

#~~~~~~~~~~~~~~~~~~~~~~~#
# Load POW Info Pointer #
#~~~~~~~~~~~~~~~~~~~~~~~#

mr r3, r12 #Copy address to r3
mr r29, r3 #Backup r3 for later use of other function
li r4, 0 #Arg 2 for POW_Init; 0 for slot 0 used for compilation, adjust this to your needs

set_pow_addr POW_Init #Set 1st half address for both function calls, doesn't matter what label out of the 2 we use for this

#~~~~~~~~~~~~~~~~~~~#
# POW_Init FUNCTION #
#~~~~~~~~~~~~~~~~~~~#

#r3 = Pointer where POW info resides (requires 3 words of space, fyi)
#r4 = Which player SLOT threw the POW

call_pow POW_Init

#~~~~~~~~~~~~~~~~~~~~#
# POW_GMode FUNCTION #
#~~~~~~~~~~~~~~~~~~~~#

#r3 = Pointer where POW info resides
#r4 = Mode (1 fully expanded, 2 half squished, 3 fully squished)

mr r3, r29
li r4, 1 #1 here used for example M value just for source compilation purposes
call_pow POW_GMode

pop_stack #Restore LR and GPR's

the_end:
#blr #uncomment blr if compiling w/ WiiRDGUI

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#
Reply


Messages In This Thread
Call POW Function Anytime [Vega] - by Vega - 11-21-2019, 09:52 PM
RE: Call POW Function Anytime [Vega] - by Bob - 02-22-2021, 04:59 PM
RE: Call POW Function Anytime [Vega] - by Vega - 02-22-2021, 05:19 PM
RE: Call POW Function Anytime [Vega] - by Bob - 02-22-2021, 05:59 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)