diff options
| author | John Peterson <jpeterson57@gmail.com> | 2008-11-17 16:59:20 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2008-11-17 16:59:20 +0000 |
| commit | d463c3b6f40e4012fd09d79fe1e3f974524fd5fa (patch) | |
| tree | a846fdeb96be647334f4099a141a08b45aed03d5 /Source | |
| parent | a88a644602b5451a07df6e19d9eea36b9fca18fc (diff) | |
Made all updates apply in DSP HLE
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1196 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/Src/HW/DSP.cpp | 4 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h | 1 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp | 306 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp | 50 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp | 46 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h | 15 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp | 5 |
7 files changed, 245 insertions, 182 deletions
diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp index d3bdc5f4d3..81c480c8de 100644 --- a/Source/Core/Core/Src/HW/DSP.cpp +++ b/Source/Core/Core/Src/HW/DSP.cpp @@ -71,8 +71,8 @@ enum {
ARAM_SIZE = 0x01000000, // 16 MB
ARAM_MASK = 0x00FFFFFF,
- WII_MASK = 0x017FFFFF,
- WII_MEM2 = 0x03FFFFFF
+ WII_MASK = 0x017FFFFF, // 24 MB
+ WII_MEM2 = 0x03FFFFFF // 64 MB
};
// UARAMCount
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h index f669a5a30f..a9a6e04df7 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h @@ -116,6 +116,7 @@ class CDebugger : public wxDialog int gUpdFreq;// main update freq.
int gPreset; // main presets
bool bShowBase; // main presets
+ u32 gLastBlock;
bool ScanMails; // mail settings
bool StoreMails;
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp index 58fcaf330f..3a282782bf 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp @@ -52,7 +52,6 @@ extern bool gSSBMremedy2; extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
-u32 gLastBlock;
extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd
extern CDebugger* m_frame;
@@ -60,12 +59,13 @@ extern CDebugger* m_frame; // Parameter blocks
+ std::vector<int> mem(NUMBER_OF_PBS); // mem1 or mem2
std::vector<u32> gloopPos(NUMBER_OF_PBS);
std::vector<u32> gsampleEnd(NUMBER_OF_PBS);
std::vector<u32> gsamplePos(NUMBER_OF_PBS);
// main
- std::vector<u16> running(NUMBER_OF_PBS);
+ std::vector<u16> running(NUMBER_OF_PBS, 0);
std::vector<u16> gsrc_type(NUMBER_OF_PBS);
std::vector<u16> gis_stream(NUMBER_OF_PBS);
@@ -124,7 +124,10 @@ extern CDebugger* m_frame; std::vector<u16> gupdates5(NUMBER_OF_PBS);
std::vector<u32> gupdates_addr(NUMBER_OF_PBS);
std::vector<u32> gupdates_data(NUMBER_OF_PBS);
-
+ std::vector<u32> gupdates_data1(NUMBER_OF_PBS);
+ std::vector<u32> gupdates_data2(NUMBER_OF_PBS);
+ std::vector<u32> gupdates_data3(NUMBER_OF_PBS);
+ std::vector<u32> gupdates_data4(NUMBER_OF_PBS);
// Counters
@@ -136,15 +139,14 @@ bool iupdonce = false; std::vector<u16> viupd(15); // the length of the update frequency bar
int vectorLengthGUI = 8; // length of playback history bar for the GUI version
int vectorLength = 15; // for console version
-int vectorLength2 = 100; // for console version
-
+int vectorLength2 = 100; // for console version, how long to show
// More stuff
// should we worry about the additonal memory these lists require? bool will allocate
// very little memory
-std::vector< std::vector<bool> > vector1(NUMBER_OF_PBS, std::vector<bool>(vectorLength, 0));
-std::vector< std::vector<bool> > vector2(NUMBER_OF_PBS, std::vector<bool>(vectorLength2, 0));
+std::vector< std::vector<bool> > vector1(NUMBER_OF_PBS, std::vector<bool>(vectorLength, false));
+std::vector< std::vector<bool> > vector2(NUMBER_OF_PBS, std::vector<bool>(vectorLength2, false));
std::vector<int> numberRunning(NUMBER_OF_PBS);
@@ -164,8 +166,8 @@ std::string writeTitle(int a, bool Wii) {
if(m_frame->bShowBase) // show base 10
{
- b = " adpcm adpcm_loop\n";
- b = b + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
+ b = " adpcm adpcm_loop\n";
+ b = b + " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
}
else
{
@@ -230,8 +232,8 @@ std::string writeMessage(int a, int i, bool Wii) // ---------------------------------------------------------------------------------------
/*
PRESET 0
- " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
- "---------------|00 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000]
+ " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
+ "---------------|00 1 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000]
" Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac rati[hi lo ]\n";
"---------------|00 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 0000 0000 000 0000 0000 | 0000 0000[0 00000]
@@ -246,15 +248,28 @@ std::string writeMessage(int a, int i, bool Wii) */
if(a == 0)
{
- if(m_frame->bShowBase)
+ if(m_frame->bShowBase) // base 10 (decimal)
{
- sprintf(buf,"%c%02i %10s/%10s %10s | %06s %06s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
- 223, i, ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
- ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
- glooping[i], gis_stream[i],
- gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
- gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
- );
+ if(Wii) // Wii
+ {
+ sprintf(buf,"%c%02i %i %10s/%10s %10s | %06s %06s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
+ 223, i, mem[i], ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
+ ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
+ glooping[i], gis_stream[i],
+ gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
+ gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
+ );
+ }
+ else // GC
+ {
+ sprintf(buf,"%c%02i %10s/%10s %10s | %06s %06s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
+ 223, i, ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
+ ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
+ glooping[i], gis_stream[i],
+ gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
+ gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
+ );
+ }
}
else
{
@@ -269,23 +284,38 @@ std::string writeMessage(int a, int i, bool Wii) }
else if(a == 1)
{
- if(m_frame->bShowBase)
+ if(m_frame->bShowBase) // base 10 (decimal)
{
sprintf(buf,"%c%02i %10s/%10s %10s | %06s %06s | %u %u %u | %u %u %u %u %u %08x %08x",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
gsrc_type[i], gaudioFormat[i], gcoef[i],
- gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i], gupdates_data[i]
+ gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i],
+ gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
);
}
- else
+ else // base 16 (hexadecimal)
{
- sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %u %u %08x %08x",
- 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
- gvolume_left[i], gvolume_right[i],
- gsrc_type[i], gaudioFormat[i], gcoef[i],
- gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i], gupdates_data[i]
- );
+ if(Wii) // Wii
+ {
+ sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %08x %08x %08x %08x %08x",
+ 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
+ gvolume_left[i], gvolume_right[i],
+ gsrc_type[i], gaudioFormat[i], gcoef[i],
+ gupdates1[i], gupdates2[i], gupdates3[i], gupdates_addr[i],
+ gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
+ );
+ }
+ else // GC
+ {
+ sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x",
+ 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
+ gvolume_left[i], gvolume_right[i],
+ gsrc_type[i], gaudioFormat[i], gcoef[i],
+ gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i],
+ gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
+ );
+ }
}
}
else if(a == 2)
@@ -318,7 +348,7 @@ std::string writeMessage(int a, int i, bool Wii) {
if(m_frame->bShowBase)
{
- if(Wii)
+ if(Wii) // Wii
{
sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %05i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
223, i,
@@ -330,7 +360,7 @@ std::string writeMessage(int a, int i, bool Wii) gmixer_d6[i], gmixer_d7[i]
);
}
- else
+ else // GC
{
sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %08i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
223, i,
@@ -420,7 +450,7 @@ template<class ParamBlockType> void CollectPB(bool Wii, int i, ParamBlockType &P if(Wii) gmixer_control_wii[i] = PBs[i].mixer_control;
else gmixer_control[i] = PBs[i].mixer_control;
- running[i] = PBs[i].running;
+ //running[i] = PBs[i].running;
gis_stream[i] = PBs[i].is_stream;
// mixer (some differences)
@@ -458,7 +488,8 @@ template<class ParamBlockType> void CollectPB(bool Wii, int i, ParamBlockType &P if(gloopPos[i] > 0x20000000) gloopPos[i] -= 0x20000000;
if(gsampleEnd[i] > 0x20000000) gsampleEnd[i] -= 0x20000000;
- if(gsamplePos[i] > 0x20000000) gsamplePos[i] -= 0x20000000;
+ if(gsamplePos[i] > 0x20000000) { gsamplePos[i] -= 0x20000000;
+ mem[i] = 2;} else { mem[i] = 1; }
// PBADPCMLoopInfo adpcm_loop_info (same in GC and Wii)
gadloop1[i] = PBs[i].adpcm.pred_scale;
@@ -477,7 +508,14 @@ template<class ParamBlockType> void CollectPB(bool Wii, int i, ParamBlockType &P gupdates5[i] = PBs[i].updates.num_updates[4];
gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
- gupdates_data[i] = Memory_Read_U32(gupdates_addr[i]);
+ if(gupdates_addr[i] > 0x80000000 && gupdates_addr[i] < 0x93ffffff)
+ {
+ gupdates_data[i] = Memory_Read_U32(gupdates_addr[i]);
+ gupdates_data1[i] = Memory_Read_U32(gupdates_addr[i] + 4);
+ gupdates_data2[i] = Memory_Read_U32(gupdates_addr[i] + 8);
+ gupdates_data3[i] = Memory_Read_U32(gupdates_addr[i] + 12);
+ gupdates_data3[i] = Memory_Read_U32(gupdates_addr[i] + 16);
+ }
// PBSampleRateConverter src
@@ -527,49 +565,22 @@ bool PrepareConditions(bool Wii, int i, ParamBlockType &PBs) // ===============
-// I placed this in CUCode_AX because it needs access to private members of that class.
-//template<class ParamBlockType>
-//void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii, AXParamBlockWii *PBs, int numberOfPBs)
-void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
+
+template<class ParamBlockType>
+void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
+ int numberOfPBs, u32 m_addressPBs)
+//void Logging__(short* _pBuffer, int _iSize, int a, bool Wii)
{
- // Declare structures
- /**/
- int version; // AX version
- int numberOfPBs, numberOfPBsWii, numberOfPBsGC;
bool Conditions; // Select blocks to show
- AXParamBlock PBs[NUMBER_OF_PBS];
- AXParamBlockWii PBw[NUMBER_OF_PBS];
- AXParamBlockWii_ PBw_[NUMBER_OF_PBS];
- if(_CRC == 0xfa450138) LOG_(0, "CRC old");
- if(_CRC == 0xfa450138) version = 0;
-
- // Read out the number of PBs that have data
- if(_CRC == 0xfa450138)
- numberOfPBsWii = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS, true);
- else
- numberOfPBsWii = ReadOutPBsWii(m_addressPBs, PBw_, NUMBER_OF_PBS, true);
- numberOfPBsGC = ReadOutPBs(m_addressPBs, PBs, NUMBER_OF_PBS);
-
- // Select the right one
- if(Wii) numberOfPBs = numberOfPBsWii;
- else numberOfPBs = numberOfPBsGC;
-
-
// =======================================================================================
// Update parameter values
// --------------
// We could chose to update these only if a block is currently running. Later I'll add options
// to see both the current and the latest active value.
- //if (PBs[i].running)
int irun = 0;
for (int i = 0; i < numberOfPBs; i++)
{
- if(Wii)
- running[i] = PBs[i].running;
- else
- running[i] = PBs[i].running;
-
// --------------------------------------------------------------------
// Write a line for the text log if nothing is playing
// --------------
@@ -590,23 +601,16 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) // --------------
- // Prepare conditions
- /**/
- if(Wii)
- if(version == 0) Conditions = PrepareConditions(Wii, i, PBw);
- else Conditions = PrepareConditions(Wii, i, PBw_);
- else
- Conditions = PrepareConditions(Wii, i, PBs);
-
-
+ // --------------------------------------
+ // Now go through only a subset of the blocks depending on Conditions
+ // ------------------
+ /* Prepare conditions. We may for example get Conditions = true for blocks
+ that currently have numberRunning.at(i) > 0 */
+ Conditions = PrepareConditions(Wii, i, PBs);
if (Conditions)
{
// Collect parameters
- if(Wii)
- if(version == 0) CollectPB(Wii, i, PBw);
- else CollectPB(Wii, i, PBw_);
- else
- CollectPB(Wii, i, PBs);
+ CollectPB(Wii, i, PBs);
// ---------------------------------------------------------------------------------------
// Write to file
@@ -619,7 +623,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) // write running
char cbuf[10];
- sprintf(cbuf, "%i", running[i]);
+ sprintf(cbuf, "%i", PBs[i].running);
sfbuff = sfbuff + cbuf;
sfbuff = sfbuff + writeMessage(ii, i, Wii);
@@ -636,85 +640,69 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) // ==============
- //PanicAlert("Done now before: %i", numberOfPBs);
-
-
// =======================================================================================
// Control how often the screen is updated, and then update the screen
// --------------
- if(a == 0) j++;
+ if(a == 0) j++; // a == 0 when Logging is called before the blocks are updated
if (m_frame->gUpdFreq > 0 && j > (200/m_frame->gUpdFreq))
{
// =======================================================================================
- // Save the running history for each block. Vector1 is a vector1[NUMBER_OF_PBS][100] vector.
+ /* Save the displayed running history for each block. Vector1 is a vector1[NUMBER_OF_PBS]
+ [100] vector. */
// --------------
/*
Move all items back like this:
- 1 to 2
- 2 3
+ 1 to 0
+ 2 1
3 ...
+ 5 to 4
*/
- for (int i = 0; i < NUMBER_OF_PBS; i++)
+ for (int i = 0; i < numberOfPBs; i++)
{
for (int j = 1; j < vectorLength; j++)
{
vector1.at(i).at(j-1) = vector1.at(i).at(j);
}
- }
-
- // Save the latest value
- for (int i = 0; i < numberOfPBs; i++)
- {
- if(Wii)
- {
- //DebugLog("Writing %i to %i | m_addressPBs: %08x", running[i], i, m_addressPBs);
- vector1.at(i).at(vectorLength-1) = running[i] ? true : false;
- }
- else
- {
- //DebugLog("Writing %i to %i", running[i], i);
- vector1.at(i).at(vectorLength-1) = running[i] ? true : false;
- }
+ // save the latest value
+ vector1.at(i).at(vectorLength-1) = PBs[i].running ? true : false;
}
// ==============
// =======================================================================================
- // Have a separate set for which ones to show
+ /* Have a separate set for which ones to show. Currently show blocks that have been
+ running at least once the last 100 updates.
// --------------
/*
Move all items back like this:
- 1 to 2
- 2 3
+ 1 to 0
+ 2 1
3 ...
*/
- for (int i = 0; i < NUMBER_OF_PBS; i++)
+ for (int i = 0; i < numberOfPBs; i++)
{
for (int j = 1; j < vectorLength2; j++)
{
vector2.at(i).at(j-1) = vector2.at(i).at(j);
}
- }
-
- // Save the latest value
- for (int i = 0; i < numberOfPBs; i++)
- {
- vector2.at(i).at(vectorLength2-1) = running[i];
+ // save the latest value
+ vector2.at(i).at(vectorLength2-1) = PBs[i].running ? true : false;
}
// ==============
// =======================================================================================
- // Count how many we have running now
+ // Count how many we have running now in a certain block
// --------------
int jj = 0;
- for (int i = 0; i < NUMBER_OF_PBS; i++)
+ for (int i = 0; i < numberOfPBs; i++)
{
- for (int j = 0; j < vectorLength2-1; j++)
+ jj = 0;
+ for (int j = 0; j < vectorLength2-1; j++) // the hundred last updates
{
- if (vector2.at(i).at(j) == 1)
- {
+ if (vector2.at(i).at(j)) // if it was on then
+ {
jj++;
}
numberRunning.at(i) = jj;
@@ -732,27 +720,30 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) // ==============
- // go through all running blocks
+ // =======================================================================================
+ // Now go through all blocks
+ // --------------
for (int i = 0; i < numberOfPBs; i++)
{
- // Prepare conditions. TODO: We use this in two places now, make it only one
- /**/if(Wii)
- if(version == 0) Conditions = PrepareConditions(Wii, i, PBw);
- else Conditions = PrepareConditions(Wii, i, PBw_);
- else
- Conditions = PrepareConditions(Wii, i, PBs);
+
- // Use the condition
+ // --------------------------------------
+ // Now go through only a subset of the blocks depending on Conditions
+ // ------------------
+ // Prepare conditions
+ Conditions = PrepareConditions(Wii, i, PBs);
if (Conditions)
{
- // Save playback history for the GUI debugger --------------------------
+ // --------------------------------------
+ // Save playback history text string for the console and GUI debugger
+ // ------------------
if(m_frame)
{
std::string guipr; // gui progress
for (int j = 0; j < vectorLengthGUI; j++)
{
- if(vector1.at(i).at(j) == 0)
+ if(vector1.at(i).at(j) == false)
{
guipr = guipr + "0";
}
@@ -767,11 +758,10 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) guipr.clear();
}
-
- // Make the playback history (progress bar) to display in the console debugger
+ // and for the console debugger
for (int j = 0; j < vectorLength; j++)
{
- if(vector1.at(i).at(j) == 0)
+ if(vector1.at(i).at(j) == false)
{
sbuff = sbuff + " ";
}
@@ -822,22 +812,23 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) sbuff = sbuff + writeMessage(m_frame->gPreset, i, Wii); strcpy(buffer, "");
sbuff = sbuff + "\n";
- } // end of if (PBs[i].running)
-
- } // end of big loop - for (int i = 0; i < numberOfPBs; i++)
+ } // end of if(Conditions)
+ // ==============
+ } // end of for (int i = 0; i < numberOfPBs; i++)
// =======================================================================================
// Write global values
// ---------------
int nOfBlocks;
+ int span = m_frame->gLastBlock - m_addressPBs;
if(Wii)
- nOfBlocks = (gLastBlock-m_addressPBs) / 256;
+ nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 256;
else
- nOfBlocks = (gLastBlock-m_addressPBs) / 192;
- sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | numberOfPBs %i | _iSize %i\n",
- m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), nOfBlocks, numberOfPBs, _iSize);
+ nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 192;
+ sprintf(buffer, "\nThe parameter blocks span from %08x to %08x (%s bytes) impl. %i blocks | numberOfPBs %i | _iSize %i\n",
+ m_addressPBs, m_frame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize);
sbuff = sbuff + buffer; strcpy(buffer, "");
// ===============
@@ -920,3 +911,42 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) } // end of if (j>20)
} // end of function
+
+
+// I placed this in CUCode_AX so it can share member values with that class
+void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
+{
+ /* Doing all this may have a noticable CPU effect, so we can disable it completely
+ this way. But remember that "Save to file" will not write anything then either. */
+ if (m_frame->gUpdFreq > 0)
+ {
+ int version; // AX version
+ int numberOfPBs;
+
+ // Declare structures
+ AXParamBlock PBs[NUMBER_OF_PBS];
+ AXParamBlockWii PBw[NUMBER_OF_PBS];
+ AXParamBlockWii_ PBw_[NUMBER_OF_PBS];
+ if(_CRC == 0xfa450138) version = 0; else version = 1;
+
+ // Read out structs and number of PBs that have data
+ if(Wii)
+ {
+ if(version == 0)
+ {
+ numberOfPBs = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS, true);
+ Logging_(_pBuffer, _iSize, a, Wii, PBw, numberOfPBs, m_addressPBs);
+ }
+ else
+ {
+ numberOfPBs = ReadOutPBsWii(m_addressPBs, PBw_, NUMBER_OF_PBS, true);
+ Logging_(_pBuffer, _iSize, a, Wii, PBw_, numberOfPBs, m_addressPBs);
+ }
+ }
+ else
+ {
+ numberOfPBs = ReadOutPBs(m_addressPBs, PBs, NUMBER_OF_PBS);
+ Logging_(_pBuffer, _iSize, a, Wii, PBs, numberOfPBs, m_addressPBs);
+ }
+ }
+}
\ No newline at end of file diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index c93299a581..00e355cfcb 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -266,11 +266,15 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num) pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
- gLastBlock = blockAddr + p*2 + 2; // save last block location
+ if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
- count++;
+ count++;
+
+ // Detect the last mail by checking when next_pb = 0
+ u32 next_pb = (Common::swap16(pSrc[0]) << 16) | Common::swap16(pSrc[1]);
+ if(next_pb == 0) break;
}
else
break;
@@ -319,28 +323,42 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) }
// ---------------------------------------------------------------------------------------
- // Make the updates we are told to do
- // This code is buggy, TODO - fix. If multiple updates in a ms, only does first.
+ /* Make the updates we are told to do. When there are multiple updates for a block they
+ are placed in memory directly following updaddr. They are mostly for initial time
+ delays, sometimes for the FIR filter or channel volumes. We do all of them at once here.
+ If we get both an on and an off update we chose on. Perhaps that makes the RE1 music
+ work better. */
// ------------
- for (int i = 0; i < numberOfPBs; i++) {
+ for (int i = 0; i < numberOfPBs; i++)
+ {
u16 *pDest = (u16 *)&PBs[i];
u16 upd0 = pDest[34]; u16 upd1 = pDest[35]; u16 upd2 = pDest[36]; // num_updates
u16 upd3 = pDest[37]; u16 upd4 = pDest[38];
u16 upd_hi = pDest[39]; // update addr
u16 upd_lo = pDest[40];
+ int numupd = upd0 + upd1 + upd2 + upd3 + upd4;
+ if(numupd > 64) numupd = 64; // prevent crazy values
const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
- const u16 updpar = Memory_Read_U16(updaddr);
- const u16 upddata = Memory_Read_U16(updaddr + 2);
- // some safety checks, I hope it's enough, how long does the memory go?
- if(updaddr > 0x80000000 && updaddr < 0x82000000
- && updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
- // 0-3, those are important
- && (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think
- // but I don't know how or when
- && gSequenced) // on and off option
- {
- pDest[updpar] = upddata;
+ int on = false, off = false;
+ for (int j = 0; j < numupd; j++)
+ {
+ const u16 updpar = Memory_Read_U16(updaddr + j);
+ const u16 upddata = Memory_Read_U16(updaddr + j + 2);
+ // some safety checks, I hope it's enough
+ if(updaddr > 0x80000000 && updaddr < 0x817fffff
+ && updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
+ // 0-3, those are important
+ //&& (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think
+ // but I don't know how or when
+ && gSequenced) // on and off option
+ {
+ pDest[updpar] = upddata;
+ }
+ if (updpar == 7 && upddata == 1) on++;
+ if (updpar == 7 && upddata == 1) off++;
}
+ // hack: if we get both an on and an off select on rather than off
+ if (on > 0 && off > 0) pDest[7] = 1;
}
//aprintf(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp index 5717f07e9b..1080732681 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp @@ -37,7 +37,6 @@ // Declarations
// -----------
extern bool gSequenced;
-extern u32 gLastBlock;
extern CDebugger * m_frame;
// -----------
@@ -108,6 +107,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) memset(templbuffer, 0, _iSize * sizeof(int));
memset(temprbuffer, 0, _iSize * sizeof(int));
+ // -------------------------------------------
// write logging data to debugger
if (m_frame)
{
@@ -147,10 +147,11 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) }
}
}
+ // -----------------
+
// ---------------------------------------------------------------------------------------
- // Make the updates we are told to do. This code may be buggy, TODO - fix. If multiple
- // updates in a ms, only does first.
+ /* Make the updates we are told to do. See comments to the GC version in UCode_AX.cpp */
// ------------
for (int i = 0; i < numberOfPBs; i++)
{
@@ -158,21 +159,32 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) u16 upd0 = pDest[41]; u16 upd1 = pDest[42]; u16 upd2 = pDest[43]; // num_updates
u16 upd_hi = pDest[44]; // update addr
u16 upd_lo = pDest[45];
- const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
- const u16 updpar = Memory_Read_U16(updaddr);
- const u16 upddata = Memory_Read_U16(updaddr + 2);
- // some safety checks, I hope it's enough, how long does the memory go?
- if(updaddr > 0x80000000 && updaddr < 0x82000000
- && updpar < 127 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
- // 0-3, those are important
- && (upd0 || upd1 || upd2) // We should use these in some way to I think
- // but I don't know how or when
- && gSequenced) // on and off option
- {
- //PanicAlert("Update %i: %i = %04x", i, updpar, upddata);
- //DebugLog("Update: %i = %04x", updpar, upddata);
- pDest[updpar] = upddata;
+ int numupd = upd0 + upd1 + upd2;
+ if(numupd > 64) numupd = 64; // prevent to high values
+ const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
+ int on = false, off = false;
+ for (int j = 0; j < numupd; j++) // make alll updates
+ {
+ const u16 updpar = Memory_Read_U16(updaddr);
+ const u16 upddata = Memory_Read_U16(updaddr + 2);
+ // some safety checks, I hope it's enough
+ if( ( (updaddr > 0x80000000 && updaddr < 0x817fffff)
+ || (updaddr > 0x90000000 && updaddr < 0x93ffffff) )
+ && updpar < 127 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
+ // 0-3, those are important
+ //&& (upd0 || upd1 || upd2) // We should use these in some way to I think
+ // but I don't know how or when
+ && gSequenced) // on and off option
+ {
+ //PanicAlert("Update %i: %i = %04x", i, updpar, upddata);
+ //DebugLog("Update: %i = %04x", updpar, upddata);
+ pDest[updpar] = upddata;
+ }
+ if (updpar == 7 && upddata == 1) on++;
+ if (updpar == 7 && upddata == 1) off++;
}
+ // hack: if we get both an on and an off select on rather than off
+ if (on > 0 && off > 0) pDest[7] = 1;
}
//aprintf(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h index f7cbb9f6a8..7c85c50a6d 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h @@ -22,6 +22,7 @@ #include "UCode_AX.h"
#include "../main.h"
+
// ----------------------------------------------------
// Externals
// -----------
@@ -33,7 +34,7 @@ extern bool gVolume; extern bool gReset;
extern bool gSequenced;
extern float ratioFactor;
-extern u32 gLastBlock;
+
template<class ParamBlockType>
inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num, int _deb)
@@ -57,7 +58,7 @@ inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num, int _ else pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
- gLastBlock = blockAddr + p*2 + 2; // save last block location
+ if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
@@ -308,15 +309,13 @@ inline void DoVoiceHacks(ParamBlockType &pb) const u16 upddata = Memory_Read_U16(updaddr + 2);
// =======================================================================================
- /* Fix problems introduced with the SSBM fix - Sometimes when a music stream ended sampleEnd
- would become extremely high and the game would play random sound data from ARAM resulting in
- a strange noise. This should take care of that. - Some games (Monkey Ball 1 and Tales of
- Symphonia and other) also had one odd last block with a strange high loopPos and strange
- num_updates values, the loopPos limit turns those off also. - Please report any side effects.
+ /* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd
+ would end up outside of bounds while the block was still playing resulting in noise
+ a strange noise. This should take care of that.
*/
// ------------
if (
- (sampleEnd > 0x10000000 || loopPos > 0x10000000)
+ (sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles
&& gSSBMremedy1
)
{
diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp index 93ec231443..3284a9e734 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp @@ -128,6 +128,9 @@ extern "C" void Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize) {
g_WiimoteInitialize = _WiimoteInitialize;
+ /* We will run WiiMoteReal::Initialize() even if we are not using a real wiimote,
+ we will ini wiiuse.dll, but we will return before creating a new thread for
+ it, in that case */
g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
WiiMoteEmu::Initialize();
@@ -235,4 +238,4 @@ void __Logv(int log, int v, const char *_fmt, ...) va_end( ap );
g_WiimoteInitialize.pLog(Msg, v);
-}
\ No newline at end of file +}
|
