-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
363 additions
and
18 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
################################################################################ | ||
# Address: 0x8038e910 # fileLoad_HPS, after entry num is fetched | ||
################################################################################ | ||
|
||
.include "Common/Common.s" | ||
|
||
.set REG_PMQ, 31 | ||
.set REG_ENTRYNUM, 30 | ||
.set REG_INTERRUPT_IDX, 29 | ||
|
||
# This will contain the DVDFileInfo struct which has length 0x40 | ||
.set SPO_STRUCT_START, BKP_FREE_SPACE_OFFSET | ||
.set SPO_FILE_OFFSET, SPO_STRUCT_START + 0x30 | ||
.set SPO_FILE_SIZE, SPO_FILE_OFFSET + 4 | ||
|
||
# This space will be used to transfer over EXI. EXI buffers must be 32 byte aligned though | ||
# so we don't know exactly where the buffer will start | ||
.set SPO_EXI_SPACE_START, SPO_STRUCT_START + 0x40 | ||
|
||
# PlayMusicQuery args | ||
.set PMQ_COMMAND, 0 | ||
.set PMQ_FILE_OFFSET, PMQ_COMMAND + 1 | ||
.set PMQ_FILE_SIZE, PMQ_FILE_OFFSET + 4 | ||
.set PMQ_SIZE, PMQ_FILE_SIZE + 4 # Confusing but this is the size of the buffer | ||
|
||
# Grab enough space that no matter where we are, we can byteAlign32 and still fit the PMQ data | ||
.set SPACE_NEEDED, SPO_EXI_SPACE_START + PMQ_SIZE + 32 | ||
|
||
backup SPACE_NEEDED | ||
|
||
mr REG_ENTRYNUM, r3 | ||
|
||
branchl r12, OSDisableInterrupts | ||
mr REG_INTERRUPT_IDX, r3 | ||
|
||
mr r3, REG_ENTRYNUM | ||
addi r4, sp, SPO_STRUCT_START | ||
branchl r12, 0x80337c60 # DVDFastOpen | ||
|
||
# TODO: File_GetLength asserts when result = 0, hopefully just ignoring it and doing nothing is fine | ||
cmpwi r3, 0 | ||
beq CLEANUP_AND_EXIT | ||
|
||
# Log | ||
# lwz r5, SPO_FILE_OFFSET(sp) | ||
# lwz r6, SPO_FILE_SIZE(sp) | ||
# logf LOG_LEVEL_WARN, "[Music] Starting song at 0x%x with size %d" | ||
|
||
addi REG_PMQ, sp, SPO_EXI_SPACE_START | ||
byteAlign32 REG_PMQ | ||
|
||
# Write command | ||
li r3, CONST_SlippiPlayMusic | ||
stb r3, PMQ_COMMAND(REG_PMQ) | ||
|
||
# Write file offset and size | ||
lwz r3, SPO_FILE_OFFSET(sp) | ||
stw r3, PMQ_FILE_OFFSET(REG_PMQ) | ||
lwz r3, SPO_FILE_SIZE(sp) | ||
stw r3, PMQ_FILE_SIZE(REG_PMQ) | ||
|
||
# Exec EXI transfer | ||
mr r3, REG_PMQ | ||
li r4, PMQ_SIZE | ||
li r5, CONST_ExiWrite | ||
branchl r12, FN_EXITransferBuffer | ||
|
||
CLEANUP_AND_EXIT: | ||
addi r3, sp, SPO_STRUCT_START | ||
branchl r12, 0x80337cd4 # DVDClose | ||
|
||
mr r3, REG_INTERRUPT_IDX | ||
branchl r12, OSRestoreInterrupts | ||
|
||
mr r3, REG_ENTRYNUM | ||
|
||
restore SPACE_NEEDED | ||
|
||
lwz r0, -0x5668(r13) # replaced code line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
################################################################################ | ||
# Address: 0x800236ec # Music_StopMusic, after function call | ||
################################################################################ | ||
|
||
.include "Common/Common.s" | ||
|
||
.set REG_SMQ, 31 | ||
|
||
# This space will be used to transfer over EXI. EXI buffers must be 32 byte aligned though | ||
# so we don't know exactly where the buffer will start | ||
.set SPO_EXI_SPACE_START, BKP_FREE_SPACE_OFFSET | ||
|
||
# PlayMusicQuery args | ||
.set SMQ_COMMAND, 0 | ||
.set SMQ_SIZE, SMQ_COMMAND + 1 | ||
|
||
# Grab enough space that no matter where we are, we can byteAlign32 and still fit the SMQ data | ||
.set SPACE_NEEDED, SPO_EXI_SPACE_START + SMQ_SIZE + 32 | ||
|
||
backup SPACE_NEEDED | ||
|
||
# logf LOG_LEVEL_WARN, "[Music] Stopping music" | ||
|
||
addi REG_SMQ, sp, SPO_EXI_SPACE_START | ||
byteAlign32 REG_SMQ | ||
|
||
# Write command | ||
li r3, CONST_SlippiStopMusic | ||
stb r3, SMQ_COMMAND(REG_SMQ) | ||
|
||
# Exec EXI transfer | ||
mr r3, REG_SMQ | ||
li r4, SMQ_SIZE | ||
li r5, CONST_ExiWrite | ||
branchl r12, FN_EXITransferBuffer | ||
|
||
CLEANUP_AND_EXIT: | ||
restore SPACE_NEEDED | ||
|
||
li r0, 0 # replaced code line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
################################################################################ | ||
# Address: 0x800249f0 # DSP_Process, where volume is written | ||
################################################################################ | ||
|
||
.include "Common/Common.s" | ||
|
||
.set REG_CMVQ, 31 | ||
.set REG_DATA, 30 | ||
|
||
# This space will be used to transfer over EXI. EXI buffers must be 32 byte aligned though | ||
# so we don't know exactly where the buffer will start | ||
.set SPO_EXI_SPACE_START, BKP_FREE_SPACE_OFFSET | ||
|
||
# PlayMusicQuery args | ||
.set CMVQ_COMMAND, 0 | ||
.set CMVQ_VOLUME, CMVQ_COMMAND + 1 | ||
.set CMVQ_SIZE, CMVQ_VOLUME + 1 | ||
|
||
# Grab enough space that no matter where we are, we can byteAlign32 and still fit the CMVQ data | ||
.set SPACE_NEEDED, SPO_EXI_SPACE_START + CMVQ_SIZE + 32 | ||
|
||
b CODE_START | ||
|
||
DATA_BLRL: | ||
blrl | ||
.set DO_PREV_VOLUME, 0 | ||
.long 0x00000000 | ||
|
||
CODE_START: | ||
stw r0, -0x7E18(r13) # replaced code line | ||
|
||
backup SPACE_NEEDED | ||
|
||
bl DATA_BLRL | ||
mflr REG_DATA | ||
|
||
lwz r4, -0x7E18(r13) # load new value | ||
lwz r3, DO_PREV_VOLUME(REG_DATA) # load old value | ||
cmpw r3, r4 | ||
beq CLEANUP_AND_EXIT | ||
|
||
# Update prev value to current | ||
stw r4, DO_PREV_VOLUME(REG_DATA) | ||
|
||
# Here the volume differs from the previous. Let's send the new volume to Dolphin | ||
# mr r5, r4 | ||
# logf LOG_LEVEL_WARN, "[Music] Volume changed: %d" | ||
|
||
addi REG_CMVQ, sp, SPO_EXI_SPACE_START | ||
byteAlign32 REG_CMVQ | ||
|
||
# Write command | ||
li r3, CONST_SlippiChangeMusicVolume | ||
stb r3, CMVQ_COMMAND(REG_CMVQ) | ||
|
||
# Write new volume | ||
stb r4, CMVQ_VOLUME(REG_CMVQ) | ||
|
||
# Exec EXI transfer | ||
mr r3, REG_CMVQ | ||
li r4, CMVQ_SIZE | ||
li r5, CONST_ExiWrite | ||
branchl r12, FN_EXITransferBuffer | ||
|
||
CLEANUP_AND_EXIT: | ||
restore SPACE_NEEDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.