Match and link dtk

Former-commit-id: f779e5819d
This commit is contained in:
Phillip Stephens 2022-10-07 19:38:36 -07:00
parent 181690e417
commit eefc0f609c
9 changed files with 645 additions and 210 deletions

View File

@ -9,7 +9,9 @@
},
"editor.tabSize": 2,
"files.associations": {
"source_location": "cpp"
"source_location": "cpp",
"dtk.h": "c",
"dvd.h": "c"
},
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,

View File

@ -147,6 +147,8 @@ $(MSL_PPCEABI_BARE_H): CFLAGS := $(CFLAGS_RUNTIME)
$(MSL_COMMON_MATH): CFLAGS := $(CFLAGS_RUNTIME)
$(PAD_FILES): MWCC_VERSION := 1.2.5
$(PAD_FILES): CFLAGS := $(CFLAGS_BASE)
$(DTK_FILES): MWCC_VERSION := 1.2.5
$(DTK_FILES): CFLAGS := $(CFLAGS_BASE)
#-------------------------------------------------------------------------------
# Recipes

View File

@ -2,103 +2,103 @@
.section .bss
.balign 8
.global lbl_80569908
lbl_80569908:
.global __block_for_run_callback
__block_for_run_callback:
.skip 0x30
.global lbl_80569938
lbl_80569938:
.global __block_for_prep_callback
__block_for_prep_callback:
.skip 0x30
.global lbl_80569968
lbl_80569968:
.global __block_for_stream_status
__block_for_stream_status:
.skip 0x30
.global lbl_80569998
lbl_80569998:
.global __block_for_ais_isr
__block_for_ais_isr:
.skip 0x30
.global lbl_805699C8
lbl_805699C8:
.global __block_for_flushtracks
__block_for_flushtracks:
.skip 0x30
.global lbl_805699F8
lbl_805699F8:
.global __block_for_set_state
__block_for_set_state:
.skip 0x30
.global lbl_80569A28
lbl_80569A28:
.global __block_for_next_track
__block_for_next_track:
.skip 0x30
.section .sbss, "wa"
.balign 8
.global lbl_805A9B98
lbl_805A9B98:
.global __DTKCurrentTrack
__DTKCurrentTrack:
.skip 0x4
.global lbl_805A9B9C
lbl_805A9B9C:
.global __DTKPlayListHead
__DTKPlayListHead:
.skip 0x4
.global lbl_805A9BA0
lbl_805A9BA0:
.global __DTKPlayListTail
__DTKPlayListTail:
.skip 0x4
.global lbl_805A9BA4
lbl_805A9BA4:
.global __DTKState
__DTKState:
.skip 0x4
.global lbl_805A9BA8
lbl_805A9BA8:
.global __DTKTempState
__DTKTempState:
.skip 0x4
.global lbl_805A9BAC
lbl_805A9BAC:
.global __DTKRepeatMode
__DTKRepeatMode:
.skip 0x4
.global lbl_805A9BB0
lbl_805A9BB0:
.global __DTKPosition
__DTKPosition:
.skip 0x4
.global lbl_805A9BB4
lbl_805A9BB4:
.global __DTKInterruptFrequency
__DTKInterruptFrequency:
.skip 0x4
.global lbl_805A9BB8
lbl_805A9BB8:
.global __DTKVolumeL
__DTKVolumeL:
.skip 0x1
.global lbl_805A9BB9
lbl_805A9BB9:
.global __DTKVolumeR
__DTKVolumeR:
.skip 0x3
.global lbl_805A9BBC
lbl_805A9BBC:
.global __DTKShutdownFlag
__DTKShutdownFlag:
.skip 0x4
.global lbl_805A9BC0
lbl_805A9BC0:
.global __DTKTrackEnded
__DTKTrackEnded:
.skip 0x4
.global lbl_805A9BC4
lbl_805A9BC4:
.global __DTKFlushCallback
__DTKFlushCallback:
.skip 0x4
.section .text, "ax"
.global sub_803b7518
sub_803b7518:
.global __DTKCallbackForStreamStatus
__DTKCallbackForStreamStatus:
/* 803B7518 003B4478 54 60 06 3F */ clrlwi. r0, r3, 0x18
/* 803B751C 003B447C 4C 82 00 20 */ bnelr
/* 803B7520 003B4480 38 00 00 01 */ li r0, 1
/* 803B7524 003B4484 90 0D B0 00 */ stw r0, lbl_805A9BC0@sda21(r13)
/* 803B7524 003B4484 90 0D B0 00 */ stw r0, __DTKTrackEnded@sda21(r13)
/* 803B7528 003B4488 38 00 00 00 */ li r0, 0
/* 803B752C 003B448C 90 0D AF F0 */ stw r0, lbl_805A9BB0@sda21(r13)
/* 803B752C 003B448C 90 0D AF F0 */ stw r0, __DTKPosition@sda21(r13)
/* 803B7530 003B4490 4E 80 00 20 */ blr
.global sub_803b7534
sub_803b7534:
.global __DTKCallbackForRun
__DTKCallbackForRun:
/* 803B7534 003B4494 7C 08 02 A6 */ mflr r0
/* 803B7538 003B4498 90 01 00 04 */ stw r0, 4(r1)
/* 803B753C 003B449C 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7540 003B44A0 88 6D AF F8 */ lbz r3, lbl_805A9BB8@sda21(r13)
/* 803B7540 003B44A0 88 6D AF F8 */ lbz r3, __DTKVolumeL@sda21(r13)
/* 803B7544 003B44A4 4B FB 5E 39 */ bl AISetStreamVolLeft
/* 803B7548 003B44A8 88 6D AF F9 */ lbz r3, lbl_805A9BB9@sda21(r13)
/* 803B7548 003B44A8 88 6D AF F9 */ lbz r3, __DTKVolumeR@sda21(r13)
/* 803B754C 003B44AC 4B FB 5E 5D */ bl AISetStreamVolRight
/* 803B7550 003B44B0 4B FB 5B 49 */ bl AIResetStreamSampleCount
/* 803B7554 003B44B4 80 6D AF F4 */ lwz r3, lbl_805A9BB4@sda21(r13)
/* 803B7554 003B44B4 80 6D AF F4 */ lwz r3, __DTKInterruptFrequency@sda21(r13)
/* 803B7558 003B44B8 4B FB 5B 59 */ bl AISetStreamTrigger
/* 803B755C 003B44BC 38 60 00 01 */ li r3, 1
/* 803B7560 003B44C0 4B FB 5B 5D */ bl AISetStreamPlayState
/* 803B7564 003B44C4 3C 60 80 57 */ lis r3, lbl_80569908@ha
/* 803B7568 003B44C8 38 63 99 08 */ addi r3, r3, lbl_80569908@l
/* 803B7564 003B44C4 3C 60 80 57 */ lis r3, __block_for_run_callback@ha
/* 803B7568 003B44C8 38 63 99 08 */ addi r3, r3, __block_for_run_callback@l
/* 803B756C 003B44CC 38 80 00 00 */ li r4, 0
/* 803B7570 003B44D0 4B FB C8 4D */ bl DVDStopStreamAtEndAsync
/* 803B7574 003B44D4 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B7574 003B44D4 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7578 003B44D8 38 00 00 01 */ li r0, 1
/* 803B757C 003B44DC 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B757C 003B44DC 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7580 003B44E0 28 03 00 00 */ cmplwi r3, 0
/* 803B7584 003B44E4 41 82 00 24 */ beq lbl_803B75A8
/* 803B7588 003B44E8 81 83 00 10 */ lwz r12, 0x10(r3)
@ -115,8 +115,8 @@ lbl_803B75A8:
/* 803B75B0 003B4510 7C 08 03 A6 */ mtlr r0
/* 803B75B4 003B4514 4E 80 00 20 */ blr
.global sub_803b75b8
sub_803b75b8:
.global __DTKCallbackForPreparePaused
__DTKCallbackForPreparePaused:
/* 803B75B8 003B4518 7C 08 02 A6 */ mflr r0
/* 803B75BC 003B451C 38 60 00 00 */ li r3, 0
/* 803B75C0 003B4520 90 01 00 04 */ stw r0, 4(r1)
@ -126,13 +126,13 @@ sub_803b75b8:
/* 803B75D0 003B4530 4B FB 5D D9 */ bl AISetStreamVolRight
/* 803B75D4 003B4534 38 60 00 00 */ li r3, 0
/* 803B75D8 003B4538 4B FB 5A E5 */ bl AISetStreamPlayState
/* 803B75DC 003B453C 3C 60 80 57 */ lis r3, lbl_80569938@ha
/* 803B75E0 003B4540 38 63 99 38 */ addi r3, r3, lbl_80569938@l
/* 803B75DC 003B453C 3C 60 80 57 */ lis r3, __block_for_prep_callback@ha
/* 803B75E0 003B4540 38 63 99 38 */ addi r3, r3, __block_for_prep_callback@l
/* 803B75E4 003B4544 38 80 00 00 */ li r4, 0
/* 803B75E8 003B4548 4B FB C7 D5 */ bl DVDStopStreamAtEndAsync
/* 803B75EC 003B454C 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B75EC 003B454C 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B75F0 003B4550 38 00 00 02 */ li r0, 2
/* 803B75F4 003B4554 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B75F4 003B4554 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B75F8 003B4558 28 03 00 00 */ cmplwi r3, 0
/* 803B75FC 003B455C 41 82 00 24 */ beq lbl_803B7620
/* 803B7600 003B4560 81 83 00 10 */ lwz r12, 0x10(r3)
@ -149,18 +149,18 @@ lbl_803B7620:
/* 803B7628 003B4588 7C 08 03 A6 */ mtlr r0
/* 803B762C 003B458C 4E 80 00 20 */ blr
.global sub_803b7630
sub_803b7630:
.global __DTKCallbackForPlaylist
__DTKCallbackForPlaylist:
/* 803B7630 003B4590 7C 08 02 A6 */ mflr r0
/* 803B7634 003B4594 90 01 00 04 */ stw r0, 4(r1)
/* 803B7638 003B4598 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B763C 003B459C 90 6D AF F0 */ stw r3, lbl_805A9BB0@sda21(r13)
/* 803B7640 003B45A0 80 0D B0 00 */ lwz r0, lbl_805A9BC0@sda21(r13)
/* 803B763C 003B459C 90 6D AF F0 */ stw r3, __DTKPosition@sda21(r13)
/* 803B7640 003B45A0 80 0D B0 00 */ lwz r0, __DTKTrackEnded@sda21(r13)
/* 803B7644 003B45A4 28 00 00 00 */ cmplwi r0, 0
/* 803B7648 003B45A8 41 82 01 C0 */ beq lbl_803B7808
/* 803B764C 003B45AC 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B764C 003B45AC 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7650 003B45B0 38 00 00 00 */ li r0, 0
/* 803B7654 003B45B4 90 0D B0 00 */ stw r0, lbl_805A9BC0@sda21(r13)
/* 803B7654 003B45B4 90 0D B0 00 */ stw r0, __DTKTrackEnded@sda21(r13)
/* 803B7658 003B45B8 28 03 00 00 */ cmplwi r3, 0
/* 803B765C 003B45BC 41 82 00 24 */ beq lbl_803B7680
/* 803B7660 003B45C0 81 83 00 10 */ lwz r12, 0x10(r3)
@ -173,8 +173,8 @@ sub_803b7630:
/* 803B767C 003B45DC 4E 80 00 21 */ blrl
lbl_803B7680:
/* 803B7680 003B45E0 38 00 00 03 */ li r0, 3
/* 803B7684 003B45E4 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7688 003B45E8 80 0D AF EC */ lwz r0, lbl_805A9BAC@sda21(r13)
/* 803B7684 003B45E4 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7688 003B45E8 80 0D AF EC */ lwz r0, __DTKRepeatMode@sda21(r13)
/* 803B768C 003B45EC 2C 00 00 01 */ cmpwi r0, 1
/* 803B7690 003B45F0 41 82 00 A0 */ beq lbl_803B7730
/* 803B7694 003B45F4 40 80 00 10 */ bge lbl_803B76A4
@ -186,80 +186,80 @@ lbl_803B76A4:
/* 803B76A8 003B4608 40 80 01 74 */ bge lbl_803B781C
/* 803B76AC 003B460C 48 00 01 18 */ b lbl_803B77C4
lbl_803B76B0:
/* 803B76B0 003B4610 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B76B0 003B4610 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B76B4 003B4614 28 03 00 00 */ cmplwi r3, 0
/* 803B76B8 003B4618 41 82 01 64 */ beq lbl_803B781C
/* 803B76BC 003B461C 80 03 00 04 */ lwz r0, 4(r3)
/* 803B76C0 003B4620 28 00 00 00 */ cmplwi r0, 0
/* 803B76C4 003B4624 41 82 00 40 */ beq lbl_803B7704
/* 803B76C8 003B4628 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B76C8 003B4628 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
/* 803B76CC 003B462C 38 60 00 00 */ li r3, 0
/* 803B76D0 003B4630 4B FB 5C AD */ bl AISetStreamVolLeft
/* 803B76D4 003B4634 38 60 00 00 */ li r3, 0
/* 803B76D8 003B4638 4B FB 5C D1 */ bl AISetStreamVolRight
/* 803B76DC 003B463C 38 60 00 00 */ li r3, 0
/* 803B76E0 003B4640 4B FB 59 DD */ bl AISetStreamPlayState
/* 803B76E4 003B4644 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B76E8 003B4648 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B76EC 003B464C 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B76E4 003B4644 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B76E8 003B4648 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B76EC 003B464C 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B76F0 003B4650 38 64 00 14 */ addi r3, r4, 0x14
/* 803B76F4 003B4654 38 80 00 00 */ li r4, 0
/* 803B76F8 003B4658 38 A0 00 00 */ li r5, 0
/* 803B76FC 003B465C 4B FB A3 89 */ bl DVDPrepareStreamAsync
/* 803B7700 003B4660 48 00 01 1C */ b lbl_803B781C
lbl_803B7704:
/* 803B7704 003B4664 80 0D AF DC */ lwz r0, lbl_805A9B9C@sda21(r13)
/* 803B7704 003B4664 80 0D AF DC */ lwz r0, __DTKPlayListHead@sda21(r13)
/* 803B7708 003B4668 38 60 00 00 */ li r3, 0
/* 803B770C 003B466C 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B770C 003B466C 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
/* 803B7710 003B4670 4B FB 5C 6D */ bl AISetStreamVolLeft
/* 803B7714 003B4674 38 60 00 00 */ li r3, 0
/* 803B7718 003B4678 4B FB 5C 91 */ bl AISetStreamVolRight
/* 803B771C 003B467C 38 60 00 00 */ li r3, 0
/* 803B7720 003B4680 4B FB 59 9D */ bl AISetStreamPlayState
/* 803B7724 003B4684 38 00 00 00 */ li r0, 0
/* 803B7728 003B4688 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7728 003B4688 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B772C 003B468C 48 00 00 F0 */ b lbl_803B781C
lbl_803B7730:
/* 803B7730 003B4690 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B7730 003B4690 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7734 003B4694 28 03 00 00 */ cmplwi r3, 0
/* 803B7738 003B4698 41 82 00 E4 */ beq lbl_803B781C
/* 803B773C 003B469C 80 03 00 04 */ lwz r0, 4(r3)
/* 803B7740 003B46A0 28 00 00 00 */ cmplwi r0, 0
/* 803B7744 003B46A4 41 82 00 40 */ beq lbl_803B7784
/* 803B7748 003B46A8 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B7748 003B46A8 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
/* 803B774C 003B46AC 38 60 00 00 */ li r3, 0
/* 803B7750 003B46B0 4B FB 5C 2D */ bl AISetStreamVolLeft
/* 803B7754 003B46B4 38 60 00 00 */ li r3, 0
/* 803B7758 003B46B8 4B FB 5C 51 */ bl AISetStreamVolRight
/* 803B775C 003B46BC 38 60 00 00 */ li r3, 0
/* 803B7760 003B46C0 4B FB 59 5D */ bl AISetStreamPlayState
/* 803B7764 003B46C4 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B7768 003B46C8 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B776C 003B46CC 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B7764 003B46C4 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7768 003B46C8 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B776C 003B46CC 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B7770 003B46D0 38 64 00 14 */ addi r3, r4, 0x14
/* 803B7774 003B46D4 38 80 00 00 */ li r4, 0
/* 803B7778 003B46D8 38 A0 00 00 */ li r5, 0
/* 803B777C 003B46DC 4B FB A3 09 */ bl DVDPrepareStreamAsync
/* 803B7780 003B46E0 48 00 00 9C */ b lbl_803B781C
lbl_803B7784:
/* 803B7784 003B46E4 80 0D AF DC */ lwz r0, lbl_805A9B9C@sda21(r13)
/* 803B7784 003B46E4 80 0D AF DC */ lwz r0, __DTKPlayListHead@sda21(r13)
/* 803B7788 003B46E8 38 60 00 00 */ li r3, 0
/* 803B778C 003B46EC 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B778C 003B46EC 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
/* 803B7790 003B46F0 4B FB 5B ED */ bl AISetStreamVolLeft
/* 803B7794 003B46F4 38 60 00 00 */ li r3, 0
/* 803B7798 003B46F8 4B FB 5C 11 */ bl AISetStreamVolRight
/* 803B779C 003B46FC 38 60 00 00 */ li r3, 0
/* 803B77A0 003B4700 4B FB 59 1D */ bl AISetStreamPlayState
/* 803B77A4 003B4704 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B77A8 003B4708 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B77AC 003B470C 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B77A4 003B4704 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B77A8 003B4708 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B77AC 003B470C 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B77B0 003B4710 38 64 00 14 */ addi r3, r4, 0x14
/* 803B77B4 003B4714 38 80 00 00 */ li r4, 0
/* 803B77B8 003B4718 38 A0 00 00 */ li r5, 0
/* 803B77BC 003B471C 4B FB A2 C9 */ bl DVDPrepareStreamAsync
/* 803B77C0 003B4720 48 00 00 5C */ b lbl_803B781C
lbl_803B77C4:
/* 803B77C4 003B4724 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B77C4 003B4724 80 0D AF D8 */ lwz r0, __DTKCurrentTrack@sda21(r13)
/* 803B77C8 003B4728 28 00 00 00 */ cmplwi r0, 0
/* 803B77CC 003B472C 41 82 00 50 */ beq lbl_803B781C
/* 803B77D0 003B4730 38 60 00 00 */ li r3, 0
@ -268,19 +268,19 @@ lbl_803B77C4:
/* 803B77DC 003B473C 4B FB 5B CD */ bl AISetStreamVolRight
/* 803B77E0 003B4740 38 60 00 00 */ li r3, 0
/* 803B77E4 003B4744 4B FB 58 D9 */ bl AISetStreamPlayState
/* 803B77E8 003B4748 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B77EC 003B474C 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B77F0 003B4750 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B77E8 003B4748 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B77EC 003B474C 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B77F0 003B4750 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B77F4 003B4754 38 64 00 14 */ addi r3, r4, 0x14
/* 803B77F8 003B4758 38 80 00 00 */ li r4, 0
/* 803B77FC 003B475C 38 A0 00 00 */ li r5, 0
/* 803B7800 003B4760 4B FB A2 85 */ bl DVDPrepareStreamAsync
/* 803B7804 003B4764 48 00 00 18 */ b lbl_803B781C
lbl_803B7808:
/* 803B7808 003B4768 3C 60 80 57 */ lis r3, lbl_80569968@ha
/* 803B780C 003B476C 3C 80 80 3B */ lis r4, sub_803b7518@ha
/* 803B7810 003B4770 38 63 99 68 */ addi r3, r3, lbl_80569968@l
/* 803B7814 003B4774 38 84 75 18 */ addi r4, r4, sub_803b7518@l
/* 803B7808 003B4768 3C 60 80 57 */ lis r3, __block_for_stream_status@ha
/* 803B780C 003B476C 3C 80 80 3B */ lis r4, __DTKCallbackForStreamStatus@ha
/* 803B7810 003B4770 38 63 99 68 */ addi r3, r3, __block_for_stream_status@l
/* 803B7814 003B4774 38 84 75 18 */ addi r4, r4, __DTKCallbackForStreamStatus@l
/* 803B7818 003B4778 4B FB C6 61 */ bl DVDGetStreamErrorStatusAsync
lbl_803B781C:
/* 803B781C 003B477C 80 01 00 0C */ lwz r0, 0xc(r1)
@ -288,21 +288,21 @@ lbl_803B781C:
/* 803B7824 003B4784 7C 08 03 A6 */ mtlr r0
/* 803B7828 003B4788 4E 80 00 20 */ blr
.global sub_803b782c
sub_803b782c:
.global __DTKCallbackForAIInterrupt
__DTKCallbackForAIInterrupt:
/* 803B782C 003B478C 7C 08 02 A6 */ mflr r0
/* 803B7830 003B4790 90 01 00 04 */ stw r0, 4(r1)
/* 803B7834 003B4794 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7838 003B4798 80 0D AF F4 */ lwz r0, lbl_805A9BB4@sda21(r13)
/* 803B7838 003B4798 80 0D AF F4 */ lwz r0, __DTKInterruptFrequency@sda21(r13)
/* 803B783C 003B479C 7C 63 02 14 */ add r3, r3, r0
/* 803B7840 003B47A0 4B FB 58 71 */ bl AISetStreamTrigger
/* 803B7844 003B47A4 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B7844 003B47A4 80 0D AF D8 */ lwz r0, __DTKCurrentTrack@sda21(r13)
/* 803B7848 003B47A8 28 00 00 00 */ cmplwi r0, 0
/* 803B784C 003B47AC 41 82 00 18 */ beq lbl_803B7864
/* 803B7850 003B47B0 3C 60 80 57 */ lis r3, lbl_80569998@ha
/* 803B7854 003B47B4 3C 80 80 3B */ lis r4, sub_803b7630@ha
/* 803B7858 003B47B8 38 63 99 98 */ addi r3, r3, lbl_80569998@l
/* 803B785C 003B47BC 38 84 76 30 */ addi r4, r4, sub_803b7630@l
/* 803B7850 003B47B0 3C 60 80 57 */ lis r3, __block_for_ais_isr@ha
/* 803B7854 003B47B4 3C 80 80 3B */ lis r4, __DTKCallbackForPlaylist@ha
/* 803B7858 003B47B8 38 63 99 98 */ addi r3, r3, __block_for_ais_isr@l
/* 803B785C 003B47BC 38 84 76 30 */ addi r4, r4, __DTKCallbackForPlaylist@l
/* 803B7860 003B47C0 4B FB C6 D5 */ bl DVDGetStreamPlayAddrAsync
lbl_803B7864:
/* 803B7864 003B47C4 80 01 00 0C */ lwz r0, 0xc(r1)
@ -310,15 +310,15 @@ lbl_803B7864:
/* 803B786C 003B47CC 7C 08 03 A6 */ mtlr r0
/* 803B7870 003B47D0 4E 80 00 20 */ blr
.global sub_803b7874
sub_803b7874:
.global __DTKCallbackForFlush
__DTKCallbackForFlush:
/* 803B7874 003B47D4 7C 08 02 A6 */ mflr r0
/* 803B7878 003B47D8 38 60 00 00 */ li r3, 0
/* 803B787C 003B47DC 90 01 00 04 */ stw r0, 4(r1)
/* 803B7880 003B47E0 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 803B7884 003B47E4 93 E1 00 14 */ stw r31, 0x14(r1)
/* 803B7888 003B47E8 4B FB 58 35 */ bl AISetStreamPlayState
/* 803B788C 003B47EC 83 ED AF DC */ lwz r31, lbl_805A9B9C@sda21(r13)
/* 803B788C 003B47EC 83 ED AF DC */ lwz r31, __DTKPlayListHead@sda21(r13)
/* 803B7890 003B47F0 48 00 00 10 */ b lbl_803B78A0
lbl_803B7894:
/* 803B7894 003B47F4 38 7F 00 14 */ addi r3, r31, 0x14
@ -327,33 +327,33 @@ lbl_803B7894:
lbl_803B78A0:
/* 803B78A0 003B4800 28 1F 00 00 */ cmplwi r31, 0
/* 803B78A4 003B4804 40 82 FF F0 */ bne lbl_803B7894
/* 803B78A8 003B4808 81 8D B0 04 */ lwz r12, lbl_805A9BC4@sda21(r13)
/* 803B78A8 003B4808 81 8D B0 04 */ lwz r12, __DTKFlushCallback@sda21(r13)
/* 803B78AC 003B480C 3B E0 00 00 */ li r31, 0
/* 803B78B0 003B4810 93 ED AF DC */ stw r31, lbl_805A9B9C@sda21(r13)
/* 803B78B0 003B4810 93 ED AF DC */ stw r31, __DTKPlayListHead@sda21(r13)
/* 803B78B4 003B4814 28 0C 00 00 */ cmplwi r12, 0
/* 803B78B8 003B4818 93 ED AF E0 */ stw r31, lbl_805A9BA0@sda21(r13)
/* 803B78BC 003B481C 93 ED AF D8 */ stw r31, lbl_805A9B98@sda21(r13)
/* 803B78C0 003B4820 93 ED AF E4 */ stw r31, lbl_805A9BA4@sda21(r13)
/* 803B78B8 003B4818 93 ED AF E0 */ stw r31, __DTKPlayListTail@sda21(r13)
/* 803B78BC 003B481C 93 ED AF D8 */ stw r31, __DTKCurrentTrack@sda21(r13)
/* 803B78C0 003B4820 93 ED AF E4 */ stw r31, __DTKState@sda21(r13)
/* 803B78C4 003B4824 41 82 00 10 */ beq lbl_803B78D4
/* 803B78C8 003B4828 7D 88 03 A6 */ mtlr r12
/* 803B78CC 003B482C 4E 80 00 21 */ blrl
/* 803B78D0 003B4830 93 ED B0 04 */ stw r31, lbl_805A9BC4@sda21(r13)
/* 803B78D0 003B4830 93 ED B0 04 */ stw r31, __DTKFlushCallback@sda21(r13)
lbl_803B78D4:
/* 803B78D4 003B4834 38 00 00 00 */ li r0, 0
/* 803B78D8 003B4838 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B78DC 003B483C 90 0D AF FC */ stw r0, lbl_805A9BBC@sda21(r13)
/* 803B78D8 003B4838 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B78DC 003B483C 90 0D AF FC */ stw r0, __DTKShutdownFlag@sda21(r13)
/* 803B78E0 003B4840 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 803B78E4 003B4844 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 803B78E8 003B4848 38 21 00 18 */ addi r1, r1, 0x18
/* 803B78EC 003B484C 7C 08 03 A6 */ mtlr r0
/* 803B78F0 003B4850 4E 80 00 20 */ blr
.global sub_803b78f4
sub_803b78f4:
.global __DTKCallbackForStop
__DTKCallbackForStop:
/* 803B78F4 003B4854 7C 08 02 A6 */ mflr r0
/* 803B78F8 003B4858 90 01 00 04 */ stw r0, 4(r1)
/* 803B78FC 003B485C 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7900 003B4860 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B7900 003B4860 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7904 003B4864 28 03 00 00 */ cmplwi r3, 0
/* 803B7908 003B4868 41 82 00 24 */ beq lbl_803B792C
/* 803B790C 003B486C 81 83 00 10 */ lwz r12, 0x10(r3)
@ -366,32 +366,32 @@ sub_803b78f4:
/* 803B7928 003B4888 4E 80 00 21 */ blrl
lbl_803B792C:
/* 803B792C 003B488C 38 00 00 00 */ li r0, 0
/* 803B7930 003B4890 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7930 003B4890 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7934 003B4894 80 01 00 0C */ lwz r0, 0xc(r1)
/* 803B7938 003B4898 38 21 00 08 */ addi r1, r1, 8
/* 803B793C 003B489C 7C 08 03 A6 */ mtlr r0
/* 803B7940 003B48A0 4E 80 00 20 */ blr
.global sub_803b7944
sub_803b7944:
.global __DTKCallbackForNextTrack
__DTKCallbackForNextTrack:
/* 803B7944 003B48A4 7C 08 02 A6 */ mflr r0
/* 803B7948 003B48A8 38 60 00 00 */ li r3, 0
/* 803B794C 003B48AC 90 01 00 04 */ stw r0, 4(r1)
/* 803B7950 003B48B0 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7954 003B48B4 4B FB 57 69 */ bl AISetStreamPlayState
/* 803B7958 003B48B8 4B FC 9D 09 */ bl OSDisableInterrupts
/* 803B795C 003B48BC 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B795C 003B48BC 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7960 003B48C0 28 04 00 00 */ cmplwi r4, 0
/* 803B7964 003B48C4 41 82 00 14 */ beq lbl_803B7978
/* 803B7968 003B48C8 80 04 00 04 */ lwz r0, 4(r4)
/* 803B796C 003B48CC 28 00 00 00 */ cmplwi r0, 0
/* 803B7970 003B48D0 41 82 00 08 */ beq lbl_803B7978
/* 803B7974 003B48D4 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B7974 003B48D4 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
lbl_803B7978:
/* 803B7978 003B48D8 4B FC 9D 11 */ bl OSRestoreInterrupts
/* 803B797C 003B48DC 38 00 00 00 */ li r0, 0
/* 803B7980 003B48E0 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7984 003B48E4 80 6D AF E8 */ lwz r3, lbl_805A9BA8@sda21(r13)
/* 803B7980 003B48E0 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7984 003B48E4 80 6D AF E8 */ lwz r3, __DTKTempState@sda21(r13)
/* 803B7988 003B48E8 48 00 02 19 */ bl DTKSetState
/* 803B798C 003B48EC 80 01 00 0C */ lwz r0, 0xc(r1)
/* 803B7990 003B48F0 38 21 00 08 */ addi r1, r1, 8
@ -408,20 +408,20 @@ DTKInit:
/* 803B79B0 003B4910 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B79B4 003B4914 38 00 00 FF */ li r0, 0xff
/* 803B79B8 003B4918 38 60 00 00 */ li r3, 0
/* 803B79BC 003B491C 90 AD AF E4 */ stw r5, lbl_805A9BA4@sda21(r13)
/* 803B79C0 003B4920 90 AD AF EC */ stw r5, lbl_805A9BAC@sda21(r13)
/* 803B79C4 003B4924 90 AD AF F0 */ stw r5, lbl_805A9BB0@sda21(r13)
/* 803B79C8 003B4928 90 8D AF F4 */ stw r4, lbl_805A9BB4@sda21(r13)
/* 803B79CC 003B492C 98 0D AF F8 */ stb r0, lbl_805A9BB8@sda21(r13)
/* 803B79D0 003B4930 90 AD AF D8 */ stw r5, lbl_805A9B98@sda21(r13)
/* 803B79D4 003B4934 90 AD AF DC */ stw r5, lbl_805A9B9C@sda21(r13)
/* 803B79D8 003B4938 90 AD AF E0 */ stw r5, lbl_805A9BA0@sda21(r13)
/* 803B79DC 003B493C 98 0D AF F9 */ stb r0, lbl_805A9BB9@sda21(r13)
/* 803B79BC 003B491C 90 AD AF E4 */ stw r5, __DTKState@sda21(r13)
/* 803B79C0 003B4920 90 AD AF EC */ stw r5, __DTKRepeatMode@sda21(r13)
/* 803B79C4 003B4924 90 AD AF F0 */ stw r5, __DTKPosition@sda21(r13)
/* 803B79C8 003B4928 90 8D AF F4 */ stw r4, __DTKInterruptFrequency@sda21(r13)
/* 803B79CC 003B492C 98 0D AF F8 */ stb r0, __DTKVolumeL@sda21(r13)
/* 803B79D0 003B4930 90 AD AF D8 */ stw r5, __DTKCurrentTrack@sda21(r13)
/* 803B79D4 003B4934 90 AD AF DC */ stw r5, __DTKPlayListHead@sda21(r13)
/* 803B79D8 003B4938 90 AD AF E0 */ stw r5, __DTKPlayListTail@sda21(r13)
/* 803B79DC 003B493C 98 0D AF F9 */ stb r0, __DTKVolumeR@sda21(r13)
/* 803B79E0 003B4940 4B FB 59 9D */ bl AISetStreamVolLeft
/* 803B79E4 003B4944 38 60 00 00 */ li r3, 0
/* 803B79E8 003B4948 4B FB 59 C1 */ bl AISetStreamVolRight
/* 803B79EC 003B494C 3C 60 80 3B */ lis r3, sub_803b782c@ha
/* 803B79F0 003B4950 38 63 78 2C */ addi r3, r3, sub_803b782c@l
/* 803B79EC 003B494C 3C 60 80 3B */ lis r3, __DTKCallbackForAIInterrupt@ha
/* 803B79F0 003B4950 38 63 78 2C */ addi r3, r3, __DTKCallbackForAIInterrupt@l
/* 803B79F4 003B4954 4B FB 56 61 */ bl AIRegisterStreamCallback
/* 803B79F8 003B4958 4B FB 56 A1 */ bl AIResetStreamSampleCount
/* 803B79FC 003B495C 38 60 00 00 */ li r3, 0
@ -431,8 +431,8 @@ DTKInit:
/* 803B7A0C 003B496C 7C 08 03 A6 */ mtlr r0
/* 803B7A10 003B4970 4E 80 00 20 */ blr
.global sub_803b7a14
sub_803b7a14:
.global DTKQueueTrack
DTKQueueTrack:
/* 803B7A14 003B4974 7C 08 02 A6 */ mflr r0
/* 803B7A18 003B4978 90 01 00 04 */ stw r0, 4(r1)
/* 803B7A1C 003B497C 94 21 FF D0 */ stwu r1, -0x30(r1)
@ -453,32 +453,32 @@ lbl_803B7A50:
/* 803B7A54 003B49B4 93 7C 00 08 */ stw r27, 8(r28)
/* 803B7A58 003B49B8 93 BC 00 0C */ stw r29, 0xc(r28)
/* 803B7A5C 003B49BC 93 DC 00 10 */ stw r30, 0x10(r28)
/* 803B7A60 003B49C0 80 0D AF DC */ lwz r0, lbl_805A9B9C@sda21(r13)
/* 803B7A60 003B49C0 80 0D AF DC */ lwz r0, __DTKPlayListHead@sda21(r13)
/* 803B7A64 003B49C4 28 00 00 00 */ cmplwi r0, 0
/* 803B7A68 003B49C8 40 82 00 2C */ bne lbl_803B7A94
/* 803B7A6C 003B49CC 93 8D AF DC */ stw r28, lbl_805A9B9C@sda21(r13)
/* 803B7A6C 003B49CC 93 8D AF DC */ stw r28, __DTKPlayListHead@sda21(r13)
/* 803B7A70 003B49D0 38 00 00 00 */ li r0, 0
/* 803B7A74 003B49D4 93 8D AF E0 */ stw r28, lbl_805A9BA0@sda21(r13)
/* 803B7A74 003B49D4 93 8D AF E0 */ stw r28, __DTKPlayListTail@sda21(r13)
/* 803B7A78 003B49D8 90 1C 00 00 */ stw r0, 0(r28)
/* 803B7A7C 003B49DC 90 1C 00 04 */ stw r0, 4(r28)
/* 803B7A80 003B49E0 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7A80 003B49E0 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7A84 003B49E4 28 00 00 01 */ cmplwi r0, 1
/* 803B7A88 003B49E8 40 82 00 28 */ bne lbl_803B7AB0
/* 803B7A8C 003B49EC 3B E0 00 01 */ li r31, 1
/* 803B7A90 003B49F0 48 00 00 20 */ b lbl_803B7AB0
lbl_803B7A94:
/* 803B7A94 003B49F4 80 8D AF E0 */ lwz r4, lbl_805A9BA0@sda21(r13)
/* 803B7A94 003B49F4 80 8D AF E0 */ lwz r4, __DTKPlayListTail@sda21(r13)
/* 803B7A98 003B49F8 38 00 00 00 */ li r0, 0
/* 803B7A9C 003B49FC 93 84 00 04 */ stw r28, 4(r4)
/* 803B7AA0 003B4A00 80 8D AF E0 */ lwz r4, lbl_805A9BA0@sda21(r13)
/* 803B7AA0 003B4A00 80 8D AF E0 */ lwz r4, __DTKPlayListTail@sda21(r13)
/* 803B7AA4 003B4A04 90 9C 00 00 */ stw r4, 0(r28)
/* 803B7AA8 003B4A08 93 8D AF E0 */ stw r28, lbl_805A9BA0@sda21(r13)
/* 803B7AA8 003B4A08 93 8D AF E0 */ stw r28, __DTKPlayListTail@sda21(r13)
/* 803B7AAC 003B4A0C 90 1C 00 04 */ stw r0, 4(r28)
lbl_803B7AB0:
/* 803B7AB0 003B4A10 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B7AB0 003B4A10 80 0D AF D8 */ lwz r0, __DTKCurrentTrack@sda21(r13)
/* 803B7AB4 003B4A14 28 00 00 00 */ cmplwi r0, 0
/* 803B7AB8 003B4A18 40 82 00 08 */ bne lbl_803B7AC0
/* 803B7ABC 003B4A1C 93 8D AF D8 */ stw r28, lbl_805A9B98@sda21(r13)
/* 803B7ABC 003B4A1C 93 8D AF D8 */ stw r28, __DTKCurrentTrack@sda21(r13)
lbl_803B7AC0:
/* 803B7AC0 003B4A20 4B FC 9B C9 */ bl OSRestoreInterrupts
/* 803B7AC4 003B4A24 28 1C 00 00 */ cmplwi r28, 0
@ -495,10 +495,10 @@ lbl_803B7AEC:
/* 803B7AEC 003B4A4C 28 1F 00 00 */ cmplwi r31, 0
/* 803B7AF0 003B4A50 41 82 00 28 */ beq lbl_803B7B18
/* 803B7AF4 003B4A54 38 00 00 03 */ li r0, 3
/* 803B7AF8 003B4A58 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B7AFC 003B4A5C 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B7B00 003B4A60 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7B04 003B4A64 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B7AF8 003B4A58 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7AFC 003B4A5C 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B7B00 003B4A60 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7B04 003B4A64 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B7B08 003B4A68 38 64 00 14 */ addi r3, r4, 0x14
/* 803B7B0C 003B4A6C 38 80 00 00 */ li r4, 0
/* 803B7B10 003B4A70 38 A0 00 00 */ li r5, 0
@ -517,25 +517,25 @@ DTKFlushTracks:
/* 803B7B30 003B4A90 7C 08 02 A6 */ mflr r0
/* 803B7B34 003B4A94 90 01 00 04 */ stw r0, 4(r1)
/* 803B7B38 003B4A98 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7B3C 003B4A9C 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7B3C 003B4A9C 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7B40 003B4AA0 28 00 00 03 */ cmplwi r0, 3
/* 803B7B44 003B4AA4 41 82 00 40 */ beq lbl_803B7B84
/* 803B7B48 003B4AA8 80 8D AF E4 */ lwz r4, lbl_805A9BA4@sda21(r13)
/* 803B7B48 003B4AA8 80 8D AF E4 */ lwz r4, __DTKState@sda21(r13)
/* 803B7B4C 003B4AAC 38 00 00 03 */ li r0, 3
/* 803B7B50 003B4AB0 90 6D B0 04 */ stw r3, lbl_805A9BC4@sda21(r13)
/* 803B7B50 003B4AB0 90 6D B0 04 */ stw r3, __DTKFlushCallback@sda21(r13)
/* 803B7B54 003B4AB4 28 04 00 01 */ cmplwi r4, 1
/* 803B7B58 003B4AB8 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7B58 003B4AB8 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7B5C 003B4ABC 40 82 00 1C */ bne lbl_803B7B78
/* 803B7B60 003B4AC0 3C 60 80 57 */ lis r3, lbl_805699C8@ha
/* 803B7B64 003B4AC4 3C 80 80 3B */ lis r4, sub_803b7874@ha
/* 803B7B68 003B4AC8 38 63 99 C8 */ addi r3, r3, lbl_805699C8@l
/* 803B7B6C 003B4ACC 38 84 78 74 */ addi r4, r4, sub_803b7874@l
/* 803B7B60 003B4AC0 3C 60 80 57 */ lis r3, __block_for_flushtracks@ha
/* 803B7B64 003B4AC4 3C 80 80 3B */ lis r4, __DTKCallbackForFlush@ha
/* 803B7B68 003B4AC8 38 63 99 C8 */ addi r3, r3, __block_for_flushtracks@l
/* 803B7B6C 003B4ACC 38 84 78 74 */ addi r4, r4, __DTKCallbackForFlush@l
/* 803B7B70 003B4AD0 4B FB C0 C9 */ bl DVDCancelStreamAsync
/* 803B7B74 003B4AD4 48 00 00 10 */ b lbl_803B7B84
lbl_803B7B78:
/* 803B7B78 003B4AD8 38 60 00 00 */ li r3, 0
/* 803B7B7C 003B4ADC 38 80 00 00 */ li r4, 0
/* 803B7B80 003B4AE0 4B FF FC F5 */ bl sub_803b7874
/* 803B7B80 003B4AE0 4B FF FC F5 */ bl __DTKCallbackForFlush
lbl_803B7B84:
/* 803B7B84 003B4AE4 80 01 00 0C */ lwz r0, 0xc(r1)
/* 803B7B88 003B4AE8 38 21 00 08 */ addi r1, r1, 8
@ -548,7 +548,7 @@ DTKSetSampleRate:
.global DTKSetRepeatMode
DTKSetRepeatMode:
/* 803B7B98 003B4AF8 90 6D AF EC */ stw r3, lbl_805A9BAC@sda21(r13)
/* 803B7B98 003B4AF8 90 6D AF EC */ stw r3, __DTKRepeatMode@sda21(r13)
/* 803B7B9C 003B4AFC 4E 80 00 20 */ blr
.global DTKSetState
@ -556,10 +556,10 @@ DTKSetState:
/* 803B7BA0 003B4B00 7C 08 02 A6 */ mflr r0
/* 803B7BA4 003B4B04 90 01 00 04 */ stw r0, 4(r1)
/* 803B7BA8 003B4B08 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7BAC 003B4B0C 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7BAC 003B4B0C 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7BB0 003B4B10 7C 00 18 40 */ cmplw r0, r3
/* 803B7BB4 003B4B14 41 82 01 BC */ beq lbl_803B7D70
/* 803B7BB8 003B4B18 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7BB8 003B4B18 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7BBC 003B4B1C 28 00 00 03 */ cmplwi r0, 3
/* 803B7BC0 003B4B20 40 82 00 08 */ bne lbl_803B7BC8
/* 803B7BC4 003B4B24 48 00 01 AC */ b lbl_803B7D70
@ -576,39 +576,39 @@ lbl_803B7BE4:
/* 803B7BE8 003B4B48 41 82 00 FC */ beq lbl_803B7CE4
/* 803B7BEC 003B4B4C 48 00 01 84 */ b lbl_803B7D70
lbl_803B7BF0:
/* 803B7BF0 003B4B50 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B7BF0 003B4B50 80 0D AF D8 */ lwz r0, __DTKCurrentTrack@sda21(r13)
/* 803B7BF4 003B4B54 28 00 00 00 */ cmplwi r0, 0
/* 803B7BF8 003B4B58 41 82 01 78 */ beq lbl_803B7D70
/* 803B7BFC 003B4B5C 38 00 00 03 */ li r0, 3
/* 803B7C00 003B4B60 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7C00 003B4B60 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7C04 003B4B64 38 60 00 00 */ li r3, 0
/* 803B7C08 003B4B68 4B FB 57 75 */ bl AISetStreamVolLeft
/* 803B7C0C 003B4B6C 38 60 00 00 */ li r3, 0
/* 803B7C10 003B4B70 4B FB 57 99 */ bl AISetStreamVolRight
/* 803B7C14 003B4B74 38 60 00 00 */ li r3, 0
/* 803B7C18 003B4B78 4B FB 54 A5 */ bl AISetStreamPlayState
/* 803B7C1C 003B4B7C 3C 60 80 57 */ lis r3, lbl_805699F8@ha
/* 803B7C20 003B4B80 3C 80 80 3B */ lis r4, sub_803b78f4@ha
/* 803B7C24 003B4B84 38 63 99 F8 */ addi r3, r3, lbl_805699F8@l
/* 803B7C28 003B4B88 38 84 78 F4 */ addi r4, r4, sub_803b78f4@l
/* 803B7C1C 003B4B7C 3C 60 80 57 */ lis r3, __block_for_set_state@ha
/* 803B7C20 003B4B80 3C 80 80 3B */ lis r4, __DTKCallbackForStop@ha
/* 803B7C24 003B4B84 38 63 99 F8 */ addi r3, r3, __block_for_set_state@l
/* 803B7C28 003B4B88 38 84 78 F4 */ addi r4, r4, __DTKCallbackForStop@l
/* 803B7C2C 003B4B8C 4B FB C0 0D */ bl DVDCancelStreamAsync
/* 803B7C30 003B4B90 48 00 01 40 */ b lbl_803B7D70
lbl_803B7C34:
/* 803B7C34 003B4B94 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7C34 003B4B94 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7C38 003B4B98 28 00 00 02 */ cmplwi r0, 2
/* 803B7C3C 003B4B9C 40 82 00 64 */ bne lbl_803B7CA0
/* 803B7C40 003B4BA0 88 6D AF F8 */ lbz r3, lbl_805A9BB8@sda21(r13)
/* 803B7C40 003B4BA0 88 6D AF F8 */ lbz r3, __DTKVolumeL@sda21(r13)
/* 803B7C44 003B4BA4 4B FB 57 39 */ bl AISetStreamVolLeft
/* 803B7C48 003B4BA8 88 6D AF F9 */ lbz r3, lbl_805A9BB9@sda21(r13)
/* 803B7C48 003B4BA8 88 6D AF F9 */ lbz r3, __DTKVolumeR@sda21(r13)
/* 803B7C4C 003B4BAC 4B FB 57 5D */ bl AISetStreamVolRight
/* 803B7C50 003B4BB0 4B FB 54 49 */ bl AIResetStreamSampleCount
/* 803B7C54 003B4BB4 80 6D AF F4 */ lwz r3, lbl_805A9BB4@sda21(r13)
/* 803B7C54 003B4BB4 80 6D AF F4 */ lwz r3, __DTKInterruptFrequency@sda21(r13)
/* 803B7C58 003B4BB8 4B FB 54 59 */ bl AISetStreamTrigger
/* 803B7C5C 003B4BBC 38 60 00 01 */ li r3, 1
/* 803B7C60 003B4BC0 4B FB 54 5D */ bl AISetStreamPlayState
/* 803B7C64 003B4BC4 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B7C64 003B4BC4 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7C68 003B4BC8 38 00 00 01 */ li r0, 1
/* 803B7C6C 003B4BCC 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7C6C 003B4BCC 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7C70 003B4BD0 28 03 00 00 */ cmplwi r3, 0
/* 803B7C74 003B4BD4 41 82 00 64 */ beq lbl_803B7CD8
/* 803B7C78 003B4BD8 41 82 00 60 */ beq lbl_803B7CD8
@ -622,13 +622,13 @@ lbl_803B7C34:
/* 803B7C98 003B4BF8 4E 80 00 21 */ blrl
/* 803B7C9C 003B4BFC 48 00 00 3C */ b lbl_803B7CD8
lbl_803B7CA0:
/* 803B7CA0 003B4C00 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B7CA0 003B4C00 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7CA4 003B4C04 28 04 00 00 */ cmplwi r4, 0
/* 803B7CA8 003B4C08 41 82 00 28 */ beq lbl_803B7CD0
/* 803B7CAC 003B4C0C 38 00 00 03 */ li r0, 3
/* 803B7CB0 003B4C10 3C 60 80 3B */ lis r3, sub_803b7534@ha
/* 803B7CB4 003B4C14 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7CB8 003B4C18 38 C3 75 34 */ addi r6, r3, sub_803b7534@l
/* 803B7CB0 003B4C10 3C 60 80 3B */ lis r3, __DTKCallbackForRun@ha
/* 803B7CB4 003B4C14 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7CB8 003B4C18 38 C3 75 34 */ addi r6, r3, __DTKCallbackForRun@l
/* 803B7CBC 003B4C1C 38 64 00 14 */ addi r3, r4, 0x14
/* 803B7CC0 003B4C20 38 80 00 00 */ li r4, 0
/* 803B7CC4 003B4C24 38 A0 00 00 */ li r5, 0
@ -636,40 +636,40 @@ lbl_803B7CA0:
/* 803B7CCC 003B4C2C 48 00 00 0C */ b lbl_803B7CD8
lbl_803B7CD0:
/* 803B7CD0 003B4C30 38 00 00 01 */ li r0, 1
/* 803B7CD4 003B4C34 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7CD4 003B4C34 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
lbl_803B7CD8:
/* 803B7CD8 003B4C38 38 00 00 00 */ li r0, 0
/* 803B7CDC 003B4C3C 90 0D B0 00 */ stw r0, lbl_805A9BC0@sda21(r13)
/* 803B7CDC 003B4C3C 90 0D B0 00 */ stw r0, __DTKTrackEnded@sda21(r13)
/* 803B7CE0 003B4C40 48 00 00 90 */ b lbl_803B7D70
lbl_803B7CE4:
/* 803B7CE4 003B4C44 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7CE4 003B4C44 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7CE8 003B4C48 28 00 00 00 */ cmplwi r0, 0
/* 803B7CEC 003B4C4C 40 82 00 84 */ bne lbl_803B7D70
/* 803B7CF0 003B4C50 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B7CF0 003B4C50 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7CF4 003B4C54 28 04 00 00 */ cmplwi r4, 0
/* 803B7CF8 003B4C58 41 82 00 24 */ beq lbl_803B7D1C
/* 803B7CFC 003B4C5C 38 00 00 03 */ li r0, 3
/* 803B7D00 003B4C60 3C 60 80 3B */ lis r3, sub_803b75b8@ha
/* 803B7D04 003B4C64 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7D08 003B4C68 38 C3 75 B8 */ addi r6, r3, sub_803b75b8@l
/* 803B7D00 003B4C60 3C 60 80 3B */ lis r3, __DTKCallbackForPreparePaused@ha
/* 803B7D04 003B4C64 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7D08 003B4C68 38 C3 75 B8 */ addi r6, r3, __DTKCallbackForPreparePaused@l
/* 803B7D0C 003B4C6C 38 64 00 14 */ addi r3, r4, 0x14
/* 803B7D10 003B4C70 38 80 00 00 */ li r4, 0
/* 803B7D14 003B4C74 38 A0 00 00 */ li r5, 0
/* 803B7D18 003B4C78 4B FB 9D 6D */ bl DVDPrepareStreamAsync
lbl_803B7D1C:
/* 803B7D1C 003B4C7C 38 00 00 00 */ li r0, 0
/* 803B7D20 003B4C80 90 0D B0 00 */ stw r0, lbl_805A9BC0@sda21(r13)
/* 803B7D20 003B4C80 90 0D B0 00 */ stw r0, __DTKTrackEnded@sda21(r13)
/* 803B7D24 003B4C84 48 00 00 4C */ b lbl_803B7D70
lbl_803B7D28:
/* 803B7D28 003B4C88 38 60 00 00 */ li r3, 0
/* 803B7D2C 003B4C8C 4B FB 53 91 */ bl AISetStreamPlayState
/* 803B7D30 003B4C90 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7D30 003B4C90 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7D34 003B4C94 28 00 00 01 */ cmplwi r0, 1
/* 803B7D38 003B4C98 40 82 00 0C */ bne lbl_803B7D44
/* 803B7D3C 003B4C9C 38 00 00 02 */ li r0, 2
/* 803B7D40 003B4CA0 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7D40 003B4CA0 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
lbl_803B7D44:
/* 803B7D44 003B4CA4 80 6D AF D8 */ lwz r3, lbl_805A9B98@sda21(r13)
/* 803B7D44 003B4CA4 80 6D AF D8 */ lwz r3, __DTKCurrentTrack@sda21(r13)
/* 803B7D48 003B4CA8 28 03 00 00 */ cmplwi r3, 0
/* 803B7D4C 003B4CAC 41 82 00 24 */ beq lbl_803B7D70
/* 803B7D50 003B4CB0 81 83 00 10 */ lwz r12, 0x10(r3)
@ -691,42 +691,42 @@ DTKNextTrack:
/* 803B7D80 003B4CE0 7C 08 02 A6 */ mflr r0
/* 803B7D84 003B4CE4 90 01 00 04 */ stw r0, 4(r1)
/* 803B7D88 003B4CE8 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7D8C 003B4CEC 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7D8C 003B4CEC 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7D90 003B4CF0 28 00 00 03 */ cmplwi r0, 3
/* 803B7D94 003B4CF4 41 82 00 80 */ beq lbl_803B7E14
/* 803B7D98 003B4CF8 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B7D98 003B4CF8 80 0D AF D8 */ lwz r0, __DTKCurrentTrack@sda21(r13)
/* 803B7D9C 003B4CFC 28 00 00 00 */ cmplwi r0, 0
/* 803B7DA0 003B4D00 41 82 00 74 */ beq lbl_803B7E14
/* 803B7DA4 003B4D04 80 6D AF E4 */ lwz r3, lbl_805A9BA4@sda21(r13)
/* 803B7DA4 003B4D04 80 6D AF E4 */ lwz r3, __DTKState@sda21(r13)
/* 803B7DA8 003B4D08 38 00 00 03 */ li r0, 3
/* 803B7DAC 003B4D0C 90 6D AF E8 */ stw r3, lbl_805A9BA8@sda21(r13)
/* 803B7DB0 003B4D10 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7DB4 003B4D14 80 0D AF E8 */ lwz r0, lbl_805A9BA8@sda21(r13)
/* 803B7DAC 003B4D0C 90 6D AF E8 */ stw r3, __DTKTempState@sda21(r13)
/* 803B7DB0 003B4D10 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
/* 803B7DB4 003B4D14 80 0D AF E8 */ lwz r0, __DTKTempState@sda21(r13)
/* 803B7DB8 003B4D18 28 00 00 01 */ cmplwi r0, 1
/* 803B7DBC 003B4D1C 40 82 00 2C */ bne lbl_803B7DE8
/* 803B7DC0 003B4D20 38 60 00 00 */ li r3, 0
/* 803B7DC4 003B4D24 4B FB 55 B9 */ bl AISetStreamVolLeft
/* 803B7DC8 003B4D28 38 60 00 00 */ li r3, 0
/* 803B7DCC 003B4D2C 4B FB 55 DD */ bl AISetStreamVolRight
/* 803B7DD0 003B4D30 3C 60 80 57 */ lis r3, lbl_80569A28@ha
/* 803B7DD4 003B4D34 3C 80 80 3B */ lis r4, sub_803b7944@ha
/* 803B7DD8 003B4D38 38 63 9A 28 */ addi r3, r3, lbl_80569A28@l
/* 803B7DDC 003B4D3C 38 84 79 44 */ addi r4, r4, sub_803b7944@l
/* 803B7DD0 003B4D30 3C 60 80 57 */ lis r3, __block_for_next_track@ha
/* 803B7DD4 003B4D34 3C 80 80 3B */ lis r4, __DTKCallbackForNextTrack@ha
/* 803B7DD8 003B4D38 38 63 9A 28 */ addi r3, r3, __block_for_next_track@l
/* 803B7DDC 003B4D3C 38 84 79 44 */ addi r4, r4, __DTKCallbackForNextTrack@l
/* 803B7DE0 003B4D40 4B FB BE 59 */ bl DVDCancelStreamAsync
/* 803B7DE4 003B4D44 48 00 00 30 */ b lbl_803B7E14
lbl_803B7DE8:
/* 803B7DE8 003B4D48 4B FC 98 79 */ bl OSDisableInterrupts
/* 803B7DEC 003B4D4C 80 8D AF D8 */ lwz r4, lbl_805A9B98@sda21(r13)
/* 803B7DEC 003B4D4C 80 8D AF D8 */ lwz r4, __DTKCurrentTrack@sda21(r13)
/* 803B7DF0 003B4D50 28 04 00 00 */ cmplwi r4, 0
/* 803B7DF4 003B4D54 41 82 00 14 */ beq lbl_803B7E08
/* 803B7DF8 003B4D58 80 04 00 04 */ lwz r0, 4(r4)
/* 803B7DFC 003B4D5C 28 00 00 00 */ cmplwi r0, 0
/* 803B7E00 003B4D60 41 82 00 08 */ beq lbl_803B7E08
/* 803B7E04 003B4D64 90 0D AF D8 */ stw r0, lbl_805A9B98@sda21(r13)
/* 803B7E04 003B4D64 90 0D AF D8 */ stw r0, __DTKCurrentTrack@sda21(r13)
lbl_803B7E08:
/* 803B7E08 003B4D68 4B FC 98 81 */ bl OSRestoreInterrupts
/* 803B7E0C 003B4D6C 80 0D AF E8 */ lwz r0, lbl_805A9BA8@sda21(r13)
/* 803B7E10 003B4D70 90 0D AF E4 */ stw r0, lbl_805A9BA4@sda21(r13)
/* 803B7E0C 003B4D6C 80 0D AF E8 */ lwz r0, __DTKTempState@sda21(r13)
/* 803B7E10 003B4D70 90 0D AF E4 */ stw r0, __DTKState@sda21(r13)
lbl_803B7E14:
/* 803B7E14 003B4D74 80 01 00 0C */ lwz r0, 0xc(r1)
/* 803B7E18 003B4D78 38 21 00 08 */ addi r1, r1, 8
@ -735,7 +735,7 @@ lbl_803B7E14:
.global DTKGetState
DTKGetState:
/* 803B7E24 003B4D84 80 6D AF E4 */ lwz r3, lbl_805A9BA4@sda21(r13)
/* 803B7E24 003B4D84 80 6D AF E4 */ lwz r3, __DTKState@sda21(r13)
/* 803B7E28 003B4D88 4E 80 00 20 */ blr
.global DTKSetVolume
@ -745,9 +745,9 @@ DTKSetVolume:
/* 803B7E34 003B4D94 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 803B7E38 003B4D98 93 E1 00 14 */ stw r31, 0x14(r1)
/* 803B7E3C 003B4D9C 7C 9F 23 78 */ mr r31, r4
/* 803B7E40 003B4DA0 98 6D AF F8 */ stb r3, lbl_805A9BB8@sda21(r13)
/* 803B7E44 003B4DA4 9B ED AF F9 */ stb r31, lbl_805A9BB9@sda21(r13)
/* 803B7E48 003B4DA8 80 0D AF E4 */ lwz r0, lbl_805A9BA4@sda21(r13)
/* 803B7E40 003B4DA0 98 6D AF F8 */ stb r3, __DTKVolumeL@sda21(r13)
/* 803B7E44 003B4DA4 9B ED AF F9 */ stb r31, __DTKVolumeR@sda21(r13)
/* 803B7E48 003B4DA8 80 0D AF E4 */ lwz r0, __DTKState@sda21(r13)
/* 803B7E4C 003B4DAC 28 00 00 01 */ cmplwi r0, 1
/* 803B7E50 003B4DB0 40 82 00 10 */ bne lbl_803B7E60
/* 803B7E54 003B4DB4 4B FB 55 29 */ bl AISetStreamVolLeft

