mirror of https://github.com/PCSX2/pcsx2.git
* 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:
parent
909714d08e
commit
115d2b6f05
|
@ -48,17 +48,17 @@ protected:
|
|||
int m_linecount;
|
||||
|
||||
public:
|
||||
virtual ~pxTextWrapperBase() { }
|
||||
virtual ~pxTextWrapperBase() throw() { }
|
||||
|
||||
pxTextWrapperBase() :
|
||||
m_eol( false )
|
||||
, m_linecount( 0 )
|
||||
pxTextWrapperBase()
|
||||
{
|
||||
m_eol = false;
|
||||
m_linecount = 0;
|
||||
}
|
||||
|
||||
// win is used for getting the font, text is the text to wrap, width is the
|
||||
// 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
|
||||
{
|
||||
|
@ -72,24 +72,8 @@ protected:
|
|||
// called at the start of every new line (except the very first one)
|
||||
virtual void OnNewLine() { }
|
||||
|
||||
void 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 IsStartOfNewLine()
|
||||
{
|
||||
if ( !m_eol )
|
||||
return false;
|
||||
|
||||
m_eol = false;
|
||||
return true;
|
||||
}
|
||||
void DoOutputLine(const wxString& line);
|
||||
bool IsStartOfNewLine();
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -100,30 +84,25 @@ protected:
|
|||
//
|
||||
class pxTextWrapper : public pxTextWrapperBase
|
||||
{
|
||||
typedef pxTextWrapperBase _parent;
|
||||
|
||||
protected:
|
||||
wxString m_text;
|
||||
|
||||
public:
|
||||
pxTextWrapper() : pxTextWrapperBase()
|
||||
, m_text()
|
||||
{
|
||||
}
|
||||
pxTextWrapper() : pxTextWrapperBase() { }
|
||||
virtual ~pxTextWrapper() throw() { }
|
||||
|
||||
const wxString& GetResult() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void OnOutputLine(const wxString& line)
|
||||
{
|
||||
m_text += line;
|
||||
}
|
||||
pxTextWrapper& Wrap( const wxWindow& win, const wxString& text, int widthMax );
|
||||
|
||||
virtual void OnNewLine()
|
||||
{
|
||||
m_text += L'\n';
|
||||
}
|
||||
protected:
|
||||
virtual void OnOutputLine(const wxString& line);
|
||||
virtual void OnNewLine();
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -211,8 +211,7 @@ void iDumpBlock( int startpc, u8 * ptr )
|
|||
|
||||
g_Conf->Folders.Logs.Mkdir();
|
||||
AsciiFile eff(
|
||||
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ),
|
||||
wxFile::write
|
||||
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
|
||||
);
|
||||
|
||||
if( disR5900GetSym(startpc) != NULL )
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <wx/file.h>
|
||||
#include <wx/ffile.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 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-
|
||||
// tional (since the dumps are only ever english/ascii only).
|
||||
//
|
||||
class AsciiFile : public wxFile
|
||||
class AsciiFile : public wxFFile
|
||||
{
|
||||
public:
|
||||
using wxFile::Write;
|
||||
using wxFFile::Write;
|
||||
|
||||
AsciiFile( const wxString& src, OpenMode mode = read ) :
|
||||
wxFile( src, mode ) {}
|
||||
AsciiFile( const wxString& src, const wxChar* mode ) :
|
||||
wxFFile( src, mode ) {}
|
||||
|
||||
void Printf( const char* fmt, ... );
|
||||
|
||||
|
|
|
@ -134,9 +134,9 @@ wxWindowID Dialogs::IssueConfirmation( wxWindow* parent, const wxString& disable
|
|||
confirmDlg.GetExtensibleSizer().Add( &cboxPad, wxSizerFlags().Centre() );
|
||||
|
||||
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
|
||||
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();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "ModalPopups.h"
|
||||
#include "Panels/ConfigurationPanels.h"
|
||||
#include "wx//file.h"
|
||||
#include <wx/file.h>
|
||||
|
||||
using namespace wxHelpers;
|
||||
using namespace Panels;
|
||||
|
@ -35,7 +35,7 @@ static T& MakeWizWidget( int pageid, wxWizardPage& src )
|
|||
Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) :
|
||||
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"by most plugins (some older plugins may not respect this value)."
|
||||
) );
|
||||
|
|
|
@ -351,6 +351,7 @@ namespace Panels
|
|||
wxDirName GetPath() const { return wxDirName( m_pickerCtrl->GetPath() ); }
|
||||
|
||||
DirPickerPanel& SetStaticDesc( const wxString& msg );
|
||||
DirPickerPanel& SetToolTip( const wxString& tip );
|
||||
|
||||
protected:
|
||||
void UseDefaultPath_Click( wxCommandEvent &event );
|
||||
|
|
|
@ -92,7 +92,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
|
|||
s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() );
|
||||
|
||||
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. " )
|
||||
);
|
||||
|
||||
|
@ -101,7 +101,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
|
|||
// button on the dialogs for now.
|
||||
|
||||
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 ) );
|
||||
Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) );
|
||||
#endif
|
||||
|
@ -125,6 +125,12 @@ Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& m
|
|||
return *this;
|
||||
}
|
||||
|
||||
Panels::DirPickerPanel& Panels::DirPickerPanel::SetToolTip( const wxString& tip )
|
||||
{
|
||||
pxSetToolTip( this, tip );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Panels::DirPickerPanel::Reset()
|
||||
{
|
||||
const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId );
|
||||
|
|
|
@ -128,8 +128,8 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
|
|||
m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
|
||||
m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
|
||||
|
||||
m_slider_eecycle->SetToolTip( tooltip );
|
||||
m_msg_eecycle->SetToolTip( tooltip );
|
||||
pxSetToolTip( m_slider_eecycle, tooltip );
|
||||
pxSetToolTip( m_msg_eecycle, tooltip );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// 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->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) );
|
||||
|
||||
m_slider_vustealer->SetToolTip( tooltip );
|
||||
m_msg_vustealer->SetToolTip( tooltip );
|
||||
pxSetToolTip( m_slider_vustealer, tooltip );
|
||||
pxSetToolTip( m_msg_vustealer, tooltip );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// microVU Hacks Section:
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
# include <wx/tooltip.h>
|
||||
#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.
|
||||
|
@ -34,19 +32,17 @@ namespace wxHelpers
|
|||
// 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()
|
||||
wxSizerFlags wxHelpers::SizerFlags::StdSpace()
|
||||
{
|
||||
return wxSizerFlags().Border( wxALL, 6 );
|
||||
}
|
||||
|
||||
wxSizerFlags StdCenter()
|
||||
wxSizerFlags wxHelpers::SizerFlags::StdCenter()
|
||||
{
|
||||
return wxSizerFlags().Align( wxALIGN_CENTER ).DoubleBorder();
|
||||
}
|
||||
|
||||
wxSizerFlags StdExpand()
|
||||
wxSizerFlags wxHelpers::SizerFlags::StdExpand()
|
||||
{
|
||||
return StdSpace().Expand();
|
||||
}
|
||||
|
@ -54,7 +50,7 @@ namespace wxHelpers
|
|||
// 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
|
||||
// manually by using a spacer.
|
||||
wxSizerFlags TopLevelBox()
|
||||
wxSizerFlags wxHelpers::SizerFlags::TopLevelBox()
|
||||
{
|
||||
return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 6 ).Expand();
|
||||
}
|
||||
|
@ -63,7 +59,7 @@ namespace wxHelpers
|
|||
// 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
|
||||
// "tight").
|
||||
wxSizerFlags SubGroup()
|
||||
wxSizerFlags wxHelpers::SizerFlags::SubGroup()
|
||||
{
|
||||
// Groups look better with a slightly smaller margin than standard.
|
||||
// (basically this accounts for the group's frame)
|
||||
|
@ -73,19 +69,18 @@ namespace wxHelpers
|
|||
// 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
|
||||
// just because it's *not* where win32 sticks it. Too bad!
|
||||
wxSizerFlags StdButton()
|
||||
wxSizerFlags wxHelpers::SizerFlags::StdButton()
|
||||
{
|
||||
return wxSizerFlags().Align( wxALIGN_RIGHT ).Border();
|
||||
}
|
||||
|
||||
wxSizerFlags Checkbox()
|
||||
wxSizerFlags wxHelpers::SizerFlags::Checkbox()
|
||||
{
|
||||
return StdExpand();
|
||||
}
|
||||
};
|
||||
|
||||
// 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;
|
||||
|
||||
|
@ -94,7 +89,7 @@ namespace wxHelpers
|
|||
wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext );
|
||||
if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation );
|
||||
if( !tooltip.IsEmpty() )
|
||||
joe->SetToolTip( tooltip );
|
||||
pxSetToolTip( joe, tooltip );
|
||||
sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) );
|
||||
sizer.AddSpacer( 9 );
|
||||
}
|
||||
|
@ -105,13 +100,13 @@ namespace wxHelpers
|
|||
// 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).
|
||||
//
|
||||
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 );
|
||||
sizer.Add( retval, SizerFlags::Checkbox() );
|
||||
|
||||
if( !tooltip.IsEmpty() )
|
||||
retval->SetToolTip( tooltip );
|
||||
pxSetToolTip( retval, tooltip );
|
||||
|
||||
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
|
||||
|
||||
|
@ -125,13 +120,13 @@ namespace wxHelpers
|
|||
//
|
||||
// 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 );
|
||||
sizer.Add( retval, SizerFlags::Checkbox() );
|
||||
|
||||
if( !tooltip.IsEmpty() )
|
||||
retval->SetToolTip( tooltip );
|
||||
pxSetToolTip( retval, tooltip );
|
||||
|
||||
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
|
||||
|
||||
|
@ -150,7 +145,7 @@ namespace wxHelpers
|
|||
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
|
||||
// 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.
|
||||
alignFlags |= wxST_NO_AUTORESIZE;
|
||||
|
@ -161,7 +156,7 @@ namespace wxHelpers
|
|||
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.
|
||||
alignFlags |= wxST_NO_AUTORESIZE;
|
||||
|
@ -175,12 +170,12 @@ namespace wxHelpers
|
|||
// ------------------------------------------------------------------------
|
||||
// Launches the specified file according to its mime type
|
||||
//
|
||||
void Launch( const wxString& filename )
|
||||
void wxHelpers::Launch( const wxString& filename )
|
||||
{
|
||||
wxLaunchDefaultBrowser( filename );
|
||||
}
|
||||
|
||||
void Launch(const char *filename)
|
||||
void wxHelpers::Launch(const char *filename)
|
||||
{
|
||||
Launch( fromUTF8(filename) );
|
||||
}
|
||||
|
@ -191,19 +186,18 @@ namespace wxHelpers
|
|||
// bypasses wxWidgets internal filename checking, which can end up launching things
|
||||
// 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 );
|
||||
}
|
||||
|
||||
void Explore(const char *path)
|
||||
void wxHelpers::Explore(const char *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;
|
||||
wxString line;
|
||||
|
@ -238,7 +232,7 @@ void pxTextWrapperBase::Wrap( const wxWindow *win, const wxString& text, int wid
|
|||
if ( widthMax >= 0 && lastSpace )
|
||||
{
|
||||
int width;
|
||||
win->GetTextExtent(line, &width, NULL);
|
||||
win.GetTextExtent(line, &width, NULL);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
bool pxDialogExists( wxWindowID id )
|
||||
|
|
|
@ -93,4 +93,5 @@ protected:
|
|||
};
|
||||
|
||||
extern bool pxDialogExists( wxWindowID id );
|
||||
|
||||
extern void pxSetToolTip( wxWindow* wind, const wxString& src );
|
||||
extern void pxSetToolTip( wxWindow& wind, const wxString& src );
|
||||
|
|
|
@ -1111,25 +1111,32 @@ void recDIV_S_xmm(int info)
|
|||
//if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");}
|
||||
//Console.WriteLn("DIV");
|
||||
|
||||
if( CHECK_FPUNEGDIVHACK )
|
||||
{
|
||||
if (g_sseMXCSR.GetRoundMode() != SSEround_NegInf)
|
||||
{
|
||||
// Set roundmode to nearest since it isn't already
|
||||
//Console.WriteLn("div to negative inf");
|
||||
|
||||
roundmode_neg = g_sseMXCSR;
|
||||
roundmode_neg.SetRoundMode( SSEround_NegInf );
|
||||
xLDMXCSR( roundmode_neg );
|
||||
roundmodeFlag = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
|
||||
{
|
||||
// Set roundmode to nearest since it isn't already
|
||||
//Console.WriteLn("div to nearest");
|
||||
|
||||
if( CHECK_FPUNEGDIVHACK )
|
||||
{
|
||||
roundmode_neg = g_sseMXCSR;
|
||||
roundmode_neg.SetRoundMode( SSEround_NegInf );
|
||||
xLDMXCSR( roundmode_neg );
|
||||
}
|
||||
else
|
||||
{
|
||||
roundmode_nearest = g_sseMXCSR;
|
||||
roundmode_nearest.SetRoundMode( SSEround_Nearest );
|
||||
xLDMXCSR( roundmode_nearest );
|
||||
}
|
||||
roundmodeFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) {
|
||||
case PROCESS_EE_S:
|
||||
|
@ -1795,6 +1802,9 @@ void recRSQRThelper2(int regd, int t0reg) // Preforms the RSQRT function when re
|
|||
|
||||
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);
|
||||
//if (t0reg == -1) {Console.Error("FPU: RSQRT Allocation Error!");}
|
||||
//Console.WriteLn("FPU: RSQRT");
|
||||
|
|
|
@ -640,28 +640,35 @@ static __aligned16 SSE_MXCSR roundmode_nearest, roundmode_neg;
|
|||
|
||||
void recDIV_S_xmm(int info)
|
||||
{
|
||||
int roundmodeFlag = 0;
|
||||
bool roundmodeFlag = false;
|
||||
//if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");}
|
||||
//Console.WriteLn("DIV");
|
||||
|
||||
if( CHECK_FPUNEGDIVHACK )
|
||||
{
|
||||
if (g_sseMXCSR.GetRoundMode() != SSEround_NegInf)
|
||||
{
|
||||
// Set roundmode to nearest since it isn't already
|
||||
//Console.WriteLn("div to negative inf");
|
||||
|
||||
roundmode_neg = g_sseMXCSR;
|
||||
roundmode_neg.SetRoundMode( SSEround_NegInf );
|
||||
xLDMXCSR( roundmode_neg );
|
||||
roundmodeFlag = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
|
||||
{
|
||||
// Set roundmode to nearest since it isn't already
|
||||
//Console.WriteLn("div to nearest");
|
||||
|
||||
if( CHECK_FPUNEGDIVHACK )
|
||||
{
|
||||
roundmode_neg = g_sseMXCSR;
|
||||
roundmode_neg.SetRoundMode( SSEround_NegInf );
|
||||
xLDMXCSR( roundmode_neg );
|
||||
}
|
||||
else
|
||||
{
|
||||
roundmode_nearest = g_sseMXCSR;
|
||||
roundmode_nearest.SetRoundMode( SSEround_Nearest );
|
||||
xLDMXCSR( roundmode_nearest );
|
||||
roundmodeFlag = true;
|
||||
}
|
||||
roundmodeFlag = 1;
|
||||
}
|
||||
|
||||
int sreg, treg;
|
||||
|
@ -675,9 +682,7 @@ void recDIV_S_xmm(int info)
|
|||
|
||||
SSE_MOVSS_XMM_to_XMM(EEREC_D, sreg);
|
||||
|
||||
if (roundmodeFlag == 1) { // Set roundmode back if it was changed
|
||||
xLDMXCSR (g_sseMXCSR);
|
||||
}
|
||||
if (roundmodeFlag) xLDMXCSR (g_sseMXCSR);
|
||||
_freeXMMreg(sreg); _freeXMMreg(treg);
|
||||
}
|
||||
|
||||
|
@ -1042,6 +1047,10 @@ void recRSQRT_S_xmm(int info)
|
|||
{
|
||||
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;
|
||||
if (g_sseMXCSR.GetRoundMode() != SSEround_Nearest)
|
||||
{
|
||||
|
|
|
@ -385,7 +385,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
|
|||
g_Conf->Folders.Logs.Mkdir();
|
||||
|
||||
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 ) {
|
||||
f.Printf("%s\n", disR3000Fasm( iopMemRead32( i ), i ) );
|
||||
|
@ -433,7 +433,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
|
|||
char command[256];
|
||||
// dump the asm
|
||||
{
|
||||
AsciiFile f2( L"mydump1", wxFile::write );
|
||||
AsciiFile f2( L"mydump1", L"w" );
|
||||
f2.Write( ptr, (uptr)x86Ptr - (uptr)ptr );
|
||||
}
|
||||
wxCharBuffer buf( filename.ToUTF8() );
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
//#define mVUdebug // Prints Extra Info to Console
|
||||
//#define mVUlogProg // Dumps MicroPrograms to \logs\*.html
|
||||
|
||||
class AsciiFile;
|
||||
|
||||
#include "microVU_IR.h"
|
||||
#include "microVU_Misc.h"
|
||||
|
||||
|
@ -152,7 +154,7 @@ struct microVU {
|
|||
microProgManager prog; // Micro Program Data
|
||||
microRegAlloc* regAlloc; // Reg Alloc Class
|
||||
|
||||
FILE* logFile; // Log File Pointer
|
||||
AsciiFile* logFile; // Log File Pointer
|
||||
VURegs* regs; // VU Regs Struct
|
||||
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
|
||||
|
|
|
@ -15,40 +15,41 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Utilities/AsciiFile.h"
|
||||
|
||||
// writes text directly to mVU->logFile, no newlines appended.
|
||||
microVUx(void) __mVULog(const char* fmt, ...) {
|
||||
|
||||
microVU* mVU = mVUx;
|
||||
if (!mVU->logFile) return;
|
||||
|
||||
char tmp[2024];
|
||||
va_list list;
|
||||
|
||||
va_start(list, fmt);
|
||||
|
||||
// concatenate the log message after the prefix:
|
||||
int length = vsprintf(tmp, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (mVU->logFile) {
|
||||
fputs(tmp, mVU->logFile);
|
||||
fflush(mVU->logFile);
|
||||
}
|
||||
mVU->logFile->Write( tmp );
|
||||
mVU->logFile->Flush();
|
||||
}
|
||||
|
||||
#define commaIf() { if (bitX[6]) { mVUlog(","); bitX[6] = 0; } }
|
||||
|
||||
#include "AppConfig.h"
|
||||
|
||||
microVUx(void) __mVUdumpProgram(int progIndex) {
|
||||
microVU* mVU = mVUx;
|
||||
bool bitX[7];
|
||||
char str[30];
|
||||
int delay = 0;
|
||||
int bBranch = mVUbranch;
|
||||
int bCode = mVU->code;
|
||||
int bPC = iPC;
|
||||
mVUbranch = 0;
|
||||
|
||||
// fixme: This needs recdone using wxFile and wxString
|
||||
|
||||
sprintf(str, "%s\\microVU%d prog - %02d.html", "logs", vuIndex, progIndex);
|
||||
mVU->logFile = fopen(str, "w");
|
||||
const wxString logname( wxsFormat( L"microVU%d prog - %02d.html", L"logs", vuIndex, progIndex) );
|
||||
mVU->logFile = new AsciiFile( Path::Combine( g_Conf->Folders.Logs, logname), L"w" );
|
||||
|
||||
mVUlog("<html>\n");
|
||||
mVUlog("<title>microVU%d MicroProgram Log</title>\n", vuIndex);
|
||||
|
@ -116,7 +117,9 @@ microVUx(void) __mVUdumpProgram(int progIndex) {
|
|||
mVUlog("</font>\n");
|
||||
mVUlog("</body>\n");
|
||||
mVUlog("</html>\n");
|
||||
fclose(mVU->logFile);
|
||||
|
||||
safe_delete( mVU->logFile );
|
||||
|
||||
mVUbranch = bBranch;
|
||||
mVU->code = bCode;
|
||||
iPC = bPC;
|
||||
|
|
|
@ -579,8 +579,7 @@ void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
|
|||
|
||||
g_Conf->Folders.Logs.Mkdir();
|
||||
AsciiFile eff(
|
||||
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ),
|
||||
wxFile::write
|
||||
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ), L"w"
|
||||
);
|
||||
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue