code cleanup, focusing on dsp hle

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5143 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2010-02-28 18:21:22 +00:00
parent cff39f5382
commit 80d303222b
32 changed files with 673 additions and 3590 deletions
+2 -1
View File
@@ -120,7 +120,8 @@ void GBASockServer::Transfer(char* si_buffer)
memset(current_data, 0, sizeof(current_data));
size_t num_received = 0;
client.Receive(current_data, sizeof(current_data), num_received);
if (client.Receive(current_data, sizeof(current_data), num_received) == sf::Socket::Disconnected)
client.Close();
DEBUG_LOG(SERIALINTERFACE, "< %02x%02x%02x%02x%02x",
(u8)current_data[0], (u8)current_data[1], (u8)current_data[2],
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="Plugin_DSP_HLE"
ProjectGUID="{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}"
RootNamespace="Plugin_DSP"
@@ -594,7 +594,7 @@
>
</File>
<Filter
Name="UCode AX"
Name="AX"
>
<File
RelativePath=".\Src\UCodes\UCode_AX.cpp"
@@ -658,7 +658,7 @@
</File>
</Filter>
<Filter
Name="UCode Zelda"
Name="Zelda"
>
<File
RelativePath="..\..\..\docs\DSP\DSP_UC_Luigi.txt"
@@ -706,50 +706,6 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
<File
RelativePath=".\Src\Debugger\Blocks.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Debugger.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Debugger.h"
>
</File>
<File
RelativePath=".\Src\Debugger\Logging.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Mails.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.h"
>
</File>
</Filter>
<Filter
Name="Logging"
>
<File
RelativePath=".\Src\Debugger\File.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\File.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\Config.cpp"
>
@@ -766,10 +722,6 @@
RelativePath=".\Src\DSPHandler.h"
>
</File>
<File
RelativePath=".\Src\Globals.cpp"
>
</File>
<File
RelativePath=".\Src\Globals.h"
>
@@ -49,20 +49,3 @@ void CConfig::Save()
file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
}
void CConfig::GameIniLoad(const char *game_ini)
{
// This game config will affect global system config
// Need a better way to seperate system config from game config
//
/*
if (game_ini && strlen(game_ini))
{
IniFile iniFile;
iniFile.Load(game_ini);
//iniFile.Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, 0);
//iniFile.Get("HLEaudio", "UseLoopFix", &m_EnableLoopFix, 0);
}
*/
}
@@ -28,7 +28,6 @@ struct CConfig
CConfig();
void Load();
void GameIniLoad(const char *game_ini);
void Save();
};
@@ -54,7 +54,6 @@ unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
// copy 128 byte from ARAM 0x000000 to IMEM
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
Temp.DSPInitCode = 0;
// MessageBox(NULL, "UCODE_INIT_AUDIO_SYSTEM", "DSP-HLE", MB_OK);
}
m_DSPControl.Hex = Temp.Hex;
@@ -1,89 +0,0 @@
//
// Licensetype: GNU General Public License (GPL)
//
// 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/
//
// Includes
// -------------
#include <iostream>
#include <fstream>
#include <sstream>
#ifndef _WIN32
#include <stdlib.h>
#endif
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
//#include "../Logging/File.h" // Write to file
// Make the wxTextCtrls scroll with each other
void DSPDebuggerHLE::DoScrollBlocks()
{
// ShowPosition = in letters
// GetScrollPos = number of lines from the top
// GetLineLength = letters in one line
// SetScrollPos = only set the scrollbar, doesn't update the text,
// Update() or Refresh() doesn't help
double pos = m_bl95->GetScrollPos(wxVERTICAL)*(m_bl95->GetLineLength(0)+12.95); // annoying :(
m_bl0->ShowPosition((int)pos);
/*
if(GetAsyncKeyState(VK_NUMPAD1))
A -= 0.1;
else if(GetAsyncKeyState(VK_NUMPAD2))
A += 0.11;
DEBUG_LOG(CONSOLE, "GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \
GetLineLength:%i XYToPosition:%i\n \
GetScrollPos * GetLineLength + GetScrollRange:%i A:%f\n",
m_bl95->GetScrollPos(wxVERTICAL), m_bl95->GetScrollRange(wxVERTICAL),
m_bl95->GetPosition().y, m_bl95->GetLastPosition(), m_bl95->GetMaxWidth(),
m_bl95->GetLineLength(0), m_bl95->XYToPosition(0,25),
pos, A
);
for (int i = 0; i < 127; ++i)
{
m_bl0->AppendText(wxString::Format("%02i|68 : 01a70144\n", i));
m_bl95->AppendText(wxString::Format("%i Mouse\n", i));
}*/
}
void DSPDebuggerHLE::ScrollBlocksMouse(wxMouseEvent& event)
{
DoScrollBlocks();
event.Skip(); // otherwise we remove the regular behavior, for example scrolling
}
void DSPDebuggerHLE::ScrollBlocksCursor(wxScrollWinEvent& event)
{
DoScrollBlocks();
event.Skip(); // otherwise we remove the regular behavior, for example scrolling
}
// ==============
File diff suppressed because it is too large Load Diff
@@ -1,173 +0,0 @@
//
// Licensetype: GNU General Public License (GPL)
//
// 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 __DSPDebuggerHLE_h__
#define __DSPDebuggerHLE_h__
// general things
#include <iostream>
#include <vector>
// wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/datetime.h> // for the timestamps
#include <wx/sizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
#include "../Globals.h"
class CPBView;
class IniFile;
class DSPDebuggerHLE : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
DSPDebuggerHLE(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("Sound"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
#ifdef _WIN32
long style = wxNO_BORDER);
#else
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
#endif
virtual ~DSPDebuggerHLE();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
// options
void ShowBase(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event);
void OnShowAll(wxCommandEvent& event);
// update frequency
void ChangeFrequency(wxCommandEvent& event);
void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event);
void DoChangePreset();
// settings
void OnSettingsCheck(wxCommandEvent& event);
// ============== Mail
void DoUpdateMail();
void UpdateMail(wxNotebookEvent& event);
void ChangeMail(wxCommandEvent& event);
void ReadDir();
bool NoDuplicate(std::string FileName);
void OnGameChange(wxCommandEvent& event);
void MailSettings(wxCommandEvent& event);
void Readfile(std::string FileName, bool GC);
std::string Readfile_(std::string FileName);
u32 CountFiles(std::string FileName);
// ============== Blocks
void DoScrollBlocks();
void ScrollBlocksMouse(wxMouseEvent& event);
void ScrollBlocksCursor(wxScrollWinEvent& event);
CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll;
bool gSaveFile; // main options
bool gOnlyLooping;
bool gShowAll;
int giShowAll;
int gUpdFreq;// main update freq.
int gPreset; // main presets
bool bShowBase; // main presets
u32 gLastBlock;
bool ScanMails; // mail settings
bool StoreMails;
bool upd95; bool upd94; bool upd93; bool upd92; // block view settings
std::string str0; std::string str95; std::string str94; std::string str93; std::string str92;
std::vector<std::string> PBn; std::vector<std::string> PBp;
// members
wxTextCtrl * m_log, * m_log1, // mail
* m_bl0, * m_bl95, * m_bl94; // blocks
private:
// declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain, *m_PageMail, *m_PageBlock;
wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5];
wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
// WARNING: Make sure these are not also elsewhere
enum
{
IDC_CHECK0 = 2000,
IDC_CHECK1,
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6,
IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4,
IDG_LABEL1, IDG_LABEL2,
ID_UPD,
ID_SELC,
ID_PRESETS,
ID_GPR,
ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook
ID_LOG, ID_LOG1, // mails
ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92,
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif
@@ -1,117 +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/
// --------------------
// Includes
#include <string>
#include <stdio.h>
#include "Common.h"
#ifdef _WIN32
#include <windows.h>
#endif
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h"
extern DSPDebuggerHLE* m_DebuggerFrame;
#endif
#include "../Debugger/File.h"
// --------------------
// On and off
bool g_consoleEnable = true;
//int gSaveFile = 0;
#define DEBUG_HLE
// --------------------
// Create file handles
#ifdef DEBUG_HLE
FILE* __fStdOut[nFiles];
#endif
// =======================================================================================
/* Open file handles */
// -------------
void StartFile(int width, int height, char* fname)
{
#if defined(DEBUG_HLE) && defined(_WIN32)
if(fname)
{
for(int i = 0; i < nFiles; i++)
{
// Edit the log file name
std::string FileEnding = ".log";
std::string FileName = fname;
char buffer[33]; _itoa(i, buffer, 10); // convert number to string
std::string FullFilename = (FileName + buffer + FileEnding);
__fStdOut[i] = fopen(FullFilename.c_str(), "w");
}
}
#endif
}
// ======================
/* Close the file handles */
// -------------
void CloseFile()
{
// Close the file handles
for(int i = 0; i < nFiles; i++)
{
if(__fStdOut[i]) fclose(__fStdOut[i]);
}
}
// ---------------------------------------------------------------------------------------
// File printf function
// -------------
int PrintFile(int a, char *fmt, ...)
{
#if defined(DEBUG_HLE) && defined(_WIN32)
if(m_DebuggerFrame->gSaveFile)
{
char s[StringSize];
va_list argptr;
int cnt;
va_start(argptr, fmt);
cnt = vsnprintf(s, StringSize, fmt, argptr);
va_end(argptr);
// ---------------------------------------------------------------------------------------
if(__fStdOut[a]) // TODO: make this work, we have to set all default values to NULL
// to make it work
fprintf(__fStdOut[a], s);
// -------------
return(cnt);
}
else
{
return 0;
}
#else
return 0;
#endif
}
@@ -1,41 +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/
// Declarations and definitions
// -------------
// --------------------
// Settings
// -------------
const int nFiles = 4;
const int StringSize = 5000; // Warning, mind this value, if exceeded a crash may occur
// --------------------
// Functions
// -------------
void StartFile(int width, int height, char* fname);
void StopFile();
int PrintFile(int a, char *fmt, ...);
void OpenConsole();
void CloseConsole();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif
File diff suppressed because it is too large Load Diff
@@ -1,297 +0,0 @@
//
// Licensetype: GNU General Public License (GPL)
//
// 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/
//
// Includes
// -------------
#include <iostream>
#include <fstream>
#include <sstream>
#ifndef _WIN32
#include <stdlib.h>
#endif
//#include "ConsoleWindow.h" // Open and close console
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
// Declarations and definitions
// -------------
extern std::vector<std::string> sMailLog, sMailTime;
extern DSPDebuggerHLE* m_DebuggerFrame;
// =======================================================================================
// Update mail window
// --------------
void DSPDebuggerHLE::DoUpdateMail()
{
//Console::Print("i %i %i\n", sFullMail.size(), sMailLog.size());
if(sFullMail.size() > 0 && sMailLog.size() > 0)
{
m_log->SetValue(wxString::FromAscii(sFullMail.at(m_RadioBox[3]->GetSelection()).c_str()));
m_log->SetDefaultStyle(wxTextAttr(*wxBLUE)); // doesn't work because of the current wx
m_log1->SetValue(wxString::FromAscii(sMailLog.at(m_RadioBox[3]->GetSelection()).c_str()));
m_log1->AppendText(wxT("\n\n"));
}
}
void DSPDebuggerHLE::UpdateMail(wxNotebookEvent& event)
{
DoUpdateMail();
/* This may be called before m_DebuggerFrame is fully created through the
EVT_NOTEBOOK_PAGE_CHANGED, in that case it will crash because this
is accessing members of it */
if(StoreMails && m_DebuggerFrame) ReadDir();
}
// Change mail from radio button change
void DSPDebuggerHLE::ChangeMail(wxCommandEvent& event)
{
//Console::Print("abc");
DoUpdateMail();
//if(StoreMails) ReadDir();
}
// ==============
// =======================================================================================
// Read out mails from dir
// --------------
void DSPDebuggerHLE::ReadDir()
{
CFileSearch::XStringVector Directories;
//Directories.push_back("Logs/Mail");
Directories.push_back(File::GetUserPath(D_MAILLOGS_IDX));
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.log");
CFileSearch FileSearch(Extensions, Directories);
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
//m_gc->Show(false);
//m_gc->Append(wxT("SSBM ffffix"));
//m_gc->Show(true);
// Clear in case we already did this earlier
all_all_files.clear();
if (rFilenames.size() > 0 && m_gc && m_wii)
{
for (u32 i = 0; i < rFilenames.size(); i++)
{
std::string FileName;
SplitPath(rFilenames[i], NULL, &FileName, NULL); // place the filename in FileName
//std::string FileName = StripSpaces(*FileName);
std::vector<std::string> pieces;
SplitString(FileName, "_sep", pieces); // split string
// Save all filenames heres
if(pieces[2] == "0") all_all_files.push_back(pieces[0]);
// Cut to size
std::string cut;
if(pieces[0].length() > 18)
cut = pieces[0].substr(0, 18) + "...";
else
cut = pieces[0];
//Console::Print("%s %s %s\n", pieces[0].c_str(), pieces[1].c_str(),
// pieces[2].c_str(), pieces[3].c_str());
if (NoDuplicate(pieces[0]) && pieces.size() >= 3)
{
all_files.push_back(pieces[0]);
if (pieces[3] == "GC")
{
gc_files.push_back(pieces[0]);
m_gc->Append(wxString::FromAscii(cut.c_str()));
}
else
{
wii_files.push_back(pieces[0]);
m_wii->Append(wxString::FromAscii(cut.c_str()));
}
}
}
}
}
// =======================================================================================
// Check for duplicates and count files from all_all_files
// --------------
bool DSPDebuggerHLE::NoDuplicate(std::string FileName)
{
for (u32 i = 0; i < all_files.size(); i++)
{
if(all_files.at(i) == FileName)
return false;
}
return true;
}
// Count the number of files for each game
u32 DSPDebuggerHLE::CountFiles(std::string FileName)
{
int match = 0;
for (u32 i = 0; i < all_all_files.size(); i++)
{
//Console::Print("CountFiles %i %s\n", i, all_all_files[i].c_str());
if(all_all_files[i] == FileName)
match++;
}
//Console::Print("We found %i files for this game\n", match);
return match;
}
// ==============
// =======================================================================================
// Read file from harddrive
// --------------
std::string DSPDebuggerHLE::Readfile_(std::string FileName)
{
char c; // declare a char variable
FILE *file; // declare a FILE pointer
std::string sz = "";
if(File::Exists(FileName.c_str()))
file = fopen(FileName.c_str(), "r"); // open a text file for reading
else
return "";
if(file == NULL)
{
// file could not be opened
}
else
{
while(1) // looping through file
{
c = fgetc(file);
if(c != EOF)
sz += c; // print the file one character at a time
else
break; // break when EOF is reached
}
fclose(file);
}
return sz;
}
// Read file
void DSPDebuggerHLE::Readfile(std::string FileName, bool GC)
{
u32 n = CountFiles(FileName); // count how many mails we have
u32 curr_n = 0;
std::ifstream file;
for (u32 i = 0; i < m_RadioBox[3]->GetCount(); i++)
{
if(m_RadioBox[3]->IsItemEnabled(i)) curr_n++;
m_RadioBox[3]->Enable(i, false); // disable all
}
//Console::Print("Disabled all: n %i\n", n);
for (u32 i = 0; i < n; i++)
{
m_RadioBox[3]->Enable(i, true); // then anble the right ones
//Console::Print("m_RadioBox[3] enabled: %i\n", i);
std::string sz = "";
std::ostringstream ci;
ci << i;
std::string f0 = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + FileName + "_sep" + ci.str() + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log";
std::string f1 = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + FileName + "_sep" + ci.str() + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log";
//Console::Print("ifstream %s %s\n", f0.c_str(), f1.c_str());
if(sFullMail.size() <= i) sFullMail.resize(sFullMail.size() + 1);
if(sMailLog.size() <= i) sMailLog.resize(sMailLog.size() + 1);
if(Readfile_(f0).length() > 0) sFullMail.at(i) = Readfile_(f0);
else sFullMail.at(i) = "";
if(Readfile_(f1).length() > 0) sMailLog.at(i) = Readfile_(f1);
else sMailLog.at(i) = "";
}
if(n < curr_n) m_RadioBox[3]->Select(n - 1);
//Console::Print("Select: %i | n %i curr_n %i\n", n - 1, n, curr_n);
DoUpdateMail();
}
// ==============
// =======================================================================================
// Read the file to the text window
// ---------------
void DSPDebuggerHLE::OnGameChange(wxCommandEvent& event)
{
if(event.GetId() == 2006)
{
// Only allow one selected game at a time
for (u32 i = 0; i < m_gc->GetCount(); ++i)
if(i != (u32)event.GetInt()) m_gc->Check(i, false);
for (u32 i = 0; i < m_wii->GetCount(); ++i)
m_wii->Check(i, false);
Readfile(gc_files[event.GetInt()], true);
}
else
{
for (u32 i = 0; i < m_gc->GetCount(); ++i)
m_gc->Check(i, false);
for (u32 i = 0; i < m_wii->GetCount(); ++i)
if(i != (u32)event.GetInt()) m_wii->Check(i, false);
Readfile(wii_files[event.GetInt()], false);
}
}
// Settings
void DSPDebuggerHLE::MailSettings(wxCommandEvent& event)
{
//for (int i = 0; i < all_all_files.size(); ++i)
//Console::Print("s: %s \n", all_all_files.at(i).c_str());
ScanMails = m_gcwiiset->IsChecked(0);
StoreMails = m_gcwiiset->IsChecked(1);
}
@@ -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/
#include "PBView.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
// external declarations
extern const char* GetGRPName(unsigned int index);
CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style)
{
}
void CPBView::Update()
{
ClearAll();
InsertColumn(1, wxT("upd4"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("upd3"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("upd2"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("upd1"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("upd0"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("r_lo"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("r_hi"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("ratio"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("frac"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("coef"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("src_t"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("form"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("isstr"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("yn2"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("yn1"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("pred_s"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("isloop"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("volr"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("voll"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("loopto"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(1, wxT("end"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(0, wxT("pos"), wxLIST_FORMAT_LEFT, 90);
InsertColumn(0, wxT("run"), wxLIST_FORMAT_RIGHT, 50);
InsertColumn(0, wxT("Block"), wxLIST_FORMAT_CENTER, 40);
for (int i = 0; i < 64; i++)
{
InsertItemInReportView(i);
}
}
void CPBView::InsertItemInReportView(int _Row)
{
long tmp = InsertItem(_Row, wxString::Format(wxT("%02i"), _Row), 0);
SetItemData(tmp, _Row);
wxString text;
// A somewhat primitive attempt to show the playing history for a certain block.
char cbuff [33];
sprintf(cbuff, "%08i", m_CachedRegs[_Row][0]); //TODO?
std::string c = cbuff;
int n[8];
for (int j = 0; j < 8; j++)
{
n[j] = atoi( c.substr(j, 1).c_str() );
// 149 = dot, 160 = space
if (n[j] == 1)
n[j] = 149;
else
n[j] = 160;
}
// pretty neat huh?
SetItem(tmp, 1, wxString::Format(wxT("%c%c%c%c%c%c%c%c"), n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]));
for (int column = 2; column < GetColumnCount(); column++)
SetItem(tmp, column, wxString::Format(wxT("0x%08x"), m_CachedRegs[_Row][column]));
}
@@ -1,45 +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 __PBView_h__
#define __PBView_h__
#include <wx/listctrl.h>
#include <wx/dcclient.h>
#include "Common.h"
class CPBView : public wxListCtrl
{
public:
CPBView(wxWindow* parent,
const wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style);
void Update();
u32 m_CachedRegs[64][92];
private:
bool m_CachedRegHasChanged[64];
void InsertItemInReportView(int _Index);
};
#endif
+35 -22
View File
@@ -22,29 +22,42 @@
#include "pluginspecs_dsp.h"
#include "StringUtil.h"
#include "../../../Core/Core/Src/ConfigManager.h" // FIXME
extern DSPInitialize g_dspInitialize;
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h"
class DSPDebuggerHLE;
extern DSPDebuggerHLE* m_DebuggerFrame;
#endif
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
extern float ratioFactor; // a global to get the ratio factor from MixAdd
u8 Memory_Read_U8(u32 _uAddress);
u16 Memory_Read_U16(u32 _uAddress);
u32 Memory_Read_U32(u32 _uAddress);
float Memory_Read_Float(u32 _uAddress);
void* Memory_Get_Pointer(u32 _uAddress);
extern PLUGIN_GLOBALS* globals;
extern u8* g_pMemory;
// TODO: Wii support? Most likely audio data still must be in the old 24MB TRAM.
#define RAM_MASK 0x1FFFFFF
inline u8 Memory_Read_U8(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return g_pMemory[_uAddress];
}
inline u16 Memory_Read_U16(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return Common::swap16(*(u16*)&g_pMemory[_uAddress]);
}
inline u32 Memory_Read_U32(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return Common::swap32(*(u32*)&g_pMemory[_uAddress]);
}
inline float Memory_Read_Float(u32 _uAddress)
{
u32 uTemp = Memory_Read_U32(_uAddress);
return *(float*)&uTemp;
}
inline void* Memory_Get_Pointer(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return &g_pMemory[_uAddress];
}
#endif
@@ -11,8 +11,6 @@ files = [
'HLEMixer.cpp',
'main.cpp',
'Config.cpp',
'Globals.cpp',
'Debugger/File.cpp',
'UCodes/UCode_AX.cpp',
'UCodes/UCode_AXWii.cpp',
'UCodes/UCode_CARD.cpp',
@@ -30,12 +28,6 @@ dspenv = env.Clone()
if dspenv['HAVE_WX']:
files += [
'ConfigDlg.cpp',
'Debugger/Debugger.cpp',
'Debugger/PBView.cpp',
'Debugger/Mails.cpp',
'Debugger/Blocks.cpp',
'Debugger/Logging.cpp',
]
dspenv.Append(
File diff suppressed because it is too large Load Diff
@@ -37,16 +37,6 @@ public:
void MixAdd(short* _pBuffer, int _iSize);
void Update(int cycles);
// Logging
//template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, va_list ap);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;
int saveNext;
// PBs
u8 numPBaddr;
u32 PBaddr[8]; //2 needed for MP2
@@ -69,8 +59,6 @@ private:
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
#endif // _UCODE_AX
@@ -20,10 +20,10 @@
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 left;
u16 left_delta;
u16 right;
u16 right_delta;
u16 unknown3[8];
u16 unknown4[6];
@@ -31,13 +31,60 @@ struct PBMixer
struct PBMixerWii
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
// volume mixing values in .15, 0x8000 = ca. 1.0
u16 left;
u16 left_delta;
u16 right;
u16 right_delta;
u16 unknown3[12];
u16 unknown4[8];
u16 auxA_left;
u16 auxA_left_delta;
u16 auxA_right;
u16 auxA_right_delta;
u16 auxB_left;
u16 auxB_left_delta;
u16 auxB_right;
u16 auxB_right_delta;
// Note: the following elements usage changes a little in DPL2 mode
// TODO: implement and comment it in the mixer
u16 auxC_left;
u16 auxC_left_delta;
u16 auxC_right;
u16 auxC_right_delta;
u16 surround;
u16 surround_delta;
u16 auxA_surround;
u16 auxA_surround_delta;
u16 auxB_surround;
u16 auxB_surround_delta;
u16 auxC_surround;
u16 auxC_surround_delta;
};
struct PBMixerWM
{
u16 main0;
u16 main0_delta;
u16 aux0;
u16 aux0_delta;
u16 main1;
u16 main1_delta;
u16 aux1;
u16 aux1_delta;
u16 main2;
u16 main2_delta;
u16 aux2;
u16 aux2_delta;
u16 main3;
u16 main3_delta;
u16 aux3;
u16 aux3_delta;
};
struct PBInitialTimeDelay
@@ -62,32 +109,49 @@ struct PBUpdates
u16 data_lo;
};
struct PBUpdatesWii
{
u16 num_updates[3];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
// The DSP stores the final sample values for each voice after every frame of processing.
// The values are then accumulated for all dropped voices, added to the next frame of audio,
// and ramped down on a per-sample basis to provide a gentle "roll off."
struct PBDpop
{
s16 unknown[9];
};
struct PBDpopWii
{
s16 unknown[12];
};
struct PBDpopWii
{
s16 left;
s16 auxA_left;
s16 auxB_left;
s16 auxC_left;
struct PBDpopWii_ // new CRC version
{
s16 unknown[7];
};
s16 right;
s16 auxA_right;
s16 auxB_right;
s16 auxC_right;
s16 surround;
s16 auxA_surround;
s16 auxB_surround;
s16 auxC_surround;
};
struct PBDpopWM
{
s16 aMain0;
s16 aMain1;
s16 aMain2;
s16 aMain3;
s16 aAux0;
s16 aAux1;
s16 aAux2;
s16 aAux3;
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
u16 cur_volume; // volume at start of frame
s16 cur_volume_delta; // signed per sample delta (96 samples per frame)
};
struct PBUnknown2
@@ -118,12 +182,20 @@ struct PBADPCMInfo
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
// ratio = (f32)ratio * 0x10000;
// valid range is 1/512 to 4.0000
u16 ratio_hi; // integer part of sampling ratio
u16 ratio_lo; // fraction part of sampling ratio
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBSampleRateConverterWM
{
u16 currentAddressFrac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
@@ -131,35 +203,34 @@ struct PBADPCMLoopInfo
u16 yn2;
};
struct AXParamBlock
struct AXPB
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 9 */ PBMixer mixer;
/* 27 */ PBInitialTimeDelay initial_time_delay;
/* 34 */ PBUpdates updates;
/* 41 */ PBDpop dpop;
/* 50 */ PBVolumeEnvelope vol_env;
/* 52 */ PBUnknown2 unknown3;
/* 55 */ PBAudioAddr audio_addr;
/* 63 */ PBADPCMInfo adpcm;
/* 83 */ PBSampleRateConverter src;
/* 90 */ PBADPCMLoopInfo adpcm_loop_info;
/* 93 */ //u16 unknown_maybe_padding[3]; // Comment this out to get some speedup
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBDpop dpop;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
struct PBLpf
struct PBLowPassFilter
{
u16 enabled;
u16 yn1;
@@ -167,69 +238,112 @@ struct PBLpf
u16 b0;
};
struct PBHpf
struct PBBiquadFilter
{
u16 enabled;
u16 on; // on = 2, off = 0
u16 xn1; // History data
u16 xn2;
u16 yn1;
u16 a0;
u16 b0;
u16 yn2;
u16 b0; // Filter coefficients
u16 b1;
u16 b2;
u16 a1;
u16 a2;
};
struct AXParamBlockWii
union PBInfImpulseResponseWM
{
PBLowPassFilter lpf;
PBBiquadFilter biquad;
};
struct AXPBWii
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u16 src_type; // Type of sample rate converter (none, 4-tap, linear)
u16 coef_select; // coef for the 4-tap src
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii dpop;
/* 58 */ PBVolumeEnvelope vol_env;
/* 60 */ PBAudioAddr audio_addr;
/* 68 */ PBADPCMInfo adpcm;
/* 88 */ PBSampleRateConverter src;
/* 95 */ PBADPCMLoopInfo adpcm_loop_info;
/* 98 */ PBLpf lpf;
/* 102 */ PBHpf hpf;
/* 106 */ //u16 pad[22]; // Comment this out to get some speedup
PBMixerWii mixer;
PBInitialTimeDelay initial_time_delay;
PBDpopWii dpop;
PBVolumeEnvelope vol_env;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
PBLowPassFilter lpf;
PBBiquadFilter biquad;
// WIIMOTE :D
u16 remote;
u16 remote_mixer_control;
PBMixerWM remote_mixer;
PBDpopWM remote_dpop;
PBSampleRateConverterWM remote_src;
PBInfImpulseResponseWM remote_iir;
u16 pad[12]; // align us, captain! (32B)
};
struct AXParamBlockWii_ // new CRC version
// Seems like nintendo used an early version of AXWii and forgot to remove the update functionality ;p
struct PBUpdatesWiiSports
{
/* 0x000 */ u16 next_pb_hi;
/* 0x002 */ u16 next_pb_lo;
/* 0x004 */ u16 this_pb_hi;
/* 0x006 */ u16 this_pb_lo;
/* 0x008 */ u16 src_type; // Type of sample rate converter (none, ?, linear)
/* 0x00A */ u16 coef_select;
/* 0x00C */ u32 mixer_control;
/* 0x010 */ u16 running; // 1=RUN 0=STOP
/* 0x012 */ u16 is_stream; // 1 = stream, 0 = one shot
/* 0x014 */ PBMixerWii mixer;
/* 0x044 */ PBInitialTimeDelay initial_time_delay;
/* 0x052 */ PBUpdatesWii updates;
/* 0x05C */ PBDpopWii_ dpop;
/* 0x06A */ PBVolumeEnvelope vol_env;
/* 0x06E */ PBAudioAddr audio_addr;
/* 0x07E */ PBADPCMInfo adpcm;
/* 0x0A6 */ PBSampleRateConverter src;
/* 0x0B4 */ PBADPCMLoopInfo adpcm_loop_info;
/* 0x0BA */ PBLpf lpf;
/* 0x0C2 */ PBHpf hpf;
/* 0x0CA */ //u16 pad[27]; // Comment this out to get some speedup
/* 0x100 */
u16 num_updates[3];
u16 data_hi;
u16 data_lo;
};
struct AXPBWiiSports
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, 4-tap, linear)
u16 coef_select; // coef for the 4-tap src
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixerWii mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdatesWiiSports updates;
PBDpopWii dpop;
PBVolumeEnvelope vol_env;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
PBLowPassFilter lpf;
PBBiquadFilter biquad;
// WIIMOTE :D
u16 remote;
u16 remote_mixer_control;
PBMixerWM remote_mixer;
PBDpopWM remote_dpop;
PBSampleRateConverterWM remote_src;
PBInfImpulseResponseWM remote_iir;
u16 pad[7]; // align us, captain! (32B)
};
// TODO: All these enums have changed a lot for wii
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
@@ -242,4 +356,10 @@ enum {
MIXCONTROL_RAMPING = 8,
};
// Both may be used at once
enum {
FILTER_LOWPASS = 1,
FILTER_BIQUAD = 2,
};
#endif // _UCODE_AX_STRUCTS_H
@@ -17,12 +17,6 @@
#include "StringUtil.h"
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h"
//#include "../Logging/File.h" // For PrintFile
extern DSPDebuggerHLE * m_DebuggerFrame;
#endif
#include "../MailHandler.h"
#include "Mixer.h"
@@ -33,33 +27,23 @@ extern DSPDebuggerHLE * m_DebuggerFrame;
#include "UCode_AX_Voice.h"
// ------------------------------------------------------------------
// Declarations
// -----------
extern bool gSequenced;
// -----------
CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler, u32 l_CRC)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
, _CRC(l_CRC)
{
// we got loaded
m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(DSP_INIT);
templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024];
lCUCode_AX = new CUCode_AX(_rMailHandler);
lCUCode_AX->_CRC = l_CRC;
wiisportsHack = _CRC == 0xfa450138;
}
CUCode_AXWii::~CUCode_AXWii()
{
m_rMailHandler.Clear();
delete lCUCode_AX;
delete [] templbuffer;
delete [] temprbuffer;
}
@@ -72,7 +56,7 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
}
else if (_uMail == 0xCDD10000) // Action 0 - restart
{
m_rMailHandler.PushMail(0xDCD10001);
m_rMailHandler.PushMail(DSP_RESUME);
}
else if (_uMail == 0xCDD10001) // Action 1 - new ucode upload
{
@@ -87,115 +71,37 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
}
}
template<class ParamBlockType> void ProcessUpdates(ParamBlockType &PB)
void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
{
// ---------------------------------------------------------------------------------------
/* Make the updates we are told to do. See comments to the GC version in UCode_AX.cpp */
// ------------
u16 *pDest = (u16 *)&PB;
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];
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);
//DEBUG_LOG(DSPHLE, "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;
}
AXPBWii PB;
template<class ParamBlockType>
void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PB)
{
if (_iSize > 1024 * 1024)
_iSize = 1024 * 1024;
// write zeroes to the beginning of templbuffer
memset(templbuffer, 0, _iSize * sizeof(int));
memset(temprbuffer, 0, _iSize * sizeof(int));
// -------------------------------------------
// write logging data to debugger
#if defined(HAVE_WX) && HAVE_WX
/*
If this is to be resurrected, it has to be moved into the main PB loop below.
if (m_DebuggerFrame && _pBuffer)
{
lCUCode_AX->Logging(_pBuffer, _iSize, 0, true);
// -------------------------------------------
// Write the first block values
int p = numberOfPBs - 1;
if(numberOfPBs > p)
{
if(PBs[p].running && !m_DebuggerFrame->upd95)
{
const u32 blockAddr = (u32)(PBs[p].this_pb_hi<< 16) | PBs[p].this_pb_lo;
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
for (u32 i = 0; i < sizeof(AXParamBlockWii) / 2; i+=2)
{
if(i == 10 || i == 34 || i == 41 || i == 46 || i == 46 || i == 58 || i == 60
|| i == 68 || i == 88 || i == 95)
{m_DebuggerFrame->str0 += "\n"; m_DebuggerFrame->str95 += "\n";}
std::string line = StringFromFormat("%02i|%02i : %s : %s",
i/2, i,
m_DebuggerFrame->PBn[i].c_str(), m_DebuggerFrame->PBp[i].c_str()
);
for (u32 j = 0; j < 50 - line.length(); ++j)
line += " ";
m_DebuggerFrame->str0 += line;
m_DebuggerFrame->str0 += "\n";
m_DebuggerFrame->str95 += StringFromFormat(" : %02i|%02i : %04x%04x\n",
i/2, i,
Common::swap16(pSrc[i]), Common::swap16(pSrc[i+1]));
}
m_DebuggerFrame->m_bl95->AppendText(wxString::FromAscii(m_DebuggerFrame->str95.c_str()));
m_DebuggerFrame->m_bl0->AppendText(wxString::FromAscii(m_DebuggerFrame->str0.c_str()));
m_DebuggerFrame->upd95 = true;
}
}
}*/
// -----------------
#endif
u32 blockAddr = m_addressPBs;
if (!blockAddr)
return;
for (int i = 0; i < NUMBER_OF_PBS; i++)
{
// read out pbs
if (!ReadOutPBWii(blockAddr, PB))
if (!ReadPB(blockAddr, PB))
break;
ProcessUpdates(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, true, UCODE_AXWII);
if (!WriteBackPBWii(blockAddr, PB))
if (wiisportsHack)
MixAddVoice(*(AXPBWiiSports*)&PB, templbuffer, temprbuffer, _iSize);
else
MixAddVoice(PB, templbuffer, temprbuffer, _iSize);
if (!WritePB(blockAddr, PB))
break;
// next block
// next PB, or done
blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo;
if (blockAddr == 0) break;
if (!blockAddr)
break;
}
// We write the sound to _pBuffer
@@ -206,22 +112,14 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PB)
// Clamp into 16-bit. Maybe we should add a volume compressor here.
int left = templbuffer[i] + _pBuffer[0];
int right = temprbuffer[i] + _pBuffer[1];
if (left < -32767) left = -32767;
if (left > 32767) left = 32767;
if (left < -32767) left = -32767;
if (left > 32767) left = 32767;
if (right < -32767) right = -32767;
if (right > 32767) right = 32767;
if (right > 32767) right = 32767;
*_pBuffer++ = left;
*_pBuffer++ = right;
}
}
#if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger again after the update
if (m_DebuggerFrame && _pBuffer)
{
lCUCode_AX->Logging(_pBuffer, _iSize, 1, true);
}
#endif
}
@@ -234,20 +132,6 @@ void CUCode_AXWii::Update(int cycles)
}
}
// Shortcut
void CUCode_AXWii::SaveLog(const char* _fmt, ...)
{
#if defined(HAVE_WX) && HAVE_WX
va_list ap;
va_start(ap, _fmt);
if(m_DebuggerFrame)
lCUCode_AX->SaveLog_(true, _fmt, ap);
va_end(ap);
#endif
}
// AX seems to bootup one task only and waits for resume-callbacks
// everytime the DSP has "spare time" it sends a resume-mail to the CPU
// and the __DSPHandler calls a AX-Callback which generates a new AXFrame
@@ -258,10 +142,6 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
u32 Addr__AXOutSBuffer;
bool bExecuteList = true;
#if defined(HAVE_WX) && HAVE_WX
if(m_DebuggerFrame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging
#endif
/*
for (int i=0;i<64;i++) {
NOTICE_LOG(DSPHLE,"%x - %08x",uAddress+(i*4),Memory_Read_U32(uAddress+(i*4)));
@@ -292,20 +172,14 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x0004:
// PBs are here now
m_addressPBs = Memory_Read_U32(uAddress);
lCUCode_AX->m_addressPBs = m_addressPBs; // for the sake of logging
soundStream->GetMixer()->SetHLEReady(true);
// soundStream->Update();
uAddress += 4;
break;
case 0x0005:
if (_CRC != 0xfa450138)
{
if (!wiisportsHack)
uAddress += 10;
}
else // Wii Sports uCode
{
}
break;
case 0x0006:
@@ -322,71 +196,39 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
break;
case 0x000a:
if (_CRC != 0xfa450138) // AXLIST_COMPRESSORTABLE
{
uAddress += 8;
}
else // Wii Sports uCode
{
uAddress += 4;
}
if (wiisportsHack) // AXLIST_COMPRESSORTABLE
uAddress += 4;
else
uAddress += 8;
break;
case 0x000b:
if (_CRC != 0xfa450138)
{
uAddress += 10;
//0xDCD10004 <-- causing problems for some games under HLE (TOS2/NTSC,...)
//m_rMailHandler.PushMail(0xDCD10004);
}
else // Wii Sports uCode
{
if (wiisportsHack)
uAddress += 2;
}
else
uAddress += 10;
break;
case 0x000c:
if (_CRC != 0xfa450138)
{
uAddress += 10;
//m_rMailHandler.PushMail(0xDCD10004);
}
else // Wii Sports uCode
{
if (wiisportsHack)
uAddress += 8;
//m_rMailHandler.PushMail(0xDCD10004);
}
else
uAddress += 10;
break;
case 0x000d:
if (_CRC != 0xfa450138)
{
uAddress += 16;
}
else // Wii Sports uCode
{
uAddress += 16; //??
//m_rMailHandler.PushMail(0xDCD10004);
}
uAddress += 16;
break;
case 0x000e:
if (_CRC != 0xfa450138)
{
// This is the end.
bExecuteList = false;
//m_rMailHandler.PushMail(0xDCD10002);
}
else // Wii Sports uCode
{
if (wiisportsHack)
uAddress += 16;
}
else
bExecuteList = false;
break;
case 0x000f: // only for Wii Sports uCode
// This is the end.
bExecuteList = false;
//m_rMailHandler.PushMail(0xDCD10002);
break;
default:
@@ -397,21 +239,6 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
}
}
m_rMailHandler.PushMail(0xDCD10002); //its here in case there is a CMD fuckup
m_rMailHandler.PushMail(DSP_YIELD); //its here in case there is a CMD fuckup
return true;
}
void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
{
if(_CRC == 0xfa450138)
{
AXParamBlockWii PB;
MixAdd_( _pBuffer, _iSize, PB);
}
else
{
AXParamBlockWii_ PB;
MixAdd_(_pBuffer, _iSize, PB);
}
}

Some files were not shown because too many files have changed in this diff Show More