Various imps

Former-commit-id: 7043befead
This commit is contained in:
Phillip Stephens 2022-08-05 03:23:49 -07:00
parent a889a5b919
commit 3a23f40720
22 changed files with 981 additions and 126 deletions

View File

@ -102,9 +102,10 @@ ifeq ($(VERBOSE),0)
# this set of LDFLAGS generates no warnings.
LDFLAGS := $(MAPGEN) -fp fmadd -nodefaults -w off
endif
CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -fp_contract on -str reuse,pool,readonly -O4,p -maxerrors 1 -use_lmw_stmw on -enum int -inline auto -MMD $(INCLUDES)
CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -MMD $(INCLUDES)
CFLAGS_MUSYX = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -O4,p -maxerrors 1 -enum int -inline auto -MMD $(INCLUDES)
CFLAGS = $(CFLAGS_1.2) -gccinc -inline deferred,noauto
CFLAGS = $(CFLAGS_1.2) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto
CFLAGS_1.2 += -str reuse
ifeq ($(VERBOSE),0)
# this set of ASFLAGS generates no warnings.
@ -117,6 +118,8 @@ $(BUILD_DIR)/src/MetroTRK/mslsupp.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/MetroTRK/mslsupp.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/PPCArch.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/PPCArch.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/ai.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/ai.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/os/OSReset.o: MWCC_VERSION := 1.2.5
@ -133,6 +136,7 @@ $(BUILD_DIR)/src/musyx/hw_memory.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/reverb_fx.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/delay_fx.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/creverb_fx.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/synth_ac.o: CFLAGS := $(CFLAGS_MUSYX)
#-------------------------------------------------------------------------------

View File

