Best of both worlds (or hacks...). Music continues to play, no sound breakage in Pikmin2/ZTP. Wind Waker still echoes weirdly in ZWW though.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4344 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-09-29 19:15:34 +00:00
parent e6b30e574e
commit 48ed2ae852
4 changed files with 40 additions and 20 deletions

View File

@ -175,7 +175,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si
address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff)); address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff));
ACC0 &= 0xffff0000ffffULL; ACC0 &= 0xffff0000ffffULL;
for(int i = 0; i < _Size; i++) for(int i = 0; i < 0x50; i++)
{ {
_Buffer[i] = m_MiscTable[address]; _Buffer[i] = m_MiscTable[address];
@ -185,7 +185,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si
ACC0 &= 0xffff0000ffffULL; ACC0 &= 0xffff0000ffffULL;
} }
ACC0 = address << 16; ACC0 += address << 16;
PB.CurSampleFrac = (ACC0 >> 6) & 0xffff; PB.CurSampleFrac = (ACC0 >> 6) & 0xffff;
} }

View File

@ -272,12 +272,15 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
restart: restart:
if (PB.ReachedEnd) if (PB.ReachedEnd)
{ {
PB.ReachedEnd = 0;
// HACK: AFC looping doesn't work. // HACK: AFC looping doesn't work.
if (PB.RepeatMode == 0) //MKDD excluded (hack) - strange menu sounds if (PB.RepeatMode == 0) //MKDD excluded (hack) - strange menu sounds
{ {
PB.KeyOff = 1; PB.KeyOff = 1;
// PB.RemLength = 0; PB.RemLength = 0;
// PB.CurAddr = PB.StartAddr + PB.RestartPos + PB.Length; PB.CurAddr = PB.StartAddr + PB.RestartPos + PB.Length;
while (sampleCount < _RealSize) while (sampleCount < _RealSize)
_Buffer[sampleCount++] = 0; _Buffer[sampleCount++] = 0;
return; return;
@ -293,6 +296,7 @@ restart:
// Hmm, this shouldn't be reversed .. or should it? Is it different between versions of the ucode? // Hmm, this shouldn't be reversed .. or should it? Is it different between versions of the ucode?
PB.YN1 = PB.LoopYN2; PB.YN1 = PB.LoopYN2;
PB.YN2 = PB.LoopYN1; PB.YN2 = PB.LoopYN1;
} }
} }

View File

@ -278,6 +278,7 @@ HRESULT Create(int adapter, HWND wnd, bool _fullscreen, int _resolution, int aa_
dev->GetRenderTarget(0, &back_buffer); dev->GetRenderTarget(0, &back_buffer);
if (dev->GetDepthStencilSurface(&back_buffer_z) == D3DERR_NOTFOUND) if (dev->GetDepthStencilSurface(&back_buffer_z) == D3DERR_NOTFOUND)
back_buffer_z = NULL; back_buffer_z = NULL;
dev->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE );
// Device state would normally be set here // Device state would normally be set here
return S_OK; return S_OK;

View File

