TAS Code [Vega]
#1
TAS Code [Vega]

This works for ALL controllers!

TAS Code (Tool Assisted Speed Run) is simply the Live Replay code with the ability to activate or deactivate at any time. A good code to have for Dolphin TASers. For more information about Live Replay, visit the Live Replay Code Thread - HERE.

This code has configured the activator and dectivator to be part of the Assembly Code. Thus, this allows the code to also work in Dolphin without any tweaking needed in Dolphin settings/config.

XXXX = Controller Address
ZZZZ = Button To Press to Activate Live Replay
zzzz = Button To Press to Deactivate Live Replay

Go to this thread HERE for a list of XXXX/ZZZZ values.

Important Note: This code makes use of memory address 0x8000164E. Make sure no other codes in your GCT File or Cheat Manager are using that memory address!

NTSC-U
C21AA91C 0000000A
3D808034 618CXXXX
A18C0000 3960ZZZZ
3880zzzz 7D805838
7C005800 41820014
7D802038 7C002000
41820014 4800001C
3D808000 39600001
4800000C 3D808000
39600000 996C164E
7C0802A6 00000000
C251C8BC 00000005
981E0014 3D808000
898C164E 2C0C0001
40A20014 7FCCF378
BB8C0004 BF8CFC9C
BF8CD81C 00000000

PAL
C21AA9BC 0000000A
3D808034 618CXXXX
A18C0000 3960ZZZZ
3880zzzz 7D805838
7C005800 41820014
7D802038 7C002000
41820014 4800001C
3D808000 39600001
4800000C 3D808000
39600000 996C164E
7C0802A6 00000000
C2520D30 00000005
981E0014 3D808000
898C164E 2C0C0001
40A20014 7FCCF378
BB8C0004 BF8CFC9C
BF8CD81C 00000000

NTSC-J
C21AA8DC 0000000A
3D808034 618CXXXX
A18C0000 3960ZZZZ
3880zzzz 7D805838
7C005800 41820014
7D802038 7C002000
41820014 4800001C
3D808000 39600001
4800000C 3D808000
39600000 996C164E
7C0802A6 00000000
C25206B0 00000005
981E0014 3D808000
898C164E 2C0C0001
40A20014 7FCCF378
BB8C0004 BF8CFC9C
BF8CD81C 00000000

NTSC-K
C21AAD18 0000000A
3D808033 618CXXXX
A18C0000 3960ZZZZ
3880zzzz 7D805838
7C005800 41820014
7D802038 7C002000
41820014 4800001C
3D808000 39600001
4800000C 3D808000
39600000 996C164E
7C0802A6 00000000
C250ED54 00000005
981E0014 3D808000
898C164E 2C0C0001
40A20014 7FCCF378
BB8C0004 BF8CFC9C
BF8CD81C 00000000




List of Sources:

SOURCE FOR FULL ASM ACTIVATOR/DEACTIVATOR CODE (NTSC-K):
####################
###START ASSEMBLY###
####################

#

##########################
##Set Controller Address##
##########################

lis r12, 0x8033 #Set 1st half address for Korean Controller
ori r12, r12, 0xXXXX #Set 2nd half address (XXXX) for specific Korean Controller

##############################################
##Load Current Halfword of Button(s) Pressed##
##############################################

lhz r12, 0x0 (r12) #Load Halfword from specific Korean Controller Address

########################
##Set User Act & Deact##
########################

li r11, 0xZZZZ #Load Activator value into r11
li r4, 0xzzzz #Load De-Activator value into r4

###########################
##Check if Act is Pressed##
###########################

and r0, r12, r11 #Logically AND the contents of buttons being pressed versus your activator. If activator is at least pressed, r0 will equal 11.
cmpw r0, r11
beq- set_act #If equal (activator pressed), jump to set_act label

#############################
##Check if Deact is Pressed##
#############################

and r0, r12, r4 #Logically AND the contents of buttons being pressed versus your deactivator. If second activator is at least pressed, r0 will equal r4.
cmpw r0, r4
beq- set_deact #If equal (other activator preseed), jump to set_deact label

###########################################
##Jump to End (Act nor Deact were Pressed##
###########################################

b the_end #If ZZZZ nor zzzz wasn't pressed, jump to the_end label

#################
##Set_Act Label##
#################

set_act:
lis r12, 0x8000 #Set first half address for code activation status number
li r11, 1 #Load code activation status number in r11
b store_byte #Jump to store_byte label

###################
##Set_Deact Label##
###################

