DSP LLE: code cleanup that doesn't affect behavior.

Make DSPCore build properly in debugfast (breakpoints work again)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4816 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-01-13 00:11:29 +00:00
parent a81efdb597
commit 3848e68585
10 changed files with 159 additions and 854 deletions

View File

@ -299,7 +299,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src"
PreprocessorDefinitions="LOGGING;WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
PreprocessorDefinitions="DEBUGFAST;LOGGING;WIN32;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@ -363,7 +363,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src"
PreprocessorDefinitions="LOGGING;WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
PreprocessorDefinitions="DEBUGFAST;LOGGING;WIN32;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@ -446,10 +446,6 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
</Filter>
<File
RelativePath=".\Src\assemble.cpp"
>

View File

@ -105,28 +105,28 @@
#define DSP_COEF_A1_0 0xa0
#define DSP_DSMAH 0xce
#define DSP_DSMAL 0xcf
#define DSP_DSCR 0xc9 // DSP DMA Control Reg
#define DSP_DSPA 0xcd // DSP DMA Block Length
#define DSP_DSBL 0xcb // DSP DMA DMEM Address
#define DSP_DSMAH 0xce // DSP DMA Mem Address H
#define DSP_DSMAL 0xcf // DSP DMA Mem Address L
#define DSP_DSPA 0xcd // DSP DMA Address (DSP)
#define DSP_DSBL 0xcb // DSP DMA Block Length
#define DSP_DSMAH 0xce // DSP DMA Address High (External)
#define DSP_DSMAL 0xcf // DSP DMA Address Low (External)
#define DSP_FORMAT 0xd1
#define DSP_FORMAT 0xd1 // Sample format
#define DSP_ACDATA1 0xd3 // used only by Zelda ucodes
#define DSP_ACSAH 0xd4
#define DSP_ACSAH 0xd4 // Start of loop
#define DSP_ACSAL 0xd5
#define DSP_ACEAH 0xd6
#define DSP_ACEAH 0xd6 // End of sample (and loop)
#define DSP_ACEAL 0xd7
#define DSP_ACCAH 0xd8
#define DSP_ACCAH 0xd8 // Current playback position
#define DSP_ACCAL 0xd9
#define DSP_PRED_SCALE 0xda
#define DSP_PRED_SCALE 0xda // ADPCM predictor and scale
#define DSP_YN1 0xdb
#define DSP_YN2 0xdc
#define DSP_ACCELERATOR 0xdd // ADPCM accelerator read. Used by AX.
#define DSP_GAIN 0xde
#define DSP_DREQ_MASK 0xef // ARAM DMA Request Mask
#define DSP_DIRQ 0xfb // DSP Irq Rest
#define DSP_DMBH 0xfc // DSP Mailbox H
#define DSP_DMBL 0xfd // DSP Mailbox L
@ -142,9 +142,9 @@
// cr (Not g_dsp.r[CR]) bits
// See HW/DSP.cpp.
#define CR_EXTERNAL_INT 0x0002
#define CR_HALT 0x0004
#define CR_INIT 0x0400
#define CR_EXTERNAL_INT 0x0002
// SR bits

View File

