Skip to content

Commit

Permalink
Send stadium transformation info
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCondron committed Sep 27, 2023
1 parent 210afdf commit 6037585
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Recording/Recording.s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
.set CMD_GAME_END, 0x39
.set CMD_FOD_INFO, 0x3E
.set CMD_DL_INFO, 0x3F
.set COMMAND_COUNT, 12 # number of possible commands
.set CMD_PS_INFO, 0x40
.set COMMAND_COUNT, 13 # number of possible commands

################################################################################
# Payload lengths
Expand All @@ -39,6 +40,7 @@
.set GAME_END_PAYLOAD_LENGTH, GAME_END_TXB_SIZE - 1 # byte count
.set FOD_INFO_PAYLOAD_LENGTH, 9 # byte count
.set DL_INFO_PAYLOAD_LENGTH, 5 # byte count
.set PS_INFO_PAYLOAD_LENGTH, 8 # byte count
.set SPLIT_MESSAGE_PAYLOAD_LENGTH, 516 # byte count

.set SPLIT_MESSAGE_INTERNAL_DATA_LEN, 512
Expand Down
5 changes: 5 additions & 0 deletions Recording/SendGameInfo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ backup
li r3, DL_INFO_PAYLOAD_LENGTH
sth r3, CommandSizesStart+0x21(REG_Buffer)

li r3, CMD_PS_INFO
stb r3, CommandSizesStart+0x23(REG_Buffer)
li r3, PS_INFO_PAYLOAD_LENGTH
sth r3, CommandSizesStart+0x24(REG_Buffer)

#------------- BEGIN GAME INFO COMMAND -------------
# game information message type
.set GameInfoCommandStart, (CommandSizesStart + CommandSizesLength)
Expand Down
55 changes: 55 additions & 0 deletions Recording/Stages/SendStadiumInfo.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
################################################################################
# Address: 801d4fd8
################################################################################
.include "Common/Common.s"
.include "Recording/Recording.s"

################################################################################
# Routine: SendStadiumInfo
# ------------------------------------------------------------------------------
# Sends Pokemon Stadium transformation IDs
################################################################################

.set REG_Buffer,11
.set REG_BufferOffset,12

b Start
STATIC_PREVIOUS_VALUE:
blrl
.long 0x00000005

Start:
bl STATIC_PREVIOUS_VALUE
mflr r3
lwz r4, 0(r3)
lwz r5,0xdc(r31)
cmpw r4, r5
beq Skip
stw r5, 0(r3)

#------------- INITIALIZE -------------
# here we want to initalize some variables we plan on using throughout
# get current offset in buffer
lwz r3, primaryDataBuffer(r13)
lwz REG_Buffer, RDB_TXB_ADDRESS(r3)
lwz REG_BufferOffset,bufferOffset(r13)
add REG_Buffer,REG_Buffer,REG_BufferOffset

# send stage info event code
li r3, CMD_PS_INFO
stb r3,0x0(REG_Buffer)

# send frame index
lwz r3,frameIndex(r13)
stw r3,0x1(REG_Buffer)

# send transform IDs (two 16 bit IDs)
stw r5,0x5(REG_Buffer)

#------------- Increment Buffer Offset ------------
lwz REG_BufferOffset,bufferOffset(r13)
addi REG_BufferOffset,REG_BufferOffset,PS_INFO_PAYLOAD_LENGTH+1
stw REG_BufferOffset,bufferOffset(r13)

Skip:
lmw r27, 0x84(r1) #execute replaced code line

0 comments on commit 6037585

Please sign in to comment.