@ -14,38 +14,28 @@ lbl_805A8A68:
.4byte 0
.section .sbss
lbl_805A96B8:
__AIS_Callback:
.skip 0x4
lbl_805A96BC:
__AID_Callback:
.skip 0x4
lbl_805A96C0:
__CallbackStack:
.skip 0x4
lbl_805A96C4:
__OldStack:
.skip 0x4
lbl_805A96C8:
__AI_init_flag:
.skip 0x4
lbl_805A96CC:
.skip 0x4
lbl_805A96D0:
.skip 0x4
lbl_805A96D4:
.skip 0x4
lbl_805A96D8:
.skip 0x4
lbl_805A96DC:
.skip 0x4
lbl_805A96E0:
.skip 0x4
lbl_805A96E4:
.skip 0x4
lbl_805A96E8:
.skip 0x4
lbl_805A96EC:
.skip 0x4
lbl_805A96F0:
.skip 0x4
lbl_805A96F4:
__AID_Active:
.skip 0x4
bound_32KHz:
.skip 0x8
bound_48KHz:
.skip 0x8
min_wait:
.skip 0x8
max_wait:
.skip 0x8
buffer:
.skip 0x8
.section .text, "ax"
@ -57,9 +47,9 @@ AIRegisterDMACallback:
/* 8036CF48 00369EA8 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8036CF4C 00369EAC 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8036CF50 00369EB0 7C 7E 1B 78 */ mr r30, r3
/* 8036CF54 00369EB4 83 ED AA FC */ lwz r31, lbl_805A96BC@sda21(r13)
/* 8036CF54 00369EB4 83 ED AA FC */ lwz r31, __AID_Callback@sda21(r13)
/* 8036CF58 00369EB8 48 01 47 09 */ bl OSDisableInterrupts
/* 8036CF5C 00369EBC 93 CD AA FC */ stw r30, lbl_805A96BC@sda21(r13)
/* 8036CF5C 00369EBC 93 CD AA FC */ stw r30, __AID_Callback@sda21(r13)
/* 8036CF60 00369EC0 48 01 47 29 */ bl OSRestoreInterrupts
/* 8036CF64 00369EC4 7F E3 FB 78 */ mr r3, r31
/* 8036CF68 00369EC8 80 01 00 1C */ lwz r0, 0x1c(r1)
@ -142,9 +132,9 @@ AIRegisterStreamCallback:
/* 8036D060 00369FC0 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8036D064 00369FC4 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8036D068 00369FC8 7C 7E 1B 78 */ mr r30, r3
/* 8036D06C 00369FCC 83 ED AA F8 */ lwz r31, lbl_805A96B8@sda21(r13)
/* 8036D06C 00369FCC 83 ED AA F8 */ lwz r31, __AIS_Callback@sda21(r13)
/* 8036D070 00369FD0 48 01 45 F1 */ bl OSDisableInterrupts
/* 8036D074 00369FD4 93 CD AA F8 */ stw r30, lbl_805A96B8@sda21(r13)
/* 8036D074 00369FD4 93 CD AA F8 */ stw r30, __AIS_Callback@sda21(r13)
/* 8036D078 00369FD8 48 01 46 11 */ bl OSRestoreInterrupts
/* 8036D07C 00369FDC 7F E3 FB 78 */ mr r3, r31
/* 8036D080 00369FE0 80 01 00 1C */ lwz r0, 0x1c(r1)
@ -154,8 +144,8 @@ AIRegisterStreamCallback:
/* 8036D090 00369FF0 7C 08 03 A6 */ mtlr r0
/* 8036D094 00369FF4 4E 80 00 20 */ blr
.global sub_8036d098
sub_8036d098:
.global AIResetStreamSampleCount
AIResetStreamSampleCount:
/* 8036D098 00369FF8 3C 60 CC 00 */ lis r3, 0xCC006C00@ha
/* 8036D09C 00369FFC 80 03 6C 00 */ lwz r0, 0xCC006C00@l(r3)
/* 8036D0A0 0036A000 54 00 06 F2 */ rlwinm r0, r0, 0, 0x1b, 0x19
@ -163,8 +153,8 @@ sub_8036d098:
/* 8036D0A8 0036A008 90 03 6C 00 */ stw r0, 0x6c00(r3)
/* 8036D0AC 0036A00C 4E 80 00 20 */ blr
.global SetTRKConnected
SetTRKConnected:
.global AISetStreamTrigger
AISetStreamTrigger:
/* 8036D0B0 0036A010 3C 80 CC 00 */ lis r4, 0xCC006C0C@ha
/* 8036D0B4 0036A014 90 64 6C 0C */ stw r3, 0xCC006C0C@l(r4)
/* 8036D0B8 0036A018 4E 80 00 20 */ blr
@ -409,7 +399,7 @@ AIInit:
/* 8036D3E0 0036A340 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8036D3E4 0036A344 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8036D3E8 0036A348 3B C3 00 00 */ addi r30, r3, 0
/* 8036D3EC 0036A34C 80 0D AB 08 */ lwz r0, lbl_805A96C8@sda21(r13)
/* 8036D3EC 0036A34C 80 0D AB 08 */ lwz r0, __AI_init_flag@sda21(r13)
/* 8036D3F0 0036A350 2C 00 00 01 */ cmpwi r0, 1
/* 8036D3F4 0036A354 41 82 01 34 */ beq lbl_8036D528
/* 8036D3F8 0036A358 80 6D 9E A8 */ lwz r3, lbl_805A8A68@sda21(r13)
@ -439,25 +429,25 @@ AIInit:
/* 8036D458 0036A3B8 7C 6A 18 16 */ mulhwu r3, r10, r3
/* 8036D45C 0036A3BC 55 08 BA 7E */ srwi r8, r8, 9
/* 8036D460 0036A3C0 54 E7 BA 7E */ srwi r7, r7, 9
/* 8036D464 0036A3C4 91 0D AB 14 */ stw r8, lbl_805A96D4@sda21(r13)
/* 8036D464 0036A3C4 91 0D AB 14 */ stw r8, bound_32KHz+4@sda21(r13)
/* 8036D468 0036A3C8 54 A5 BA 7E */ srwi r5, r5, 9
/* 8036D46C 0036A3CC 54 84 BA 7E */ srwi r4, r4, 9
/* 8036D470 0036A3D0 90 ED AB 1C */ stw r7, lbl_805A96DC@sda21(r13)
/* 8036D470 0036A3D0 90 ED AB 1C */ stw r7, bound_48KHz+4@sda21(r13)
/* 8036D474 0036A3D4 3B E0 00 00 */ li r31, 0
/* 8036D478 0036A3D8 54 63 BA 7E */ srwi r3, r3, 9
/* 8036D47C 0036A3DC 90 AD AB 24 */ stw r5, lbl_805A96E4@sda21(r13)
/* 8036D47C 0036A3DC 90 AD AB 24 */ stw r5, min_wait+4@sda21(r13)
/* 8036D480 0036A3E0 3C C0 CC 00 */ lis r6, 0xCC006C00@ha
/* 8036D484 0036A3E4 90 6D AB 34 */ stw r3, lbl_805A96F4@sda21(r13)
/* 8036D484 0036A3E4 90 6D AB 34 */ stw r3, buffer+4@sda21(r13)
/* 8036D488 0036A3E8 38 60 00 01 */ li r3, 1
/* 8036D48C 0036A3EC 80 06 6C 00 */ lwz r0, 0xCC006C00@l(r6)
/* 8036D490 0036A3F0 90 8D AB 2C */ stw r4, lbl_805A96EC@sda21(r13)
/* 8036D490 0036A3F0 90 8D AB 2C */ stw r4, max_wait+4@sda21(r13)
/* 8036D494 0036A3F4 54 00 06 F2 */ rlwinm r0, r0, 0, 0x1b, 0x19
/* 8036D498 0036A3F8 60 00 00 20 */ ori r0, r0, 0x20
/* 8036D49C 0036A3FC 93 ED AB 10 */ stw r31, lbl_805A96D0@sda21(r13)
/* 8036D4A0 0036A400 93 ED AB 18 */ stw r31, lbl_805A96D8@sda21(r13)
/* 8036D4A4 0036A404 93 ED AB 20 */ stw r31, lbl_805A96E0@sda21(r13)
/* 8036D4A8 0036A408 93 ED AB 28 */ stw r31, lbl_805A96E8@sda21(r13)
/* 8036D4AC 0036A40C 93 ED AB 30 */ stw r31, lbl_805A96F0@sda21(r13)
/* 8036D49C 0036A3FC 93 ED AB 10 */ stw r31, bound_32KHz@sda21(r13)
/* 8036D4A0 0036A400 93 ED AB 18 */ stw r31, bound_48KHz@sda21(r13)
/* 8036D4A4 0036A404 93 ED AB 20 */ stw r31, min_wait@sda21(r13)
/* 8036D4A8 0036A408 93 ED AB 28 */ stw r31, max_wait@sda21(r13)
/* 8036D4AC 0036A40C 93 ED AB 30 */ stw r31, buffer@sda21(r13)
/* 8036D4B0 0036A410 80 A6 6C 04 */ lwz r5, 0x6c04(r6)
/* 8036D4B4 0036A414 90 06 6C 00 */ stw r0, 0x6c00(r6)
/* 8036D4B8 0036A418 54 A0 06 1E */ rlwinm r0, r5, 0, 0x18, 0xf
@ -472,11 +462,11 @@ AIInit:
/* 8036D4DC 0036A43C 38 60 00 00 */ li r3, 0
/* 8036D4E0 0036A440 4B FF FC C5 */ bl AISetDSPSampleRate
/* 8036D4E4 0036A444 3C 60 80 37 */ lis r3, __AIDHandler@ha
/* 8036D4E8 0036A448 93 ED AA F8 */ stw r31, lbl_805A96B8@sda21(r13)
/* 8036D4E8 0036A448 93 ED AA F8 */ stw r31, __AIS_Callback@sda21(r13)
/* 8036D4EC 0036A44C 38 83 D5 BC */ addi r4, r3, __AIDHandler@l
/* 8036D4F0 0036A450 93 ED AA FC */ stw r31, lbl_805A96BC@sda21(r13)
/* 8036D4F0 0036A450 93 ED AA FC */ stw r31, __AID_Callback@sda21(r13)
/* 8036D4F4 0036A454 38 60 00 05 */ li r3, 5
/* 8036D4F8 0036A458 93 CD AB 00 */ stw r30, lbl_805A96C0@sda21(r13)
/* 8036D4F8 0036A458 93 CD AB 00 */ stw r30, __CallbackStack@sda21(r13)
/* 8036D4FC 0036A45C 48 01 41 B1 */ bl __OSSetInterruptHandler
/* 8036D500 0036A460 3C 60 04 00 */ lis r3, 0x400
/* 8036D504 0036A464 48 01 45 AD */ bl __OSUnmaskInterrupts
@ -487,7 +477,7 @@ AIInit:
/* 8036D518 0036A478 3C 60 00 80 */ lis r3, 0x80
/* 8036D51C 0036A47C 48 01 45 95 */ bl __OSUnmaskInterrupts
/* 8036D520 0036A480 38 00 00 01 */ li r0, 1
/* 8036D524 0036A484 90 0D AB 08 */ stw r0, lbl_805A96C8@sda21(r13)
/* 8036D524 0036A484 90 0D AB 08 */ stw r0, __AI_init_flag@sda21(r13)
lbl_8036D528:
/* 8036D528 0036A488 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8036D52C 0036A48C 83 E1 00 14 */ lwz r31, 0x14(r1)
@ -512,7 +502,7 @@ __AISHandler:
/* 8036D56C 0036A4CC 48 01 20 A9 */ bl OSClearContext
/* 8036D570 0036A4D0 38 61 00 10 */ addi r3, r1, 0x10
/* 8036D574 0036A4D4 48 01 1E A9 */ bl OSSetCurrentContext
/* 8036D578 0036A4D8 81 8D AA F8 */ lwz r12, lbl_805A96B8@sda21(r13)
/* 8036D578 0036A4D8 81 8D AA F8 */ lwz r12, __AIS_Callback@sda21(r13)
/* 8036D57C 0036A4DC 28 0C 00 00 */ cmplwi r12, 0
/* 8036D580 0036A4E0 41 82 00 14 */ beq lbl_8036D594
/* 8036D584 0036A4E4 38 7F 6C 00 */ addi r3, r31, 0x6c00
@ -549,15 +539,15 @@ __AIDHandler:
/* 8036D5F0 0036A550 48 01 20 25 */ bl OSClearContext
/* 8036D5F4 0036A554 38 61 00 10 */ addi r3, r1, 0x10
/* 8036D5F8 0036A558 48 01 1E 25 */ bl OSSetCurrentContext
/* 8036D5FC 0036A55C 80 6D AA FC */ lwz r3, lbl_805A96BC@sda21(r13)
/* 8036D5FC 0036A55C 80 6D AA FC */ lwz r3, __AID_Callback@sda21(r13)
/* 8036D600 0036A560 28 03 00 00 */ cmplwi r3, 0
/* 8036D604 0036A564 41 82 00 40 */ beq lbl_8036D644
/* 8036D608 0036A568 80 0D AB 0C */ lwz r0, lbl_805A96CC@sda21(r13)
/* 8036D608 0036A568 80 0D AB 0C */ lwz r0, __AID_Active@sda21(r13)
/* 8036D60C 0036A56C 2C 00 00 00 */ cmpwi r0, 0
/* 8036D610 0036A570 40 82 00 34 */ bne lbl_8036D644
/* 8036D614 0036A574 80 0D AB 00 */ lwz r0, lbl_805A96C0@sda21(r13)
/* 8036D614 0036A574 80 0D AB 00 */ lwz r0, __CallbackStack@sda21(r13)
/* 8036D618 0036A578 38 80 00 01 */ li r4, 1
/* 8036D61C 0036A57C 90 8D AB 0C */ stw r4, lbl_805A96CC@sda21(r13)
/* 8036D61C 0036A57C 90 8D AB 0C */ stw r4, __AID_Active@sda21(r13)
/* 8036D620 0036A580 28 00 00 00 */ cmplwi r0, 0
/* 8036D624 0036A584 41 82 00 0C */ beq lbl_8036D630
/* 8036D628 0036A588 48 00 00 41 */ bl __AICallbackStackSwitch
@ -568,7 +558,7 @@ lbl_8036D630:
/* 8036D638 0036A598 4E 80 00 21 */ blrl
lbl_8036D63C:
/* 8036D63C 0036A59C 38 00 00 00 */ li r0, 0
/* 8036D640 0036A5A0 90 0D AB 0C */ stw r0, lbl_805A96CC@sda21(r13)
/* 8036D640 0036A5A0 90 0D AB 0C */ stw r0, __AID_Active@sda21(r13)
lbl_8036D644:
/* 8036D644 0036A5A4 38 61 00 10 */ addi r3, r1, 0x10
/* 8036D648 0036A5A8 48 01 1F CD */ bl OSClearContext
@ -587,17 +577,17 @@ __AICallbackStackSwitch:
/* 8036D670 0036A5D0 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8036D674 0036A5D4 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8036D678 0036A5D8 7C 7F 1B 78 */ mr r31, r3
/* 8036D67C 0036A5DC 3C A0 80 5B */ lis r5, lbl_805A96C4@ha
/* 8036D680 0036A5E0 38 A5 96 C4 */ addi r5, r5, lbl_805A96C4@l
/* 8036D67C 0036A5DC 3C A0 80 5B */ lis r5, __OldStack@ha
/* 8036D680 0036A5E0 38 A5 96 C4 */ addi r5, r5, __OldStack@l
/* 8036D684 0036A5E4 90 25 00 00 */ stw r1, 0(r5)
/* 8036D688 0036A5E8 3C A0 80 5B */ lis r5, lbl_805A96C0@ha
/* 8036D68C 0036A5EC 38 A5 96 C0 */ addi r5, r5, lbl_805A96C0@l
/* 8036D688 0036A5E8 3C A0 80 5B */ lis r5, __CallbackStack@ha
/* 8036D68C 0036A5EC 38 A5 96 C0 */ addi r5, r5, __CallbackStack@l
/* 8036D690 0036A5F0 80 25 00 00 */ lwz r1, 0(r5)
/* 8036D694 0036A5F4 38 21 FF F8 */ addi r1, r1, -8
/* 8036D698 0036A5F8 7F E8 03 A6 */ mtlr r31
/* 8036D69C 0036A5FC 4E 80 00 21 */ blrl
/* 8036D6A0 0036A600 3C A0 80 5B */ lis r5, lbl_805A96C4@ha
/* 8036D6A4 0036A604 38 A5 96 C4 */ addi r5, r5, lbl_805A96C4@l
/* 8036D6A0 0036A600 3C A0 80 5B */ lis r5, __OldStack@ha
/* 8036D6A4 0036A604 38 A5 96 C4 */ addi r5, r5, __OldStack@l
/* 8036D6A8 0036A608 80 25 00 00 */ lwz r1, 0(r5)
/* 8036D6AC 0036A60C 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8036D6B0 0036A610 83 E1 00 14 */ lwz r31, 0x14(r1)
@ -665,15 +655,15 @@ lbl_8036D778:
/* 8036D780 0036A6E0 41 82 FF F8 */ beq lbl_8036D778
/* 8036D784 0036A6E4 48 01 7C 25 */ bl OSGetTime
/* 8036D788 0036A6E8 7D 1A 20 10 */ subfc r8, r26, r4
/* 8036D78C 0036A6EC 81 8D AB 14 */ lwz r12, lbl_805A96D4@sda21(r13)
/* 8036D78C 0036A6EC 81 8D AB 14 */ lwz r12, bound_32KHz+4@sda21(r13)
/* 8036D790 0036A6F0 80 BF 6C 00 */ lwz r5, 0x6c00(r31)
/* 8036D794 0036A6F4 7C FB 19 10 */ subfe r7, r27, r3
/* 8036D798 0036A6F8 81 4D AB 34 */ lwz r10, lbl_805A96F4@sda21(r13)
/* 8036D798 0036A6F8 81 4D AB 34 */ lwz r10, buffer+4@sda21(r13)
/* 8036D79C 0036A6FC 6C E7 80 00 */ xoris r7, r7, 0x8000
/* 8036D7A0 0036A700 54 A5 07 FA */ rlwinm r5, r5, 0, 0x1f, 0x1d
/* 8036D7A4 0036A704 81 6D AB 10 */ lwz r11, lbl_805A96D0@sda21(r13)
/* 8036D7A4 0036A704 81 6D AB 10 */ lwz r11, bound_32KHz@sda21(r13)
/* 8036D7A8 0036A708 7C CA 60 10 */ subfc r6, r10, r12
/* 8036D7AC 0036A70C 81 2D AB 30 */ lwz r9, lbl_805A96F0@sda21(r13)
/* 8036D7AC 0036A70C 81 2D AB 30 */ lwz r9, buffer@sda21(r13)
/* 8036D7B0 0036A710 90 BF 6C 00 */ stw r5, 0x6c00(r31)
/* 8036D7B4 0036A714 7C 09 59 10 */ subfe r0, r9, r11
/* 8036D7B8 0036A718 6C 05 80 00 */ xoris r5, r0, 0x8000
@ -686,9 +676,9 @@ lbl_8036D778:
/* 8036D7D4 0036A734 2C 05 00 00 */ cmpwi r5, 0
/* 8036D7D8 0036A738 90 1F 6C 00 */ stw r0, 0x6c00(r31)
/* 8036D7DC 0036A73C 41 82 00 14 */ beq lbl_8036D7F0
/* 8036D7E0 0036A740 83 AD AB 20 */ lwz r29, lbl_805A96E0@sda21(r13)
/* 8036D7E0 0036A740 83 AD AB 20 */ lwz r29, min_wait@sda21(r13)
/* 8036D7E4 0036A744 38 00 00 01 */ li r0, 1
/* 8036D7E8 0036A748 83 8D AB 24 */ lwz r28, lbl_805A96E4@sda21(r13)
/* 8036D7E8 0036A748 83 8D AB 24 */ lwz r28, min_wait+4@sda21(r13)
/* 8036D7EC 0036A74C 48 00 00 68 */ b lbl_8036D854
lbl_8036D7F0:
/* 8036D7F0 0036A750 7C CC 50 14 */ addc r6, r12, r10
@ -700,8 +690,8 @@ lbl_8036D7F0:
/* 8036D808 0036A768 7C A5 00 D0 */ neg r5, r5
/* 8036D80C 0036A76C 2C 05 00 00 */ cmpwi r5, 0
/* 8036D810 0036A770 40 82 00 40 */ bne lbl_8036D850
/* 8036D814 0036A774 80 AD AB 1C */ lwz r5, lbl_805A96DC@sda21(r13)
/* 8036D818 0036A778 80 0D AB 18 */ lwz r0, lbl_805A96D8@sda21(r13)
/* 8036D814 0036A774 80 AD AB 1C */ lwz r5, bound_48KHz+4@sda21(r13)
/* 8036D818 0036A778 80 0D AB 18 */ lwz r0, bound_48KHz@sda21(r13)
/* 8036D81C 0036A77C 7C CA 28 10 */ subfc r6, r10, r5
/* 8036D820 0036A780 7C 09 01 10 */ subfe r0, r9, r0
/* 8036D824 0036A784 6C 05 80 00 */ xoris r5, r0, 0x8000
@ -711,9 +701,9 @@ lbl_8036D7F0:
/* 8036D834 0036A794 7C A5 00 D0 */ neg r5, r5
/* 8036D838 0036A798 2C 05 00 00 */ cmpwi r5, 0
/* 8036D83C 0036A79C 41 82 00 14 */ beq lbl_8036D850
/* 8036D840 0036A7A0 83 AD AB 28 */ lwz r29, lbl_805A96E8@sda21(r13)
/* 8036D840 0036A7A0 83 AD AB 28 */ lwz r29, max_wait@sda21(r13)
/* 8036D844 0036A7A4 38 00 00 01 */ li r0, 1
/* 8036D848 0036A7A8 83 8D AB 2C */ lwz r28, lbl_805A96EC@sda21(r13)
/* 8036D848 0036A7A8 83 8D AB 2C */ lwz r28, max_wait+4@sda21(r13)
/* 8036D84C 0036A7AC 48 00 00 08 */ b lbl_8036D854
lbl_8036D850:
/* 8036D850 0036A7B0 38 00 00 00 */ li r0, 0

View File

@ -1,6 +1,7 @@
.include "macros.inc"
.section .data
.balign 8
.global ARVersionString
ARVersionString:
.asciz "<< Dolphin SDK - AR\trelease build: Sep 5 2002 05:34:27 (0x2301) >>"

View File

@ -297,7 +297,7 @@ lbl_803B81E0:
/* 803B81FC 003B515C 7C 60 00 34 */ cntlzw r0, r3
/* 803B8200 003B5160 38 7E 00 00 */ addi r3, r30, 0
/* 803B8204 003B5164 54 1F D9 7E */ srwi r31, r0, 5
/* 803B8208 003B5168 48 00 82 E9 */ bl sub_803c04f0
/* 803B8208 003B5168 48 00 82 E9 */ bl EXISync
/* 803B820C 003B516C 7C 60 00 34 */ cntlzw r0, r3
/* 803B8210 003B5170 54 00 D9 7E */ srwi r0, r0, 5
/* 803B8214 003B5174 38 7E 00 00 */ addi r3, r30, 0
@ -348,7 +348,7 @@ lbl_803B8290:
/* 803B82B0 003B5210 7C 60 00 34 */ cntlzw r0, r3
/* 803B82B4 003B5214 38 7D 00 00 */ addi r3, r29, 0
/* 803B82B8 003B5218 54 1F D9 7E */ srwi r31, r0, 5
/* 803B82BC 003B521C 48 00 82 35 */ bl sub_803c04f0
/* 803B82BC 003B521C 48 00 82 35 */ bl EXISync
/* 803B82C0 003B5220 7C 60 00 34 */ cntlzw r0, r3
/* 803B82C4 003B5224 54 00 D9 7E */ srwi r0, r0, 5
/* 803B82C8 003B5228 38 7D 00 00 */ addi r3, r29, 0
@ -362,7 +362,7 @@ lbl_803B8290:
/* 803B82E8 003B5248 54 00 D9 7E */ srwi r0, r0, 5
/* 803B82EC 003B524C 38 7D 00 00 */ addi r3, r29, 0
/* 803B82F0 003B5250 7F FF 03 78 */ or r31, r31, r0
/* 803B82F4 003B5254 48 00 81 FD */ bl sub_803c04f0
/* 803B82F4 003B5254 48 00 81 FD */ bl EXISync
/* 803B82F8 003B5258 7C 60 00 34 */ cntlzw r0, r3
/* 803B82FC 003B525C 54 00 D9 7E */ srwi r0, r0, 5
/* 803B8300 003B5260 38 7D 00 00 */ addi r3, r29, 0
@ -412,7 +412,7 @@ lbl_803B8378:
/* 803B8398 003B52F8 7C 60 00 34 */ cntlzw r0, r3
/* 803B839C 003B52FC 38 7E 00 00 */ addi r3, r30, 0
/* 803B83A0 003B5300 54 1F D9 7E */ srwi r31, r0, 5
/* 803B83A4 003B5304 48 00 81 4D */ bl sub_803c04f0
/* 803B83A4 003B5304 48 00 81 4D */ bl EXISync
/* 803B83A8 003B5308 7C 60 00 34 */ cntlzw r0, r3
/* 803B83AC 003B530C 54 00 D9 7E */ srwi r0, r0, 5
/* 803B83B0 003B5310 38 7E 00 00 */ addi r3, r30, 0

View File

