mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Added AI FIFO wave logging to HLE plugin. Same for LLE plugin is coming soon. Plus some extra critical section locks in LLE plugin.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@797 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -14,13 +14,13 @@
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#include "gdsp_interface.h"
|
||||
|
||||
extern uint16 dsp_swap16(uint16 x);
|
||||
|
||||
|
||||
// the hardware adpcm decoder :)
|
||||
// The hardware adpcm decoder :)
|
||||
sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress)
|
||||
{
|
||||
sint16* pCoefTable = (sint16*)&gdsp_ifx_regs[DSP_COEF_A1_0];
|
||||
@ -42,30 +42,25 @@ sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress)
|
||||
(g_dspInitialize.pARAM_Read_U8(_rSamplePos >> 1) >> 4);
|
||||
|
||||
if (temp >= 8)
|
||||
{
|
||||
temp -= 16; //temp += 0xFFFFFFF0;
|
||||
}
|
||||
temp -= 16;
|
||||
|
||||
//0x400 = 0.5 in 11-bit fixed point
|
||||
// 0x400 = 0.5 in 11-bit fixed point
|
||||
int val = (scale * temp) + ((0x400 + coef1 * (sint16)gdsp_ifx_regs[DSP_YN1] + coef2 * (sint16)gdsp_ifx_regs[DSP_YN2]) >> 11);
|
||||
|
||||
// Clamp values.
|
||||
if (val > 0x7FFF)
|
||||
{
|
||||
val = 0x7FFF;
|
||||
}
|
||||
else if (val < -0x7FFF)
|
||||
{
|
||||
val = -0x7FFF;
|
||||
}
|
||||
|
||||
gdsp_ifx_regs[DSP_YN2] = gdsp_ifx_regs[DSP_YN1];
|
||||
gdsp_ifx_regs[DSP_YN1] = val;
|
||||
|
||||
_rSamplePos++;
|
||||
|
||||
return(val);
|
||||
|
||||
// I think the interpolation (linear, polyphase,...) is done by the UCode
|
||||
// The advanced interpolation (linear, polyphase,...) is done by the UCode, so we don't
|
||||
// need to bother with it here.
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@ -104,8 +99,12 @@ uint16 dsp_read_aram()
|
||||
if (Address > EndAddress)
|
||||
{
|
||||
Address = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL];
|
||||
//ErrorLog("Should we generate a lvl5 exception !??!");
|
||||
//gdsp_exception(5);
|
||||
// ErrorLog("Should we generate a lvl5 exception !??!");
|
||||
// gdsp_exception(5);
|
||||
|
||||
// Somehow, YN1 and YN2 must be initialized with their "loop" values, so yeah,
|
||||
// it seems likely that we should raise an exception to let the DSP program do that,
|
||||
// at least if DSP_FORMAT == 0x0A.
|
||||
}
|
||||
|
||||
gdsp_ifx_regs[DSP_ACCAH] = Address >> 16;
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#pragma once
|
||||
|
||||
#ifndef _GDSP_ARAM_H
|
||||
#define _GDSP_ARAM_H
|
||||
|
||||
uint16 dsp_read_aram();
|
||||
|
||||
#endif
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "Globals.h"
|
||||
#include "Thread.h"
|
||||
|
||||
#include "gdsp_aram.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
@ -66,9 +67,8 @@ const char* reg_names[] =
|
||||
|
||||
void gdsp_dma();
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
extern CRITICAL_SECTION g_CriticalSection;
|
||||
#ifdef WITH_DSP_ON_THREAD
|
||||
Common::CriticalSection g_CriticalSection;
|
||||
#endif
|
||||
|
||||
static volatile uint16 gdsp_mbox[2][2];
|
||||
@ -93,20 +93,27 @@ void gdsp_ifx_init()
|
||||
|
||||
uint32 gdsp_mbox_peek(uint8 mbx)
|
||||
{
|
||||
return((gdsp_mbox[mbx][0] << 16) | gdsp_mbox[mbx][1]);
|
||||
#if WITH_DSP_ON_THREAD
|
||||
g_CriticalSection.Enter();
|
||||
#endif
|
||||
uint32 value = ((gdsp_mbox[mbx][0] << 16) | gdsp_mbox[mbx][1]);
|
||||
#if WITH_DSP_ON_THREAD
|
||||
g_CriticalSection.Leave();
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void gdsp_mbox_write_h(uint8 mbx, uint16 val)
|
||||
{
|
||||
#if WITH_DSP_ON_THREAD
|
||||
EnterCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Enter();
|
||||
#endif
|
||||
|
||||
gdsp_mbox[mbx][0] = val & 0x7fff;
|
||||
|
||||
#if WITH_DSP_ON_THREAD
|
||||
LeaveCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Leave();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -114,14 +121,14 @@ void gdsp_mbox_write_h(uint8 mbx, uint16 val)
|
||||
void gdsp_mbox_write_l(uint8 mbx, uint16 val)
|
||||
{
|
||||
#if WITH_DSP_ON_THREAD
|
||||
EnterCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Enter();
|
||||
#endif
|
||||
|
||||
gdsp_mbox[mbx][1] = val;
|
||||
gdsp_mbox[mbx][0] |= 0x8000;
|
||||
|
||||
#if WITH_DSP_ON_THREAD
|
||||
LeaveCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Leave();
|
||||
#endif
|
||||
|
||||
if (mbx == GDSP_MBOX_DSP)
|
||||
@ -133,7 +140,7 @@ void gdsp_mbox_write_l(uint8 mbx, uint16 val)
|
||||
|
||||
uint16 gdsp_mbox_read_h(uint8 mbx)
|
||||
{
|
||||
return(gdsp_mbox[mbx][0]);
|
||||
return (gdsp_mbox[mbx][0]);
|
||||
}
|
||||
|
||||
|
||||
@ -141,14 +148,14 @@ uint16 gdsp_mbox_read_l(uint8 mbx)
|
||||
{
|
||||
uint16 val;
|
||||
#if WITH_DSP_ON_THREAD
|
||||
EnterCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Enter();
|
||||
#endif
|
||||
|
||||
val = gdsp_mbox[mbx][1];
|
||||
gdsp_mbox[mbx][0] &= ~0x8000;
|
||||
|
||||
#if WITH_DSP_ON_THREAD
|
||||
LeaveCriticalSection(&g_CriticalSection);
|
||||
g_CriticalSection.Leave();
|
||||
#endif
|
||||
return(val);
|
||||
}
|
||||
|
Reference in New Issue
Block a user