mirror of
https://github.com/zeldaret/tp
synced 2026-07-11 07:25:22 -04:00
dolphin lib work (#237)
* getLayerNo_common_common finally matched * dolphin ai / ar / card work from prime decomp * work on dolphin dvd / dsp / db * more dolphin os work * si work * remove asm * build fix
This commit is contained in:
@@ -5,16 +5,14 @@
|
||||
|
||||
#include "dolphin/os/OSAudioSystem.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/dsp/dsp.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
SECTION_INIT void memcpy();
|
||||
void OSGetArenaHi();
|
||||
void DCFlushRange();
|
||||
void OSGetTick();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
@@ -33,17 +31,100 @@ static u8 DSPInitCode[128] = {
|
||||
0x02, 0xFF, 0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#define __DSPWorkBuffer (void*)0x81000000
|
||||
|
||||
/* 8033B2D8-8033B494 335C18 01BC+00 0/0 1/1 0/0 .text __OSInitAudioSystem */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __OSInitAudioSystem(void) {
|
||||
nofralloc
|
||||
#include "asm/dolphin/os/OSAudioSystem/__OSInitAudioSystem.s"
|
||||
void __OSInitAudioSystem(void) {
|
||||
u32 r28;
|
||||
u16 r3;
|
||||
|
||||
u32 padding;
|
||||
|
||||
memcpy((void*)((u8*)OSGetArenaHi() - 128), __DSPWorkBuffer, 128);
|
||||
memcpy(__DSPWorkBuffer, (void*)DSPInitCode, 128);
|
||||
|
||||
DCFlushRange(__DSPWorkBuffer, 128);
|
||||
|
||||
__DSPRegs[9] = 0x43;
|
||||
__DSPRegs[5] = 0x8AC;
|
||||
__DSPRegs[5] |= 1;
|
||||
while (__DSPRegs[5] & 1)
|
||||
;
|
||||
__DSPRegs[0] = 0;
|
||||
while (((__DSPRegs[2] << 16) | __DSPRegs[3]) & 0x80000000)
|
||||
;
|
||||
*(u32*)&__DSPRegs[16] = 0x1000000;
|
||||
*(u32*)&__DSPRegs[18] = 0;
|
||||
*(u32*)&__DSPRegs[20] = 0x20;
|
||||
|
||||
r3 = __DSPRegs[5];
|
||||
while (!(r3 & 0x20))
|
||||
r3 = __DSPRegs[5];
|
||||
__DSPRegs[5] = r3;
|
||||
|
||||
r28 = OSGetTick();
|
||||
while ((s32)(OSGetTick() - r28) < 0x892)
|
||||
;
|
||||
|
||||
*(u32*)&__DSPRegs[16] = 0x1000000;
|
||||
*(u32*)&__DSPRegs[18] = 0;
|
||||
*(u32*)&__DSPRegs[20] = 0x20;
|
||||
|
||||
r3 = __DSPRegs[5];
|
||||
while (!(r3 & 0x20))
|
||||
r3 = __DSPRegs[5];
|
||||
__DSPRegs[5] = r3;
|
||||
|
||||
__DSPRegs[5] &= ~0x800;
|
||||
while ((__DSPRegs[5]) & 0x400)
|
||||
;
|
||||
__DSPRegs[5] &= ~4;
|
||||
|
||||
r3 = __DSPRegs[2];
|
||||
|
||||
while (!(r3 & 0x8000))
|
||||
r3 = __DSPRegs[2];
|
||||
|
||||
(void)__DSPRegs[3];
|
||||
r3 != 42069;
|
||||
__DSPRegs[5] |= 4;
|
||||
__DSPRegs[5] = 0x8AC;
|
||||
__DSPRegs[5] |= 1;
|
||||
while (__DSPRegs[5] & 1)
|
||||
;
|
||||
memcpy(__DSPWorkBuffer, (void*)((u8*)OSGetArenaHi() - 128), 128);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 8033B494-8033B56C 335DD4 00D8+00 0/0 1/1 0/0 .text __OSStopAudioSystem */
|
||||
#ifdef NONMATCHING
|
||||
void __OSStopAudioSystem(void) {
|
||||
u32 r28;
|
||||
|
||||
#define waitUntil(load, mask) \
|
||||
r28 = (load); \
|
||||
while (r28 & (mask)) { \
|
||||
r28 = (load); \
|
||||
}
|
||||
|
||||
__DSPRegs[5] = 0x804;
|
||||
r28 = __DSPRegs[27];
|
||||
__DSPRegs[27] = r28 & ~0x8000;
|
||||
waitUntil(__DSPRegs[5], 0x400);
|
||||
waitUntil(__DSPRegs[5], 0x200);
|
||||
__DSPRegs[5] = 0x8ac;
|
||||
__DSPRegs[0] = 0;
|
||||
|
||||
while (((__DSPRegs[2] << 16) | __DSPRegs[3]) & 0x80000000)
|
||||
;
|
||||
r28 = OSGetTick();
|
||||
while ((s32)(OSGetTick() - r28) < 0x2c)
|
||||
;
|
||||
__DSPRegs[5] |= 1;
|
||||
waitUntil(__DSPRegs[5], 0x001);
|
||||
|
||||
#undef waitUntil
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
@@ -52,3 +133,4 @@ asm void __OSStopAudioSystem(void) {
|
||||
#include "asm/dolphin/os/OSAudioSystem/__OSStopAudioSystem.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user