View File

@ -1120,7 +1120,7 @@ lbl_8034B478:
/* 8034B488 003483E8 7F C6 F3 78 */ mr r6, r30
/* 8034B48C 003483EC 80 83 00 00 */ lwz r4, 0(r3)
/* 8034B490 003483F0 80 64 00 54 */ lwz r3, 0x54(r4)
/* 8034B494 003483F4 48 06 C5 81 */ bl sub_803b7a14
/* 8034B494 003483F4 48 06 C5 81 */ bl DTKQueueTrack
/* 8034B498 003483F8 7C 7D 1B 78 */ mr r29, r3
/* 8034B49C 003483FC 38 61 00 0C */ addi r3, r1, 0xc
/* 8034B4A0 00348400 48 00 1F 65 */ bl sub_8034d404
@ -1139,7 +1139,7 @@ lbl_8034B4B4:
/* 8034B4D0 00348430 80 61 00 10 */ lwz r3, 0x10(r1)
/* 8034B4D4 00348434 80 83 00 00 */ lwz r4, 0(r3)
/* 8034B4D8 00348438 80 64 00 54 */ lwz r3, 0x54(r4)
/* 8034B4DC 0034843C 48 06 C5 39 */ bl sub_803b7a14
/* 8034B4DC 0034843C 48 06 C5 39 */ bl DTKQueueTrack
/* 8034B4E0 00348440 7C 7D 1B 78 */ mr r29, r3
/* 8034B4E4 00348444 38 61 00 10 */ addi r3, r1, 0x10
/* 8034B4E8 00348448 48 00 1F 1D */ bl sub_8034d404
@ -3502,4 +3502,3 @@ lbl_803D8210:
.byte 0x4E
.4byte 0x554C4C00
.4byte 0

