Make the OptimizeQuantizers option apply to the IL build. More cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2696 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-03-20 19:12:04 +00:00
parent 6bacdc0af3
commit 482ea5c0e7
11 changed files with 203 additions and 200 deletions

View File

@ -27,19 +27,15 @@
#include "LogManager.h" // Common
// Inits as a Listener
ConsoleListener::ConsoleListener() : Listener("console")
{
}
ConsoleListener::~ConsoleListener()
{
Close();
}
//150, 100, "Dolphin Log Console"
// Open console window - width and height is the size of console window
// Name is the window title
void ConsoleListener::Open(int Width, int Height, char * Name)
void ConsoleListener::Open(int width, int height, char *title)
{
#ifdef _WIN32
// Open the console window and create the window handle for GetStdHandle()
@ -49,15 +45,15 @@ void ConsoleListener::Open(int Width, int Height, char * Name)
m_hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
SetConsoleTitle(Name);
SetConsoleTitle(title);
// Set the total letter space
COORD co = {Width, Height};
COORD co = {width, height};
SetConsoleScreenBufferSize(m_hStdOut, co);
/* Set the window size in number of letters. The height is hard coded here
because it can be changed with MoveWindow() later */
SMALL_RECT coo = {0,0, (Width - 1),50}; // Top, left, right, bottom
SMALL_RECT coo = {0,0, (width - 1), 50}; // Top, left, right, bottom
SetConsoleWindowInfo(m_hStdOut, TRUE, &coo);
#endif
}
@ -125,7 +121,6 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char *text)
#endif
}
// Clear console screen
void ConsoleListener::ClearScreen()
{
@ -147,36 +142,3 @@ void ConsoleListener::ClearScreen()
SetConsoleCursorPosition(hConsole, coordScreen);
#endif
}
// Get window handle of console window to be able to resize it. We use
// GetConsoleTitle() and FindWindow() to locate the console window handle.
#if defined(_WIN32)
HWND GetHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles
HWND hwndFound; // This is what is returned to the caller
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle
// Fetch current window title.
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
// Format a "unique" NewWindowTitle
wsprintf(pszNewWindowTitle, "%d/%d", GetTickCount(), GetCurrentProcessId());
// Change current window title
SetConsoleTitle(pszNewWindowTitle);
// Ensure window title has been updated
Sleep(40);
// Look for NewWindowTitle
hwndFound = FindWindow(NULL, pszNewWindowTitle);
// Restore original window title
SetConsoleTitle(pszOldWindowTitle);
return(hwndFound);
}
#endif // _WIN32

View File