@ -3443,8 +3443,10 @@ label09ab:
0a0a_ReadFromAccelerator8To16(OutBuffer($AR3), Count($AX0.H)) 0a0a_ReadFromAccelerator8To16(OutBuffer($AR3), Count($AX0.H))
09d3 5500 subr $ACC1, $AX0.H 09d3 5500 subr $ACC1, $AX0.H
09d4 0a01 lris $AX0.H, #0x01 // 09d4 0a01 lris $AX0.H, #0x01
09d5 00fa 0405 sr @0x0405, $AX0.H // 09d5 00fa 0405 sr @0x0405, $AX0.H
*0x405 = 1; // PB.ReachedEnd = 1;
09d7 029f 09ab jmp 0x09ab 09d7 029f 09ab jmp 0x09ab
} }
@ -3459,12 +3461,18 @@ label09ab:
09df 263a lrs $AC0.M, @0x003a 09df 263a lrs $AC0.M, @0x003a
09e0 243b lrs $AC0.L, @0x003b 09e0 243b lrs $AC0.L, @0x003b
09e1 1570 lsr $ACC1, #-16 09e1 1570 lsr $ACC1, #-16
09e2 0a01 lris $AX0.H, #0x01
09e3 0081 0405 lri $AR1, #0x0405 // 09e2 0a01 lris $AX0.H, #0x01
09e5 5c00 sub $ACC0, $ACC1 // 09e3 0081 0405 lri $AR1, #0x0405
09e6 b100 tst $ACC0 // 09e5 5c00 sub $ACC0, $ACC1
09e7 0275 ifz // 09e6 b100 tst $ACC0
09e8 1a3a srr @$AR1, $AX0.H // 09e7 0275 ifz
// 09e8 1a3a srr @$AR1, $AX0.H
ACC0 -= ACC1;
if(ACC0 == 0)
*0x405 = 1; // PB.ReachedEnd = 1
09e9 2e3a srs @0x003a, $AC0.M 09e9 2e3a srs @0x003a, $AC0.M
09ea 2c3b srs @0x003b, $AC0.L 09ea 2c3b srs @0x003b, $AC0.L
09eb 2638 lrs $AC0.M, @0x0038 09eb 2638 lrs $AC0.M, @0x0038
@ -3612,8 +3620,10 @@ void Decoder0x10() {
// 0a56 02bf 0a91 call 0x0a91 // Read more samples // 0a56 02bf 0a91 call 0x0a91 // Read more samples
0a91_ReadFromAccelerator(OutBuffer($AR3), Count($AX0.H)); 0a91_ReadFromAccelerator(OutBuffer($AR3), Count($AX0.H));
0a58 5500 subr $ACC1, $AX0.H 0a58 5500 subr $ACC1, $AX0.H
0a59 0a01 lris $AX0.H, #0x01 // 0a59 0a01 lris $AX0.H, #0x01
0a5a 00fa 0405 sr @0x0405, $AX0.H // 0a5a 00fa 0405 sr @0x0405, $AX0.H
*0x405 = 1; // PB.ReachedEnd
0a5c 029f 0a30 jmp 0x0a30 // GOTO retry_0a30; 0a5c 029f 0a30 jmp 0x0a30 // GOTO retry_0a30;
} }
} }
@ -3629,12 +3639,17 @@ void Decoder0x10() {
0a64 263a lrs $AC0.M, @0x003a 0a64 263a lrs $AC0.M, @0x003a
0a65 243b lrs $AC0.L, @0x003b 0a65 243b lrs $AC0.L, @0x003b
0a66 1570 lsr $ACC1, #-16 0a66 1570 lsr $ACC1, #-16
0a67 0a01 lris $AX0.H, #0x01 // 0a67 0a01 lris $AX0.H, #0x01
0a68 0081 0405 lri $AR1, #0x0405 // 0a68 0081 0405 lri $AR1, #0x0405
0a6a 5c00 sub $ACC0, $ACC1 // 0a6a 5c00 sub $ACC0, $ACC1
0a6b b100 tst $ACC0 // 0a6b b100 tst $ACC0
0a6c 0275 ifz // 0a6c 0275 ifz
0a6d 1a3a srr @$AR1, $AX0.H // 0a6d 1a3a srr @$AR1, $AX0.H
ACC0 -= ACC1;
if(ACC0 == 0)
*0x405 = 1; // PB.ReachedEnd = 1
0a6e 2e3a srs @0x003a, $AC0.M 0a6e 2e3a srs @0x003a, $AC0.M
0a6f 2c3b srs @0x003b, $AC0.L 0a6f 2c3b srs @0x003b, $AC0.L
0a70 2638 lrs $AC0.M, @0x0038 0a70 2638 lrs $AC0.M, @0x0038