View File

@ -127,6 +127,7 @@ COMPLETE_OBJECTS = [
"musyx/delay_fx",
"Dolphin/pad/PadClamp",
#"Dolphin/pad/pad",
"Dolphin/dtk",
"Dolphin/card/CARDUnlock",
"Dolphin/card/CARDRdwr",
"Dolphin/card/CARDBlock",

48
include/dolphin/dtk.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef __DTK_H__
#define __DTK_H__
#include <dolphin/types.h>
#include <dolphin/dvd.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*DTKCallback)(u32 eventMask);
typedef void (*DTKFlushCallback)(void);
typedef struct DTKTrack {
struct DTKTrack* prev;
struct DTKTrack* next;
char* fileName;
u32 eventMask;
DTKCallback callback;
DVDFileInfo dvdFileInfo;
} DTKTrack;
void DTKInit(void);
void DTKShutdown(void);
u32 DTKQueueTrack(char* fileName, DTKTrack* track, u32 eventMask, DTKCallback callback);
u32 DTKRemoveTrack(DTKTrack* track);
void DTKFlushTracks(DTKFlushCallback callback);
void DTKSetSampleRate(u32 samplerate);
u32 DTKGetSampleRate(void);
void DTKSetInterruptFrequency(u32 samples);
u32 DTKGetInterruptFrequency(void);
void DTKSetRepeatMode(u32 repeat);
u32 DTKGetRepeatMode(void);
void DTKSetState(u32 state);
u32 DTKGetState(void);
void DTKNextTrack(void);
void DTKPrevTrack(void);
u32 DTKGetPosition(void);
DTKTrack* DTKGetCurrentTrack(void);
void DTKSetVolume(u8 left, u8 right);
u16 DTKGetVolume(void);
#ifdef __cplusplus
}
#endif
#endif // __DTK_H__

