Delete some obsolete junk, in zelda ucode and in gl plugin.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3577 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
17f697d856
commit
dfdfbd4a6a
|
@ -125,42 +125,28 @@ void BPWritten(const Bypass& bp)
|
|||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||
// Set LogicOp Blending Mode
|
||||
if (bp.changes & 2)
|
||||
{
|
||||
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
|
||||
SetLogicOpMode(bp);
|
||||
}
|
||||
// Set Dithering Mode
|
||||
if (bp.changes & 4)
|
||||
{
|
||||
SETSTAT(stats.dither, bpmem.blendmode.dither);
|
||||
SetDitherMode(bp);
|
||||
}
|
||||
// Set Blending Mode
|
||||
if (bp.changes & 0xFE1)
|
||||
{
|
||||
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
|
||||
SETSTAT(stats.dstFactor, bpmem.blendmode.dstfactor);
|
||||
SetBlendMode(bp);
|
||||
}
|
||||
// Set Color Mask
|
||||
if (bp.changes & 0x18)
|
||||
{
|
||||
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);
|
||||
SETSTAT(stats.colorUpdate, bpmem.blendmode.colorupdate);
|
||||
SetColorMask(bp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
|
||||
{
|
||||
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
|
||||
SETSTAT(stats.dstAlphaEnable, bpmem.dstalpha.enable);
|
||||
SETSTAT_UINT(stats.dstAlpha, bpmem.dstalpha.alpha);
|
||||
PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
|
||||
break;
|
||||
}
|
||||
// This is called when the game is done drawing the new frame (eg: like in DX: Begin(); Draw(); End();)
|
||||
// Triggers an interrupt on the PPC side so that the game knows when the GPU has finished drawing.
|
||||
// Tokens are similar.
|
||||
case BPMEM_SETDRAWDONE:
|
||||
switch (bp.newvalue & 0xFF)
|
||||
{
|
||||
|
@ -272,7 +258,7 @@ void BPWritten(const Bypass& bp)
|
|||
case BPMEM_FOGBMAGNITUDE:
|
||||
case BPMEM_FOGBEXPONENT:
|
||||
case BPMEM_FOGPARAM3:
|
||||
if(!GetConfig(CONFIG_DISABLEFOG))
|
||||
if (!GetConfig(CONFIG_DISABLEFOG))
|
||||
PixelShaderManager::SetFogParamChanged();
|
||||
break;
|
||||
case BPMEM_FOGCOLOR: // Fog Color
|
||||
|
@ -383,6 +369,7 @@ void BPWritten(const Bypass& bp)
|
|||
case BPMEM_UNKNOWN2:
|
||||
case BPMEM_UNKNOWN3:
|
||||
case BPMEM_UNKNOWN4:
|
||||
|
||||
break;
|
||||
// ------------------------------------------------
|
||||
// On Default, we try to look for other things
|
||||
|
|
|
@ -41,15 +41,6 @@ struct Statistics
|
|||
|
||||
int numVertexLoaders;
|
||||
|
||||
int logicOpMode;
|
||||
int srcFactor;
|
||||
int dstFactor;
|
||||
int dither;
|
||||
int alphaUpdate;
|
||||
int colorUpdate;
|
||||
int dstAlphaEnable;
|
||||
u32 dstAlpha;
|
||||
|
||||
float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5, proj_6;
|
||||
float gproj_0, gproj_1, gproj_2, gproj_3, gproj_4, gproj_5;
|
||||
float gproj_6, gproj_7, gproj_8, gproj_9, gproj_10, gproj_11, gproj_12, gproj_13, gproj_14, gproj_15;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "WaveFile.h"
|
||||
|
||||
/*
|
||||
class CResampler
|
||||
{
|
||||
public:
|
||||
|
@ -85,6 +86,7 @@ public:
|
|||
int m_queueSize;
|
||||
int m_mode;
|
||||
};
|
||||
*/
|
||||
|
||||
CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler, u32 _CRC)
|
||||
: IUCode(_rMailHandler)
|
||||
|
@ -527,39 +529,27 @@ void CUCode_Zelda::ExecuteList()
|
|||
// DsetupTable ... zelda ww jumps to 0x0095
|
||||
case 0x01:
|
||||
{
|
||||
u16 *TempPtr;
|
||||
int i;
|
||||
// num_param_blocks = ExtraData;
|
||||
// u32 tmp[4];
|
||||
//param_blocks_ptr = tmp[0] = Read32();
|
||||
// tmp[1] = Read32();
|
||||
// tmp[2] = Read32();
|
||||
//param_blocks2_ptr = tmp[3] = Read32();
|
||||
|
||||
m_NumVoices = ExtraData;
|
||||
|
||||
m_VoicePBsAddr = Read32() & 0x7FFFFFFF;
|
||||
m_UnkTableAddr = Read32() & 0x7FFFFFFF;
|
||||
m_AFCCoefTableAddr = Read32() & 0x7FFFFFFF;
|
||||
m_ReverbPBsAddr = Read32() & 0x7FFFFFFF; // WARNING: reverb PBs are very different from voice PBs!
|
||||
m_ReverbPBsAddr = Read32() & 0x7FFFFFFF; // WARNING: reverb PBs are very different from voice PBs!
|
||||
|
||||
// Read AFC coef table
|
||||
TempPtr = (u16*) g_dspInitialize.pGetMemoryPointer(m_AFCCoefTableAddr);
|
||||
for (i = 0; i < 32; i++)
|
||||
u16 *TempPtr = (u16*) g_dspInitialize.pGetMemoryPointer(m_AFCCoefTableAddr);
|
||||
for (int i = 0; i < 32; i++)
|
||||
m_AFCCoefTable[i] = Common::swap16(TempPtr[i]);
|
||||
|
||||
DEBUG_LOG(DSPHLE, "DsetupTable");
|
||||
DEBUG_LOG(DSPHLE, "Num voice param blocks: %i", m_NumVoices);
|
||||
DEBUG_LOG(DSPHLE, "Voice param blocks address: 0x%08x", m_VoicePBsAddr);
|
||||
|
||||
// This points to some strange data table.
|
||||
// This points to some strange data table. Don't know yet what it's for. Reverb coefs?
|
||||
DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", m_UnkTableAddr);
|
||||
|
||||
// Zelda WW: This points to a 64-byte array of coefficients, which are EXACTLY the same
|
||||
// as the AFC ADPCM coef array in decode.c of the in_cube winamp plugin,
|
||||
// which can play Zelda audio.
|
||||
// There's also a lot more table-looking data immediately after - maybe alternative
|
||||
// tables? I wonder where the parameter blocks are?
|
||||
// which can play Zelda audio. So, these should definitely be used when decoding AFC.
|
||||
DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", m_AFCCoefTableAddr);
|
||||
DEBUG_LOG(DSPHLE, "Reverb param blocks address: 0x%08x", m_ReverbPBsAddr);
|
||||
}
|
||||
|
@ -568,11 +558,6 @@ void CUCode_Zelda::ExecuteList()
|
|||
// SyncFrame ... zelda ww jumps to 0x0243
|
||||
case 0x02:
|
||||
{
|
||||
//u32 tmp[2];
|
||||
//tmp[0] = Read32();
|
||||
//tmp[1] = Read32();
|
||||
|
||||
// We're ready to mix
|
||||
// soundStream->GetMixer()->SetHLEReady(true);
|
||||
// DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
|
||||
//soundStream->Update(); //do it in this thread to avoid sync problems
|
||||
|
@ -592,14 +577,12 @@ void CUCode_Zelda::ExecuteList()
|
|||
// but not at, the ADMA read addresses.
|
||||
DEBUG_LOG(DSPHLE, "Right buffer address: 0x%08x", m_RightBuffersAddr);
|
||||
DEBUG_LOG(DSPHLE, "Left buffer address: 0x%08x", m_LeftBuffersAddr);
|
||||
//DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]); // wtf?
|
||||
|
||||
// Let's log the parameter blocks.
|
||||
// Copy and byteswap the parameter blocks.
|
||||
|
||||
// For some reason, in Z:WW we get no param blocks until in-game,
|
||||
// while Zelda Four Swords happily sets param blocks as soon as the title screen comes up.
|
||||
// Looks like it's playing midi music.
|
||||
// Both Z:TP, Z:WW and Zelda Four Swords happily sets param blocks as soon as the title screen comes up.
|
||||
// Although in Z:WW, it won't set any param blocks until in-game if the item hack is on.
|
||||
#if 0
|
||||
DEBUG_LOG(DSPHLE, "Param block at %08x:", param_blocks_ptr);
|
||||
CopyPBsFromRAM();
|
||||
|
@ -665,8 +648,7 @@ void CUCode_Zelda::ExecuteList()
|
|||
// DsetDolbyDelay ... zelda ww jumps to 0x00b2
|
||||
case 0x0d:
|
||||
{
|
||||
u32 tmp[1];
|
||||
tmp[0] = Read32();
|
||||
u32 tmp = Read32();
|
||||
DEBUG_LOG(DSPHLE, "DSetDolbyDelay");
|
||||
DEBUG_LOG(DSPHLE, "DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp);
|
||||
}
|
||||
|
@ -677,13 +659,12 @@ void CUCode_Zelda::ExecuteList()
|
|||
case 0x0e:
|
||||
{
|
||||
m_DMABaseAddr = Read32() & 0x7FFFFFFF;
|
||||
|
||||
DEBUG_LOG(DSPHLE, "DsetDMABaseAddr");
|
||||
DEBUG_LOG(DSPHLE, "DMA base address: 0x%08x", m_DMABaseAddr);
|
||||
}
|
||||
break;
|
||||
|
||||
// default ... zelda ww jumps to 0x0043
|
||||
// default ... zelda ww jumps to 0x0043
|
||||
default:
|
||||
PanicAlert("Zelda UCode - unknown cmd: %x (size %i)", Command, m_numSteps);
|
||||
break;
|
||||
|
@ -695,61 +676,6 @@ void CUCode_Zelda::ExecuteList()
|
|||
m_rMailHandler.PushMail(0xF3550000 | Sync);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void CUCode_Zelda::CopyPBsFromRAM()
|
||||
{
|
||||
for (u32 i = 0; i < m_NumPBs; i++)
|
||||
{
|
||||
u32 addr = m_PBAddress + i * sizeof(ZPB);
|
||||
const u16 *src_ptr = (u16 *)g_dspInitialize.pGetMemoryPointer(addr);
|
||||
u16 *dst_ptr = (u16 *)&m_PBs[i];
|
||||
|
||||
for (size_t p = 0; p < 0xC0; p++)
|
||||
{
|
||||
dst_ptr[p] = Common::swap16(src_ptr[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_Zelda::CopyPBsToRAM()
|
||||
{
|
||||
for (u32 i = 0; i < m_NumPBs; i++)
|
||||
{
|
||||
u32 addr = m_PBAddress + i * sizeof(ZPB);
|
||||
const u16 *src_ptr = (u16 *)&m_PBs[i];
|
||||
u16 *dst_ptr = (u16 *)g_dspInitialize.pGetMemoryPointer(addr);
|
||||
for (size_t p = 0; p < 0x80; p++) // we write the first 0x80 shorts back only
|
||||
{
|
||||
dst_ptr[p] = Common::swap16(src_ptr[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// --- Debug Helper
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CUCode_Zelda::DumpPB(const ZPB& _rPB)
|
||||
{
|
||||
u16* pTmp = (u16*)&_rPB;
|
||||
FILE* pF = fopen("d:\\dump\\PB.txt", "a");
|
||||
if (pF)
|
||||
{
|
||||
if (_rPB.addr_high)
|
||||
{
|
||||
for (int i = 0; i < 0xc0; i += 4)
|
||||
{
|
||||
fprintf(pF, "[0x%02x] %04x %04x %04x %04x\n", i, pTmp[i], pTmp[i + 1], pTmp[i + 2], pTmp[i + 3]);
|
||||
}
|
||||
fprintf(pF, "\n");
|
||||
fclose(pF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// size is in stereo samples.
|
||||
void CUCode_Zelda::MixAdd(short* _Buffer, int _Size)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#include "Common.h"
|
||||
#include "UCodes.h"
|
||||
|
||||
// Obviously missing things that must be in here, somewhere among the "unknown":
|
||||
// * Volume
|
||||
// * L/R Pan
|
||||
// * (probably) choice of resampling algorithm (point, linear, cubic)
|
||||
|
||||
struct ZeldaVoicePB
|
||||
{
|
||||
|
@ -44,7 +48,7 @@ struct ZeldaVoicePB
|
|||
u16 Unk3C[0x2A]; // 0x3C | unknown
|
||||
u16 YN1; // 0x66 | YN1
|
||||
u16 YN2; // 0x67 | YN2
|
||||
u16 Unk68[0x18]; // 0x68 | unknwon
|
||||
u16 Unk68[0x18]; // 0x68 | unknown
|
||||
|
||||
// Read-only part
|
||||
u16 Format; // 0x80 | audio format
|
||||
|
@ -57,46 +61,11 @@ struct ZeldaVoicePB
|
|||
u16 Padding[0x30]; // 0x90 | padding
|
||||
};
|
||||
|
||||
// Here's a piece of pure guesswork, looking at random supposedly-PBs
|
||||
// from Zelda Four Swords.
|
||||
|
||||
// These are 0x180 bytes large.
|
||||
struct ZPB
|
||||
{
|
||||
// R/W data =============
|
||||
// AFC history (2 shorts) must be in here somewhere, plus lots of other state.
|
||||
u16 unk0;
|
||||
u16 unk1;
|
||||
u16 unk2;
|
||||
u16 unk3;
|
||||
u16 unk4;
|
||||
u16 unk5;
|
||||
u16 unk6;
|
||||
|
||||
u16 unk7[0x2C]; // 0x033
|
||||
u16 SampleData[0x4D]; // 0x4D = 9 * 8
|
||||
|
||||
// From here, "read only" data (0x80 to the end)
|
||||
// 0x88, 0x89 could be volume
|
||||
u16 type; // 0x5, 0x9 = AFC. There are more types but we've only seen AFC so far.
|
||||
u16 r_unknown1;
|
||||
|
||||
u16 r_unknown2[0x14 / 2];
|
||||
|
||||
// Pointer to sample data in ARAM.
|
||||
// These are the only things in the param blocks that look a lot like pointers.
|
||||
u16 addr_high; // at 0x18 = 0xC * 2
|
||||
u16 addr_low;
|
||||
|
||||
u16 r_unknown3[(0x80 - 0x1C) / 2];
|
||||
};
|
||||
|
||||
namespace {
|
||||
// If this miscompiles, adjust the size of ZPB to 0x180 bytes (0xc0 shorts).
|
||||
CompileTimeAssert<sizeof(ZPB) == 0x180> ensure_zpb_size_correct;
|
||||
// If this miscompiles, adjust the size of ZeldaVoicePB to 0x180 bytes (0xc0 shorts).
|
||||
CompileTimeAssert<sizeof(ZeldaVoicePB) == 0x180> ensure_zpb_size_correct;
|
||||
} // namespace
|
||||
|
||||
|
||||
class CUCode_Zelda : public IUCode
|
||||
{
|
||||
public:
|
||||
|
@ -107,8 +76,6 @@ public:
|
|||
void Update(int cycles);
|
||||
void MixAdd(short* buffer, int size);
|
||||
|
||||
void UpdatePB(ZPB& _rPB, int *templbuffer, int *temprbuffer, u32 _Size);
|
||||
|
||||
void CopyPBsFromRAM();
|
||||
void CopyPBsToRAM();
|
||||
|
||||
|
@ -118,7 +85,6 @@ public:
|
|||
int *temprbuffer;
|
||||
|
||||
// simple dump ...
|
||||
void DumpPB(const ZPB& _rPB);
|
||||
int DumpAFC(u8* pIn, const int size, const int srate);
|
||||
|
||||
u32 Read32()
|
||||
|
|
|
@ -1327,18 +1327,6 @@ void Renderer::DrawDebugText()
|
|||
p+=sprintf(p,"%s",text1.c_str());
|
||||
}
|
||||
|
||||
if (g_Config.bOverlayBlendStats)
|
||||
{
|
||||
p+=sprintf(p,"LogicOp Mode: %i\n", stats.logicOpMode);
|
||||
p+=sprintf(p,"Source Factor: %i\n", stats.srcFactor);
|
||||
p+=sprintf(p,"Destination Factor: %i\n", stats.dstFactor);
|
||||
p+=sprintf(p,"Dithering: %s\n", stats.dither==1 ? "Enabled" : "Disabled");
|
||||
p+=sprintf(p,"Color Update: %s\n", stats.colorUpdate==1 ? "Enabled" : "Disabled");
|
||||
p+=sprintf(p,"Alpha Update: %s\n", stats.alphaUpdate==1 ? "Enabled" : "Disabled");
|
||||
p+=sprintf(p,"Dst Alpha Enabled: %s\n", stats.dstAlphaEnable==1 ? "Enabled" : "Disabled");
|
||||
p+=sprintf(p,"Dst Alpha: %08x\n", stats.dstAlpha);
|
||||
}
|
||||
|
||||
if (g_Config.bOverlayProjStats)
|
||||
{
|
||||
p+=sprintf(p,"Projection #: X for Raw 6=0 (X for Raw 6!=0)\n\n");
|
||||
|
|
Loading…
Reference in New Issue