@ -144,14 +144,14 @@ void ln(const UDSPInstruction& opc)
void ls(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 sreg = 0x03;
u8 sreg = DSP_REG_AR3;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
dsp_dmem_write(g_dsp.r[sreg], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[0x00]));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[DSP_REG_AR0]));
writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(2, 0x00, dsp_increment_addr_reg(0x00));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
@ -164,14 +164,14 @@ void ls(const UDSPInstruction& opc)
void lsn(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 sreg = 0x03;
u8 sreg = DSP_REG_AR3;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
dsp_dmem_write(g_dsp.r[sreg], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[0x00]));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[DSP_REG_AR0]));
writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(2, 0x00,dsp_increase_addr_reg(0x00, (s16)g_dsp.r[DSP_REG_IX0]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r[DSP_REG_IX0]));
}
// LSM $acD.l, $acS.m
@ -183,14 +183,14 @@ void lsn(const UDSPInstruction& opc)
void lsm(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 sreg = 0x03;
u8 sreg = DSP_REG_AR3;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
dsp_dmem_write(g_dsp.r[sreg], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[0x00]));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[DSP_REG_AR0]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
writeToBackLog(2, 0x00, dsp_increment_addr_reg(0x00));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
// LSMN $acD.l, $acS.m
@ -203,14 +203,14 @@ void lsm(const UDSPInstruction& opc)
void lsnm(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 sreg = 0x03;
u8 sreg = DSP_REG_AR3;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
dsp_dmem_write(g_dsp.r[sreg], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[0x00]));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[DSP_REG_AR0]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
writeToBackLog(2, 0x00, dsp_increase_addr_reg(0x00, (s16)g_dsp.r[DSP_REG_IX0]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r[DSP_REG_IX0]));
}
// SL $acS.m, $acD.l
@ -222,13 +222,13 @@ void sl(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
const u8 sreg = 0x03;
const u8 sreg = DSP_REG_AR3;
dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
dsp_dmem_write(g_dsp.r[DSP_REG_AR0], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(2, 0x00, dsp_increment_addr_reg(0x00));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
// SLN $acS.m, $acD.l
@ -241,13 +241,13 @@ void sln(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
const u8 sreg = 0x03;
const u8 sreg = DSP_REG_AR3;
dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
dsp_dmem_write(g_dsp.r[DSP_REG_AR0], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(2, 0x00, dsp_increase_addr_reg(0x00, (s16)g_dsp.r[DSP_REG_IX0]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r[DSP_REG_IX0]));
}
// SLM $acS.m, $acD.l
@ -260,13 +260,13 @@ void slm(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
const u8 sreg = 0x03;
const u8 sreg = DSP_REG_AR3;
dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
dsp_dmem_write(g_dsp.r[DSP_REG_AR0], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
writeToBackLog(2, 0x00, dsp_increment_addr_reg(0x00));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
// SLMN $acS.m, $acD.l
@ -279,13 +279,13 @@ void slnm(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + DSP_REG_ACM0;
u8 dreg = ((opc.hex >> 4) & 0x3) + DSP_REG_AXL0;
const u8 sreg = 0x03;
const u8 sreg = DSP_REG_AR3;
dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
dsp_dmem_write(g_dsp.r[DSP_REG_AR0], g_dsp.r[areg]);
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
writeToBackLog(2, 0x00, dsp_increase_addr_reg(0x00, (s16)g_dsp.r[DSP_REG_IX0]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r[DSP_REG_IX0]));
}
// Not in duddie's doc
@ -297,22 +297,22 @@ void ld(const UDSPInstruction& opc)
u8 rreg = (opc.hex >> 4) & 0x1;
u8 sreg = opc.hex & 0x3;
if (sreg != 0x03) {
if (sreg != DSP_REG_AR3) {
writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg]));
if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[sreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg]));
else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
} else {
writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg]));
if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[dreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg]));
else
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, dreg, dsp_increment_addr_reg(dreg));
}
@ -329,22 +329,22 @@ void ldn(const UDSPInstruction& opc)
u8 rreg = (opc.hex >> 4) & 0x1;
u8 sreg = opc.hex & 0x3;
if (sreg != 0x03) {
if (sreg != DSP_REG_AR3) {
writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg]));
if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[sreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg]));
else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
} else {
writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg]));
if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[dreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg]));
else
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + dreg]));
}
@ -362,22 +362,22 @@ void ldm(const UDSPInstruction& opc)
u8 rreg = (opc.hex >> 4) & 0x1;
u8 sreg = opc.hex & 0x3;
if (sreg != 0x03) {
if (sreg != DSP_REG_AR3) {
writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg]));
if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[sreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg]));
else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
} else {
writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg]));
if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[dreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg]));
else
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, dreg, dsp_increment_addr_reg(dreg));
}
@ -395,22 +395,22 @@ void ldnm(const UDSPInstruction& opc)
u8 rreg = (opc.hex >> 4) & 0x1;
u8 sreg = opc.hex & 0x3;
if (sreg != 0x03) {
if (sreg != DSP_REG_AR3) {
writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg]));
if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[sreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg]));
else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
} else {
writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg]));
if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3]))
if (IsSameMemArea(g_dsp.r[dreg], g_dsp.r[DSP_REG_AR3]))
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg]));
else
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3]));
writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[DSP_REG_AR3]));
writeToBackLog(2, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + dreg]));
}