@ -86,9 +86,9 @@ sub_803b7534:
/* 803B7544 003B44A4 4B FB 5E 39 */ bl AISetStreamVolLeft
/* 803B7548 003B44A8 88 6D AF F9 */ lbz r3, lbl_805A9BB9@sda21(r13)
/* 803B754C 003B44AC 4B FB 5E 5D */ bl AISetStreamVolRight
/* 803B7550 003B44B0 4B FB 5B 49 */ bl sub_8036d098
/* 803B7550 003B44B0 4B FB 5B 49 */ bl AIResetStreamSampleCount
/* 803B7554 003B44B4 80 6D AF F4 */ lwz r3, lbl_805A9BB4@sda21(r13)
/* 803B7558 003B44B8 4B FB 5B 59 */ bl SetTRKConnected
/* 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
@ -294,7 +294,7 @@ sub_803b782c:
/* 803B7834 003B4794 94 21 FF F8 */ stwu r1, -8(r1)
/* 803B7838 003B4798 80 0D AF F4 */ lwz r0, lbl_805A9BB4@sda21(r13)
/* 803B783C 003B479C 7C 63 02 14 */ add r3, r3, r0
/* 803B7840 003B47A0 4B FB 58 71 */ bl SetTRKConnected
/* 803B7840 003B47A0 4B FB 58 71 */ bl AISetStreamTrigger
/* 803B7844 003B47A4 80 0D AF D8 */ lwz r0, lbl_805A9B98@sda21(r13)
/* 803B7848 003B47A8 28 00 00 00 */ cmplwi r0, 0
/* 803B784C 003B47AC 41 82 00 18 */ beq lbl_803B7864
@ -422,7 +422,7 @@ DTKInit:
/* 803B79EC 003B494C 3C 60 80 3B */ lis r3, sub_803b782c@ha
/* 803B79F0 003B4950 38 63 78 2C */ addi r3, r3, sub_803b782c@l
/* 803B79F4 003B4954 4B FB 56 61 */ bl AIRegisterStreamCallback
/* 803B79F8 003B4958 4B FB 56 A1 */ bl sub_8036d098
/* 803B79F8 003B4958 4B FB 56 A1 */ bl AIResetStreamSampleCount
/* 803B79FC 003B495C 38 60 00 00 */ li r3, 0
/* 803B7A00 003B4960 4B FB 56 BD */ bl AISetStreamPlayState
/* 803B7A04 003B4964 80 01 00 0C */ lwz r0, 0xc(r1)
@ -600,9 +600,9 @@ lbl_803B7C34:
/* 803B7C44 003B4BA4 4B FB 57 39 */ bl AISetStreamVolLeft
/* 803B7C48 003B4BA8 88 6D AF F9 */ lbz r3, lbl_805A9BB9@sda21(r13)
/* 803B7C4C 003B4BAC 4B FB 57 5D */ bl AISetStreamVolRight
/* 803B7C50 003B4BB0 4B FB 54 49 */ bl sub_8036d098
/* 803B7C50 003B4BB0 4B FB 54 49 */ bl AIResetStreamSampleCount
/* 803B7C54 003B4BB4 80 6D AF F4 */ lwz r3, lbl_805A9BB4@sda21(r13)
/* 803B7C58 003B4BB8 4B FB 54 59 */ bl SetTRKConnected
/* 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)

View File

@ -289,7 +289,7 @@ lbl_803C039C:
/* 803C03C0 003BD320 48 00 00 30 */ b lbl_803C03F0
lbl_803C03C4:
/* 803C03C4 003BD324 7F 63 DB 78 */ mr r3, r27
/* 803C03C8 003BD328 48 00 01 29 */ bl sub_803c04f0
/* 803C03C8 003BD328 48 00 01 29 */ bl EXISync
/* 803C03CC 003BD32C 2C 03 00 00 */ cmpwi r3, 0
/* 803C03D0 003BD330 40 82 00 0C */ bne lbl_803C03DC
/* 803C03D4 003BD334 38 60 00 00 */ li r3, 0
@ -374,8 +374,8 @@ lbl_803C04DC:
/* 803C04E8 003BD448 7C 08 03 A6 */ mtlr r0
/* 803C04EC 003BD44C 4E 80 00 20 */ blr
.global sub_803c04f0
sub_803c04f0:
.global EXISync
EXISync:
/* 803C04F0 003BD450 7C 08 02 A6 */ mflr r0
/* 803C04F4 003BD454 90 01 00 04 */ stw r0, 4(r1)
/* 803C04F8 003BD458 94 21 FF D0 */ stwu r1, -0x30(r1)
@ -1677,7 +1677,7 @@ lbl_803C16B4:
/* 803C1714 003BE674 54 00 D9 7E */ srwi r0, r0, 5
/* 803C1718 003BE678 7F DE 03 78 */ or r30, r30, r0
/* 803C171C 003BE67C 38 7A 00 00 */ addi r3, r26, 0
/* 803C1720 003BE680 4B FF ED D1 */ bl sub_803c04f0
/* 803C1720 003BE680 4B FF ED D1 */ bl EXISync
/* 803C1724 003BE684 7C 60 00 34 */ cntlzw r0, r3
/* 803C1728 003BE688 54 00 D9 7E */ srwi r0, r0, 5
/* 803C172C 003BE68C 7F DE 03 78 */ or r30, r30, r0
@ -1691,7 +1691,7 @@ lbl_803C16B4:
/* 803C174C 003BE6AC 54 00 D9 7E */ srwi r0, r0, 5
/* 803C1750 003BE6B0 7F DE 03 78 */ or r30, r30, r0
/* 803C1754 003BE6B4 38 7A 00 00 */ addi r3, r26, 0
/* 803C1758 003BE6B8 4B FF ED 99 */ bl sub_803c04f0
/* 803C1758 003BE6B8 4B FF ED 99 */ bl EXISync
/* 803C175C 003BE6BC 7C 60 00 34 */ cntlzw r0, r3
/* 803C1760 003BE6C0 54 00 D9 7E */ srwi r0, r0, 5
/* 803C1764 003BE6C4 7F DE 03 78 */ or r30, r30, r0

View File

@ -97,7 +97,7 @@ lbl_803C1A10:
/* 803C1A24 003BE984 38 E0 00 00 */ li r7, 0
/* 803C1A28 003BE988 4B FF E6 E1 */ bl EXIImm
/* 803C1A2C 003BE98C 80 6D B0 28 */ lwz r3, lbl_805A9BE8@sda21(r13)
/* 803C1A30 003BE990 4B FF EA C1 */ bl sub_803c04f0
/* 803C1A30 003BE990 4B FF EA C1 */ bl EXISync
/* 803C1A34 003BE994 80 6D B0 28 */ lwz r3, lbl_805A9BE8@sda21(r13)
/* 803C1A38 003BE998 38 81 00 10 */ addi r4, r1, 0x10
/* 803C1A3C 003BE99C 38 A0 00 01 */ li r5, 1
@ -105,7 +105,7 @@ lbl_803C1A10:
/* 803C1A44 003BE9A4 38 E0 00 00 */ li r7, 0
/* 803C1A48 003BE9A8 4B FF E6 C1 */ bl EXIImm
/* 803C1A4C 003BE9AC 80 6D B0 28 */ lwz r3, lbl_805A9BE8@sda21(r13)
/* 803C1A50 003BE9B0 4B FF EA A1 */ bl sub_803c04f0
/* 803C1A50 003BE9B0 4B FF EA A1 */ bl EXISync
/* 803C1A54 003BE9B4 80 6D B0 28 */ lwz r3, lbl_805A9BE8@sda21(r13)
/* 803C1A58 003BE9B8 4B FF F3 31 */ bl EXIDeselect
/* 803C1A5C 003BE9BC 80 01 00 10 */ lwz r0, 0x10(r1)
@ -139,7 +139,7 @@ lbl_803C1AAC:
/* 803C1ABC 003BEA1C 38 E0 00 00 */ li r7, 0
/* 803C1AC0 003BEA20 4B FF E6 49 */ bl EXIImm
/* 803C1AC4 003BEA24 80 6D B0 28 */ lwz r3, lbl_805A9BE8@sda21(r13)
/* 803C1AC8 003BEA28 4B FF EA 29 */ bl sub_803c04f0
/* 803C1AC8 003BEA28 4B FF EA 29 */ bl EXISync
/* 803C1ACC 003BEA2C 48 00 00 54 */ b lbl_803C1B20
lbl_803C1AD0:
/* 803C1AD0 003BEA30 2C 1B 00 04 */ cmpwi r27, 4
@ -164,7 +164,7 @@ lbl_803C1AF4:
/* 803C1B10 003BEA70 7F DE E2 14 */ add r30, r30, r28
/* 803C1B14 003BEA74 7F FC F8 50 */ subf r31, r28, r31
/* 803C1B18 003BEA78 7F 7C D8 50 */ subf r27, r28, r27
/* 803C1B1C 003BEA7C 4B FF E9 D5 */ bl sub_803c04f0
/* 803C1B1C 003BEA7C 4B FF E9 D5 */ bl EXISync
lbl_803C1B20:
/* 803C1B20 003BEA80 2C 1B 00 00 */ cmpwi r27, 0
/* 803C1B24 003BEA84 41 82 00 0C */ beq lbl_803C1B30

View File