View File

@ -38,9 +38,33 @@ struct DVDCommandBlock {
typedef struct DVDFileInfo DVDFileInfo;
typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo);
struct DVDFileInfo {
u32 startAddr;
u32 length;
DVDCallback callback;
};
void DVDSetAutoFatalMessaging(BOOL);
void DVDReset();
BOOL DVDPrepareStreamAsync(DVDFileInfo *fInfo, u32 length, u32 offset, DVDCallback callback);
s32 DVDPrepareStream(DVDFileInfo *fInfo, u32 length, u32 offset);
BOOL DVDCancelStreamAsync(DVDCommandBlock *block, DVDCBCallback callback);
s32 DVDCancelStream(DVDCommandBlock *block);
BOOL DVDStopStreamAtEndAsync(DVDCommandBlock *block, DVDCBCallback callback);
s32 DVDStopStreamAtEnd(DVDCommandBlock *block);
BOOL DVDGetStreamErrorStatusAsync(DVDCommandBlock *block, DVDCBCallback callback);
s32 DVDGetStreamErrorStatus(DVDCommandBlock *block);
BOOL DVDGetStreamPlayAddrAsync(DVDCommandBlock *block, DVDCBCallback callback);
s32 DVDGetStreamPlayAddr(DVDCommandBlock *block);
#ifdef __cplusplus
}
#endif