set_deact:
lis r12, 0x8000 #Set first half address for code deactivation status number
li r11, 0 #Load code deactivation status number in r11

####################
##Store_Byte Label##
####################

store_byte:
stb r11, 0x15F0 (r12) #Store code deactivation status number to mem location 0x800015F0

#################
##The_End Label##
#################

the_end:
mflr r0 #Default ASM

#############################################
##Notes about Using r0 & r4 w/o Restoration##
#############################################

##r0 gets written to later on by a mflr 0, and r4 gets written to after a BL during a rlwinm function##
##Thus, they are safe to use w/o restoring original values##

#

##################
###END ASSEMBLY###
##################




SOURCE FOR TAS CODE:

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

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#           Register Safety NOTES           #
#         r27 thru r31 safe for use         #
#    Two steps ahead is a BL instruction    #
# After the BL, r27 thru r31 are written to #
#         So they are safe for use          #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                                                                INPUT FIELDS                                                            #
# 1st Input Field - Halfword - Ghost: 0x0004 (r30) You (GCN/WiiMote): -0x364/-0x27E4 (r30) #Halfword at 0x0006 (r30) is never written to #
#                    2nd Input Field - Float Single - Ghost: 0x0008 (r30) You (GCN/WiiMote): -0x360/-0x27E0 (r30)                        #
#                    3rd Input Field - Float Single - Ghost: 0x000C (r30) You (GCN/WiiMote): -0x35C/-0x27DC (r30)                        #
#                      4th Input Field - Byte - Ghost: 0x0010 (r30) You (GCN/WiiMote): -0x358/-0x27D8 (r30)                            #
#                      5th Input Field - Byte - Ghost: 0x0011 (r30) You (GCN/WiiMote): -0x357/-0x27D7 (r30)                            #
#                      6th Input Field - Byte - Ghost: 0x0012 (r30) You (GCN/WiiMote): -0x356/-0x27D6 (r30)                            #
#                      7th Input Field - Byte - Ghost: 0x0013 (r30) You (GCN/WiiMote): -0x355/-0x27D5 (r30)                            #
#                      8th Input Field - Byte - Ghost: 0x0014 (r30) You (GCN/WiiMote): -0x354/-0x27D4 (r30)                            #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~#
# Default Instruction #
#~~~~~~~~~~~~~~~~~~~~~#

stb r0, 0x0014 (r30) #Store the byte of r0 to address of r30 plus offset of 0x0014

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load Status Byte, & Check #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8000 #Load 0x8000 into upper 16 bits of r12, lower 16 bits are cleared
lbz r12, 0x164E (r12) #Load the byte from address 0x8000164E back into r12

cmpwi r12, 0x1 #Compare r12 to the value of 0x1
bne+ de_activate_tas #If r12 is NOT equal to one, we know the activator has not been pressed, jump to de_activate_tas label

#If equal to one, then code will continue proceeding as normal, Live Replay is executed#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Backup Register 30 due to upcoming LWM & STWM instructions #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r12, r30 #Copy value of r30 to r12

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load All Ghost Input Fields #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lmw r28, 0x4 (r12) #Load consecutive words starting at address of r12 offset 0x4 into r28 thru r31

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store All Ghost Input Fields To Your Own GCN Fields #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

stmw r28, -0x0364 (r12) #Store words of r28 thru r31 to address of r12 offset -0x364 (For GCN Input Field)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store All Ghost Input Fields To Your WiiMote Fields #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

stmw r28, -0x27E4 (r12) #Store words of r28 thru r31 to address of r12 offset -27E4 (For Wii Remote Field)

#~~~~~~~~~~~~~~~~~~~~~~~#
# de_activate_tas Label #
#~~~~~~~~~~~~~~~~~~~~~~~#

de_activate_tas: #Label name set to force navigation to end of code, no label contents needed

#

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




Code creator: Vega
Code credits: Megazig (OSSleepThread subroutine); Bully (original Wiimote Live Replay); Mdmwii (original GCN Live Replay)
Reply


Messages In This Thread
TAS Code [Vega] - by Vega - 01-22-2019, 10:28 PM
RE: TAS Code [Vega] - by KartPlayer - 10-02-2021, 07:04 PM
RE: TAS Code [Vega] - by Vega - 10-02-2021, 07:17 PM
RE: TAS Code [Vega] - by CommonAmmo - 03-31-2022, 10:31 PM
RE: TAS Code [Vega] - by Vega - 04-01-2022, 11:21 PM
RE: TAS Code [Vega] - by Hibyehello - 02-20-2023, 07:40 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)