@ -80,7 +80,7 @@ lbl_803838FC:
/* 80383924 00380884 7C 60 00 34 */ cntlzw r0, r3
/* 80383928 00380888 54 1F D9 7E */ srwi r31, r0, 5
/* 8038392C 0038088C 38 60 00 00 */ li r3, 0
/* 80383930 00380890 48 03 CB C1 */ bl sub_803c04f0
/* 80383930 00380890 48 03 CB C1 */ bl EXISync
/* 80383934 00380894 7C 60 00 34 */ cntlzw r0, r3
/* 80383938 00380898 54 00 D9 7E */ srwi r0, r0, 5
/* 8038393C 0038089C 38 9D 00 00 */ addi r4, r29, 0
@ -155,7 +155,7 @@ lbl_80383A14:
/* 80383A38 00380998 7C 60 00 34 */ cntlzw r0, r3
/* 80383A3C 0038099C 54 1F D9 7E */ srwi r31, r0, 5
/* 80383A40 003809A0 38 60 00 00 */ li r3, 0
/* 80383A44 003809A4 48 03 CA AD */ bl sub_803c04f0
/* 80383A44 003809A4 48 03 CA AD */ bl EXISync
/* 80383A48 003809A8 7C 60 00 34 */ cntlzw r0, r3
/* 80383A4C 003809AC 54 00 D9 7E */ srwi r0, r0, 5
/* 80383A50 003809B0 38 9E 00 00 */ addi r4, r30, 0
@ -169,7 +169,7 @@ lbl_80383A14:
/* 80383A70 003809D0 54 00 D9 7E */ srwi r0, r0, 5
/* 80383A74 003809D4 7F FF 03 78 */ or r31, r31, r0
/* 80383A78 003809D8 38 60 00 00 */ li r3, 0
/* 80383A7C 003809DC 48 03 CA 75 */ bl sub_803c04f0
/* 80383A7C 003809DC 48 03 CA 75 */ bl EXISync
/* 80383A80 003809E0 7C 60 00 34 */ cntlzw r0, r3
/* 80383A84 003809E4 54 00 D9 7E */ srwi r0, r0, 5
/* 80383A88 003809E8 7F FF 03 78 */ or r31, r31, r0
@ -416,7 +416,7 @@ lbl_80383DCC:
/* 80383DF4 00380D54 7C 60 00 34 */ cntlzw r0, r3
/* 80383DF8 00380D58 54 1D D9 7E */ srwi r29, r0, 5
/* 80383DFC 00380D5C 38 60 00 00 */ li r3, 0
/* 80383E00 00380D60 48 03 C6 F1 */ bl sub_803c04f0
/* 80383E00 00380D60 48 03 C6 F1 */ bl EXISync
/* 80383E04 00380D64 7C 60 00 34 */ cntlzw r0, r3
/* 80383E08 00380D68 54 00 D9 7E */ srwi r0, r0, 5
/* 80383E0C 00380D6C 38 9C 00 00 */ addi r4, r28, 0
@ -530,7 +530,7 @@ lbl_80383F5C:
/* 80383F7C 00380EDC 7C 60 00 34 */ cntlzw r0, r3
/* 80383F80 00380EE0 54 1F D9 7E */ srwi r31, r0, 5
/* 80383F84 00380EE4 38 60 00 00 */ li r3, 0
/* 80383F88 00380EE8 48 03 C5 69 */ bl sub_803c04f0
/* 80383F88 00380EE8 48 03 C5 69 */ bl EXISync
/* 80383F8C 00380EEC 7C 60 00 34 */ cntlzw r0, r3
/* 80383F90 00380EF0 54 00 D9 7E */ srwi r0, r0, 5
/* 80383F94 00380EF4 38 9D 00 00 */ addi r4, r29, 0
@ -544,7 +544,7 @@ lbl_80383F5C:
/* 80383FB4 00380F14 54 00 D9 7E */ srwi r0, r0, 5
/* 80383FB8 00380F18 7F FF 03 78 */ or r31, r31, r0
/* 80383FBC 00380F1C 38 60 00 00 */ li r3, 0
/* 80383FC0 00380F20 48 03 C5 31 */ bl sub_803c04f0
/* 80383FC0 00380F20 48 03 C5 31 */ bl EXISync
/* 80383FC4 00380F24 7C 60 00 34 */ cntlzw r0, r3
/* 80383FC8 00380F28 54 00 D9 7E */ srwi r0, r0, 5
/* 80383FCC 00380F2C 7F FF 03 78 */ or r31, r31, r0

36
include/Dolphin/ai.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef __AI_H__
#define __AI_H__
#include "types.h"
typedef void (*AISCallback)(u32 count);
typedef void (*AIDCallback)();
AIDCallback AIRegisterDMACallback(AIDCallback callback);
void AIInitDMA(u32 start_addr, u32 length);
BOOL AIGetDMAEnableFlag();
void AIStartDMA();
void AIStopDMA();
u32 AIGetDMABytesLeft();
u32 AIGetDMAStartAddr();
u32 AIGetDMALength();
u32 AIGetDSPSampleRate();
void AISetDSPSampleRate(u32 rate);
AISCallback AIRegisterStreamCallback(AISCallback callback);
u32 AIGetStreamSampleCount();
void AIResetStreamSampleCount();
void AISetStreamTrigger(u32 trigger);
u32 AIGetStreamTrigger();
void AISetStreamPlayState(u32 state);
u32 AIGetStreamPlayState();
void AISetStreamSampleRate(u32 rate);
u32 AIGetStreamSampleRate();
void AISetStreamVolLeft(u8 vol);
void AISetStreamVolRight(u8 vol);
u8 AIGetStreamVolLeft();
u8 AIGetStreamVolRight();
void AIInit(u8* stack);
BOOL AICheckInit();
void AIReset();
#endif // __AI_H__

168
include/Dolphin/card.h Normal file
View File

@ -0,0 +1,168 @@
#ifndef __CARD_H__
#define __CARD_H__
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CARD_ENCODE_ANSI 0u
#define CARD_ENCODE_SJIS 1u
/* Sizes */
#define CARD_WORKAREA_SIZE (5 * 8 * 1024)
#define CARD_READ_SIZE 512
#define CARD_MAX_FILE 127
#define CARD_COMMENT_SIZE 64
#define CARD_FILENAME_MAX 32
#define CARD_ICON_MAX 8
#define CARD_ICON_WIDTH 32
#define CARD_ICON_HEIGHT 32
#define CARD_BANNER_WIDTH 96
#define CARD_BANNER_HEIGHT 32
/* Icon animation */
#define CARD_MODE_NORMAL 0
#define CARD_MODE_FAST 1
#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK)
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK)
#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK)
#define CARDSetBannerFormat(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f)))
#define CARDSetIconAnim(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f)))
#define CARDSetIconFormat(stat, n, f) \
((stat)->iconFormat = (u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconSpeed(stat, n, f) \
((stat)->iconSpeed = (u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr))
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
#define CARD_RESULT_UNLOCKED 1
#define CARD_RESULT_READY 0
#define CARD_RESULT_BUSY -1
#define CARD_RESULT_WRONGDEVICE -2
#define CARD_RESULT_NOCARD -3
#define CARD_RESULT_NOFILE -4
#define CARD_RESULT_IOERROR -5
#define CARD_RESULT_BROKEN -6
#define CARD_RESULT_EXIST -7
#define CARD_RESULT_NOENT -8
#define CARD_RESULT_INSSPACE -9
#define CARD_RESULT_NOPERM -10
#define CARD_RESULT_LIMIT -11
#define CARD_RESULT_NAMETOOLONG -12
#define CARD_RESULT_ENCODING -13
#define CARD_RESULT_CANCELED -14
#define CARD_RESULT_FATAL_ERROR -128
#define CARD_STAT_ICON_NONE 0
#define CARD_STAT_ICON_C8 1
#define CARD_STAT_ICON_RGB5A3 2
#define CARD_STAT_ICON_MASK 3
#define CARD_STAT_BANNER_NONE 0
#define CARD_STAT_BANNER_C8 1
#define CARD_STAT_BANNER_RGB5A3 2
#define CARD_STAT_BANNER_MASK 3
#define CARD_STAT_ANIM_LOOP 0x00
#define CARD_STAT_ANIM_BOUNCE 0x04
#define CARD_STAT_ANIM_MASK 0x04
#define CARD_STAT_SPEED_END 0
#define CARD_STAT_SPEED_FAST 1
#define CARD_STAT_SPEED_MIDDLE 2
#define CARD_STAT_SPEED_SLOW 3
#define CARD_STAT_SPEED_MASK 3
#define CARD_ATTR_PUBLIC 0x04u
#define CARD_ATTR_NO_COPY 0x08u
#define CARD_ATTR_NO_MOVE 0x10u
#define CARD_ATTR_GLOBAL 0x20u
#define CARD_ATTR_COMPANY 0x40u
typedef struct CARDFileInfo {
s32 chan;
s32 fileNo;
s32 offset;
s32 length;
u16 iBlock;
u16 __padding;
} CARDFileInfo;
typedef struct CARDStat {
char fileName[CARD_FILENAME_MAX];
u32 length;
u32 time; // seconds since 01/01/2000 midnight
u8 gameName[4];
u8 company[2];
u8 bannerFormat;
u8 __padding;
u32 iconAddr; // offset to the banner, bannerTlut, icon, iconTlut data set.
u16 iconFormat;
u16 iconSpeed;
u32 commentAddr; // offset to the pair of 32 byte character strings.
u32 offsetBanner;
u32 offsetBannerTlut;
u32 offsetIcon[CARD_ICON_MAX];
u32 offsetIconTlut;
u32 offsetData;
} CARDStat;
typedef void (*CARDCallback)(s32 chan, s32 result);
void CARDInit(void);
BOOL CARDGetFastMode(void);
BOOL CARDSetFastMode(BOOL enable);
s32 CARDCheck(s32 chan);
s32 CARDCheckAsync(s32 chan, CARDCallback callback);
s32 CARDCheckEx(s32 chan, s32* xferBytes);
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo);
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback);
s32 CARDDelete(s32 chan, const char* fileName);
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
s32 CARDFastDelete(s32 chan, s32 fileNo);
s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback);
s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo);
s32 CARDFormat(s32 chan);
s32 CARDFormatAsync(s32 chan, CARDCallback callback);
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed);
s32 CARDGetAttributes(s32 chan, s32 fileNo, u8* attr);
s32 CARDGetEncoding(s32 chan, u16* encode);
s32 CARDGetMemSize(s32 chan, u16* size);
s32 CARDGetResultCode(s32 chan);
s32 CARDGetSectorSize(s32 chan, u32* size);
s32 CARDGetSerialNo(s32 chan, u64* serialNo);
s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
s32 CARDGetXferredBytes(s32 chan);
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback);
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback);
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo);
BOOL CARDProbe(s32 chan);
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
s32 CARDRename(s32 chan, const char* oldName, const char* newName);
s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback);
s32 CARDSetAttributesAsync(s32 chan, s32 fileNo, u8 attr, CARDCallback callback);
s32 CARDSetAttributes(s32 chan, s32 fileNo, u8 attr);
s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat);
s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback);
s32 CARDUnmount(s32 chan);
s32 CARDGetCurrentMode(s32 chan, u32* mode);
s32 CARDCancel(CARDFileInfo* fileInfo);
s32 CARDClose(CARDFileInfo* fileInfo);
s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset, CARDCallback callback);
s32 CARDWrite(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset);
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset, CARDCallback callback);
#ifdef __cplusplus
}
#endif
#endif // __CARD_H__