@ -91,17 +91,17 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
}
void LogManager::removeListener(LogTypes::LOG_TYPE type, Listener *listener) {
void LogManager::removeListener(LogTypes::LOG_TYPE type, LogListener *listener) {
logMutex->Enter();
m_Log[type]->removeListener(listener);
logMutex->Leave();
}
// LogContainer
void LogContainer::addListener(Listener *listener) {
std::vector<Listener *>::iterator i;
void LogContainer::addListener(LogListener *listener) {
bool exists = false;
std::vector<LogListener *>::iterator i;
for(i = listeners.begin(); i != listeners.end(); i++) {
if ((*i) == listener) {
exists = true;
@ -113,8 +113,8 @@ void LogContainer::addListener(Listener *listener) {
listeners.push_back(listener);
}
void LogContainer::removeListener(Listener *listener) {
std::vector<Listener *>::iterator i;
void LogContainer::removeListener(LogListener *listener) {
std::vector<LogListener *>::iterator i;
for(i = listeners.begin(); i != listeners.end(); i++) {
if ((*i) == listener) {
listeners.erase(i);
@ -123,8 +123,8 @@ void LogContainer::removeListener(Listener *listener) {
}
}
bool LogContainer::isListener(Listener *listener) {
std::vector<Listener *>::iterator i;
bool LogContainer::isListener(LogListener *listener) const {
std::vector<LogListener *>::const_iterator i;
for(i = listeners.begin(); i != listeners.end(); i++) {
if ((*i) == listener) {
return true;
@ -134,13 +134,13 @@ bool LogContainer::isListener(Listener *listener) {
}
void LogContainer::trigger(LogTypes::LOG_LEVELS level, const char *msg) {
std::vector<Listener *>::const_iterator i;
std::vector<LogListener *>::const_iterator i;
for (i = listeners.begin(); i != listeners.end(); i++) {
(*i)->Log(level, msg);
}
}
FileLogListener::FileLogListener(const char *filename) : Listener("File") {
FileLogListener::FileLogListener(const char *filename) {
m_filename = strndup(filename, 255);
m_logfile = fopen(filename, "a+");
setEnable(true);

View File

@ -32,17 +32,15 @@
#define MAX_MSGLEN 512
class Listener {
// pure virtual interface (well, except the destructor which we just leave empty).
class LogListener {
public:
Listener(const char *name) : m_name(name) {}
virtual ~LogListener() {}
virtual void Log(LogTypes::LOG_LEVELS, const char *msg) = 0;
virtual const char *getName() { return m_name; }
private:
const char *m_name;
virtual const char *getName() const = 0;
};
class FileLogListener : public Listener {
class FileLogListener : public LogListener {
public:
FileLogListener(const char *filename);
~FileLogListener();
@ -60,17 +58,18 @@ public:
void setEnable(bool enable) {
m_enable = enable;
}
const char *getName() const { return "file"; }
private:
char *m_filename;
FILE *m_logfile;
bool m_enable;
};
class ConsoleListener : public Listener
class ConsoleListener : public LogListener
{
public:
ConsoleListener();
~ConsoleListener();
void Open(int Width = 100, int Height = 100,
@ -80,6 +79,8 @@ public:
void Log(LogTypes::LOG_LEVELS, const char *text);
void ClearScreen();
const char *getName() const { return "console"; }
private:
#ifdef _WIN32
HWND GetHwnd(void);
@ -89,7 +90,6 @@ private:
class LogContainer {
public:
LogContainer(const char* shortName, const char* fullName,
bool enable = false) : m_enable(enable) {
strncpy(m_fullName, fullName, 128);
@ -97,26 +97,16 @@ public:
m_level = LogTypes::LWARNING;
}
const char *getShortName() {
return m_shortName;
}
const char *getShortName() const { return m_shortName; }
const char *getFullName() const { return m_fullName; }
const char *getFullName() {
return m_fullName;
}
bool isListener(Listener *listener);
void addListener(Listener *listener);
void removeListener(Listener *listener);
bool isListener(LogListener *listener) const;
void addListener(LogListener *listener);
void removeListener(LogListener *listener);
void trigger(LogTypes::LOG_LEVELS, const char *msg);
bool isEnable() {
return m_enable;
}
bool isEnable() const { return m_enable; }
void setEnable(bool enable) {
m_enable = enable;
}
@ -135,24 +125,20 @@ private:
bool m_enable;
LogTypes::LOG_LEVELS m_level;
std::vector<Listener *> listeners;
std::vector<LogListener *> listeners;
};
class LogManager
{
private:
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
Common::CriticalSection* logMutex;
FileLogListener *m_fileLog;
ConsoleListener *m_consoleLog;
static LogManager *m_logManager; // FIXME: find a way without singletone
static LogManager *m_logManager; // Singleton. Ugh.
public:
static u32 GetMaxLevel() {
return LOGLEVEL;
}
static u32 GetMaxLevel() { return LOGLEVEL; }
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *fmt, ...);
@ -165,23 +151,23 @@ public:
m_Log[type]->setEnable(enable);
}
const char *getShortName(LogTypes::LOG_TYPE type) {
const char *getShortName(LogTypes::LOG_TYPE type) const {
return m_Log[type]->getShortName();
}
const char *getFullName(LogTypes::LOG_TYPE type) {
const char *getFullName(LogTypes::LOG_TYPE type) const {
return m_Log[type]->getFullName();
}
bool isListener(LogTypes::LOG_TYPE type, Listener *listener) {
bool isListener(LogTypes::LOG_TYPE type, LogListener *listener) const {
return m_Log[type]->isListener(listener);
}
void addListener(LogTypes::LOG_TYPE type, Listener *listener) {
void addListener(LogTypes::LOG_TYPE type, LogListener *listener) {
m_Log[type]->addListener(listener);
}
void removeListener(LogTypes::LOG_TYPE type, Listener *listener);
void removeListener(LogTypes::LOG_TYPE type, LogListener *listener);
FileLogListener *getFileListener() {
return m_fileLog;
@ -194,7 +180,6 @@ public:
static LogManager* GetInstance() {
if (! m_logManager)
m_logManager = new LogManager();
return m_logManager;
}

View File

@ -21,6 +21,10 @@
#include "EXI_Device.h"
#ifdef _WIN32
#pragma warning(disable:4201)
#endif
class CEXIChannel
{
private:
@ -51,7 +55,7 @@ private:
unsigned EXT : 1; //19 // External Insertion Status (1: External EXI device present)
unsigned ROMDIS : 1; //18 // ROM Disable
unsigned :18;
};
}; // DO NOT obey the warning and give this struct a name. Things will fail.
UEXI_STATUS() {hex = 0;}
UEXI_STATUS(u32 _hex) {hex = _hex;}
};
@ -110,4 +114,3 @@ public:
};
#endif

View File

@ -178,7 +178,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
if (Loader.IsValid())
{
const std::vector<DiscIO::SNANDContent>& rContent = Loader.GetContent();
for (size_t i=0; i<Loader.GetContentSize(); i++)
for (int i = 0; i < (int)Loader.GetContentSize(); i++)
{
if ((rContent[i].m_Type & 0x8000) == 0)
{

View File

@ -45,7 +45,7 @@ void Jit64::psq_st(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(LoadStorePaired)
if (inst.W) {Default(inst); return;}
if (inst.W || !Core::GetStartupParameter().bOptimizeQuantizers) {Default(inst); return;}
IREmitter::InstLoc addr = ibuild.EmitIntConst(inst.SIMM_12), val;
if (inst.RA)
addr = ibuild.EmitAdd(addr, ibuild.EmitLoadGReg(inst.RA));
@ -60,7 +60,7 @@ void Jit64::psq_l(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(LoadStorePaired)
if (inst.W) {Default(inst); return;}
if (inst.W || !Core::GetStartupParameter().bOptimizeQuantizers) {Default(inst); return;}
IREmitter::InstLoc addr = ibuild.EmitIntConst(inst.SIMM_12), val;
if (inst.RA)
addr = ibuild.EmitAdd(addr, ibuild.EmitLoadGReg(inst.RA));

View File

@ -682,11 +682,13 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
{
CheatsWindow = new wxCheatsWindow(this, wxDefaultPosition, wxSize(600, 390));
}
void CFrame::OnShow_SDCardWindow(wxCommandEvent& WXUNUSED (event))
{
wxSDCardWindow SDWindow(this);
SDWindow.ShowModal();
}
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
{
BootManager::BootCore(FULL_WII_MENU_DIR);
@ -700,12 +702,12 @@ void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
UpdateGUI();
}
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore = !SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore;
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnToggleSkipIdle(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = !SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
@ -737,8 +739,8 @@ void CFrame::OnSaveState(wxCommandEvent& event)
void CFrame::OnToggleToolbar(wxCommandEvent& event)
{
wxToolBarBase* toolBar = GetToolBar();
if (SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked() == true)
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked();
if (SConfig::GetInstance().m_InterfaceToolbar == true)
{
CFrame::RecreateToolbar();
}
@ -754,7 +756,8 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
// Enable and disable the status bar
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
{
if (SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked() == true)
SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked();
if (SConfig::GetInstance().m_InterfaceStatusbar == true)
m_pStatusBar->Show();
else
m_pStatusBar->Hide();
@ -770,7 +773,8 @@ void CFrame::OnToggleLogWindow(wxCommandEvent& event)
void CFrame::ToggleLogWindow(bool check)
{
if (SConfig::GetInstance().m_InterfaceLogWindow = check == true)
SConfig::GetInstance().m_InterfaceLogWindow = check;
if (SConfig::GetInstance().m_InterfaceLogWindow)
m_LogWindow->Show();
else
m_LogWindow->Hide();
@ -788,7 +792,8 @@ void CFrame::OnToggleConsole(wxCommandEvent& event)
void CFrame::ToggleConsole(bool check)
{
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener();
if (SConfig::GetInstance().m_InterfaceConsole = check == true)
SConfig::GetInstance().m_InterfaceConsole = check;
if (SConfig::GetInstance().m_InterfaceConsole)
console->Open();
else
console->Close();

View File

@ -27,7 +27,7 @@
#include "Console.h"
// milliseconds between msgQueue flushes to wxTextCtrl
#define UPDATETIME 100
#define UPDATETIME 200
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
EVT_CLOSE(CLogWindow::OnClose)
@ -44,8 +44,7 @@ END_EVENT_TABLE()
CLogWindow::CLogWindow(wxWindow* parent)
: wxDialog(parent, wxID_ANY, wxT("Log/Console"),
wxPoint(100, 700), wxSize(800, 270),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
Listener("LogWindow")
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
m_logManager = LogManager::GetInstance();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
@ -351,43 +350,51 @@ void CLogWindow::NotifyUpdate()
void CLogWindow::UpdateLog()
{
if (!msgQueue.size())
return;
m_logTimer->Stop();
wxString collected_text;
// rough estimate.
collected_text.reserve(100 * msgQueue.size());
u32 msgQueueSize = msgQueue.size();
for (u32 i = 0; i < msgQueueSize; i++)
for (unsigned int i = 0; i < msgQueueSize; i++)
{
#ifndef _WIN32
// FIXME This looks horrible on windows: SetForegroundColour changes
// ALL text in the control, and SetDefaultStyle doesn't work at all
// switch (msgQueue.front().first)
// {
// // red
// case ERROR_LEVEL:
// m_log->SetForegroundColour(*wxRED);
// break;
// // yellow
// case WARNING_LEVEL:
// m_log->SetForegroundColour(wxColour(255, 255, 0));
// break;
// // green
// case NOTICE_LEVEL:
// m_log->SetForegroundColour(*wxGREEN);
// break;
// // cyan
// case INFO_LEVEL:
// m_log->SetForegroundColour(*wxCYAN);
// break;
// // light gray
// case DEBUG_LEVEL:
// m_log->SetForegroundColour(wxColour(211, 211, 211));
// break;
// // white
// default:
// m_log->SetForegroundColour(*wxWHITE);
// break;
// }
m_log->AppendText(msgQueue.front().second);
switch (msgQueue.front().first)
{
// red
case ERROR_LEVEL:
m_log->SetForegroundColour(*wxRED);
break;
// yellow
case WARNING_LEVEL:
m_log->SetForegroundColour(wxColour(255, 255, 0));
break;
// green
case NOTICE_LEVEL:
m_log->SetForegroundColour(*wxGREEN);
break;
// cyan
case INFO_LEVEL:
m_log->SetForegroundColour(*wxCYAN);
break;
// light gray
case DEBUG_LEVEL:
m_log->SetForegroundColour(wxColour(211, 211, 211));
break;
// white
default:
m_log->SetForegroundColour(*wxWHITE);
break;
}
#endif
collected_text.Append(msgQueue.front().second);
msgQueue.pop();
}
if (collected_text.size())
m_log->AppendText(collected_text);
m_logTimer->Start(UPDATETIME);
}

View File

@ -40,7 +40,8 @@ class wxTextCtrl;
class wxCheckListBox;
class wxString;
class CLogWindow : public wxDialog,Listener
// Uses multiple inheritance - only sane because LogListener is a pure virtual interface.
class CLogWindow : public wxDialog, LogListener
{
public:
CLogWindow(wxWindow* parent);
@ -77,6 +78,8 @@ private:
void UpdateChecks();
void UpdateLog();
// LogListener
const char *getName() const { return "LogWindow"; }
};
#endif /*LOGWINDOW_H_*/

View File

@ -1,6 +1,25 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include <wx/wx.h>
#include <wx/string.h>
namespace WxUtils {
// Launch a file according to its mime type
@ -26,4 +45,4 @@ namespace WxUtils {
}
}
}
} // namespace

View File

@ -1,12 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef WXUTILS_H
#define WXUTILS_H
namespace WxUtils {
// Launch a file according to its mime type
void Launch(const char *filename);
// Launch an file explorer window on a certain path
void Explore(const char *path);
} // NameSpace WxUtils
} // namespace
#endif // WXUTILS