* Added word wrapping to tooltips! (Windows only)

* Minor cleanups to iFPU roundmode recompilation.
 * Changed AsciiFile from wxFile (slow!) to wxFFile (fast!)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2156 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-08 01:56:24 +00:00
parent 909714d08e
commit 115d2b6f05
16 changed files with 311 additions and 242 deletions

View File

@ -44,21 +44,21 @@
class pxTextWrapperBase class pxTextWrapperBase
{ {
protected: protected:
bool m_eol; bool m_eol;
int m_linecount; int m_linecount;
public: public:
virtual ~pxTextWrapperBase() { } virtual ~pxTextWrapperBase() throw() { }
pxTextWrapperBase() : pxTextWrapperBase()
m_eol( false )
, m_linecount( 0 )
{ {
m_eol = false;
m_linecount = 0;
} }
// win is used for getting the font, text is the text to wrap, width is the // win is used for getting the font, text is the text to wrap, width is the
// max line width or -1 to disable wrapping // max line width or -1 to disable wrapping
void Wrap( const wxWindow *win, const wxString& text, int widthMax ); pxTextWrapperBase& Wrap( const wxWindow& win, const wxString& text, int widthMax );
int GetLineCount() const int GetLineCount() const
{ {
@ -72,24 +72,8 @@ protected:
// called at the start of every new line (except the very first one) // called at the start of every new line (except the very first one)
virtual void OnNewLine() { } virtual void OnNewLine() { }
void DoOutputLine(const wxString& line) void DoOutputLine(const wxString& line);
{ bool IsStartOfNewLine();
OnOutputLine(line);
m_linecount++;
m_eol = true;
}
// this function is a destructive inspector: when it returns true it also
// resets the flag to false so calling it again wouldn't return true any
// more
bool IsStartOfNewLine()
{
if ( !m_eol )
return false;
m_eol = false;
return true;
}
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -100,30 +84,25 @@ protected:
// //
class pxTextWrapper : public pxTextWrapperBase class pxTextWrapper : public pxTextWrapperBase
{ {
typedef pxTextWrapperBase _parent;
protected: protected:
wxString m_text; wxString m_text;
public: public:
pxTextWrapper() : pxTextWrapperBase() pxTextWrapper() : pxTextWrapperBase() { }
, m_text() virtual ~pxTextWrapper() throw() { }
{
}
const wxString& GetResult() const const wxString& GetResult() const
{ {
return m_text; return m_text;
} }
protected: pxTextWrapper& Wrap( const wxWindow& win, const wxString& text, int widthMax );
virtual void OnOutputLine(const wxString& line)
{
m_text += line;
}
virtual void OnNewLine() protected:
{ virtual void OnOutputLine(const wxString& line);
m_text += L'\n'; virtual void OnNewLine();
}
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -211,8 +211,7 @@ void iDumpBlock( int startpc, u8 * ptr )
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
AsciiFile eff( AsciiFile eff(
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
wxFile::write
); );
if( disR5900GetSym(startpc) != NULL ) if( disR5900GetSym(startpc) != NULL )

View File

@ -15,7 +15,7 @@
#pragma once #pragma once
#include <wx/file.h> #include <wx/ffile.h>
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Helper class for wxFile which provides old-school ASCII interfaces (char* style), // Helper class for wxFile which provides old-school ASCII interfaces (char* style),
@ -25,13 +25,13 @@
// This is an ideal solution on several fronts since it is both faster, and fully func- // This is an ideal solution on several fronts since it is both faster, and fully func-
// tional (since the dumps are only ever english/ascii only). // tional (since the dumps are only ever english/ascii only).
// //
class AsciiFile : public wxFile class AsciiFile : public wxFFile
{ {
public: public:
using wxFile::Write; using wxFFile::Write;
AsciiFile( const wxString& src, OpenMode mode = read ) : AsciiFile( const wxString& src, const wxChar* mode ) :
wxFile( src, mode ) {} wxFFile( src, mode ) {}
void Printf( const char* fmt, ... ); void Printf( const char* fmt, ... );

View File

@ -134,9 +134,9 @@ wxWindowID Dialogs::IssueConfirmation( wxWindow* parent, const wxString& disable
confirmDlg.GetExtensibleSizer().Add( &cboxPad, wxSizerFlags().Centre() ); confirmDlg.GetExtensibleSizer().Add( &cboxPad, wxSizerFlags().Centre() );
if( type != ConfButtons().OK() ) if( type != ConfButtons().OK() )
DisablerCtrl.SetToolTip(_("Disables this popup and whatever response you select here will be automatically used from now on.")); pxSetToolTip(&DisablerCtrl, _("Disables this popup and whatever response you select here will be automatically used from now on."));
else else
DisablerCtrl.SetToolTip(_("The popup will not be shown again. This setting can be undone from the settings panels.")); pxSetToolTip(&DisablerCtrl, _("The popup will not be shown again. This setting can be undone from the settings panels."));
confirmDlg.Fit(); confirmDlg.Fit();

View File

@ -19,7 +19,7 @@
#include "ModalPopups.h" #include "ModalPopups.h"
#include "Panels/ConfigurationPanels.h" #include "Panels/ConfigurationPanels.h"
#include "wx//file.h" #include <wx/file.h>
using namespace wxHelpers; using namespace wxHelpers;
using namespace Panels; using namespace Panels;
@ -35,7 +35,7 @@ static T& MakeWizWidget( int pageid, wxWizardPage& src )
Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) : Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) :
DirPickerPanel( parent, FolderId_Settings, _("Settings"), _("Select a folder for PCSX2 settings") ) DirPickerPanel( parent, FolderId_Settings, _("Settings"), _("Select a folder for PCSX2 settings") )
{ {
SetToolTip( pxE( ".Tooltips:Folders:Settings", pxSetToolTip( this, pxE( ".Tooltips:Folders:Settings",
L"This is the folder where PCSX2 saves your settings, including settings generated " L"This is the folder where PCSX2 saves your settings, including settings generated "
L"by most plugins (some older plugins may not respect this value)." L"by most plugins (some older plugins may not respect this value)."
) ); ) );

View File

@ -351,6 +351,7 @@ namespace Panels
wxDirName GetPath() const { return wxDirName( m_pickerCtrl->GetPath() ); } wxDirName GetPath() const { return wxDirName( m_pickerCtrl->GetPath() ); }
DirPickerPanel& SetStaticDesc( const wxString& msg ); DirPickerPanel& SetStaticDesc( const wxString& msg );
DirPickerPanel& SetToolTip( const wxString& tip );
protected: protected:
void UseDefaultPath_Click( wxCommandEvent &event ); void UseDefaultPath_Click( wxCommandEvent &event );

View File

@ -92,7 +92,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() ); s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() );
m_checkCtrl = &AddCheckBox( s_lower, _("Use default setting") ); m_checkCtrl = &AddCheckBox( s_lower, _("Use default setting") );
m_checkCtrl->SetToolTip( pxE( ".Tooltip:DirPicker:UseDefault", pxSetToolTip( m_checkCtrl, pxE( ".Tooltip:DirPicker:UseDefault",
L"When checked this folder will automatically reflect the default associated with PCSX2's current usermode setting. " ) L"When checked this folder will automatically reflect the default associated with PCSX2's current usermode setting. " )
); );
@ -101,7 +101,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
// button on the dialogs for now. // button on the dialogs for now.
wxButton* b_explore( new wxButton( this, wxID_ANY, _("Open in Explorer") ) ); wxButton* b_explore( new wxButton( this, wxID_ANY, _("Open in Explorer") ) );
b_explore->SetToolTip( _("Open an explorer window to this folder.") ); pxSetToolTip( b_explore, _("Open an explorer window to this folder.") );
s_lower.Add( b_explore, SizerFlags::StdButton().Align( wxALIGN_RIGHT ) ); s_lower.Add( b_explore, SizerFlags::StdButton().Align( wxALIGN_RIGHT ) );
Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) ); Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) );
#endif #endif
@ -125,6 +125,12 @@ Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& m
return *this; return *this;
} }
Panels::DirPickerPanel& Panels::DirPickerPanel::SetToolTip( const wxString& tip )
{
pxSetToolTip( this, tip );
return *this;
}
void Panels::DirPickerPanel::Reset() void Panels::DirPickerPanel::Reset()
{ {
const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId ); const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId );

View File

@ -128,8 +128,8 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) ); m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) ); m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
m_slider_eecycle->SetToolTip( tooltip ); pxSetToolTip( m_slider_eecycle, tooltip );
m_msg_eecycle->SetToolTip( tooltip ); pxSetToolTip( m_msg_eecycle, tooltip );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// VU Cycle Stealing Hack Section: // VU Cycle Stealing Hack Section:
@ -151,8 +151,8 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) ); m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) );
m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) ); m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) );
m_slider_vustealer->SetToolTip( tooltip ); pxSetToolTip( m_slider_vustealer, tooltip );
m_msg_vustealer->SetToolTip( tooltip ); pxSetToolTip( m_msg_vustealer, tooltip );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// microVU Hacks Section: // microVU Hacks Section:

View File

@ -23,187 +23,181 @@
# include <wx/tooltip.h> # include <wx/tooltip.h>
#endif #endif
namespace wxHelpers // ------------------------------------------------------------------------
// FlagsAccessors - Provides read-write copies of standard sizer flags for our interface.
// These standard definitions provide a consistent and pretty interface for our GUI.
// Without them things look compacted, misaligned, and yucky!
//
// Implementation Note: Accessors are all provisioned as dynamic (realtime) sizer calculations.
// I've preferred this over cstatic const variables on the premise that spacing logic could
// in the future become a dynamic value (currently it is affixed to 6 for most items).
//
wxSizerFlags wxHelpers::SizerFlags::StdSpace()
{ {
// ------------------------------------------------------------------------ return wxSizerFlags().Border( wxALL, 6 );
// FlagsAccessors - Provides read-write copies of standard sizer flags for our interface. }
// These standard definitions provide a consistent and pretty interface for our GUI.
// Without them things look compacted, misaligned, and yucky!
//
// Implementation Note: Accessors are all provisioned as dynamic (realtime) sizer calculations.
// I've preferred this over cstatic const variables on the premise that spacing logic could
// in the future become a dynamic value (currently it is affixed to 6 for most items).
//
namespace SizerFlags
{
wxSizerFlags StdSpace()
{
return wxSizerFlags().Border( wxALL, 6 );
}
wxSizerFlags StdCenter() wxSizerFlags wxHelpers::SizerFlags::StdCenter()
{ {
return wxSizerFlags().Align( wxALIGN_CENTER ).DoubleBorder(); return wxSizerFlags().Align( wxALIGN_CENTER ).DoubleBorder();
} }
wxSizerFlags StdExpand() wxSizerFlags wxHelpers::SizerFlags::StdExpand()
{ {
return StdSpace().Expand(); return StdSpace().Expand();
} }
// A good sizer flags setting for top-level static boxes or top-level picture boxes. // A good sizer flags setting for top-level static boxes or top-level picture boxes.
// Gives a generous border to the left, right, and bottom. Top border can be configured // Gives a generous border to the left, right, and bottom. Top border can be configured
// manually by using a spacer. // manually by using a spacer.
wxSizerFlags TopLevelBox() wxSizerFlags wxHelpers::SizerFlags::TopLevelBox()
{ {
return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 6 ).Expand(); return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 6 ).Expand();
} }
// Flags intended for use on grouped StaticBox controls. These flags are ideal for // Flags intended for use on grouped StaticBox controls. These flags are ideal for
// StaticBoxes that are part of sub-panels or children of other static boxes, but may // StaticBoxes that are part of sub-panels or children of other static boxes, but may
// not be best for parent StaticBoxes on dialogs (left and right borders feel a bit // not be best for parent StaticBoxes on dialogs (left and right borders feel a bit
// "tight"). // "tight").
wxSizerFlags SubGroup() wxSizerFlags wxHelpers::SizerFlags::SubGroup()
{ {
// Groups look better with a slightly smaller margin than standard. // Groups look better with a slightly smaller margin than standard.
// (basically this accounts for the group's frame) // (basically this accounts for the group's frame)
return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 4 ).Expand(); return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 4 ).Expand();
} }
// This force-aligns the std button sizer to the right, where (at least) us win32 platform // This force-aligns the std button sizer to the right, where (at least) us win32 platform
// users always expect it to be. Most likely Mac platforms expect it on the left side // users always expect it to be. Most likely Mac platforms expect it on the left side
// just because it's *not* where win32 sticks it. Too bad! // just because it's *not* where win32 sticks it. Too bad!
wxSizerFlags StdButton() wxSizerFlags wxHelpers::SizerFlags::StdButton()
{ {
return wxSizerFlags().Align( wxALIGN_RIGHT ).Border(); return wxSizerFlags().Align( wxALIGN_RIGHT ).Border();
} }
wxSizerFlags Checkbox() wxSizerFlags wxHelpers::SizerFlags::Checkbox()
{ {
return StdExpand(); return StdExpand();
} }
};
// This method is used internally to create multi line checkboxes and radio buttons. // This method is used internally to create multi line checkboxes and radio buttons.
void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen ) static void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen )
{ {
static const int Indentation = 23; static const int Indentation = 23;
if( subtext.IsEmpty() ) return; if( subtext.IsEmpty() ) return;
wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext ); wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext );
if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation ); if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation );
if( !tooltip.IsEmpty() ) if( !tooltip.IsEmpty() )
joe->SetToolTip( tooltip ); pxSetToolTip( joe, tooltip );
sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) ); sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) );
sizer.AddSpacer( 9 ); sizer.AddSpacer( 9 );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Creates a new checkbox and adds it to the specified sizer/parent combo, with optional tooltip. // Creates a new checkbox and adds it to the specified sizer/parent combo, with optional tooltip.
// Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied // Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied
// to both the checkbox and it's static subtext (if present). // to both the checkbox and it's static subtext (if present).
// //
wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen ) wxCheckBox& wxHelpers::AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen )
{ {
wxCheckBox* retval = new wxCheckBox( parent, wxID_ANY, label ); wxCheckBox* retval = new wxCheckBox( parent, wxID_ANY, label );
sizer.Add( retval, SizerFlags::Checkbox() ); sizer.Add( retval, SizerFlags::Checkbox() );
if( !tooltip.IsEmpty() ) if( !tooltip.IsEmpty() )
retval->SetToolTip( tooltip ); pxSetToolTip( retval, tooltip );
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen ); _appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
return *retval; return *retval;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Creates a new Radio button and adds it to the specified sizer/parent combo, with optional tooltip. // Creates a new Radio button and adds it to the specified sizer/parent combo, with optional tooltip.
// Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied // Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied
// to both the radio button and it's static subtext (if present). // to both the radio button and it's static subtext (if present).
// //
// The first item in a group should pass True for the isFirst parameter. // The first item in a group should pass True for the isFirst parameter.
// //
wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen, bool isFirst ) wxRadioButton& wxHelpers::AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen, bool isFirst )
{ {
wxRadioButton* retval = new wxRadioButton( parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, isFirst ? wxRB_GROUP : 0 ); wxRadioButton* retval = new wxRadioButton( parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, isFirst ? wxRB_GROUP : 0 );
sizer.Add( retval, SizerFlags::Checkbox() ); sizer.Add( retval, SizerFlags::Checkbox() );
if( !tooltip.IsEmpty() ) if( !tooltip.IsEmpty() )
retval->SetToolTip( tooltip ); pxSetToolTip( retval, tooltip );
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen ); _appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
return *retval; return *retval;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this // Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this
// ensures that that auto resizing is disabled, and that the sizer flags match the alignment specified // ensures that that auto resizing is disabled, and that the sizer flags match the alignment specified
// for the textbox. // for the textbox.
// //
// Parameters: // Parameters:
// Size - allows forcing the control to wrap text at a specific pre-defined pixel width; // Size - allows forcing the control to wrap text at a specific pre-defined pixel width;
// or specify zero to let wxWidgets layout the text as it deems appropriate (recommended) // or specify zero to let wxWidgets layout the text as it deems appropriate (recommended)
// //
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored // alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
// or overridden. [default is left alignment] // or overridden. [default is left alignment]
// //
wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags, int size ) wxStaticText& wxHelpers::AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags, int size )
{ {
// No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems. // No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
alignFlags |= wxST_NO_AUTORESIZE; alignFlags |= wxST_NO_AUTORESIZE;
wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) ); wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) );
if( size > 0 ) temp.Wrap( size ); if( size > 0 ) temp.Wrap( size );
sizer.Add( &temp, SizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) ); sizer.Add( &temp, SizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) );
return temp; return temp;
} }
wxStaticText& InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags, int size ) wxStaticText& wxHelpers::InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags, int size )
{ {
// No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems. // No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
alignFlags |= wxST_NO_AUTORESIZE; alignFlags |= wxST_NO_AUTORESIZE;
wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) ); wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) );
if( size > 0 ) temp.Wrap( size ); if( size > 0 ) temp.Wrap( size );
sizer.Insert( position, &temp, SizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) ); sizer.Insert( position, &temp, SizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) );
return temp; return temp;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Launches the specified file according to its mime type // Launches the specified file according to its mime type
// //
void Launch( const wxString& filename ) void wxHelpers::Launch( const wxString& filename )
{ {
wxLaunchDefaultBrowser( filename ); wxLaunchDefaultBrowser( filename );
} }
void Launch(const char *filename) void wxHelpers::Launch(const char *filename)
{ {
Launch( fromUTF8(filename) ); Launch( fromUTF8(filename) );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Launches a file explorer window on the specified path. If the given path is not // Launches a file explorer window on the specified path. If the given path is not
// a qualified URI (with a prefix:// ), file:// is automatically prepended. This // a qualified URI (with a prefix:// ), file:// is automatically prepended. This
// bypasses wxWidgets internal filename checking, which can end up launching things // bypasses wxWidgets internal filename checking, which can end up launching things
// through browser more often than desired. // through browser more often than desired.
// //
void Explore( const wxString& path ) void wxHelpers::Explore( const wxString& path )
{ {
wxLaunchDefaultBrowser( !path.Contains( L"://") ? L"file://" + path : path ); wxLaunchDefaultBrowser( !path.Contains( L"://") ? L"file://" + path : path );
} }
void Explore(const char *path) void wxHelpers::Explore(const char *path)
{ {
Explore( fromUTF8(path) ); Explore( fromUTF8(path) );
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void pxTextWrapperBase::Wrap( const wxWindow *win, const wxString& text, int widthMax ) pxTextWrapperBase& pxTextWrapperBase::Wrap( const wxWindow& win, const wxString& text, int widthMax )
{ {
const wxChar *lastSpace = NULL; const wxChar *lastSpace = NULL;
wxString line; wxString line;
@ -238,7 +232,7 @@ void pxTextWrapperBase::Wrap( const wxWindow *win, const wxString& text, int wid
if ( widthMax >= 0 && lastSpace ) if ( widthMax >= 0 && lastSpace )
{ {
int width; int width;
win->GetTextExtent(line, &width, NULL); win.GetTextExtent(line, &width, NULL);
if ( width > widthMax ) if ( width > widthMax )
{ {
@ -254,8 +248,74 @@ void pxTextWrapperBase::Wrap( const wxWindow *win, const wxString& text, int wid
//else: no wrapping at all or impossible to wrap //else: no wrapping at all or impossible to wrap
} }
} }
return *this;
} }
void pxTextWrapperBase::DoOutputLine(const wxString& line)
{
OnOutputLine(line);
m_linecount++;
m_eol = true;
}
// this function is a destructive inspector: when it returns true it also
// resets the flag to false so calling it again wouldn't return true any
// more
bool pxTextWrapperBase::IsStartOfNewLine()
{
if ( !m_eol )
return false;
m_eol = false;
return true;
}
pxTextWrapper& pxTextWrapper::Wrap( const wxWindow& win, const wxString& text, int widthMax )
{
_parent::Wrap( win, text, widthMax );
return *this;
}
void pxTextWrapper::OnOutputLine(const wxString& line)
{
m_text += line;
}
void pxTextWrapper::OnNewLine()
{
m_text += L'\n';
}
// This is the preferred way to assign tooltips to wxWindow-based objects, as it performs the
// necessary text wrapping on platforms that need it. On windows tooltips are wrapped at 600
// pixels, or 66% of the screen width, whichever is smaller. GTK and MAC perform internal
// wrapping, so this function does a regular assignment there.
void pxSetToolTip( wxWindow* wind, const wxString& src )
{
if( !pxAssert( wind != NULL ) ) return;
// Windows needs manual tooltip word wrapping (sigh).
// GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all
// half the time because of some other bug .. sigh)
#ifdef __WXMSW__
int whee = wxGetDisplaySize().GetWidth() * 0.75;
wind->SetToolTip( pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult() );
#else
wind->SetToolTip( src );
#endif
}
void pxSetToolTip( wxWindow& wind, const wxString& src )
{
pxSetToolTip( &wind, src );
}
// =====================================================================================================
// wxDialogWithHelpers Class Implementations
// =====================================================================================================
HashTools::HashMap< wxWindowID, int > m_DialogIdents( 0, wxID_ANY ); HashTools::HashMap< wxWindowID, int > m_DialogIdents( 0, wxID_ANY );
bool pxDialogExists( wxWindowID id ) bool pxDialogExists( wxWindowID id )

View File

@ -93,4 +93,5 @@ protected:
}; };
extern bool pxDialogExists( wxWindowID id ); extern bool pxDialogExists( wxWindowID id );
extern void pxSetToolTip( wxWindow* wind, const wxString& src );
extern void pxSetToolTip( wxWindow& wind, const wxString& src );

View File

@ -1111,24 +1111,31 @@ void recDIV_S_xmm(int info)
//if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");} //if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");}
//Console.WriteLn("DIV"); //Console.WriteLn("DIV");
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest) if( CHECK_FPUNEGDIVHACK )
{ {
// Set roundmode to nearest since it isn't already if (g_sseMXCSR.GetRoundMode() != SSEround_NegInf)
//Console.WriteLn("div to nearest");
if( CHECK_FPUNEGDIVHACK )
{ {
// Set roundmode to nearest since it isn't already
//Console.WriteLn("div to negative inf");
roundmode_neg = g_sseMXCSR; roundmode_neg = g_sseMXCSR;
roundmode_neg.SetRoundMode( SSEround_NegInf ); roundmode_neg.SetRoundMode( SSEround_NegInf );
xLDMXCSR( roundmode_neg ); xLDMXCSR( roundmode_neg );
roundmodeFlag = true;
} }
else }
else
{
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
{ {
// Set roundmode to nearest since it isn't already
//Console.WriteLn("div to nearest");
roundmode_nearest = g_sseMXCSR; roundmode_nearest = g_sseMXCSR;
roundmode_nearest.SetRoundMode( SSEround_Nearest ); roundmode_nearest.SetRoundMode( SSEround_Nearest );
xLDMXCSR( roundmode_nearest ); xLDMXCSR( roundmode_nearest );
roundmodeFlag = true;
} }
roundmodeFlag = true;
} }
switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) { switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) {
@ -1795,6 +1802,9 @@ void recRSQRThelper2(int regd, int t0reg) // Preforms the RSQRT function when re
void recRSQRT_S_xmm(int info) void recRSQRT_S_xmm(int info)
{ {
// iFPUd (Full mode) sets roundmode to nearest for rSQRT.
// Should this do the same, or should Full mode leave roundmode alone? --air
int t0reg = _allocTempXMMreg(XMMT_FPS, -1); int t0reg = _allocTempXMMreg(XMMT_FPS, -1);
//if (t0reg == -1) {Console.Error("FPU: RSQRT Allocation Error!");} //if (t0reg == -1) {Console.Error("FPU: RSQRT Allocation Error!");}
//Console.WriteLn("FPU: RSQRT"); //Console.WriteLn("FPU: RSQRT");

View File

@ -640,28 +640,35 @@ static __aligned16 SSE_MXCSR roundmode_nearest, roundmode_neg;
void recDIV_S_xmm(int info) void recDIV_S_xmm(int info)
{ {
int roundmodeFlag = 0; bool roundmodeFlag = false;
//if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");} //if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");}
//Console.WriteLn("DIV"); //Console.WriteLn("DIV");
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest) if( CHECK_FPUNEGDIVHACK )
{ {
// Set roundmode to nearest since it isn't already if (g_sseMXCSR.GetRoundMode() != SSEround_NegInf)
//Console.WriteLn("div to nearest");
if( CHECK_FPUNEGDIVHACK )
{ {
// Set roundmode to nearest since it isn't already
//Console.WriteLn("div to negative inf");
roundmode_neg = g_sseMXCSR; roundmode_neg = g_sseMXCSR;
roundmode_neg.SetRoundMode( SSEround_NegInf ); roundmode_neg.SetRoundMode( SSEround_NegInf );
xLDMXCSR( roundmode_neg ); xLDMXCSR( roundmode_neg );
roundmodeFlag = true;
} }
else }
else
{
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
{ {
// Set roundmode to nearest since it isn't already
//Console.WriteLn("div to nearest");
roundmode_nearest = g_sseMXCSR; roundmode_nearest = g_sseMXCSR;
roundmode_nearest.SetRoundMode( SSEround_Nearest ); roundmode_nearest.SetRoundMode( SSEround_Nearest );
xLDMXCSR( roundmode_nearest ); xLDMXCSR( roundmode_nearest );
roundmodeFlag = true;
} }
roundmodeFlag = 1;
} }
int sreg, treg; int sreg, treg;
@ -675,9 +682,7 @@ void recDIV_S_xmm(int info)
SSE_MOVSS_XMM_to_XMM(EEREC_D, sreg); SSE_MOVSS_XMM_to_XMM(EEREC_D, sreg);
if (roundmodeFlag == 1) { // Set roundmode back if it was changed if (roundmodeFlag) xLDMXCSR (g_sseMXCSR);
xLDMXCSR (g_sseMXCSR);
}
_freeXMMreg(sreg); _freeXMMreg(treg); _freeXMMreg(sreg); _freeXMMreg(treg);
} }
@ -1042,6 +1047,10 @@ void recRSQRT_S_xmm(int info)
{ {
int sreg, treg; int sreg, treg;
// iFPU (regular FPU) doesn't touch roundmode for rSQRT.
// Should this do the same? or is changing the roundmode to nearest the better
// behavior for both recs? --air
bool roundmodeFlag = false; bool roundmodeFlag = false;
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest) if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
{ {

View File

@ -385,7 +385,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
wxString filename( Path::Combine( g_Conf->Folders.Logs, wxsFormat( L"psxdump%.8X.txt", startpc ) ) ); wxString filename( Path::Combine( g_Conf->Folders.Logs, wxsFormat( L"psxdump%.8X.txt", startpc ) ) );
AsciiFile f( filename, wxFile::write ); AsciiFile f( filename, L"w" );
/*for ( i = startpc; i < s_nEndBlock; i += 4 ) { /*for ( i = startpc; i < s_nEndBlock; i += 4 ) {
f.Printf("%s\n", disR3000Fasm( iopMemRead32( i ), i ) ); f.Printf("%s\n", disR3000Fasm( iopMemRead32( i ), i ) );
@ -433,7 +433,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
char command[256]; char command[256];
// dump the asm // dump the asm
{ {
AsciiFile f2( L"mydump1", wxFile::write ); AsciiFile f2( L"mydump1", L"w" );
f2.Write( ptr, (uptr)x86Ptr - (uptr)ptr ); f2.Write( ptr, (uptr)x86Ptr - (uptr)ptr );
} }
wxCharBuffer buf( filename.ToUTF8() ); wxCharBuffer buf( filename.ToUTF8() );

View File

@ -17,6 +17,8 @@
//#define mVUdebug // Prints Extra Info to Console //#define mVUdebug // Prints Extra Info to Console
//#define mVUlogProg // Dumps MicroPrograms to \logs\*.html //#define mVUlogProg // Dumps MicroPrograms to \logs\*.html
class AsciiFile;
#include "microVU_IR.h" #include "microVU_IR.h"
#include "microVU_Misc.h" #include "microVU_Misc.h"
@ -152,7 +154,7 @@ struct microVU {
microProgManager prog; // Micro Program Data microProgManager prog; // Micro Program Data
microRegAlloc* regAlloc; // Reg Alloc Class microRegAlloc* regAlloc; // Reg Alloc Class
FILE* logFile; // Log File Pointer AsciiFile* logFile; // Log File Pointer
VURegs* regs; // VU Regs Struct VURegs* regs; // VU Regs Struct
u8* cache; // Dynarec Cache Start (where we will start writing the recompiled code to) u8* cache; // Dynarec Cache Start (where we will start writing the recompiled code to)
u8* startFunct; // Ptr Function to the Start code for recompiled programs u8* startFunct; // Ptr Function to the Start code for recompiled programs

View File

@ -15,40 +15,41 @@
#pragma once #pragma once
#include "Utilities/AsciiFile.h"
// writes text directly to mVU->logFile, no newlines appended. // writes text directly to mVU->logFile, no newlines appended.
microVUx(void) __mVULog(const char* fmt, ...) { microVUx(void) __mVULog(const char* fmt, ...) {
microVU* mVU = mVUx; microVU* mVU = mVUx;
if (!mVU->logFile) return;
char tmp[2024]; char tmp[2024];
va_list list; va_list list;
va_start(list, fmt); va_start(list, fmt);
// concatenate the log message after the prefix: // concatenate the log message after the prefix:
int length = vsprintf(tmp, fmt, list); int length = vsprintf(tmp, fmt, list);
va_end(list); va_end(list);
if (mVU->logFile) { mVU->logFile->Write( tmp );
fputs(tmp, mVU->logFile); mVU->logFile->Flush();
fflush(mVU->logFile);
}
} }
#define commaIf() { if (bitX[6]) { mVUlog(","); bitX[6] = 0; } } #define commaIf() { if (bitX[6]) { mVUlog(","); bitX[6] = 0; } }
#include "AppConfig.h"
microVUx(void) __mVUdumpProgram(int progIndex) { microVUx(void) __mVUdumpProgram(int progIndex) {
microVU* mVU = mVUx; microVU* mVU = mVUx;
bool bitX[7]; bool bitX[7];
char str[30];
int delay = 0; int delay = 0;
int bBranch = mVUbranch; int bBranch = mVUbranch;
int bCode = mVU->code; int bCode = mVU->code;
int bPC = iPC; int bPC = iPC;
mVUbranch = 0; mVUbranch = 0;
// fixme: This needs recdone using wxFile and wxString
sprintf(str, "%s\\microVU%d prog - %02d.html", "logs", vuIndex, progIndex); const wxString logname( wxsFormat( L"microVU%d prog - %02d.html", L"logs", vuIndex, progIndex) );
mVU->logFile = fopen(str, "w"); mVU->logFile = new AsciiFile( Path::Combine( g_Conf->Folders.Logs, logname), L"w" );
mVUlog("<html>\n"); mVUlog("<html>\n");
mVUlog("<title>microVU%d MicroProgram Log</title>\n", vuIndex); mVUlog("<title>microVU%d MicroProgram Log</title>\n", vuIndex);
@ -116,7 +117,9 @@ microVUx(void) __mVUdumpProgram(int progIndex) {
mVUlog("</font>\n"); mVUlog("</font>\n");
mVUlog("</body>\n"); mVUlog("</body>\n");
mVUlog("</html>\n"); mVUlog("</html>\n");
fclose(mVU->logFile);
safe_delete( mVU->logFile );
mVUbranch = bBranch; mVUbranch = bBranch;
mVU->code = bCode; mVU->code = bCode;
iPC = bPC; iPC = bPC;

View File

@ -579,8 +579,7 @@ void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
AsciiFile eff( AsciiFile eff(
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ), Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ), L"w"
wxFile::write
); );
eff.Printf("Format: upper_inst lower_inst\ntype f:vf_live_vars vf_used_vars i:vi_live_vars vi_used_vars inst_cycle pq_inst\n"); eff.Printf("Format: upper_inst lower_inst\ntype f:vf_live_vars vf_used_vars i:vi_live_vars vi_used_vars inst_cycle pq_inst\n");