View File

@ -4,5 +4,6 @@
#include "types.h"
vu16 __DSPRegs[32] : 0xCC005000;
vu32 __AIRegs[8] : 0xCC006C00;
#endif // __DSP_REGS_H__

View File

@ -7,19 +7,32 @@
extern "C" {
#endif
// #ifndef ADDRESS
// #define ADDRESS(v) __attribute__((address((v))))
// #endif
// const u32 __OSBusClock ADDRESS(0x800000f8);
// const u32 __OSCoreClock ADDRESS(0x800000fc);
// #define OS_BUS_CLOCK __OSBusClock
// #define OS_CORE_CLOCK __OSCoreClock
// Upper words of the masks, since UIMM is only 16 bits
#define OS_CACHED_REGION_PREFIX 0x8000
#define OS_UNCACHED_REGION_PREFIX 0xC000
#define OS_PHYSICAL_MASK 0x3FFF
#define OS_BUS_CLOCK *((const u32*)0x800000f8)
#define OS_CORE_CLOCK *((const u32*)0x800000fc)
#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)
#define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16)
#define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16)
#define OSSecondsToTicks(v) ((v)*OS_TIMER_CLOCK)
#define AT_ADDRESS(xyz) : (xyz)
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h
#define OS_BUS_CLOCK __OSBusClock
#define OS_CORE_CLOCK __OSCoreClock
#define OS_TIMER_CLOCK (OS_BUS_CLOCK/4)
#define OSTicksToCycles( ticks ) (((ticks) * ((OS_CORE_CLOCK * 2) / OS_TIMER_CLOCK)) / 2)
#define OSTicksToSeconds( ticks ) ((ticks) / OS_TIMER_CLOCK)
#define OSTicksToMilliseconds( ticks ) ((ticks) / (OS_TIMER_CLOCK / 1000))
#define OSTicksToMicroseconds( ticks ) (((ticks) * 8) / (OS_TIMER_CLOCK / 125000))
#define OSTicksToNanoseconds( ticks ) (((ticks) * 8000) / (OS_TIMER_CLOCK / 125000))
#define OSSecondsToTicks( sec ) ((sec) * OS_TIMER_CLOCK)
#define OSMillisecondsToTicks( msec ) ((msec) * (OS_TIMER_CLOCK / 1000))
#define OSMicrosecondsToTicks( usec ) (((usec) * (OS_TIMER_CLOCK / 125000)) / 8)
#define OSNanosecondsToTicks( nsec ) (((nsec) * (OS_TIMER_CLOCK / 125000)) / 8000)
#define OSDiffTick(tick1, tick0) ((s32) (tick1) - (s32) (tick0))
typedef struct OSContext {

View File

@ -0,0 +1,46 @@
#ifndef __COBJECTLIST_HPP__
#define __COBJECTLIST_HPP__
#define kMaxObjects 1024
enum EGameObjectList {
kGOL_Invalid = -1,
kGOL_All,
kGOL_Actor,
kGOL_PhysicsActor,
kGOL_GameCamera,
kGOL_GameLight,
kGOL_ListeningAi,
kGOL_AiWaypoint,
kGOL_PlatformAndDoor,
};
class CEntity;
class CObjectList {
struct SObjectListEntry {
CEntity* mEnt;
s16 mNext;
s16 mPrev;
SObjectListEntry();
};
public:
CObjectList(EGameObjectList list);
bool IsQualified(CEntity& ent);
void AddObject(CEntity& ent);
void RemoveObject(TUniqueId uid);
CEntity* GetObjectById();
const CEntity* GetObjectById() const;
CEntity* GetValidObjectById(TUniqueId uid);
const CEntity* GetValidObjectById(TUniqueId uid) const;
CEntity* operator[](s32 idx);
const CEntity* operator[](s32 idx) const;
const CEntity* GetValidObjectByIndex(s32 idx) const;
s32 size() const { return mCount; }
private:
SObjectListEntry mObjects[1024];
EGameObjectList mListType;
s16 mFirstId = -1;
s16 mCount = 0;
}
#endif // __COBJECTLIST_HPP__

View File

@ -0,0 +1,32 @@
#ifndef __CBALLCAMERA_HPP__
#define __CBALLCAMERA_HPP__
class CBallCamera {
public:
enum EBallCameraState {
kBCS_Default,
kBCS_One,
kBCS_Chase,
kBCS_Boost,
kBCS_ToBall,
kBCS_FromBall,
};
enum EBallCameraBehaviour {
kBCB_Default,
kBCB_FreezeLookPosition, // Unused
kBCB_HintBallToCam,
kBCB_HintInitializePosition,
kBCB_HintFixedPosition,
kBCB_HintFixedTransform,
kBCB_PathCameraDesiredPos, // Unused
kBCB_PathCamera,
kBCB_SpindleCamera,
};
enum ESplineState {
kSS_Invalid,
kSS_Nav,
kSS_Arc,
};
};
#endif // __CBALLCAMERA_HPP__

View File

@ -0,0 +1,38 @@
#ifndef __CCAMERAHINT_HPP__
#define __CCAMERAHINT_HPP__
#include "types.h"
#include "MetroidPrime/Cameras/CBallCamera.hpp"
#include "Kyoto/Math/CVector3f.hpp"
class CCameraHint {
public:
CCameraHint(u32 overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist, f32 maxDist,
f32 backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange,
f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime,
f32 clampVelTime, f32 controlInterpDur);
virtual ~CCameraHint();
private:
u32 mOverrideFlags;
CBallCamera::EBallCameraBehaviour mBehaviour;
f32 mMinDist;
f32 mMaxDist;
f32 mBackwardsDist;
CVector3f mLookAtOffset;
CVector3f mChaseLookAtOffset;
CVector3f mBallToCam;
f32 mFov;
f32 mAttitudeRange;
f32 mAzimuthRange;
f32 mAnglePerSecond;
f32 mClampVelRange;
f32 mClampRotRange;
f32 mElevation;
f32 mInterpolateTime;
f32 mClampVelTime;
f32 mControlInterpDur;
};
#endif // __CCAMERAHINT_HPP__

View File

@ -12,7 +12,8 @@ extern "C" {
#endif
typedef struct _SynthInfo {
u8 unk[0x210];
u32 freq;
u8 unk[0x20c];
u8 voices;
u8 music;
u8 sfx;

View File

@ -36,6 +36,7 @@ typedef u32 uintptr_t;
typedef s16 __OSInterrupt;
typedef s64 OSTime;
typedef u32 OSTick;
// Pointer to unknown, to be determined at a later date.
typedef void* unkptr;

316
src/Dolphin/ai.c Normal file
View File

@ -0,0 +1,316 @@
#include "dolphin/ai.h"
#include "dolphin/dsp_regs.h"
#include "dolphin/os.h"
const char* __AIVersion = "<< Dolphin SDK - AI\trelease build: Sep 5 2002 05:34:25 (0x2301) >>";
static AISCallback __AIS_Callback = NULL;
static AIDCallback __AID_Callback = NULL;
static u8* __CallbackStack;
static u8* __OldStack;
static volatile s32 __AI_init_flag = FALSE;
static volatile s32 __AID_Active = FALSE;
static OSTime bound_32KHz;
static OSTime bound_48KHz;
static OSTime min_wait;
static OSTime max_wait;
static OSTime buffer;
void __AISHandler(s16 interrupt, OSContext* context);
void __AIDHandler(s16 interrupt, OSContext* context);
void __AICallbackStackSwitch(register AIDCallback cb);
void __AI_SRC_INIT(void);
AIDCallback AIRegisterDMACallback(AIDCallback callback) {
AIDCallback ret;
s32 oldInts;
ret = __AID_Callback;
oldInts = OSDisableInterrupts();
__AID_Callback = callback;
OSRestoreInterrupts(oldInts);
return ret;
}
void AIInitDMA(u32 addr, u32 length) {
s32 oldInts;
oldInts = OSDisableInterrupts();
__DSPRegs[24] = (u16)((__DSPRegs[24] & ~0x3FF) | (addr >> 16));
__DSPRegs[25] = (u16)((__DSPRegs[25] & ~0xFFE0) | (0xffff & addr));
__DSPRegs[27] = (u16)((__DSPRegs[27] & ~0x7FFF) | (u16)((length >> 5) & 0xFFFF));
OSRestoreInterrupts(oldInts);
}
void AIStartDMA() { __DSPRegs[27] |= 0x8000; }
void AIStopDMA(void) { __DSPRegs[27] &= ~0x8000; }
u32 AIGetDMAStartAddr(void) { return (u32)((__DSPRegs[24] & 0x03ff) << 16) | (__DSPRegs[25] & 0xffe0); }
AISCallback AIRegisterStreamCallback(AISCallback callback) {
AISCallback ret;
s32 oldInts;
ret = __AIS_Callback;
oldInts = OSDisableInterrupts();
__AIS_Callback = callback;
OSRestoreInterrupts(oldInts);
return ret;
}
void AIResetStreamSampleCount(void) { __AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20; }
void AISetStreamTrigger(u32 trigger) { __AIRegs[3] = trigger; }
void AISetStreamPlayState(u32 state) {
s32 oldInts;
u8 volRight;
u8 volLeft;
if (state == AIGetStreamPlayState()) {
return;
}
if ((AIGetStreamSampleRate() == 0U) && (state == 1)) {
volRight = AIGetStreamVolRight();
volLeft = AIGetStreamVolLeft();
AISetStreamVolRight(0);
AISetStreamVolLeft(0);
oldInts = OSDisableInterrupts();
__AI_SRC_INIT();
__AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
__AIRegs[0] = (__AIRegs[0] & ~1) | 1;
OSRestoreInterrupts(oldInts);
AISetStreamVolLeft(volRight);
AISetStreamVolRight(volLeft);
} else {
__AIRegs[0] = (__AIRegs[0] & ~1) | state;
}
}
u32 AIGetStreamPlayState() { return __AIRegs[0] & 1; }
void AISetDSPSampleRate(u32 rate) {
u32 state;
s32 oldInts;
u8 left;
u8 right;
u32 sampleRate;
if (rate == AIGetDSPSampleRate()) {
return;
}
__AIRegs[0] &= ~0x40;
if (rate == 0) {
left = AIGetStreamVolLeft();
right = AIGetStreamVolRight();
state = AIGetStreamPlayState();
sampleRate = AIGetStreamSampleRate();
AISetStreamVolLeft(0);
AISetStreamVolRight(0);
oldInts = OSDisableInterrupts();
__AI_SRC_INIT();
__AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
__AIRegs[0] = (__AIRegs[0] & ~2) | (sampleRate * 2);
__AIRegs[0] = (__AIRegs[0] & ~1) | state;
__AIRegs[0] |= 0x40;
OSRestoreInterrupts(oldInts);
AISetStreamVolLeft(left);
AISetStreamVolRight(right);
}
}
u32 AIGetDSPSampleRate() { return ((__AIRegs[0] >> 6) & 1) ^ 1; }
void __AI_set_stream_sample_rate(u32 rate) {
s32 oldInts;
s32 state;
u8 left;
u8 right;
s32 temp_r26;
if (rate == AIGetStreamSampleRate()) {
return;
}
state = AIGetStreamPlayState();
left = AIGetStreamVolLeft();
right = AIGetStreamVolRight();
AISetStreamVolRight(0);
AISetStreamVolLeft(0);
temp_r26 = __AIRegs[0] & 0x40;
__AIRegs[0] &= ~0x40;
oldInts = OSDisableInterrupts();
__AI_SRC_INIT();
__AIRegs[0] |= temp_r26;
__AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
__AIRegs[0] = (__AIRegs[0] & ~2) | (rate * 2);
OSRestoreInterrupts(oldInts);
AISetStreamPlayState(state);
AISetStreamVolLeft(left);
AISetStreamVolRight(right);
}
u32 AIGetStreamSampleRate() { return (__AIRegs[0] >> 1) & 1; }
void AISetStreamVolLeft(u8 volume) { __AIRegs[1] = (__AIRegs[1] & ~0xFF) | (volume & 0xFF); }
u8 AIGetStreamVolLeft() { return __AIRegs[1]; }
void AISetStreamVolRight(u8 volume) { __AIRegs[1] = (__AIRegs[1] & ~0xFF00) | ((volume & 0xFF) << 8); }
u8 AIGetStreamVolRight() { return __AIRegs[1] >> 8; }
void AIInit(u8* stack) {
if (__AI_init_flag == TRUE) {
return;
}
OSRegisterVersion(__AIVersion);
bound_32KHz = OSNanosecondsToTicks(31524);
bound_48KHz = OSNanosecondsToTicks(42024);
min_wait = OSNanosecondsToTicks(42000);
max_wait = OSNanosecondsToTicks(63000);
buffer = OSNanosecondsToTicks(3000);
AISetStreamVolRight(0);
AISetStreamVolLeft(0);
AISetStreamTrigger(0);
AIResetStreamSampleCount();
__AI_set_stream_sample_rate(1);
AISetDSPSampleRate(0);
__AIS_Callback = 0;
__AID_Callback = 0;
__CallbackStack = stack;
__OSSetInterruptHandler(5, __AIDHandler);
__OSUnmaskInterrupts(0x04000000);
__OSSetInterruptHandler(8, __AISHandler);
__OSUnmaskInterrupts(0x800000);
__AI_init_flag = TRUE;
}
void __AISHandler(s16 interrupt, OSContext* context) {
OSContext tmpContext;
__AIRegs[0] |= 8;
OSClearContext(&tmpContext);
OSSetCurrentContext(&tmpContext);
if (__AIS_Callback != NULL) {
__AIS_Callback(__AIRegs[2]);
}
OSClearContext(&tmpContext);
OSSetCurrentContext(context);
}
void __AIDHandler(s16 interrupt, OSContext* context) {
OSContext tempContext;
u32 temp = __DSPRegs[5];
__DSPRegs[5] = (temp & ~0xA0) | 8;
OSClearContext(&tempContext);
OSSetCurrentContext(&tempContext);
if (__AID_Callback && !__AID_Active) {
__AID_Active = TRUE;
if (__CallbackStack) {
__AICallbackStackSwitch(__AID_Callback);
} else {
__AID_Callback();
}
__AID_Active = FALSE;
}
OSClearContext(&tempContext);
OSSetCurrentContext(context);
}
// clang-format off
asm void __AICallbackStackSwitch(register AIDCallback cb) {
// Allocate stack frame
fralloc
// Store current stack
lis r5, __OldStack@ha
addi r5, r5, __OldStack@l
stw r1, 0(r5)
// Load stack for callback
lis r5, __CallbackStack@ha
addi r5, r5, __CallbackStack@l
lwz r1,0(r5)
// Move stack down 8 bytes
subi r1, r1, 8
// Call callback
mtlr cb
blrl
// Restore old stack
lis r5, __OldStack @ha
addi r5, r5, __OldStack@l
lwz r1,0(r5)
// Free stack frame
frfree
blr
}
// clang-format on
void __AI_SRC_INIT(void) {
OSTime rise32 = 0;
OSTime rise48 = 0;
OSTime diff = 0;
OSTime unused1 = 0;
OSTime temp = 0;
u32 temp0 = 0;
u32 temp1 = 0;
u32 done = 0;
u32 walking = 0;
u32 unused2 = 0;
u32 initCnt = 0;
walking = 0;
initCnt = 0;
temp = 0;
while (!done) {
__AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
__AIRegs[0] &= ~2;
__AIRegs[0] = (__AIRegs[0] & ~1) | 1;
temp0 = __AIRegs[2];
while (temp0 == __AIRegs[2])
;
rise32 = OSGetTime();
__AIRegs[0] = (__AIRegs[0] & ~2) | 2;
__AIRegs[0] = (__AIRegs[0] & ~1) | 1;
temp1 = __AIRegs[2];
while (temp1 == __AIRegs[2])
;
rise48 = OSGetTime();
diff = rise48 - rise32;
__AIRegs[0] &= ~2;
__AIRegs[0] &= ~1;
if (diff < (bound_32KHz - buffer)) {
temp = min_wait;
done = 1;
++initCnt;
} else if (diff >= (bound_32KHz + buffer) && diff < (bound_48KHz - buffer)) {
temp = max_wait;
done = 1;
++initCnt;
} else {
done = 0;
walking = 1;
++initCnt;
}
}
while ((rise48 + temp) > OSGetTime())
;
}

103
src/Dolphin/card/CARDBios.c Normal file
View File

@ -0,0 +1,103 @@
CARDControl __CARDBlock[2];
DVDDiskID __CARDDiskNone;
void __CARDDefaultApiCallback(s32 chan, s32 result) {
}
void __CARDExtHandler(s32 chan, OSContext* context) {
CARDControl* card;
CARDCallback callback;
card = &__CARDBlock[chan];
if (card->attached) {
card->attached = FALSE;
EXISetExiCallback(chan, 0);
OSCancelAlarm(&card->alarm);
callback = card->exiCallback;
if (callback) {
card->exiCallback = 0;
callback(chan, CARD_RESULT_NOCARD);
}
if (card->result != CARD_RESULT_BUSY) {
card->result = CARD_RESULT_NOCARD;
}
callback = card->extCallback;
if (callback && CARD_MAX_MOUNT_STEP <= card->mountStep) {
card->extCallback = 0;
callback(chan, CARD_RESULT_NOCARD);
}
}
}
void __CARDExiHandler(s32 chan, OSContext* context) {
CARDControl* card;
CARDCallback callback;
u8 status;
s32 result;
card = &__CARDBlock[chan];
OSCancelAlarm(&card->alarm);
if (!card->attached) {
return;
}
if (!EXILock(chan, 0, 0)) {
result = CARD_RESULT_FATAL_ERROR;
goto fatal;
}
if ((result = __CARDReadStatus(chan, &status)) < 0 || (result = __CARDClearStatus(chan)) < 0) {
goto error;
}
if ((result = (status & 0x18) ? CARD_RESULT_IOERROR : CARD_RESULT_READY) == CARD_RESULT_IOERROR && --card->retry > 0) {
result = Retry(chan);
if (result >= 0) {
return;
}
goto fatal;
}
error:
EXIUnlock(chan);
fatal:
callback = card->exiCallback;
if (callback) {
card->exiCallback = 0;
callback(chan, result);
}
}
void __CARDTxHandler(s32 chan, OSContext* context) {
CARDControl* card;
CARDCallback callback;
BOOL err;
card = &__CARDBlock[chan];
err = !EXIDeselect(chan);
EXIUnlock(chan);
callback = card->txCallback;
if (callback) {
card->txCallback = 0;
callback(chan, (!err && EXIProbe(chan)) ? CARD_RESULT_READY : CARD_RESULT_NOCARD);
}
}
void __CARDUnlockedHandler(s32 chan, OSContext* context) {
CARDControl* card;
CARDCallback callback;
card = &__CARDBlock[chan];
callback = card->unlockCallback;
if (callback) {
card->unlockCallback = 0;
callback(chan, EXIProbe(chan) ? CARD_RESULT_UNLOCKED : CARD_RESULT_NOCARD);
}
}

View File

@ -0,0 +1,46 @@
#include "MetroidPrime/CObjectList.hpp"
CObjectList::SObjectListEntry::SObjectListEntry() : mEnt(nullptr), mNext(-1), mPrev(-1) {}
CObjectList::CObjectList(EGameObjectList list)
: mListType(list)
, mFirstId(-1)
, mCount(0) {
for (s32 i = 0; i < kMaxObjects; ++i) {
mObjects[i] = SObjectListEntry();
}
}
bool CObjectList::IsQualified(CEntity& ent) { return true; }
void CObjectList::AddObject(CEntity& ent) {
if (IsQualified(ent)) {
s16 next = -1;
if (mFirstId != -1) {
mObjects[this->mFirstId].mPrev = ent.GetUniqueId().Value();
next = mFirstId;
}
mFirstId = ent.GetUniqueId().Value();
SObjectListEntry* entry = &mObjects[ent.GetUniqueId().Value()];
entry->mEnt = &ent;
entry->mNext = next;
entry->mPrev = -1;
++mCount;
}
}
void CObjectList::RemoveObject(TUniqueId uid) {}
CEntity* CObjectList::GetObjectById() {}
const CEntity* CObjectList::GetObjectById() const {}
CEntity* CObjectList::GetValidObjectById(TUniqueId uid) {}
const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const {}
CEntity* CObjectList::operator[](s32 idx) {}
const CEntity* CObjectList::operator[](s32 idx) const {}
const CEntity* CObjectList::GetValidObjectByIndex(s32 idx) const {}

View File

@ -0,0 +1,27 @@
#include "MetroidPrime/Cameras/CCameraHint.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
CCameraHint::CCameraHint(u32 overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, float maxDist, float backwardsDist,
CVector3f* lookAtOffset, CVector3f* chaseLookAtOffset, CVector3f* ballToCam, float fov, float attitudeRange,
float azimuthRange, float anglePerSecond, float clampVelRange, float clampRotRange, float elevation,
float InterpolationTime, float clampVelTime, float controlInterpDur)
: mOverrideFlags(overrideFlags)
, mBehaviour(behaviour)
, mMinDist(minDist)
, mMaxDist(maxDist)
, mBackwardsDist(backwardsDist)
, mLookAtOffset(lookAtOffset)
, mChaseLookAtOffset(chaseLookAtOffset)
, mBallToCam(ballToCam)
, mFov(fov)
, mAttitudeRange(attitudeRange)
, mAzimuthRnage(azimuthRange)
, mAnglePerSecond(anglePerSecond)
, mClampVelRange(clampVelRange)
, mClampRotRange(clampRotRange)
, mElevation(elevation)
, mInterpolateTime(interpolateTime)
, mClampVelTime(clampVelTime)
, mControlInterpDur(controlInterpDur) {}
CCameraHint::~CCameraHint() {}

View File

@ -1,22 +1,54 @@
#include "musyx/musyx_priv.h"
s32 sndPitchUpOne(u16 note) {
return note * 1.059463f;
}
extern SynthInfo synthInfo;
static float toneup_tab[128] = {
1.000000, 1.059464, 1.122462, 1.189207, 1.259921, 1.334840, 1.414214, 1.498307, 1.587401, 1.681793,
1.781798, 1.887749, 2.000001, 2.118927, 2.244925, 2.378415, 2.519843, 2.669681, 2.828428, 2.996615,
3.174804, 3.363587, 3.563597, 3.775498, 4.000002, 4.237854, 4.489850, 4.756830, 5.039686, 5.339362,
5.656857, 5.993231, 6.349607, 6.727175, 7.127193, 7.550998, 8.000004, 8.475709, 8.979701, 9.513661,
10.079373, 10.678724, 11.313714, 11.986463, 12.699215, 13.454350, 14.254387, 15.101996, 16.000008, 16.951418,
17.959402, 19.027323, 20.158747, 21.357449, 22.627428, 23.972925, 25.398430, 26.908699, 28.508774, 30.203993,
32.000015, 33.902836, 35.918804, 38.054646, 40.317493, 42.714897, 45.254856, 47.945850, 50.796860, 53.817398,
57.017548, 60.407986, 64.000031, 67.805672, 71.837608, 76.109291, 80.634987, 85.429794, 90.509712, 95.891701,
101.593719, 107.634796, 114.035095, 120.815971, 128.000061, 135.611343, 143.675217, 152.218582, 161.269974, 170.859589,
181.019424, 191.783401, 203.187439, 215.269592, 228.070190, 241.631943, 256.000122, 271.222687, 287.350433, 304.437164,
322.539948, 341.719177, 362.038849, 383.566803, 406.374878, 430.539185, 456.140381, 483.263885, 512.000244, 542.445374,
574.700867, 608.874329, 645.079895, 683.438354, 724.077698, 767.133606, 812.749756, 861.078369, 912.280762, 966.527771,
1024.000488, 1084.890747, 1149.401733, 1217.748657, 1290.159790, 1366.876709, 1448.155396, 1534.267212,
};
static float tonedown_tab[128] = {
1.000000, 0.943874, 0.890899, 0.840897, 0.793700, 0.749153, 0.707107, 0.667419, 0.629960, 0.594604, 0.561231, 0.529732, 0.500000,
0.471937, 0.445449, 0.420448, 0.396851, 0.374577, 0.353553, 0.333710, 0.314981, 0.297301, 0.280616, 0.264866, 0.250000, 0.235969,
0.222725, 0.210224, 0.198425, 0.187288, 0.176777, 0.166855, 0.157490, 0.148651, 0.140307, 0.132433, 0.125000, 0.117984, 0.111362,
0.105112, 0.099213, 0.093644, 0.088388, 0.083427, 0.078745, 0.074326, 0.070154, 0.066216, 0.062500, 0.058992, 0.055681, 0.052556,
0.049606, 0.046823, 0.044194, 0.041714, 0.039372, 0.037163, 0.035077, 0.033108, 0.031250, 0.029496, 0.027841, 0.026278, 0.024803,
0.023411, 0.022097, 0.020857, 0.019687, 0.018581, 0.017538, 0.016554, 0.015625, 0.014748, 0.013920, 0.013139, 0.012402, 0.011705,
0.011048, 0.010428, 0.009843, 0.009291, 0.008769, 0.008277, 0.007812, 0.007374, 0.006960, 0.006570, 0.006201, 0.005853, 0.005525,
0.005215, 0.004922, 0.004645, 0.004385, 0.004139, 0.003906, 0.003687, 0.003480, 0.003284, 0.003100, 0.002927, 0.002762, 0.002607,
0.002460, 0.002322, 0.002192, 0.002069, 0.001953, 0.001843, 0.001740, 0.001642, 0.001550, 0.001463, 0.001381, 0.001304, 0.001230,
0.001162, 0.001096, 0.001035, 0.000977, 0.000922, 0.000870, 0.000821, 0.000775, 0.000731, 0.000690, 0.000651,
};
s32 sndPitchUpOne(u16 note) { return note * 1.059463f; }
/* non-matching https://decomp.me/scratch/6pRdi */
u32 sndGetPitch(u8 a, u32 b) {
f32 var_f0;
u32 temp_r6;
u32 sndGetPitch(u8 arg0, u32 arg1) {
f32 var_f0;
float scale;
u32 temp_r6;
float freq;
if (arg1 == 0xFFFFFFFF) {
arg1 = 0x40005622;
}
temp_r6 = arg1 >> 0x18U;
if (arg0 == temp_r6) {
var_f0 = (f32) ((arg1 & 0xFFFFFF) * (temp_r6 < arg0 ? toneup_map[(arg0 - temp_r6)] : tonedown_tab[temp_r6 - arg0]));
} else {
var_f0 = (f32) (arg1 & 0xFFFFFF);
}
return (u32) ((4096.f * var_f0) / synthInfo.freq);
if (arg1 == 0xFFFFFFFF) {
arg1 = 0x40005622;
}
scale = 4096.f;
temp_r6 = (arg1 >> 0x18U);
if (arg0 != temp_r6) {
var_f0 = (f32)((arg1 & 0xFFFFFF) * (temp_r6 < arg0 ? toneup_tab[(arg0 - temp_r6)] : tonedown_tab[temp_r6 - arg0]));
} else {
var_f0 = (f32)(arg1 & 0xFFFFFF);
}
scale *= var_f0;
return (u32)(scale / synthInfo.freq);
}