View File

@ -84,10 +84,11 @@ void clrp(const UDSPInstruction& opc)
// Magic numbers taken from duddie's doc
// These are probably a bad idea to put here.
zeroWriteBackLog();
g_dsp.r[0x14] = 0x0000;
g_dsp.r[0x15] = 0xfff0;
g_dsp.r[0x16] = 0x00ff;
g_dsp.r[0x17] = 0x0010;
g_dsp.r[DSP_REG_PRODL] = 0x0000;
g_dsp.r[DSP_REG_PRODM] = 0xfff0;
g_dsp.r[DSP_REG_PRODH] = 0x00ff;
g_dsp.r[DSP_REG_PRODM2] = 0x0010;
// 00ff_(fff0 + 0010)_0000 = 0100_0000_0000, conveniently, lower 40bits = 0
}
// MOVP $acD

View File

@ -1,91 +0,0 @@
// Copyright (C) 2003 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/
#include "../Globals.h"
#include "Common.h"
extern u32 m_addressPBs;
// Get the parameter block location - Example SSBM: We get the addr 8049cf00,
// first we always get 0 and go to AXLIST_STUDIOADDR, then we end up at
// AXLIST_PBADDR.
bool AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
DEBUG_LOG(DSPLLE, "AXTask - ================================================================");
DEBUG_LOG(DSPLLE, "AXTask - AXCommandList-Addr: 0x%08x", uAddress);
bool bExecuteList = true;
while (bExecuteList)
{
// SSBM: We get the addr 8049cf00, first we always get 0
u16 iCommand = Memory_Read_U16(uAddress);
uAddress += 2;
switch (iCommand)
{
// ?
case 0: // AXLIST_STUDIOADDR: //00
{
uAddress += 4;
DEBUG_LOG(DSPLLE, "AXLIST AXLIST_SBUFFER: %08x", uAddress);
}
break;
case 2: // AXLIST_PBADDR: // 02
{
m_addressPBs = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPLLE, "AXLIST PB address: %08x", m_addressPBs);
bExecuteList = false;
}
break;
case 7: // AXLIST_SBUFFER: // 7
{
// Hopefully this is where in main ram to write.
uAddress += 4;
DEBUG_LOG(DSPLLE, "AXLIST AXLIST_SBUFFER: %08x", uAddress);
}
break;
default:
{
// Stop the execution of this TaskList
DEBUG_LOG(DSPLLE, "AXLIST default: %08x", uAddress);
bExecuteList = false;
}
break;
} // end of switch
}
DEBUG_LOG(DSPLLE, "AXTask - done, send resume");
DEBUG_LOG(DSPLLE, "AXTask - ================================================================");
// now resume
return true;
}

View File