View File

@ -812,7 +812,7 @@ MUSYX_FILES :=\
$(BUILD_DIR)/asm/musyx/chorus_fx.o\
DTK_FILES :=\
$(BUILD_DIR)/asm/Dolphin/dtk.o
$(BUILD_DIR)/src/Dolphin/dtk.ep.o
CARD_FILES :=\
$(BUILD_DIR)/asm/Dolphin/card/CARDBios.o\

359
src/Dolphin/dtk.c Normal file
View File

@ -0,0 +1,359 @@
#include <dolphin/ai.h>
#include <dolphin/dtk.h>
static DVDCommandBlock __block_for_run_callback;
static DVDCommandBlock __block_for_prep_callback;
static DVDCommandBlock __block_for_stream_status;
static DVDCommandBlock __block_for_ais_isr;
static DVDCommandBlock __block_for_flushtracks;
static DVDCommandBlock __block_for_set_state;
static DVDCommandBlock __block_for_next_track;
static DTKTrack* __DTKCurrentTrack;
static DTKTrack* __DTKPlayListHead;
static DTKTrack* __DTKPlayListTail;
static vu32 __DTKState;
static vu32 __DTKTempState;
static vu32 __DTKRepeatMode;
static vu32 __DTKPosition;
static vu32 __DTKInterruptFrequency;
static vu8 __DTKVolumeL;
static vu8 __DTKVolumeR;
static volatile u32 __DTKShutdownFlag;
static volatile u32 __DTKTrackEnded;
static DTKFlushCallback __DTKFlushCallback;
static void __DTKStartAi() {
AISetStreamVolLeft(__DTKVolumeL);
AISetStreamVolRight(__DTKVolumeR);
AIResetStreamSampleCount();
AISetStreamTrigger(__DTKInterruptFrequency);
AISetStreamPlayState(1);
}
static void __DTKStopAi() {
AISetStreamVolLeft(0);
AISetStreamVolRight(0);
AISetStreamPlayState(0);
}
static void __DTKCheckUserCallback(DTKTrack* track, u32 event) {
if (track == NULL) {
return;
}
if (track->callback != NULL && (track->eventMask & event) != 0) {
track->callback(track->eventMask & event);
}
}
static void __DTKForward() {
BOOL enabled;
enabled = OSDisableInterrupts();
if (__DTKCurrentTrack != NULL && __DTKCurrentTrack->next != nullptr) {
__DTKCurrentTrack = __DTKCurrentTrack->next;
}
OSRestoreInterrupts(enabled);
}
static void __DTKBackward() {
BOOL enabled;
enabled = OSDisableInterrupts();
if (__DTKCurrentTrack != NULL && __DTKCurrentTrack->prev != nullptr) {
__DTKCurrentTrack = __DTKCurrentTrack->prev;
}
OSRestoreInterrupts(enabled);
}
static void __DTKCallbackForStreamStatus(s32 result, DVDCommandBlock* block) {
if ((u8)result) {
return;
}
__DTKTrackEnded = TRUE;
__DTKPosition = 0;
}
static void __DTKCallbackForRun(s32 result, DVDFileInfo* fileInfo) {
__DTKStartAi();
DVDStopStreamAtEndAsync(&__block_for_run_callback, NULL);
__DTKState = 1;
__DTKCheckUserCallback(__DTKCurrentTrack, 1);
}
static void __DTKCallbackForPreparePaused(s32 result, DVDFileInfo* fileInfo) {
__DTKStopAi();
DVDStopStreamAtEndAsync(&__block_for_prep_callback, NULL);
__DTKState = 2;
__DTKCheckUserCallback(__DTKCurrentTrack, 32);
}
static void __DTKPrepareCurrentTrack(DVDCallback callback) {
DVDPrepareStreamAsync(&__DTKCurrentTrack->dvdFileInfo, 0, 0, callback);
}
static void __DTKCallbackForPlaylist(s32 result, DVDCommandBlock* block) {
__DTKPosition = result;
if (__DTKTrackEnded != FALSE) {
__DTKTrackEnded = FALSE;
__DTKCheckUserCallback(__DTKCurrentTrack, 16);
__DTKState = 3;
switch (__DTKRepeatMode) {
case 0:
if (__DTKCurrentTrack == NULL) {
break;
}
if (__DTKCurrentTrack->next != NULL) {
__DTKCurrentTrack = __DTKCurrentTrack->next;
__DTKStopAi();
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
} else {
__DTKCurrentTrack = __DTKPlayListHead;
__DTKStopAi();
__DTKState = 0;
}
break;
case 1: {
if (__DTKCurrentTrack == NULL) {
break;
}
if (__DTKCurrentTrack->next != NULL) {
__DTKCurrentTrack = __DTKCurrentTrack->next;
__DTKStopAi();
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
} else {
__DTKCurrentTrack = __DTKPlayListHead;
__DTKStopAi();
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
}
break;
}
case 2: {
if (__DTKCurrentTrack == NULL) {
break;
}
__DTKStopAi();
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
break;
}
}
return;
}
DVDGetStreamErrorStatusAsync(&__block_for_stream_status, __DTKCallbackForStreamStatus);
}
static void __DTKCallbackForAIInterrupt(u32 result) {
AISetStreamTrigger(result + __DTKInterruptFrequency);
if (__DTKCurrentTrack != NULL) {
DVDGetStreamPlayAddrAsync(&__block_for_ais_isr, __DTKCallbackForPlaylist);
}
}
static void __DTKCallbackForFlush(s32 result, DVDCommandBlock* block) {
DTKTrack* iter;
AISetStreamPlayState(0);
for (iter = __DTKPlayListHead; iter != NULL; iter = iter->next) {
DVDClose(&iter->dvdFileInfo);
}
__DTKPlayListHead = NULL;
__DTKPlayListTail = NULL;
__DTKCurrentTrack = NULL;
__DTKState = 0;
if (__DTKFlushCallback != NULL) {
__DTKFlushCallback();
__DTKFlushCallback = NULL;
}
__DTKState = 0;
__DTKShutdownFlag = 0;
}
static void __DTKCallbackForStop() {
__DTKCheckUserCallback(__DTKCurrentTrack, 2);
__DTKState = 0;
}
static void __DTKCallbackForNextTrack() {
AISetStreamPlayState(0);
__DTKForward();
__DTKState = 0;
DTKSetState(__DTKTempState);
}
static void __DTKCallbackForPrevTrack() {
AISetStreamPlayState(0);
__DTKBackward();
__DTKState = 0;
DTKSetState(__DTKTempState);
}
void DTKInit() {
__DTKCurrentTrack = NULL;
__DTKPlayListHead = NULL;
__DTKPlayListTail = NULL;
__DTKState = 0;
__DTKRepeatMode = 0;
__DTKPosition = 0;
__DTKInterruptFrequency = 48000;
__DTKVolumeL = 255;
__DTKVolumeR = 255;
AISetStreamVolLeft(0);
AISetStreamVolRight(0);
AIRegisterStreamCallback(__DTKCallbackForAIInterrupt);
AIResetStreamSampleCount();
AISetStreamPlayState(0);
}
u32 DTKQueueTrack(char* fileName, DTKTrack* track, u32 eventMask, DTKCallback callback) {
BOOL enabled;
u32 prepareTrack = FALSE;
if (DVDOpen(fileName, &track->dvdFileInfo) == 0) {
return 1;
}
enabled = OSDisableInterrupts();
track->fileName = fileName;
track->eventMask = eventMask;
track->callback = callback;
if (__DTKPlayListHead == NULL) {
__DTKPlayListHead = track;
__DTKPlayListTail = track;
track->prev = NULL;
track->next = NULL;
if (__DTKState == 1) {
prepareTrack = TRUE;
}
} else {
__DTKPlayListTail->next = track;
track->prev = __DTKPlayListTail;
__DTKPlayListTail = track;
track->next = NULL;
}
if (__DTKCurrentTrack == NULL) {
__DTKCurrentTrack = track;
}
OSRestoreInterrupts(enabled);
__DTKCheckUserCallback(track, 8);
if (prepareTrack != 0) {
__DTKState = 3;
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
}
return 0;
}
void DTKFlushTracks(DTKFlushCallback callback) {
u32 oldState;
if (__DTKState != 3) {
oldState = __DTKState;
__DTKState = 3;
__DTKFlushCallback = callback;
if (oldState == 1) {
DVDCancelStreamAsync(&__block_for_flushtracks, __DTKCallbackForFlush);
} else {
__DTKCallbackForFlush(0, NULL);
}
}
}
void DTKSetSampleRate(u32 rate) {}
void DTKSetRepeatMode(u32 repeat) { __DTKRepeatMode = repeat; }
void DTKSetState(u32 state) {
if (__DTKState == state || __DTKState == 3) {
return;
}
switch (state) {
case 0: {
if (__DTKCurrentTrack == NULL) {
break;
}
__DTKState = 3;
AISetStreamVolLeft(0);
AISetStreamVolRight(0);
AISetStreamPlayState(0);
DVDCancelStreamAsync(&__block_for_set_state, __DTKCallbackForStop);
break;
}
case 1: {
if (__DTKState == 2) {
__DTKStartAi();
__DTKState = 1;
if (__DTKCurrentTrack != NULL) {
__DTKCheckUserCallback(__DTKCurrentTrack, 1);
}
} else if (__DTKCurrentTrack != NULL) {
__DTKState = 3;
__DTKPrepareCurrentTrack(__DTKCallbackForRun);
} else {
__DTKState = 1;
}
__DTKTrackEnded = 0;
break;
}
case 4: {
if (__DTKState != 0) {
break;
}
if (__DTKCurrentTrack != NULL) {
__DTKState = 3;
__DTKPrepareCurrentTrack(__DTKCallbackForPreparePaused);
}
__DTKTrackEnded = FALSE;
break;
}
case 2: {
AISetStreamPlayState(0);
if (__DTKState == 1) {
__DTKState = 2;
}
__DTKCheckUserCallback(__DTKCurrentTrack, 4);
break;
}
}
}
void DTKNextTrack() {
if (__DTKState != 3 && __DTKCurrentTrack != NULL) {
__DTKTempState = __DTKState;
__DTKState = 3;
if (__DTKTempState == 1) {
AISetStreamVolLeft(0);
AISetStreamVolRight(0);
DVDCancelStreamAsync(&__block_for_next_track, __DTKCallbackForNextTrack);
} else {
__DTKForward();
__DTKState = __DTKTempState;
}
}
}
u32 DTKGetState() {
return __DTKState;
}
void DTKSetVolume(u8 left, u8 right) {
__DTKVolumeL = left;
__DTKVolumeR = right;
if (__DTKState == 1) {
AISetStreamVolLeft(left);
AISetStreamVolRight(right);
}
}