mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
updated dsp null some clean up as well.
Please test on windows git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2018 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -11,6 +11,7 @@ files = [
|
||||
"main.cpp",
|
||||
"Globals.cpp",
|
||||
"UCodes/UCode_AX.cpp",
|
||||
"UCodes/UCode_AXWii.cpp",
|
||||
"UCodes/UCode_CARD.cpp",
|
||||
"UCodes/UCode_InitAudioSystem.cpp",
|
||||
"UCodes/UCode_Jac.cpp",
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "FileUtil.h" // For IsDirectory()
|
||||
#include "StringUtil.h" // For StringFromFormat()
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "../MailHandler.h"
|
||||
@@ -27,7 +26,6 @@
|
||||
#include "UCode_AX.h"
|
||||
#include "UCode_AX_Voice.h"
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Externals
|
||||
// -----------
|
||||
@@ -95,8 +93,9 @@ void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap)
|
||||
char Msg[512];
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
|
||||
TmpMailLog += Msg;
|
||||
TmpMailLog += "\n";
|
||||
TmpMailLog += Msg;
|
||||
TmpMailLog += "\n";
|
||||
|
||||
}
|
||||
// ----------------
|
||||
|
||||
@@ -125,6 +124,7 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num)
|
||||
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
|
||||
{
|
||||
pDest[p] = Common::swap16(pSrc[p]);
|
||||
|
||||
}
|
||||
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
|
||||
count++;
|
||||
@@ -236,6 +236,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +344,6 @@ bool CUCode_AX::AXTask(u32& _uMail)
|
||||
m_addressPBs = Memory_Read_U32(uAddress);
|
||||
uAddress += 4;
|
||||
|
||||
SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,64 +1,64 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _UCODE_AXWII
|
||||
#define _UCODE_AXWII
|
||||
|
||||
#include "UCode_AXStructs.h"
|
||||
|
||||
#define NUMBER_OF_PBS 128
|
||||
|
||||
class CUCode_AXWii : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC);
|
||||
virtual ~CUCode_AXWii();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
void MixAdd(short* _pBuffer, int _iSize);
|
||||
template<class ParamBlockType>
|
||||
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
|
||||
void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs);
|
||||
void Update();
|
||||
|
||||
// The logging function for the debugger
|
||||
void Logging(short* _pBuffer, int _iSize, int a);
|
||||
CUCode_AX * lCUCode_AX; // we need the logging functions in there
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MAIL_AX_ALIST = 0xBABE0000,
|
||||
};
|
||||
|
||||
// PBs
|
||||
u32 m_addressPBs;
|
||||
u32 _CRC;
|
||||
|
||||
int *templbuffer;
|
||||
int *temprbuffer;
|
||||
|
||||
// ax task message handler
|
||||
bool AXTask(u32& _uMail);
|
||||
void SaveLog(const char* _fmt, ...);
|
||||
void SendMail(u32 _uMail);
|
||||
};
|
||||
|
||||
//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
|
||||
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
|
||||
|
||||
#endif // _UCODE_AXWII
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _UCODE_AXWII
|
||||
#define _UCODE_AXWII
|
||||
|
||||
#include "UCode_AXStructs.h"
|
||||
|
||||
#define NUMBER_OF_PBS 128
|
||||
|
||||
class CUCode_AXWii : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC);
|
||||
virtual ~CUCode_AXWii();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
void MixAdd(short* _pBuffer, int _iSize);
|
||||
template<class ParamBlockType>
|
||||
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
|
||||
void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs);
|
||||
void Update();
|
||||
|
||||
// The logging function for the debugger
|
||||
void Logging(short* _pBuffer, int _iSize, int a);
|
||||
CUCode_AX * lCUCode_AX; // we need the logging functions in there
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MAIL_AX_ALIST = 0xBABE0000,
|
||||
};
|
||||
|
||||
// PBs
|
||||
u32 m_addressPBs;
|
||||
u32 _CRC;
|
||||
|
||||
int *templbuffer;
|
||||
int *temprbuffer;
|
||||
|
||||
// ax task message handler
|
||||
bool AXTask(u32& _uMail);
|
||||
void SaveLog(const char* _fmt, ...);
|
||||
void SendMail(u32 _uMail);
|
||||
};
|
||||
|
||||
//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
|
||||
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
|
||||
|
||||
#endif // _UCODE_AXWII
|
||||
|
||||
@@ -1,92 +1,92 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _UCODE_AX_ADPCM_H
|
||||
#define _UCODE_AX_ADPCM_H
|
||||
#include "../Globals.h"
|
||||
|
||||
inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
|
||||
{
|
||||
while (samplePos < newSamplePos)
|
||||
{
|
||||
if ((samplePos & 15) == 0)
|
||||
{
|
||||
adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1);
|
||||
samplePos += 2;
|
||||
newSamplePos += 2;
|
||||
}
|
||||
|
||||
int scale = 1 << (adpcm.pred_scale & 0xF);
|
||||
int coef_idx = adpcm.pred_scale >> 4;
|
||||
|
||||
s32 coef1 = adpcm.coefs[coef_idx * 2 + 0];
|
||||
s32 coef2 = adpcm.coefs[coef_idx * 2 + 1];
|
||||
|
||||
int temp = (samplePos & 1) ?
|
||||
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) :
|
||||
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4);
|
||||
|
||||
if (temp >= 8)
|
||||
temp -= 16;
|
||||
|
||||
// 0x400 = 0.5 in 11-bit fixed point
|
||||
int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11);
|
||||
|
||||
if (val > 0x7FFF)
|
||||
val = 0x7FFF;
|
||||
else if (val < -0x7FFF)
|
||||
val = -0x7FFF;
|
||||
|
||||
adpcm.yn2 = adpcm.yn1;
|
||||
adpcm.yn1 = val;
|
||||
|
||||
samplePos++;
|
||||
}
|
||||
|
||||
return adpcm.yn1;
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// Volume control (ramping)
|
||||
// --------------
|
||||
inline u16 ADPCM_Vol(u16 vol, u16 delta)
|
||||
{
|
||||
int x = vol;
|
||||
if (delta && delta < 0x5000)
|
||||
x += delta * 20 * 8; // unsure what the right step is
|
||||
//x += 1 * 20 * 8;
|
||||
else if (delta && delta > 0x5000)
|
||||
//x -= (0x10000 - delta); // this is to small, it's often 1
|
||||
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
|
||||
// did not have time to go to zero before the were closed
|
||||
//x -= 1 * 20 * 16;
|
||||
|
||||
// make lower limits
|
||||
if (x < 0) x = 0;
|
||||
//if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make
|
||||
// any sense?
|
||||
|
||||
// make upper limits
|
||||
//if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also
|
||||
// has a volume target?
|
||||
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
|
||||
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
|
||||
return x; // update volume
|
||||
}
|
||||
// ==============
|
||||
|
||||
#endif // _UCODE_AX_ADPCM_H
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _UCODE_AX_ADPCM_H
|
||||
#define _UCODE_AX_ADPCM_H
|
||||
#include "../Globals.h"
|
||||
|
||||
inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
|
||||
{
|
||||
while (samplePos < newSamplePos)
|
||||
{
|
||||
if ((samplePos & 15) == 0)
|
||||
{
|
||||
adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1);
|
||||
samplePos += 2;
|
||||
newSamplePos += 2;
|
||||
}
|
||||
|
||||
int scale = 1 << (adpcm.pred_scale & 0xF);
|
||||
int coef_idx = adpcm.pred_scale >> 4;
|
||||
|
||||
s32 coef1 = adpcm.coefs[coef_idx * 2 + 0];
|
||||
s32 coef2 = adpcm.coefs[coef_idx * 2 + 1];
|
||||
|
||||
int temp = (samplePos & 1) ?
|
||||
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) :
|
||||
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4);
|
||||
|
||||
if (temp >= 8)
|
||||
temp -= 16;
|
||||
|
||||
// 0x400 = 0.5 in 11-bit fixed point
|
||||
int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11);
|
||||
|
||||
if (val > 0x7FFF)
|
||||
val = 0x7FFF;
|
||||
else if (val < -0x7FFF)
|
||||
val = -0x7FFF;
|
||||
|
||||
adpcm.yn2 = adpcm.yn1;
|
||||
adpcm.yn1 = val;
|
||||
|
||||
samplePos++;
|
||||
}
|
||||
|
||||
return adpcm.yn1;
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// Volume control (ramping)
|
||||
// --------------
|
||||
inline u16 ADPCM_Vol(u16 vol, u16 delta)
|
||||
{
|
||||
int x = vol;
|
||||
if (delta && delta < 0x5000)
|
||||
x += delta * 20 * 8; // unsure what the right step is
|
||||
//x += 1 * 20 * 8;
|
||||
else if (delta && delta > 0x5000)
|
||||
//x -= (0x10000 - delta); // this is to small, it's often 1
|
||||
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
|
||||
// did not have time to go to zero before the were closed
|
||||
//x -= 1 * 20 * 16;
|
||||
|
||||
// make lower limits
|
||||
if (x < 0) x = 0;
|
||||
//if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make
|
||||
// any sense?
|
||||
|
||||
// make upper limits
|
||||
//if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also
|
||||
// has a volume target?
|
||||
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
|
||||
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
|
||||
return x; // update volume
|
||||
}
|
||||
// ==============
|
||||
|
||||
#endif // _UCODE_AX_ADPCM_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user