@ -1,331 +0,0 @@
// Copyright (C) 2003 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/
#include <iostream>
#include <vector>
#include <string> // So that we can test if std::string == abc
#include "Common.h"
#include "UCode_AXStructs.h" // they are only in a virtual dir called UCodes AX
// Settings
#define NUMBER_OF_PBS 64 // Todo: move this to a logging class
// Externals
extern u32 m_addressPBs;
static float ratioFactor;
u32 gLastBlock;
// Vectors and other things
static std::vector<u32> gloopPos(64);
static std::vector<u32> gsampleEnd(64);
static std::vector<u32> gsamplePos(64);
static std::vector<u32> gratio(64);
static std::vector<u32> gratiohi(64);
static std::vector<u32> gratiolo(64);
static std::vector<u32> gfrac(64);
static std::vector<u32> gcoef(64);
// PBSampleRateConverter mixer
static std::vector<u16> gvolume_left(64);
static std::vector<u16> gvolume_right(64);
static std::vector<u16> gmixer_control(64);
static std::vector<u16> gcur_volume(64);
static std::vector<u16> gcur_volume_delta(64);
static std::vector<u16> gaudioFormat(64);
static std::vector<u16> glooping(64);
static std::vector<u16> gsrc_type(64);
static std::vector<u16> gis_stream(64);
// loop
static std::vector<u16> gloop1(64);
static std::vector<u16> gloop2(64);
static std::vector<u16> gloop3(64);
static std::vector<u16> gadloop1(64);
static std::vector<u16> gadloop2(64);
static std::vector<u16> gadloop3(64);
// updates
static std::vector<u16> gupdates1(64);
static std::vector<u16> gupdates2(64);
static std::vector<u16> gupdates3(64);
static std::vector<u16> gupdates4(64);
static std::vector<u16> gupdates5(64);
static std::vector<u32> gupdates_addr(64);
// Other things
static std::vector<u16> Jump(64); // this is 1 or 0
static std::vector<int> musicLength(64);
static std::vector< std::vector<int> > vector1(64, std::vector<int>(100,0));
static std::vector<int> numberRunning(64);
static int j = 0;
static int k = 0;
static s64 l = 0;
static bool iupdonce = false;
static std::vector<u16> viupd(15); // the length of the update frequency bar
static int vectorLength = 15; // the length of the playback history bar and how long
// old blocks are shown
static std::vector<u16> vector62(vectorLength);
static std::vector<u16> vector63(vectorLength);
int ReadOutPBs(AXParamBlock * _pPBs, int _num);
// Main logging function
void Logging()
{
// Control how often the screen is updated
j++;
l++;
if (j>1000000) // TODO: make the update frequency adjustable from the logging window
{
AXParamBlock PBs[NUMBER_OF_PBS];
int numberOfPBs = ReadOutPBs(PBs, NUMBER_OF_PBS);
// =======================================================================================
// Vector1 is a vector1[64][100] vector
/*
Move all items back like this
1 to 2
2 3
3 ...
*/
// ----------------
for (int i = 0; i < 64; i++)
{
for (int j = 1; j < vectorLength; j++)
{
vector1.at(i).at(j-1) = vector1.at(i).at(j);
}
}
// =================
// Enter the latest value
for (int i = 0; i < numberOfPBs; i++)
{
vector1.at(i).at(vectorLength-1) = PBs[i].running;
}
// Count how many blocks we have running now
int jj = 0;
for (int i = 0; i < 64; i++)
{
for (int j = 0; j < vectorLength-1; j++)
{
if (vector1.at(i).at(j) == 1)
{
jj++;
}
numberRunning.at(i) = jj;
}
}
// Write the first row
char buffer [1000] = "";
std::string sbuff;
//sbuff = sbuff + " Nr | | frac ratio | old new \n"; // 5
sbuff = sbuff + " Nr pos / end lpos | voll volr curv vold mix | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
// Read out values for all blocks
for (int i = 0; i < numberOfPBs; i++)
{
if (numberRunning.at(i) > 0)
{
// Write the playback bar
for (int j = 0; j < vectorLength; j++)
{
if(vector1.at(i).at(j) == 0)
{
sbuff = sbuff + " ";
}
else
{
sprintf(buffer, "%c", 177);
sbuff = sbuff + buffer; strcpy(buffer, "");
}
}
int sampleJump;
int loopJump;
//if (PBs[i].running && PBs[i].adpcm_loop_info.yn1 && PBs[i].mixer.volume_left)
if (true)
{
// AXPB base
//int running = pb.running;
gcoef[i] = PBs[i].unknown1;
sampleJump = ((PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo) - gsamplePos[i];
loopJump = ((PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo) - gloopPos[i];
gloopPos[i] = (PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo;
gsampleEnd[i] = (PBs[i].audio_addr.end_addr_hi << 16) | PBs[i].audio_addr.end_addr_lo;
gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo;
// PBSampleRateConverter src
gratio[i] = (u32)(((PBs[i].src.ratio_hi << 16) + PBs[i].src.ratio_lo) * ratioFactor);
gratiohi[i] = PBs[i].src.ratio_hi;
gratiolo[i] = PBs[i].src.ratio_lo;
gfrac[i] = PBs[i].src.cur_addr_frac;
// adpcm_loop_info
gadloop1[i] = PBs[i].adpcm.pred_scale;
gadloop2[i] = PBs[i].adpcm.yn1;
gadloop3[i] = PBs[i].adpcm.yn2;
gloop1[i] = PBs[i].adpcm_loop_info.pred_scale;
gloop2[i] = PBs[i].adpcm_loop_info.yn1;
gloop3[i] = PBs[i].adpcm_loop_info.yn2;
// updates
gupdates1[i] = PBs[i].updates.num_updates[0];
gupdates2[i] = PBs[i].updates.num_updates[1];
gupdates3[i] = PBs[i].updates.num_updates[2];
gupdates4[i] = PBs[i].updates.num_updates[3];
gupdates5[i] = PBs[i].updates.num_updates[4];
gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
gaudioFormat[i] = PBs[i].audio_addr.sample_format;
glooping[i] = PBs[i].audio_addr.looping;
gsrc_type[i] = PBs[i].src_type;
gis_stream[i] = PBs[i].is_stream;
// mixer
gvolume_left[i] = PBs[i].mixer.volume_left;
gvolume_right[i] = PBs[i].mixer.volume_right;
gmixer_control[i] = PBs[i].mixer_control;
gcur_volume[i] = PBs[i].vol_env.cur_volume;
gcur_volume_delta[i] = PBs[i].vol_env.cur_volume_delta;
// other stuff
Jump[i] = (gfrac[i] >> 16); // This is 1 or 0
musicLength[i] = gsampleEnd[i] - gloopPos[i];
}
// PRESETS
/*
/" Nr pos / end lpos | voll volr curv vold mix | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
"---------------|00 12341234/12341234 12341234 | 00000 00000 00000 0000 00000 | 0[000 00000 00000] 0 | 00000 00000[0 00000] |
*/
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i %05i %04i %05i | %i[%03i %05i %05i] %i | %05i %05i[%i %05i] | %i %i %i %i %i",
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
gvolume_left[i], gvolume_right[i], gcur_volume[i], gcur_volume_delta[i], gmixer_control[i],
glooping[i], gloop1[i], gloop2[i], gloop3[i], gis_stream[i],
gfrac[i], gratio[i], gratiohi[i], gratiolo[i],
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i]
);
// write a new line
sbuff = sbuff + buffer; strcpy(buffer, "");
sbuff = sbuff + "\n";
} // end of if (true)
} // end of big loop - for (int i = 0; i < numberOfPBs; i++)
// Write global values
sprintf(buffer, "\nParameter blocks span from %08x | to %08x | distance %i %i\n", m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192);
sbuff = sbuff + buffer; strcpy(buffer, "");
// Show update frequency
sbuff = sbuff + "\n";
if(!iupdonce)
{
/*
for (int i = 0; i < 10; i++)
{
viupd.at(i) == 0;
}
*/
viupd.at(0) = 1;
viupd.at(1) = 1;
viupd.at(2) = 1;
iupdonce = true;
}
for (int i = 0; i < (int)viupd.size(); i++) // 0, 1,..., 9
{
if (i < (int)viupd.size()-1)
{
viupd.at(viupd.size()-i-1) = viupd.at(viupd.size()-i-2); // move all forward
}
else
{
viupd.at(0) = viupd.at(viupd.size()-1);
}
// Correction
if (viupd.at(viupd.size()-3) == 1 && viupd.at(viupd.size()-2) == 1 && viupd.at(viupd.size()-1) == 1)
{
viupd.at(0) = 0;
}
if(viupd.at(0) == 0 && viupd.at(1) == 1 && viupd.at(2) == 1 && viupd.at(3) == 0)
{
viupd.at(0) = 1;
}
}
for (int i = 0; i < (int)viupd.size(); i++)
{
if(viupd.at(i) == 0)
sbuff = sbuff + " ";
else
sbuff = sbuff + ".";
}
// ================
// Print
INFO_LOG(DSPLLE, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, "");
// ---------------
k=0;
j=0;
// ---------------
}
}

View File

@ -1,23 +0,0 @@
// Copyright (C) 2003 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 LOGGING_H
#define LOGGING_H
void Logging();
#endif

View File

@ -1,103 +0,0 @@
// Copyright (C) 2003 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/
// Turn on and off logging modes
// --------------
//#define LOG1 // writes selected parameters only and with more readable formatting
//#define LOG2 // writes all parameters
#include "Common.h"
#include "../Globals.h"
#include "CommonTypes.h" // Pluginspecs
#include "UCode_AXStructs.h" // For the AXParamBlock structure
u32 m_addressPBs = 0;
extern u32 gLastBlock;
int m = 0;
int n = 0;
#ifdef LOG2
bool logall = true;
#else
bool logall = false;
#endif
int ReadOutPBs(AXParamBlock * _pPBs, int _num)
{
int count = 0;
u32 blockAddr = m_addressPBs;
u32 OldblockAddr = blockAddr;
u32 paraAddr = blockAddr;
// reading and 'halfword' swap
n++;
//FIXME if (n > 20 && logall) {Console::ClearScreen();}
for (int i = 0; i < _num; i++)
{
// Check if there is something here.
const short * pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
// -------------
if (pSrc != NULL) // only read non-blank blocks
{
// Create a shortcut that let us update struct members
short * pDest = (short *) & _pPBs[i];
if (n > 20 && logall) {DEBUG_LOG(DSPLLE, "%c%i:", 223, i);} // logging
// Here we update the PB. We do it by going through all 192 / 2 = 96 u16 values
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
paraAddr += 2;
if(pSrc != NULL)
{
if (pSrc[p] != 0 && n > 20 && logall)
{
DEBUG_LOG(DSPLLE, "%i %04x | ", p, Common::swap16(pSrc[p]));
}
}
pDest[p] = Common::swap16(pSrc[p]);
}
if(n > 20 && logall) {DEBUG_LOG(DSPLLE, "\n");} // logging
// Here we update the block address to the starting point of the next PB
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
// save some values
count++;
gLastBlock = paraAddr; // blockAddr
// ============
}
else
{
break;
}
} // end of the big loop
if (n > 20) {n = 0;} // for logging
// return the number of readed PBs
return count;
}

View File

@ -1,143 +0,0 @@
// Copyright (C) 2003 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_STRUCTS
#define UCODE_AX_STRUCTS
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBInitialTimeDelay
{
u16 unknown[7];
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUnknown
{
s16 unknown[9];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 unknown;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (2 = none, ?, linear)
u16 unknown1;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBUnknown unknown2;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif

View File

@ -31,7 +31,6 @@
#include "AudioCommon.h"
#include "Mixer.h"
#include "Logging/Logging.h" // For Logging
#include "DSPTables.h"
#include "DSPCore.h"