The beginning of another approach on Zelda HLE UCode: PB debugging and comparison

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4481 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-10-30 07:10:46 +00:00
parent dd7f6f991f
commit 4fbf138ed2
3 changed files with 33 additions and 8 deletions

View File

@ -108,8 +108,8 @@ union ZeldaVoicePB
u32 StartAddr; // 0x8C | sound start address u32 StartAddr; // 0x8C | sound start address
u32 UnkAddr; // 0x8E | ??? u32 UnkAddr; // 0x8E | ???
u16 Padding[0x10]; // 0x90 | padding u16 Padding[0x10]; // 0x90 | padding
u16 Padding2[0x8]; // 0xa0 | FIR filter coefs of some sort u16 Padding2[0x8]; // 0xa0 | FIR filter coefs of some sort (0xa4 controls the appearance of 0xa5-0xa7 and is almost always 0x7FFF)
u16 FilterEnable; // 0xa8 | FilterBufferInPlace enable. u16 FilterEnable; // 0xa8 | FilterBufferInPlace enable
u16 Padding3[0x7]; // 0xa9 | padding u16 Padding3[0x7]; // 0xa9 | padding
u16 Padding4[0x10]; // 0xb0 | padding u16 Padding4[0x10]; // 0xb0 | padding
}; };

View File

@ -22,6 +22,8 @@
#include "../main.h" #include "../main.h"
#include "Mixer.h" #include "Mixer.h"
#include <sstream>
void CUCode_Zelda::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB) void CUCode_Zelda::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB)
{ {
u16 *memory = (u16*)g_dspInitialize.pGetMemoryPointer(_Addr); u16 *memory = (u16*)g_dspInitialize.pGetMemoryPointer(_Addr);
@ -220,9 +222,28 @@ clear_buffer:
PB.CurAddr += rem_samples; PB.CurAddr += rem_samples;
} }
template <typename T>
void PrintObject(const T &Obj)
{
char byte[2] = {0};
std::stringstream ss;
u8 *o = (u8 *)&Obj;
for(int i = 0; i < sizeof(T); i++) {
if(i > 0 && i % 2 == 0)
ss << " ";
sprintf(byte, "%02X", Common::swap16(o[i]));
ss << byte;
}
DEBUG_LOG(DSPHLE, "AFC PB: %s", ss.str().c_str());
}
void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size) void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{ {
// TODO: Compare mono, stereo and surround samples
PrintObject(PB);
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt); int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
// initialize "decoder" if the sample is played the first time // initialize "decoder" if the sample is played the first time
@ -340,6 +361,7 @@ restart:
PB.CurAddr = prev_addr; PB.CurAddr = prev_addr;
PB.NeedsReset = 0; PB.NeedsReset = 0;
// PB.CurBlock = 0x10 - (PB.LoopStartPos & 0xf);
// write back // write back
// NumberOfSamples = (NumberOfSamples << 4) | frac; // missing fraction // NumberOfSamples = (NumberOfSamples << 4) | frac; // missing fraction

View File

@ -2529,12 +2529,15 @@ void 06f9_Unk_PrepareSampleDecode()
void EarlyOutFrom_073d_DECODE_0x05_0x09() { void EarlyOutFrom_073d_DECODE_0x05_0x09() {
//070e 02bf 06f9 call 0x06f9 //070e 02bf 06f9 call 0x06f9
06f9_Unk_PrepareSampleDecode() 06f9_Unk_PrepareSampleDecode()
0710 8100 clr $ACC0 // 0710 8100 clr $ACC0
0711 2632 lrs $AC0.M, @0x0032 // 0711 2632 lrs $AC0.M, @0x0032
0712 5c00 sub $ACC0, $ACC1 // 0712 5c00 sub $ACC0, $ACC1
0713 2e32 srs @0x0032, $AC0.M // 0713 2e32 srs @0x0032, $AC0.M
0714 0092 00ff lri $CR, #0x00ff
0716 02df ret *0x0432 -= _numberOfSamples // PB.CurBlock
// 0714 0092 00ff lri $CR, #0x00ff
// 0716 02df ret
} }
// Here, CR is 0x04 and thus these are not hw regs. // Here, CR is 0x04 and thus these are not hw regs.