mirror of https://github.com/PCSX2/pcsx2.git
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :) * Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely). * More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads. * Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs). * Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
638740b53d
commit
653d09e821
|
@ -41,6 +41,8 @@
|
|||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_LIB"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="PrecompiledHeader.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -96,6 +98,8 @@
|
|||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_LIB"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="PrecompiledHeader.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -151,6 +155,8 @@
|
|||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_LIB"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="PrecompiledHeader.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -213,6 +219,34 @@
|
|||
RelativePath="..\..\src\Utilities\PathUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\PrecompiledHeader.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Devel|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\StringHelpers.cpp"
|
||||
>
|
||||
|
@ -367,6 +401,10 @@
|
|||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\Utilities\Assertions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\Utilities\Console.h"
|
||||
>
|
||||
|
|
|
@ -59,7 +59,10 @@
|
|||
// jASSUME - give hints to the optimizer
|
||||
// This is primarily useful for the default case switch optimizer, which enables VC to
|
||||
// generate more compact switches.
|
||||
|
||||
//
|
||||
// Note: When using the PCSX2 Utilities library, this is deprecated. Use pxAssert instead,
|
||||
// which itself optimizes to an __assume() hint in release mode builds.
|
||||
//
|
||||
#ifndef jASSUME
|
||||
# ifdef NDEBUG
|
||||
# define jBREAKPOINT() ((void) 0)
|
||||
|
@ -224,8 +227,9 @@ This theoretically unoptimizes. Not having much luck so far.
|
|||
# define PCSX2_ALIGNED_EXTERN(alig,x) extern x __attribute((aligned(alig)))
|
||||
# define PCSX2_ALIGNED16_EXTERN(x) extern x __attribute((aligned(16)))
|
||||
|
||||
# define __naked // GCC lacks the naked specifier
|
||||
# define CALLBACK // CALLBACK is a win32-specific mess
|
||||
# define __naked // GCC lacks the naked specifier
|
||||
# define __assume(cond) // GCC has no equivalent for __assume
|
||||
# define CALLBACK __stdcall
|
||||
|
||||
// Inlining note: GCC needs ((unused)) attributes defined on inlined functions to suppress
|
||||
// warnings when a static inlined function isn't used in the scope of a single file (which
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// pxAssert / pxAssertDev / pxFail / pxFailDev
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Standard debug-ony "nothrow" (pxAssert) and devel-style "throw" (pxAssertDev) style
|
||||
// assertions. All assertions act as valid conditional statements that return the result
|
||||
// of the specified conditional; useful for handling failed assertions in a "graceful" fashion
|
||||
// when utilizing the "ignore" feature of assertion debugging. (Release builds *always* return
|
||||
// true for assertion success, but no actual assertion check is performed).
|
||||
//
|
||||
// Performance: All assertion types optimize into __assume() directives in Release builds.
|
||||
//
|
||||
// pxAssertDev is an assertion tool for Devel builds, intended for sanity checking and/or
|
||||
// bounds checking variables in areas which are not performance critical.
|
||||
//
|
||||
// How it works: pxAssertDev throws an exception of type Exception::LogicError if the assertion
|
||||
// conditional is false. Typically for the end-user, this exception is handled by the general
|
||||
// exception handler defined by the application, which (should eventually) create some state
|
||||
// dumps and other information for troubleshooting purposes.
|
||||
//
|
||||
// From a debugging environment, you can trap your pxAssertDev by either breakpointing the
|
||||
// exception throw code in pxOnAssert, or by adding Exception::LogicError to your First-Chance
|
||||
// Exception catch list (Visual Studio, under the Debug->Exceptions menu/dialog). You should
|
||||
// have LogicErrors enabled as First-Chance exceptions regardless, so do it now. :)
|
||||
//
|
||||
// Credits Notes: These macros are based on a combination of wxASSERT, MSVCRT's assert
|
||||
// and the ATL's Assertion/Assumption macros. the best of all worlds!
|
||||
|
||||
#if defined(PCSX2_DEBUG)
|
||||
|
||||
# define pxAssertMsg(cond, msg) ( ((!!(cond)) || \
|
||||
(pxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg), 0)), !!(cond) )
|
||||
|
||||
# define pxAssertDev(cond,msg) pxAssertMsg(cond, msg)
|
||||
|
||||
# define pxFail(msg) pxAssertMsg(false, msg)
|
||||
# define pxFailDev(msg) pxAssertDev(false, msg)
|
||||
|
||||
#elif defined(PCSX2_DEVBUILD)
|
||||
|
||||
// Devel builds use __assume for standard assertions and call pxOnAssertDevel
|
||||
// for AssertDev brand assertions (which typically throws a LogicError exception).
|
||||
|
||||
# define pxAssertMsg(cond, msg) (!!(cond))
|
||||
|
||||
# define pxAssertDev(cond, msg) ( ((!!(cond)) || \
|
||||
(pxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg), 0)), !!(cond) )
|
||||
|
||||
# define pxFail(msg) __assume(false)
|
||||
# define pxFailDev(msg ) pxAssertDev(false, msg)
|
||||
|
||||
#else
|
||||
|
||||
// Release Builds just use __assume as an optimization, and always return 'true'
|
||||
// indicating the assertion check succeeded (no actual check is performed).
|
||||
|
||||
# define pxAssertMsg(cond, msg) (__assume(cond), true)
|
||||
# define pxAssertDev(cond, msg) (__assume(cond), true)
|
||||
# define pxFail(msg) (__assume(false), true)
|
||||
# define pxFailDev(msg) (__assume(false), true)
|
||||
|
||||
#endif
|
||||
|
||||
#define pxAssert(cond) pxAssertMsg(cond, (wxChar*)NULL)
|
||||
|
||||
extern void pxOnAssert( const wxChar* file, int line, const char* func, const wxChar* cond, const wxChar* msg);
|
||||
extern void pxOnAssert( const wxChar* file, int line, const char* func, const wxChar* cond, const char* msg);
|
||||
|
|
@ -17,103 +17,99 @@
|
|||
|
||||
#include "StringHelpers.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Console Namespace -- For printing messages to the console.
|
||||
//
|
||||
|
||||
enum ConsoleColors
|
||||
{
|
||||
Color_Black = 0,
|
||||
Color_Red,
|
||||
Color_Green,
|
||||
Color_Yellow,
|
||||
Color_Blue,
|
||||
Color_Magenta,
|
||||
Color_Cyan,
|
||||
Color_White
|
||||
};
|
||||
|
||||
// Use fastcall for the console; should be helpful in most cases
|
||||
#define __concall __fastcall
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// IConsole -- For printing messages to the console.
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// SysPrintf is depreciated; We should phase these in over time.
|
||||
//
|
||||
namespace Console
|
||||
struct IConsoleWriter
|
||||
{
|
||||
enum Colors
|
||||
{
|
||||
Color_Black = 0,
|
||||
Color_Red,
|
||||
Color_Green,
|
||||
Color_Yellow,
|
||||
Color_Blue,
|
||||
Color_Magenta,
|
||||
Color_Cyan,
|
||||
Color_White
|
||||
};
|
||||
// Write implementation for internal use only.
|
||||
void (__concall *DoWrite)( const wxString& fmt );
|
||||
|
||||
// va_args version of WriteLn, mostly for internal use only.
|
||||
extern void __fastcall _WriteLn( Colors color, const char* fmt, va_list args );
|
||||
// WriteLn implementation for internal use only.
|
||||
void (__concall *DoWriteLn)( const wxString& fmt );
|
||||
|
||||
extern void __fastcall SetTitle( const wxString& title );
|
||||
void (__concall *Newline)();
|
||||
|
||||
void (__concall *SetTitle)( const wxString& title );
|
||||
|
||||
// Changes the active console color.
|
||||
// This color will be unset by calls to colored text methods
|
||||
// such as ErrorMsg and Notice.
|
||||
extern void __fastcall SetColor( Colors color );
|
||||
void (__concall *SetColor)( ConsoleColors color );
|
||||
|
||||
// Restores the console color to default (usually low-intensity white on Win32)
|
||||
extern void ClearColor();
|
||||
void (__concall *ClearColor)();
|
||||
|
||||
// The following Write functions return bool so that we can use macros to exclude
|
||||
// them from different build types. The return values are always zero.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Public members; call these to print stuff to console!
|
||||
|
||||
// Writes a newline to the console.
|
||||
extern bool Newline();
|
||||
void Write( ConsoleColors color, const char* fmt, ... ) const;
|
||||
void Write( const char* fmt, ... ) const;
|
||||
void Write( ConsoleColors color, const wxString& fmt ) const;
|
||||
void Write( const wxString& fmt ) const;
|
||||
|
||||
// Writes a line of colored text to the console, with automatic newline appendage.
|
||||
// The console color is reset to default when the operation is complete.
|
||||
extern bool WriteLn( Colors color, const char* fmt, ... );
|
||||
void WriteLn( ConsoleColors color, const char* fmt, ... ) const;
|
||||
void WriteLn( const char* fmt, ... ) const;
|
||||
void WriteLn( ConsoleColors color, const wxString& fmt ) const;
|
||||
void WriteLn( const wxString& fmt ) const;
|
||||
|
||||
// Writes a formatted message to the console, with appended newline.
|
||||
extern bool WriteLn( const char* fmt, ... );
|
||||
void Error( const char* fmt, ... ) const;
|
||||
void Notice( const char* fmt, ... ) const;
|
||||
void Status( const char* fmt, ... ) const;
|
||||
|
||||
// Writes a line of colored text to the console (no newline).
|
||||
// The console color is reset to default when the operation is complete.
|
||||
extern bool Write( Colors color, const char* fmt, ... );
|
||||
void Error( const wxString& src ) const;
|
||||
void Notice( const wxString& src ) const;
|
||||
void Status( const wxString& src ) const;
|
||||
|
||||
// Writes a formatted message to the console (no newline)
|
||||
extern bool Write( const char* fmt, ... );
|
||||
// ----------------------------------------------------------------------------
|
||||
// Private Members; for internal use only.
|
||||
|
||||
// Displays a message in the console with red emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Error( const char* fmt, ... );
|
||||
void _Write( const char* fmt, va_list args ) const;
|
||||
void _WriteLn( const char* fmt, va_list args ) const;
|
||||
void _WriteLn( ConsoleColors color, const char* fmt, va_list args ) const;
|
||||
};
|
||||
|
||||
// Displays a message in the console with yellow emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Notice( const char* fmt, ... );
|
||||
extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL );
|
||||
extern const wxString& ConsoleBuffer_Get();
|
||||
extern void ConsoleBuffer_Clear();
|
||||
extern void ConsoleBuffer_FlushToFile( FILE *fp );
|
||||
|
||||
// Displays a message in the console with yellow emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Status( const char* fmt, ... );
|
||||
extern const IConsoleWriter ConsoleWriter_Null;
|
||||
extern const IConsoleWriter ConsoleWriter_Assert;
|
||||
extern const IConsoleWriter ConsoleWriter_Buffered;
|
||||
extern const IConsoleWriter ConsoleWriter_wxError;
|
||||
|
||||
|
||||
extern bool __fastcall Write( const wxString& text );
|
||||
extern bool __fastcall Write( Colors color, const wxString& text );
|
||||
extern bool __fastcall WriteLn( const wxString& text );
|
||||
extern bool __fastcall WriteLn( Colors color, const wxString& text );
|
||||
|
||||
extern bool __fastcall Error( const wxString& text );
|
||||
extern bool __fastcall Notice( const wxString& text );
|
||||
extern bool __fastcall Status( const wxString& text );
|
||||
}
|
||||
|
||||
using Console::Color_Black;
|
||||
using Console::Color_Red;
|
||||
using Console::Color_Green;
|
||||
using Console::Color_Blue;
|
||||
using Console::Color_Magenta;
|
||||
using Console::Color_Cyan;
|
||||
using Console::Color_Yellow;
|
||||
using Console::Color_White;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DevCon / DbgCon
|
||||
extern IConsoleWriter Console;
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
# define DevCon Console
|
||||
# define DevMsg MsgBox
|
||||
extern IConsoleWriter DevConWriter;
|
||||
# define DevCon DevConWriter
|
||||
#else
|
||||
# define DevCon 0&&Console
|
||||
# define DevMsg
|
||||
# define DevCon ConsoleWriter_Null
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
# define DbgCon Console
|
||||
extern IConsoleWriter DbgConWriter;
|
||||
# define DbgCon DbgConWriter
|
||||
#else
|
||||
# define DbgCon 0&&Console
|
||||
# define DbgCon ConsoleWriter_Null
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// Dependencies.h : Contains classes required by all Utilities headers.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DeclareNoncopyableObject
|
||||
// This macro provides an easy and clean method for ensuring objects are not copyable.
|
||||
|
@ -73,17 +75,15 @@ protected:
|
|||
//
|
||||
#define wxLt(a) (a)
|
||||
|
||||
#ifndef wxASSERT_MSG_A
|
||||
# define wxASSERT_MSG_A( cond, msg ) wxASSERT_MSG( cond, wxString::FromAscii( msg ).c_str() )
|
||||
#endif
|
||||
|
||||
// must include wx/setup.h first, otherwise we get warnings/errors regarding __LINUX__
|
||||
#include <wx/setup.h>
|
||||
|
||||
class wxString;
|
||||
|
||||
#include "Pcsx2Defs.h"
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
//#include <wx/tokenzr.h>
|
||||
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
||||
#include <wx/intl.h>
|
||||
#include <wx/log.h>
|
||||
|
@ -94,3 +94,5 @@ protected:
|
|||
#include <cstring> // string.h under c++
|
||||
#include <cstdio> // stdio.h under c++
|
||||
#include <cstdlib>
|
||||
|
||||
#include "Utilities/Assertions.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "Dependencies.h"
|
||||
|
||||
extern bool DevAssert( bool condition, const char* msg );
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// DESTRUCTOR_CATCHALL - safe destructor helper
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -30,13 +28,13 @@ extern bool DevAssert( bool condition, const char* msg );
|
|||
#define __DESTRUCTOR_CATCHALL( funcname ) \
|
||||
catch( Exception::BaseException& ex ) \
|
||||
{ \
|
||||
Console::Error( "Unhandled BaseException in %s (ignored!):", funcname ); \
|
||||
Console::Error( ex.FormatDiagnosticMessage() ); \
|
||||
Console.Error( "Unhandled BaseException in %s (ignored!):", funcname ); \
|
||||
Console.Error( ex.FormatDiagnosticMessage() ); \
|
||||
} \
|
||||
catch( std::exception& ex ) \
|
||||
{ \
|
||||
Console::Error( "Unhandled std::exception in %s (ignored!):", funcname ); \
|
||||
Console::Error( ex.what() ); \
|
||||
Console.Error( "Unhandled std::exception in %s (ignored!):", funcname ); \
|
||||
Console.Error( ex.what() ); \
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -15,6 +15,31 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// RecursionGuard - Basic protection against function recursion
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Thread safety note: If used in a threaded environment, you shoud use a handle to a __threadlocal
|
||||
// storage variable (protects aaginst race conditions and, in *most* cases, is more desirable
|
||||
// behavior as well.
|
||||
//
|
||||
// Rationale: wxWidgets has its own wxRecursionGuard, but it has a sloppy implementation with
|
||||
// entirely unnecessary assertion checks.
|
||||
//
|
||||
class RecursionGuard
|
||||
{
|
||||
public:
|
||||
int& Counter;
|
||||
|
||||
RecursionGuard( int& counter ) : Counter( counter )
|
||||
{ ++Counter; }
|
||||
|
||||
virtual ~RecursionGuard() throw()
|
||||
{ --Counter; }
|
||||
|
||||
bool IsReentrant() const { return Counter > 1; }
|
||||
};
|
||||
|
||||
|
||||
enum PageProtectionMode
|
||||
{
|
||||
Protect_NoAccess = 0,
|
||||
|
|
|
@ -15,13 +15,48 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Dependencies.h"
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for wxWidgets stuff!
|
||||
//
|
||||
extern void px_fputs( FILE* fp, const char* src );
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// toUTF8 - shortcut for str.ToUTF8().data()
|
||||
// --------------------------------------------------------------------------------------
|
||||
class toUTF8
|
||||
{
|
||||
DeclareNoncopyableObject( toUTF8 );
|
||||
|
||||
protected:
|
||||
wxCharBuffer m_charbuffer;
|
||||
|
||||
public:
|
||||
toUTF8( const wxString& str ) : m_charbuffer( str.ToUTF8().data() ) { }
|
||||
virtual ~toUTF8() throw() {}
|
||||
|
||||
operator const char*() { return m_charbuffer.data(); }
|
||||
};
|
||||
|
||||
// This class provided for completeness sake. You probably should use toUTF8 instead.
|
||||
class toAscii
|
||||
{
|
||||
DeclareNoncopyableObject( toAscii );
|
||||
|
||||
protected:
|
||||
wxCharBuffer m_charbuffer;
|
||||
|
||||
public:
|
||||
toAscii( const wxString& str ) : m_charbuffer( str.ToAscii().data() ) { }
|
||||
virtual ~toAscii() throw() {}
|
||||
|
||||
operator const char*() { return m_charbuffer.data(); }
|
||||
};
|
||||
|
||||
extern wxString fromUTF8( const char* src );
|
||||
extern wxString fromAscii( const char* src );
|
||||
|
||||
// wxWidgets lacks one of its own...
|
||||
extern const wxRect wxDefaultRect;
|
||||
|
|
|
@ -120,25 +120,33 @@ namespace Threading
|
|||
|
||||
virtual bool IsSelf() const { return false; }
|
||||
virtual bool IsRunning() { return false; }
|
||||
virtual int GetReturnCode() const
|
||||
{
|
||||
DevAssert( false, "Cannot obtain a return code from a placebo thread." );
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void Start() {}
|
||||
virtual void Cancel( bool isBlocking = true ) {}
|
||||
virtual sptr Block() { return NULL; }
|
||||
virtual void Block() {}
|
||||
virtual bool Detach() { return false; }
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// PersistentThread - Helper class for the basics of starting/managing persistent threads.
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Use this as a base class for your threaded procedure, and implement the 'int ExecuteTask()'
|
||||
// method. Use Start() and Cancel() to start and shutdown the thread, and use m_sem_event
|
||||
// internally to post/receive events for the thread (make a public accessor for it in your
|
||||
// derived class if your thread utilizes the post).
|
||||
// This class is meant to be a helper for the typical threading model of "start once and
|
||||
// reuse many times." This class incorporates a lot of extra overhead in stopping and
|
||||
// starting threads, but in turn provides most of the basic thread-safety and event-handling
|
||||
// functionality needed for a threaded operation. In practice this model is usually an
|
||||
// ideal one for efficiency since Operating Systems themselves typically subscribe to a
|
||||
// design where sleeping, suspending, and resuming threads is very efficient, but starting
|
||||
// new threads has quite a bit of overhead.
|
||||
//
|
||||
// To use this as a base class for your threaded procedure, overload the following virtual
|
||||
// methods:
|
||||
// void OnStart();
|
||||
// void ExecuteTask();
|
||||
// void OnThreadCleanup();
|
||||
//
|
||||
// Use the public methods Start() and Cancel() to start and shutdown the thread, and use
|
||||
// m_sem_event internally to post/receive events for the thread (make a public accessor for
|
||||
// it in your derived class if your thread utilizes the post).
|
||||
//
|
||||
// Notes:
|
||||
// * Constructing threads as static global vars isn't recommended since it can potentially
|
||||
|
@ -159,7 +167,6 @@ namespace Threading
|
|||
Semaphore m_sem_event; // general wait event that's needed by most threads.
|
||||
Semaphore m_sem_finished; // used for canceling and closing threads in a deadlock-safe manner
|
||||
MutexLock m_lock_start; // used to lock the Start() code from starting simutaneous threads accidentally.
|
||||
sptr m_returncode; // value returned from the thread on close.
|
||||
|
||||
volatile long m_detached; // a boolean value which indicates if the m_thread handle is valid
|
||||
volatile long m_running; // set true by Start(), and set false by Cancel(), Block(), etc.
|
||||
|
@ -176,18 +183,23 @@ namespace Threading
|
|||
virtual void Start();
|
||||
virtual void Cancel( bool isBlocking = true );
|
||||
virtual bool Detach();
|
||||
virtual sptr Block();
|
||||
|
||||
virtual int GetReturnCode() const;
|
||||
virtual void Block();
|
||||
virtual void RethrowException() const;
|
||||
|
||||
bool IsRunning() const;
|
||||
bool IsSelf() const;
|
||||
wxString GetName() const;
|
||||
|
||||
virtual void DoThreadCleanup();
|
||||
void _ThreadCleanup();
|
||||
|
||||
protected:
|
||||
|
||||
// Extending classes should always implement your own OnStart(), which is called by
|
||||
// Start() once necessary locks have been obtained. Do not override Start() directly
|
||||
// unless you're really sure that's what you need to do. ;)
|
||||
virtual void OnStart()=0;
|
||||
virtual void OnThreadCleanup()=0;
|
||||
|
||||
void DoSetThreadName( const wxString& name );
|
||||
void DoSetThreadName( __unused const char* name );
|
||||
void _internal_execute();
|
||||
|
@ -198,7 +210,7 @@ namespace Threading
|
|||
static void* _internal_callback( void* func );
|
||||
|
||||
// Implemented by derived class to handle threading actions!
|
||||
virtual sptr ExecuteTask()=0;
|
||||
virtual void ExecuteTask()=0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -295,7 +307,7 @@ namespace Threading
|
|||
{
|
||||
}
|
||||
|
||||
sptr Block();
|
||||
void Block();
|
||||
void PostTask();
|
||||
void WaitForResult();
|
||||
|
||||
|
@ -304,7 +316,7 @@ namespace Threading
|
|||
// all your necessary processing work here.
|
||||
virtual void Task()=0;
|
||||
|
||||
sptr ExecuteTask();
|
||||
virtual void ExecuteTask();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -55,36 +55,3 @@ public:
|
|||
wxLog::EnableLogging( m_prev );
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// wxToUTF8 - shortcut for str.ToUTF8().data()
|
||||
// --------------------------------------------------------------------------------------
|
||||
class wxToUTF8
|
||||
{
|
||||
DeclareNoncopyableObject( wxToUTF8 );
|
||||
|
||||
protected:
|
||||
wxCharBuffer m_charbuffer;
|
||||
|
||||
public:
|
||||
wxToUTF8( const wxString& str ) : m_charbuffer( str.ToUTF8().data() ) { }
|
||||
virtual ~wxToUTF8() throw() {}
|
||||
|
||||
operator const char*() { return m_charbuffer.data(); }
|
||||
};
|
||||
|
||||
// This class provided for completeness sake. You probably should use ToUTF8 instead.
|
||||
class wxToAscii
|
||||
{
|
||||
DeclareNoncopyableObject( wxToAscii );
|
||||
|
||||
protected:
|
||||
wxCharBuffer m_charbuffer;
|
||||
|
||||
public:
|
||||
wxToAscii( const wxString& str ) : m_charbuffer( str.ToAscii().data() ) { }
|
||||
virtual ~wxToAscii() throw() {}
|
||||
|
||||
operator const char*() { return m_charbuffer.data(); }
|
||||
};
|
||||
|
||||
|
|
|
@ -11,3 +11,7 @@ folder prefix, these files can be included the same way as other wxWidgets inclu
|
|||
|
||||
If/when PCSX2 upgrades to wx2.9/3.0 these files will be removed and the wxWidgets
|
||||
distribution files will automatically be used instead.
|
||||
|
||||
|
||||
NOTE: Removed wxScopedPtr in favor of our own implementation, which uses a more
|
||||
sensible API naming convention and also features better operator assignment.
|
|
@ -203,7 +203,7 @@ namespace x86Emitter
|
|||
Factor++;
|
||||
else
|
||||
{
|
||||
DevAssert( Index.IsEmpty(), "x86Emitter: Only one scaled index register is allowed in an address modifier." );
|
||||
pxAssertDev( Index.IsEmpty(), "x86Emitter: Only one scaled index register is allowed in an address modifier." );
|
||||
Index = src;
|
||||
Factor = 2;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ namespace x86Emitter
|
|||
// Don't ask. --arcum42
|
||||
#if !defined(__LINUX__) || !defined(DEBUG)
|
||||
|
||||
Console::Error( "Emitter Error: Invalid short jump displacement = 0x%x", (int)displacement );
|
||||
Console.Error( "Emitter Error: Invalid short jump displacement = 0x%x", (int)displacement );
|
||||
#endif
|
||||
}
|
||||
BasePtr[-1] = (s8)displacement;
|
||||
|
|
|
@ -19,138 +19,301 @@
|
|||
using namespace Threading;
|
||||
using namespace std;
|
||||
|
||||
namespace Console
|
||||
// Important! Only Assert and Null console loggers are allowed for initial console targeting.
|
||||
// Other log targets rely on the static buffer and a threaded mutex lock, which are only valid
|
||||
// after C++ initialization has finished.
|
||||
void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp )
|
||||
{
|
||||
MutexLock m_writelock;
|
||||
pxAssertDev(
|
||||
(writer.DoWrite != NULL) && (writer.DoWriteLn != NULL) &&
|
||||
(writer.Newline != NULL) && (writer.SetTitle != NULL) &&
|
||||
(writer.SetColor != NULL) && (writer.ClearColor != NULL),
|
||||
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented."
|
||||
);
|
||||
|
||||
if( !ConsoleBuffer_Get().IsEmpty() )
|
||||
writer.DoWriteLn( ConsoleBuffer_Get() );
|
||||
|
||||
bool __fastcall Write( Colors color, const wxString& fmt )
|
||||
{
|
||||
SetColor( color );
|
||||
Write( fmt );
|
||||
ClearColor();
|
||||
Console = writer;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall WriteLn( Colors color, const wxString& fmt )
|
||||
{
|
||||
SetColor( color );
|
||||
WriteLn( fmt );
|
||||
ClearColor();
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
__forceinline void __fastcall _Write( const char* fmt, va_list args )
|
||||
{
|
||||
std::string m_format_buffer;
|
||||
vssprintf( m_format_buffer, fmt, args );
|
||||
Write( wxString::FromUTF8( m_format_buffer.c_str() ) );
|
||||
}
|
||||
|
||||
__forceinline void __fastcall _WriteLn( const char* fmt, va_list args )
|
||||
{
|
||||
std::string m_format_buffer;
|
||||
vssprintf( m_format_buffer, fmt, args );
|
||||
WriteLn( wxString::FromUTF8( m_format_buffer.c_str() ) );
|
||||
}
|
||||
|
||||
__forceinline void __fastcall _WriteLn( Colors color, const char* fmt, va_list args )
|
||||
{
|
||||
SetColor( color );
|
||||
_WriteLn( fmt, args );
|
||||
ClearColor();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool Write( const char* fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_Write( fmt, args );
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Write( Colors color, const char* fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
SetColor( color );
|
||||
_Write( fmt, args );
|
||||
ClearColor();
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool WriteLn( const char* fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( fmt, args );
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WriteLn( Colors color, const char* fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( color, fmt, args );
|
||||
va_end(args);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool Error( const char* fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( Color_Red, fmt, args );
|
||||
va_end(args);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Notice( const char* fmt, ... )
|
||||
{
|
||||
va_list list;
|
||||
va_start(list,fmt);
|
||||
_WriteLn( Color_Yellow, fmt, list );
|
||||
va_end(list);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Status( const char* fmt, ... )
|
||||
{
|
||||
va_list list;
|
||||
va_start(list,fmt);
|
||||
_WriteLn( Color_Green, fmt, list );
|
||||
va_end(list);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool __fastcall Error( const wxString& src )
|
||||
{
|
||||
WriteLn( Color_Red, src );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall Notice( const wxString& src )
|
||||
{
|
||||
WriteLn( Color_Yellow, src );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall Status( const wxString& src )
|
||||
{
|
||||
WriteLn( Color_Green, src );
|
||||
return false;
|
||||
}
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
DevCon = writer;
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
DbgCon = writer;
|
||||
#endif
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleImpl_Null
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void __concall ConsoleNull_SetTitle( const wxString& title ) {}
|
||||
static void __concall ConsoleNull_SetColor( ConsoleColors color ) {}
|
||||
static void __concall ConsoleNull_ClearColor() {}
|
||||
static void __concall ConsoleNull_Newline() {}
|
||||
static void __concall ConsoleNull_DoWrite( const wxString& fmt ) {}
|
||||
static void __concall ConsoleNull_DoWriteLn( const wxString& fmt ) {}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleImpl_Assert
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void __concall ConsoleAssert_DoWrite( const wxString& fmt )
|
||||
{
|
||||
pxFail( L"Console class has not been initialized; Message written:\n\t" + fmt );
|
||||
}
|
||||
|
||||
static void __concall ConsoleAssert_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
pxFail( L"Console class has not been initialized; Message written:\n\t" + fmt );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleImpl_Buffered Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static wxString m_buffer;
|
||||
|
||||
const wxString& ConsoleBuffer_Get()
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void ConsoleBuffer_Clear()
|
||||
{
|
||||
m_buffer.Clear();
|
||||
}
|
||||
|
||||
void ConsoleBuffer_FlushToFile( FILE *fp )
|
||||
{
|
||||
if( fp == NULL || m_buffer.IsEmpty() ) return;
|
||||
px_fputs( fp, toUTF8(m_buffer) );
|
||||
m_buffer.Clear();
|
||||
}
|
||||
|
||||
static void __concall ConsoleBuffer_DoWrite( const wxString& fmt )
|
||||
{
|
||||
m_buffer += fmt;
|
||||
}
|
||||
|
||||
static void __concall ConsoleBuffer_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
m_buffer += fmt + L"\n";
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleImpl_wxLogError Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void __concall Console_wxLogError_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
if( !m_buffer.IsEmpty() )
|
||||
{
|
||||
wxLogError( m_buffer );
|
||||
m_buffer.Clear();
|
||||
}
|
||||
wxLogError( fmt );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// IConsole Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
// Default write action at startup and shutdown is to use the stdout.
|
||||
void IConsole_DoWrite( const wxString& fmt )
|
||||
{
|
||||
wxPrintf( fmt );
|
||||
}
|
||||
|
||||
// Default write action at startup and shutdown is to use the stdout.
|
||||
void IConsole_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
wxPrintf( fmt );
|
||||
}
|
||||
|
||||
// Writes a line of colored text to the console (no newline).
|
||||
// The console color is reset to default when the operation is complete.
|
||||
void IConsoleWriter::Write( ConsoleColors color, const wxString& fmt ) const
|
||||
{
|
||||
SetColor( color );
|
||||
Write( fmt );
|
||||
ClearColor();
|
||||
}
|
||||
|
||||
// Writes a line of colored text to the console, with automatic newline appendage.
|
||||
// The console color is reset to default when the operation is complete.
|
||||
void IConsoleWriter::WriteLn( ConsoleColors color, const wxString& fmt ) const
|
||||
{
|
||||
SetColor( color );
|
||||
WriteLn( fmt );
|
||||
ClearColor();
|
||||
}
|
||||
|
||||
void IConsoleWriter::_Write( const char* fmt, va_list args ) const
|
||||
{
|
||||
std::string m_format_buffer;
|
||||
vssprintf( m_format_buffer, fmt, args );
|
||||
Write( wxString::FromUTF8( m_format_buffer.c_str() ) );
|
||||
}
|
||||
|
||||
void IConsoleWriter::_WriteLn( const char* fmt, va_list args ) const
|
||||
{
|
||||
std::string m_format_buffer;
|
||||
vssprintf( m_format_buffer, fmt, args );
|
||||
WriteLn( wxString::FromUTF8( m_format_buffer.c_str() ) );
|
||||
}
|
||||
|
||||
void IConsoleWriter::_WriteLn( ConsoleColors color, const char* fmt, va_list args ) const
|
||||
{
|
||||
SetColor( color );
|
||||
_WriteLn( fmt, args );
|
||||
ClearColor();
|
||||
}
|
||||
|
||||
void IConsoleWriter::Write( const char* fmt, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_Write( fmt, args );
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void IConsoleWriter::Write( ConsoleColors color, const char* fmt, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
SetColor( color );
|
||||
_Write( fmt, args );
|
||||
ClearColor();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void IConsoleWriter::WriteLn( const char* fmt, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( fmt, args );
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( color, fmt, args );
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void IConsoleWriter::Write( const wxString& src ) const
|
||||
{
|
||||
DoWrite( src );
|
||||
}
|
||||
|
||||
void IConsoleWriter::WriteLn( const wxString& src ) const
|
||||
{
|
||||
DoWriteLn( src );
|
||||
}
|
||||
|
||||
void IConsoleWriter::Error( const char* fmt, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
_WriteLn( Color_Red, fmt, args );
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void IConsoleWriter::Notice( const char* fmt, ... ) const
|
||||
{
|
||||
va_list list;
|
||||
va_start(list,fmt);
|
||||
_WriteLn( Color_Yellow, fmt, list );
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void IConsoleWriter::Status( const char* fmt, ... ) const
|
||||
{
|
||||
va_list list;
|
||||
va_start(list,fmt);
|
||||
_WriteLn( Color_Green, fmt, list );
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void IConsoleWriter::Error( const wxString& src ) const
|
||||
{
|
||||
WriteLn( Color_Red, src );
|
||||
}
|
||||
|
||||
void IConsoleWriter::Notice( const wxString& src ) const
|
||||
{
|
||||
WriteLn( Color_Yellow, src );
|
||||
}
|
||||
|
||||
void IConsoleWriter::Status( const wxString& src ) const
|
||||
{
|
||||
WriteLn( Color_Green, src );
|
||||
}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Null =
|
||||
{
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_DoWriteLn,
|
||||
|
||||
ConsoleNull_Newline,
|
||||
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_SetColor,
|
||||
ConsoleNull_ClearColor,
|
||||
};
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Assert =
|
||||
{
|
||||
ConsoleAssert_DoWrite,
|
||||
ConsoleAssert_DoWriteLn,
|
||||
|
||||
ConsoleNull_Newline,
|
||||
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_SetColor,
|
||||
ConsoleNull_ClearColor,
|
||||
};
|
||||
|
||||
const IConsoleWriter ConsoleWriter_wxError =
|
||||
{
|
||||
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
||||
Console_wxLogError_DoWriteLn,
|
||||
|
||||
ConsoleNull_Newline,
|
||||
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_SetColor,
|
||||
ConsoleNull_ClearColor,
|
||||
};
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Buffered =
|
||||
{
|
||||
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid assertion spam.
|
||||
ConsoleBuffer_DoWriteLn,
|
||||
|
||||
ConsoleNull_Newline,
|
||||
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_SetColor,
|
||||
ConsoleNull_ClearColor,
|
||||
};
|
||||
|
||||
|
||||
// Important! Only Assert and Null console loggers are allowed for initial console targeting.
|
||||
// Other log targets rely on the static buffer and a threaded mutex lock, which are only valid
|
||||
// after C++ initialization has finished.
|
||||
|
||||
IConsoleWriter Console = ConsoleWriter_Assert;
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
IConsoleWriter DevConWriter= ConsoleWriter_Assert;
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
IConsoleWriter DbgConWriter= ConsoleWriter_Assert;
|
||||
#endif
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include <wx/app.h>
|
||||
|
||||
wxString GetEnglish( const char* msg )
|
||||
{
|
||||
return wxString::FromAscii(msg);
|
||||
|
@ -26,11 +28,9 @@ wxString GetTranslation( const char* msg )
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Force DevAssert to *not* inline for devel/debug builds (allows using breakpoints to trap
|
||||
// assertions), and force it to inline for release builds (optimizes it out completely since
|
||||
// IsDevBuild is false). Since Devel builds typically aren't enabled with Global Optimization/
|
||||
// LTCG, this currently isn't even necessary. But might as well, in case we decide at a later
|
||||
// date to re-enable LTCG for devel.
|
||||
// Force DevAssert to *not* inline for devel builds (allows using breakpoints to trap assertions,
|
||||
// and force it to inline for release builds (optimizes it out completely since IsDevBuild is a
|
||||
// const false).
|
||||
//
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
# define DEVASSERT_INLINE __noinline
|
||||
|
@ -38,37 +38,44 @@ wxString GetTranslation( const char* msg )
|
|||
# define DEVASSERT_INLINE __forceinline
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Assertion tool for Devel builds, intended for sanity checking and/or bounds checking
|
||||
// variables in areas which are not performance critical.
|
||||
//
|
||||
// How it works: This function throws an exception of type Exception::AssertionFailure if
|
||||
// the assertion conditional is false. Typically for the end-user, this exception is handled
|
||||
// by the general handler, which (should eventually) create some state dumps and other
|
||||
// information for troubleshooting purposes.
|
||||
//
|
||||
// From a debugging environment, you can trap your DevAssert by either breakpointing the
|
||||
// exception throw below, or by adding Exception::LogicError to your First-Chance Exception
|
||||
// catch list (Visual Studio, under the Debug->Exceptions menu/dialog). You should have
|
||||
// LogicErrors enabled as First-Chance exceptions regardless, so do it now. :)
|
||||
//
|
||||
// Returns:
|
||||
// TRUE if the assertion succeeded (condition is valid), or FALSE if the assertion
|
||||
// failed. The true clause is only reachable in release builds, and can be used by code
|
||||
// to provide a "stable" escape clause for unexpected behavior.
|
||||
//
|
||||
DEVASSERT_INLINE bool DevAssert( bool condition, const char* msg )
|
||||
// Using a threadlocal assertion guard. Separate threads can assert at the same time.
|
||||
// That's ok. What we don't want is the *same* thread recurse-asserting.
|
||||
static __threadlocal int s_assert_guard = 0;
|
||||
|
||||
DEVASSERT_INLINE void pxOnAssert( const wxChar* file, int line, const char* func, const wxChar* cond, const wxChar* msg)
|
||||
{
|
||||
if( condition ) return true;
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
RecursionGuard guard( s_assert_guard );
|
||||
if( guard.IsReentrant() ) return;
|
||||
|
||||
if( wxTheApp == NULL )
|
||||
{
|
||||
// Note: Format uses MSVC's syntax for output window hotlinking.
|
||||
wxsFormat( L"%s(%d): Assertion failed in %s: %s\n",
|
||||
file, line, fromUTF8(func), msg );
|
||||
|
||||
wxASSERT_MSG_A( false, msg );
|
||||
|
||||
if( IsDevBuild && !IsDebugBuild )
|
||||
throw Exception::LogicError( msg );
|
||||
|
||||
return false;
|
||||
wxLogError( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxTheApp->OnAssertFailure( file, line, fromUTF8(func), cond, msg );
|
||||
#elif wxUSE_GUI
|
||||
// FIXME: this should create a popup dialog for devel builds.
|
||||
wxLogError( msg );
|
||||
#else
|
||||
wxLogError( msg );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__forceinline void pxOnAssert( const wxChar* file, int line, const char* func, const wxChar* cond, const char* msg)
|
||||
{
|
||||
pxOnAssert( file, line, func, cond, fromUTF8(msg) );
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Exception Namespace Implementations (Format message handlers for general exceptions)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -87,7 +94,7 @@ void Exception::BaseException::InitBaseEx( const wxString& msg_eng, const wxStri
|
|||
|
||||
#ifdef __LINUX__
|
||||
//wxLogError( msg_eng.c_str() );
|
||||
Console::Error( msg_eng );
|
||||
Console.Error( msg_eng );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -100,7 +107,7 @@ void Exception::BaseException::InitBaseEx( const char* msg_eng )
|
|||
|
||||
#ifdef __LINUX__
|
||||
//wxLogError( m_message_diag.c_str() );
|
||||
Console::Error( msg_eng );
|
||||
Console.Error( msg_eng );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace HostSys
|
|||
{
|
||||
u8 *Mem;
|
||||
Mem = (u8*)mmap((uptr*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
||||
if (Mem == MAP_FAILED) Console::Notice("Mmap Failed!");
|
||||
if (Mem == MAP_FAILED) Console.Notice("Mmap Failed!");
|
||||
|
||||
return Mem;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using std::string;
|
|||
using std::min;
|
||||
using std::max;
|
||||
|
||||
#include "Assertions.h"
|
||||
#include "MemcpyFast.h"
|
||||
#include "Console.h"
|
||||
#include "Exceptions.h"
|
||||
|
|
|
@ -17,6 +17,17 @@
|
|||
|
||||
const wxRect wxDefaultRect( wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord );
|
||||
|
||||
|
||||
__forceinline wxString fromUTF8( const char* src )
|
||||
{
|
||||
return wxString::FromUTF8( src );
|
||||
}
|
||||
|
||||
__forceinline wxString fromAscii( const char* src )
|
||||
{
|
||||
return wxString::FromAscii( src );
|
||||
}
|
||||
|
||||
// Splits a string into parts and adds the parts into the given SafeList.
|
||||
// This list is not cleared, so concatenating many splits into a single large list is
|
||||
// the 'default' behavior, unless you manually clear the SafeList prior to subsequent calls.
|
||||
|
@ -160,3 +171,49 @@ bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval, const wx
|
|||
dest = wxRect( point, size );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Performs a cross-platform puts operation, which adds CRs to naked LFs on Win32 platforms,
|
||||
// so that Notepad won't throw a fit and Rama can read the logs again! On Unix and Mac platforms,
|
||||
// the input string is written unmodified.
|
||||
//
|
||||
// PCSX2 generally uses Unix-style newlines -- LF (\n) only -- hence there's no need to strip CRs
|
||||
// from incoming data. Mac platforms may need an implementation of their own that converts
|
||||
// newlines to CRs...?
|
||||
//
|
||||
void px_fputs( FILE* fp, const char* src )
|
||||
{
|
||||
if( fp == NULL ) return;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows needs CR's partnered with all newlines, or else notepad.exe can't view
|
||||
// the stupid logfile. Best way is to write one char at a time.. >_<
|
||||
|
||||
const char* curchar = src;
|
||||
bool prevcr = false;
|
||||
while( *curchar != 0 )
|
||||
{
|
||||
if( *curchar == '\r' )
|
||||
{
|
||||
prevcr = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only write a CR/LF pair if the current LF is not prefixed nor
|
||||
// post-fixed by a CR.
|
||||
if( *curchar == '\n' && !prevcr && (*(curchar+1) != '\r') )
|
||||
fputs( "\r\n", fp );
|
||||
else
|
||||
fputc( *curchar, fp );
|
||||
|
||||
prevcr = false;
|
||||
}
|
||||
++curchar;
|
||||
}
|
||||
|
||||
#else
|
||||
// Linux is happy with plain old LFs. Not sure about Macs... does OSX still
|
||||
// go by the old school Mac style of using Crs only?
|
||||
|
||||
fputs( src, emuLog ); // fputs does not do automatic newlines, so it's ok!
|
||||
#endif
|
||||
}
|
|
@ -34,7 +34,7 @@ namespace Threading
|
|||
|
||||
static void _pt_callback_cleanup( void* handle )
|
||||
{
|
||||
((PersistentThread*)handle)->DoThreadCleanup();
|
||||
((PersistentThread*)handle)->_ThreadCleanup();
|
||||
}
|
||||
|
||||
PersistentThread::PersistentThread() :
|
||||
|
@ -43,39 +43,60 @@ namespace Threading
|
|||
, m_sem_event()
|
||||
, m_sem_finished()
|
||||
, m_lock_start( true ) // recursive mutexing!
|
||||
, m_returncode( 0 )
|
||||
, m_detached( true ) // start out with m_thread in detached/invalid state
|
||||
, m_running( false )
|
||||
{
|
||||
}
|
||||
|
||||
// This destructor performs basic "last chance" cleanup, which is a blocking
|
||||
// join against non-detached threads. Detached threads are unhandled.
|
||||
// Extending classes should always implement their own thread closure process.
|
||||
// This class must not be deleted from its own thread. That would be like marrying
|
||||
// your sister, and then cheating on her with your daughter.
|
||||
// This destructor performs basic "last chance" cleanup, which is a blocking join
|
||||
// against the thread. Extending classes should almost always implement their own
|
||||
// thread closure process, since any PersistentThread will, by design, not terminate
|
||||
// unless it has been properly canceled.
|
||||
//
|
||||
// Thread safetly: This class must not be deleted from its own thread. That would be
|
||||
// like marrying your sister, and then cheating on her with your daughter.
|
||||
PersistentThread::~PersistentThread() throw()
|
||||
{
|
||||
if( m_running )
|
||||
try
|
||||
{
|
||||
#if wxUSE_GUI
|
||||
m_sem_finished.WaitGui();
|
||||
#else
|
||||
m_sem_finished.Wait();
|
||||
#endif
|
||||
}
|
||||
wxString logfix = L"Thread Destructor for " + m_name;
|
||||
|
||||
Detach();
|
||||
if( m_running )
|
||||
{
|
||||
Console.WriteLn( logfix + L": Waiting for running thread to end.");
|
||||
#if wxUSE_GUI
|
||||
m_sem_finished.WaitGui();
|
||||
#else
|
||||
m_sem_finished.Wait();
|
||||
#endif
|
||||
// Need to lock here so that the thread can finish shutting down before
|
||||
// it gets destroyed, otherwise th mutex handle would become invalid.
|
||||
ScopedLock locker( m_lock_start );
|
||||
}
|
||||
else
|
||||
Console.WriteLn( logfix + L": thread not running.");
|
||||
Sleep( 1 );
|
||||
Detach();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
// Main entry point for starting or e-starting a persistent thread. This function performs necessary
|
||||
// locks and checks for avoiding race conditions, and then calls OnStart() immeediately before
|
||||
// the actual thread creation. Extending classes should generally not override Start(), and should
|
||||
// instead override DoPrepStart instead.
|
||||
//
|
||||
// This function should not be called from the owner thread.
|
||||
void PersistentThread::Start()
|
||||
{
|
||||
ScopedLock startlock( m_lock_start ); // Prevents sudden parallel startup
|
||||
if( m_running ) return;
|
||||
|
||||
Detach(); // clean up previous thread, if one exists.
|
||||
Detach(); // clean up previous thread handle, if one exists.
|
||||
m_sem_finished.Reset();
|
||||
|
||||
OnStart();
|
||||
|
||||
if( pthread_create( &m_thread, NULL, _internal_callback, this ) != 0 )
|
||||
throw Exception::ThreadCreationError();
|
||||
|
||||
|
@ -108,11 +129,12 @@ namespace Threading
|
|||
void PersistentThread::Cancel( bool isBlocking )
|
||||
{
|
||||
wxASSERT( !IsSelf() );
|
||||
if( !m_running ) return;
|
||||
|
||||
if( !m_running ) return;
|
||||
|
||||
if( m_detached )
|
||||
{
|
||||
Console::Notice( "Threading Warning: Attempted to cancel detached thread; Ignoring..." );
|
||||
Console.Notice( "Threading Warning: Attempted to cancel detached thread; Ignoring..." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,9 +158,9 @@ namespace Threading
|
|||
// Returns the return code of the thread.
|
||||
// This method is roughly the equivalent of pthread_join().
|
||||
//
|
||||
sptr PersistentThread::Block()
|
||||
void PersistentThread::Block()
|
||||
{
|
||||
DevAssert( !IsSelf(), "Thread deadlock detected; Block() should never be called by the owner thread." );
|
||||
pxAssertDev( !IsSelf(), "Thread deadlock detected; Block() should never be called by the owner thread." );
|
||||
|
||||
if( m_running )
|
||||
#if wxUSE_GUI
|
||||
|
@ -146,7 +168,6 @@ namespace Threading
|
|||
#else
|
||||
m_sem_finished.Wait();
|
||||
#endif
|
||||
return m_returncode;
|
||||
}
|
||||
|
||||
bool PersistentThread::IsSelf() const
|
||||
|
@ -159,18 +180,6 @@ namespace Threading
|
|||
return !!m_running;
|
||||
}
|
||||
|
||||
// Gets the return code of the thread.
|
||||
// Exceptions:
|
||||
// InvalidOperation - thrown if the thread is still running or has never been started.
|
||||
//
|
||||
sptr PersistentThread::GetReturnCode() const
|
||||
{
|
||||
if( IsRunning() )
|
||||
throw Exception::InvalidOperation( "Thread.GetReturnCode : thread is still running." );
|
||||
|
||||
return m_returncode;
|
||||
}
|
||||
|
||||
// Throws an exception if the thread encountered one. Uses the BaseException's Rethrow() method,
|
||||
// which ensures the exception type remains consistent. Debuggable stacktraces will be lost, since
|
||||
// the thread will have allowed itself to terminate properly.
|
||||
|
@ -180,10 +189,19 @@ namespace Threading
|
|||
m_except->Rethrow();
|
||||
}
|
||||
|
||||
// invoked when canceling or exiting the thread.
|
||||
void PersistentThread::DoThreadCleanup()
|
||||
// invoked internally when canceling or exiting the thread. Extending classes should implement
|
||||
// OnThreadCleanup() to extend clenup functionality.
|
||||
void PersistentThread::_ThreadCleanup()
|
||||
{
|
||||
wxASSERT( IsSelf() ); // only allowed from our own thread, thanks.
|
||||
|
||||
// Typically thread cleanup needs to lock against thread startup, since both
|
||||
// will perform some measure of variable inits or resets, depending on how the
|
||||
// derrived class is implemented.
|
||||
ScopedLock startlock( m_lock_start );
|
||||
|
||||
OnThreadCleanup();
|
||||
|
||||
m_running = false;
|
||||
m_sem_finished.Post();
|
||||
}
|
||||
|
@ -199,7 +217,7 @@ namespace Threading
|
|||
DoSetThreadName( m_name );
|
||||
|
||||
try {
|
||||
m_returncode = ExecuteTask();
|
||||
ExecuteTask();
|
||||
}
|
||||
catch( std::logic_error& ex )
|
||||
{
|
||||
|
@ -233,6 +251,9 @@ namespace Threading
|
|||
}
|
||||
}
|
||||
|
||||
void PersistentThread::OnStart() {}
|
||||
void PersistentThread::OnThreadCleanup() {}
|
||||
|
||||
void* PersistentThread::_internal_callback( void* itsme )
|
||||
{
|
||||
jASSUME( itsme != NULL );
|
||||
|
@ -241,12 +262,12 @@ namespace Threading
|
|||
pthread_cleanup_push( _pt_callback_cleanup, itsme );
|
||||
owner._internal_execute();
|
||||
pthread_cleanup_pop( true );
|
||||
return (void*)owner.m_returncode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PersistentThread::DoSetThreadName( const wxString& name )
|
||||
{
|
||||
DoSetThreadName( wxToUTF8(name) );
|
||||
DoSetThreadName( toUTF8(name) );
|
||||
}
|
||||
|
||||
void PersistentThread::DoSetThreadName( __unused const char* name )
|
||||
|
@ -292,12 +313,12 @@ namespace Threading
|
|||
// --------------------------------------------------------------------------------------
|
||||
|
||||
// Tells the thread to exit and then waits for thread termination.
|
||||
sptr BaseTaskThread::Block()
|
||||
void BaseTaskThread::Block()
|
||||
{
|
||||
if( !IsRunning() ) return m_returncode;
|
||||
if( !IsRunning() ) return;
|
||||
m_Done = true;
|
||||
m_sem_event.Post();
|
||||
return PersistentThread::Block();
|
||||
PersistentThread::Block();
|
||||
}
|
||||
|
||||
// Initiates the new task. This should be called after your own StartTask has
|
||||
|
@ -326,7 +347,7 @@ namespace Threading
|
|||
m_post_TaskComplete.Reset();
|
||||
}
|
||||
|
||||
sptr BaseTaskThread::ExecuteTask()
|
||||
void BaseTaskThread::ExecuteTask()
|
||||
{
|
||||
while( !m_Done )
|
||||
{
|
||||
|
@ -340,7 +361,7 @@ namespace Threading
|
|||
m_lock_TaskComplete.Unlock();
|
||||
};
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../PrecompiledHeader.h"
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Utilities/RedtapeWindows.h"
|
||||
#include <winnt.h>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../PrecompiledHeader.h"
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "RedtapeWindows.h"
|
||||
#include "WinVersion.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../PrecompiledHeader.h"
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "RedtapeWindows.h"
|
||||
#include "x86emitter/tools.h"
|
||||
#include "Threading.h"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
3dsdk.support@amd.com
|
||||
******************************************************************************/
|
||||
|
||||
#include "../PrecompiledHeader.h"
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4414)
|
||||
|
|
|
@ -98,7 +98,7 @@ static void SetSingleAffinity()
|
|||
|
||||
if( s_oldmask == ERROR_INVALID_PARAMETER )
|
||||
{
|
||||
Console::Notice(
|
||||
Console.Notice(
|
||||
"CpuDetect: SetThreadAffinityMask failed...\n"
|
||||
"\tSystem Affinity : 0x%08x"
|
||||
"\tProcess Affinity: 0x%08x"
|
||||
|
@ -354,7 +354,7 @@ void cpudetectInit()
|
|||
|
||||
if( sse3_result != !!x86caps.hasStreamingSIMD3Extensions )
|
||||
{
|
||||
Console::Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
Console.Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
bool_to_char( !!x86caps.hasStreamingSIMD3Extensions ), bool_to_char( sse3_result ) );
|
||||
|
||||
x86caps.hasStreamingSIMD3Extensions = sse3_result;
|
||||
|
@ -362,7 +362,7 @@ void cpudetectInit()
|
|||
|
||||
if( ssse3_result != !!x86caps.hasSupplementalStreamingSIMD3Extensions )
|
||||
{
|
||||
Console::Notice( "SSSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
Console.Notice( "SSSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
bool_to_char( !!x86caps.hasSupplementalStreamingSIMD3Extensions ), bool_to_char( ssse3_result ) );
|
||||
|
||||
x86caps.hasSupplementalStreamingSIMD3Extensions = ssse3_result;
|
||||
|
@ -370,7 +370,7 @@ void cpudetectInit()
|
|||
|
||||
if( sse41_result != !!x86caps.hasStreamingSIMD4Extensions )
|
||||
{
|
||||
Console::Notice( "SSE4 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
Console.Notice( "SSE4 Detection Inconsistency: cpuid=%s, test_result=%s",
|
||||
bool_to_char( !!x86caps.hasStreamingSIMD4Extensions ), bool_to_char( sse41_result ) );
|
||||
|
||||
x86caps.hasStreamingSIMD4Extensions = sse41_result;
|
||||
|
@ -379,7 +379,7 @@ void cpudetectInit()
|
|||
}
|
||||
else
|
||||
{
|
||||
Console::Notice(
|
||||
Console.Notice(
|
||||
"Notice: Could not allocate memory for SSE3/4 detection.\n"
|
||||
"\tRelying on CPUID results. [this is not an error]"
|
||||
);
|
||||
|
|
|
@ -370,7 +370,7 @@ void x86SetJ8( u8* j8 )
|
|||
u32 jump = ( x86Ptr - j8 ) - 1;
|
||||
|
||||
if ( jump > 0x7f ) {
|
||||
Console::Error( "j8 greater than 0x7f!!" );
|
||||
Console.Error( "j8 greater than 0x7f!!" );
|
||||
assert(0);
|
||||
}
|
||||
*j8 = (u8)jump;
|
||||
|
@ -381,7 +381,7 @@ void x86SetJ8A( u8* j8 )
|
|||
u32 jump = ( x86Ptr - j8 ) - 1;
|
||||
|
||||
if ( jump > 0x7f ) {
|
||||
Console::Error( "j8 greater than 0x7f!!" );
|
||||
Console.Error( "j8 greater than 0x7f!!" );
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,14 +40,14 @@ __forceinline void FreezeMMXRegs(int save)
|
|||
{
|
||||
if( !g_EEFreezeRegs ) return;
|
||||
|
||||
//DevCon::Notice("FreezeMMXRegs_(%d); [%d]\n", save, g_globalMMXSaved);
|
||||
//DevCon.Notice("FreezeMMXRegs_(%d); [%d]\n", save, g_globalMMXSaved);
|
||||
|
||||
if( save )
|
||||
{
|
||||
g_globalMMXSaved++;
|
||||
if( g_globalMMXSaved > 1 )
|
||||
{
|
||||
//DevCon::Notice("MMX Already Saved!\n");
|
||||
//DevCon.Notice("MMX Already Saved!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ __forceinline void FreezeMMXRegs(int save)
|
|||
else {
|
||||
if( g_globalMMXSaved==0 )
|
||||
{
|
||||
//DevCon::Notice("MMX Not Saved!\n");
|
||||
//DevCon.Notice("MMX Not Saved!\n");
|
||||
return;
|
||||
}
|
||||
g_globalMMXSaved--;
|
||||
|
@ -129,13 +129,13 @@ __forceinline void FreezeXMMRegs(int save)
|
|||
{
|
||||
if( !g_EEFreezeRegs ) return;
|
||||
|
||||
//DevCon::Notice("FreezeXMMRegs_(%d); [%d]\n", save, g_globalXMMSaved);
|
||||
//DevCon.Notice("FreezeXMMRegs_(%d); [%d]\n", save, g_globalXMMSaved);
|
||||
|
||||
if( save )
|
||||
{
|
||||
g_globalXMMSaved++;
|
||||
if( g_globalXMMSaved > 1 ){
|
||||
//DevCon::Notice("XMM Already saved\n");
|
||||
//DevCon.Notice("XMM Already saved\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ __forceinline void FreezeXMMRegs(int save)
|
|||
{
|
||||
if( g_globalXMMSaved==0 )
|
||||
{
|
||||
//DevCon::Notice("XMM Regs not saved!\n");
|
||||
//DevCon.Notice("XMM Regs not saved!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,11 +84,11 @@ FILE *_cdvdOpenMechaVer()
|
|||
fd = fopen(file.data(), "r+b");
|
||||
if (fd == NULL)
|
||||
{
|
||||
Console::Notice("MEC File Not Found , Creating Blank File");
|
||||
Console.Notice("MEC File Not Found , Creating Blank File");
|
||||
fd = fopen(file.data(), "wb");
|
||||
if (fd == NULL)
|
||||
{
|
||||
Console::Error( "\tMEC File Creation failed!" );
|
||||
Console.Error( "\tMEC File Creation failed!" );
|
||||
throw Exception::CreateStream( file );
|
||||
//Msgbox::Alert( "_cdvdOpenMechaVer: Error creating %s", file);
|
||||
//exit(1);
|
||||
|
@ -124,11 +124,11 @@ FILE *_cdvdOpenNVM()
|
|||
fd = fopen(file.data(), "r+b");
|
||||
if (fd == NULL)
|
||||
{
|
||||
Console::Notice("NVM File Not Found , Creating Blank File");
|
||||
Console.Notice("NVM File Not Found , Creating Blank File");
|
||||
fd = fopen(file.data(), "wb");
|
||||
if (fd == NULL)
|
||||
{
|
||||
Console::Error( "\tMEC File Creation failed!" );
|
||||
Console.Error( "\tMEC File Creation failed!" );
|
||||
throw Exception::CreateStream( file );
|
||||
}
|
||||
for (int i=0; i<1024; i++) fputc(0, fd);
|
||||
|
@ -314,7 +314,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
|
|||
const wxCharBuffer crap( fname.ToAscii() );
|
||||
const char* str = crap.data();
|
||||
sprintf(exeName, "%c%c%c%c%c%c%c%c%c%c%c",str[8],str[9],str[10],str[11],str[12],str[13],str[14],str[15],str[16],str[17],str[18]);
|
||||
DevCon::Notice("exeName = %s", &str[8]);
|
||||
DevCon.Notice("exeName = %s", &str[8]);
|
||||
|
||||
// convert the number characters to a real 32bit number
|
||||
numbers = ((((exeName[5] - '0'))*10000) +
|
||||
|
@ -369,7 +369,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
|
|||
key[15] = 0x01;
|
||||
}
|
||||
|
||||
Console::WriteLn( "CDVD.KEY = %02X,%02X,%02X,%02X,%02X,%02X,%02X",
|
||||
Console.WriteLn( "CDVD.KEY = %02X,%02X,%02X,%02X,%02X,%02X,%02X",
|
||||
cdvd.Key[0],cdvd.Key[1],cdvd.Key[2],cdvd.Key[3],cdvd.Key[4],cdvd.Key[14],cdvd.Key[15] );
|
||||
|
||||
// Now's a good time to reload the ELF info...
|
||||
|
@ -622,7 +622,7 @@ int cdvdReadSector() {
|
|||
// be more correct. (air)
|
||||
psxCpu->Clear( HW_DMA3_MADR, cdvd.BlockSize/4 );
|
||||
|
||||
// Console::WriteLn("sector %x;%x;%x", PSXMu8(madr+0), PSXMu8(madr+1), PSXMu8(madr+2));
|
||||
// Console.WriteLn("sector %x;%x;%x", PSXMu8(madr+0), PSXMu8(madr+1), PSXMu8(madr+2));
|
||||
|
||||
HW_DMA3_BCR_H16 -= (cdvd.BlockSize / (HW_DMA3_BCR_L16*4));
|
||||
HW_DMA3_MADR += cdvd.BlockSize;
|
||||
|
@ -670,7 +670,7 @@ __forceinline void cdvdActionInterrupt()
|
|||
// inlined due to being referenced in only one place.
|
||||
__forceinline void cdvdReadInterrupt()
|
||||
{
|
||||
//Console::WriteLn("cdvdReadInterrupt %x %x %x %x %x", cpuRegs.interrupt, cdvd.Readed, cdvd.Reading, cdvd.nSectors, (HW_DMA3_BCR_H16 * HW_DMA3_BCR_L16) *4);
|
||||
//Console.WriteLn("cdvdReadInterrupt %x %x %x %x %x", cpuRegs.interrupt, cdvd.Readed, cdvd.Reading, cdvd.nSectors, (HW_DMA3_BCR_H16 * HW_DMA3_BCR_L16) *4);
|
||||
|
||||
cdvd.Ready = CDVD_NOTREADY;
|
||||
if (!cdvd.Readed)
|
||||
|
@ -717,7 +717,7 @@ __forceinline void cdvdReadInterrupt()
|
|||
CDVDREAD_INT(cdvd.ReadTime);
|
||||
}
|
||||
else
|
||||
Console::Error("CDVD READ ERROR, sector = 0x%08x", cdvd.Sector);
|
||||
Console.Error("CDVD READ ERROR, sector = 0x%08x", cdvd.Sector);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1011,14 +1011,14 @@ u8 cdvdRead(u8 key)
|
|||
case 0x3A: // DEC_SET
|
||||
CDR_LOG("cdvdRead3A(DecSet) %x", cdvd.decSet);
|
||||
|
||||
Console::WriteLn("DecSet Read: %02X", cdvd.decSet);
|
||||
Console.WriteLn("DecSet Read: %02X", cdvd.decSet);
|
||||
return cdvd.decSet;
|
||||
break;
|
||||
|
||||
default:
|
||||
// note: notify the console since this is a potentially serious emulation problem:
|
||||
PSXHW_LOG("*Unknown 8bit read at address 0x1f4020%x", key);
|
||||
Console::Error( "IOP Unknown 8bit read from addr 0x1f4020%x", key );
|
||||
Console.Error( "IOP Unknown 8bit read from addr 0x1f4020%x", key );
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
@ -1042,14 +1042,14 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
// Seek to sector zero. The cdvdStartSeek function will simulate
|
||||
// spinup times if needed.
|
||||
|
||||
DevCon::Notice( "CdStandby : %d", rt );
|
||||
DevCon.Notice( "CdStandby : %d", rt );
|
||||
cdvd.Action = cdvdAction_Standby;
|
||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM );
|
||||
CDVD_INT( cdvdStartSeek( 0, MODE_DVDROM ) );
|
||||
break;
|
||||
|
||||
case N_CD_STOP: // CdStop
|
||||
DevCon::Notice( "CdStop : %d", rt );
|
||||
DevCon.Notice( "CdStop : %d", rt );
|
||||
cdvd.Action = cdvdAction_Stop;
|
||||
CDVD_INT( PSXCLK / 6 ); // 166ms delay?
|
||||
break;
|
||||
|
@ -1083,7 +1083,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
|
||||
|
||||
if( EmuConfig.CdvdVerboseReads )
|
||||
Console::WriteLn("CdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
Console.WriteLn("CdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);
|
||||
|
||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
||||
|
@ -1131,7 +1131,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
|
||||
|
||||
if( EmuConfig.CdvdVerboseReads )
|
||||
Console::WriteLn("CdAudioRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
Console.WriteLn("CdAudioRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);
|
||||
|
||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
||||
|
@ -1167,7 +1167,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
|
||||
|
||||
if( EmuConfig.CdvdVerboseReads )
|
||||
Console::WriteLn("DvdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
Console.WriteLn("DvdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
|
||||
cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);
|
||||
|
||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM );
|
||||
|
@ -1189,7 +1189,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
//the code below handles only CdGetToc!
|
||||
//if(cdvd.Param[0]==0x01)
|
||||
//{
|
||||
DevCon::WriteLn("CDGetToc Param[0]=%d, Param[1]=%d", cdvd.Param[0],cdvd.Param[1]);
|
||||
DevCon.WriteLn("CDGetToc Param[0]=%d, Param[1]=%d", cdvd.Param[0],cdvd.Param[1]);
|
||||
//}
|
||||
cdvdGetToc( iopPhysMem( HW_DMA3_MADR ) );
|
||||
cdvdSetIrq( (1<<Irq_CommandComplete) ); //| (1<<Irq_DataReady) );
|
||||
|
@ -1202,7 +1202,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
u8 arg0 = cdvd.Param[0];
|
||||
u16 arg1 = cdvd.Param[1] | (cdvd.Param[2]<<8);
|
||||
u32 arg2 = cdvd.Param[3] | (cdvd.Param[4]<<8) | (cdvd.Param[5]<<16) | (cdvd.Param[6]<<24);
|
||||
DevCon::WriteLn("cdvdReadKey(%d, %d, %d)", arg0, arg1, arg2);
|
||||
DevCon.WriteLn("cdvdReadKey(%d, %d, %d)", arg0, arg1, arg2);
|
||||
cdvdReadKey(arg0, arg1, arg2, cdvd.Key);
|
||||
cdvd.KeyXor = 0x00;
|
||||
cdvdSetIrq();
|
||||
|
@ -1210,12 +1210,12 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
|||
break;
|
||||
|
||||
case N_CD_CHG_SPDL_CTRL: // CdChgSpdlCtrl
|
||||
Console::Notice("sceCdChgSpdlCtrl(%d)", cdvd.Param[0]);
|
||||
Console.Notice("sceCdChgSpdlCtrl(%d)", cdvd.Param[0]);
|
||||
cdvdSetIrq();
|
||||
break;
|
||||
|
||||
default:
|
||||
Console::Notice("NCMD Unknown %x", rt);
|
||||
Console.Notice("NCMD Unknown %x", rt);
|
||||
cdvdSetIrq();
|
||||
break;
|
||||
}
|
||||
|
@ -1244,7 +1244,7 @@ static __forceinline void cdvdWrite07(u8 rt) // BREAK
|
|||
// If we're already in a Ready state or already Breaking, then do nothing:
|
||||
if ((cdvd.Ready != CDVD_NOTREADY) || (cdvd.Action == cdvdAction_Break)) return;
|
||||
|
||||
DbgCon::Notice("*PCSX2*: CDVD BREAK %x", rt);
|
||||
DbgCon.Notice("*PCSX2*: CDVD BREAK %x", rt);
|
||||
|
||||
// Aborts any one of several CD commands:
|
||||
// Pause, Seek, Read, Status, Standby, and Stop
|
||||
|
@ -1272,16 +1272,16 @@ static __forceinline void cdvdWrite0A(u8 rt) { // STATUS
|
|||
|
||||
static __forceinline void cdvdWrite0F(u8 rt) { // TYPE
|
||||
CDR_LOG("cdvdWrite0F(Type) %x", rt);
|
||||
DevCon::WriteLn("*PCSX2*: CDVD TYPE %x", rt);
|
||||
DevCon.WriteLn("*PCSX2*: CDVD TYPE %x", rt);
|
||||
}
|
||||
|
||||
static __forceinline void cdvdWrite14(u8 rt) { // PS1 MODE??
|
||||
u32 cycle = psxRegs.cycle;
|
||||
|
||||
if (rt == 0xFE)
|
||||
Console::Notice("*PCSX2*: go PS1 mode DISC SPEED = FAST");
|
||||
Console.Notice("*PCSX2*: go PS1 mode DISC SPEED = FAST");
|
||||
else
|
||||
Console::Notice("*PCSX2*: go PS1 mode DISC SPEED = %dX", rt);
|
||||
Console.Notice("*PCSX2*: go PS1 mode DISC SPEED = %dX", rt);
|
||||
|
||||
psxReset();
|
||||
psxHu32(0x1f801450) = 0x8;
|
||||
|
@ -1291,7 +1291,7 @@ static __forceinline void cdvdWrite14(u8 rt) { // PS1 MODE??
|
|||
|
||||
static __forceinline void fail_pol_cal()
|
||||
{
|
||||
Console::Error("[MG] ERROR - Make sure the file is already decrypted!!!");
|
||||
Console.Error("[MG] ERROR - Make sure the file is already decrypted!!!");
|
||||
cdvd.Result[0] = 0x80;
|
||||
}
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
default:
|
||||
SetResultSize(1);
|
||||
cdvd.Result[0] = 0x80;
|
||||
Console::WriteLn("*Unknown Mecacon Command param[0]=%02X", cdvd.Param[0]);
|
||||
Console.WriteLn("*Unknown Mecacon Command param[0]=%02X", cdvd.Param[0]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -1377,9 +1377,9 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
if(cdvd.Result[3] <= 7) cdvd.Result[5] += 1;
|
||||
cdvd.Result[6] = itob(cdvd.RTC.month)+0x80; //Month
|
||||
cdvd.Result[7] = itob(cdvd.RTC.year); //Year
|
||||
/*Console::WriteLn("RTC Read Sec %x Min %x Hr %x Day %x Month %x Year %x", cdvd.Result[1], cdvd.Result[2],
|
||||
/*Console.WriteLn("RTC Read Sec %x Min %x Hr %x Day %x Month %x Year %x", cdvd.Result[1], cdvd.Result[2],
|
||||
cdvd.Result[3], cdvd.Result[5], cdvd.Result[6], cdvd.Result[7]);
|
||||
Console::WriteLn("RTC Read Real Sec %d Min %d Hr %d Day %d Month %d Year %d", cdvd.RTC.second, cdvd.RTC.minute,
|
||||
Console.WriteLn("RTC Read Real Sec %d Min %d Hr %d Day %d Month %d Year %d", cdvd.RTC.second, cdvd.RTC.minute,
|
||||
cdvd.RTC.hour, cdvd.RTC.day, cdvd.RTC.month, cdvd.RTC.year);*/
|
||||
break;
|
||||
|
||||
|
@ -1395,9 +1395,9 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
if(cdvd.Param[cdvd.ParamP-5] <= 7) cdvd.RTC.day -= 1;
|
||||
cdvd.RTC.month = btoi(cdvd.Param[cdvd.ParamP-2]-0x80);
|
||||
cdvd.RTC.year = btoi(cdvd.Param[cdvd.ParamP-1]);
|
||||
/*Console::WriteLn("RTC write incomming Sec %x Min %x Hr %x Day %x Month %x Year %x", cdvd.Param[cdvd.ParamP-7], cdvd.Param[cdvd.ParamP-6],
|
||||
/*Console.WriteLn("RTC write incomming Sec %x Min %x Hr %x Day %x Month %x Year %x", cdvd.Param[cdvd.ParamP-7], cdvd.Param[cdvd.ParamP-6],
|
||||
cdvd.Param[cdvd.ParamP-5], cdvd.Param[cdvd.ParamP-3], cdvd.Param[cdvd.ParamP-2], cdvd.Param[cdvd.ParamP-1]);
|
||||
Console::WriteLn("RTC Write Sec %d Min %d Hr %d Day %d Month %d Year %d", cdvd.RTC.second, cdvd.RTC.minute,
|
||||
Console.WriteLn("RTC Write Sec %d Min %d Hr %d Day %d Month %d Year %d", cdvd.RTC.second, cdvd.RTC.minute,
|
||||
cdvd.RTC.hour, cdvd.RTC.day, cdvd.RTC.month, cdvd.RTC.year);*/
|
||||
//memcpy_fast((u8*)&cdvd.RTC, cdvd.Param, 7);
|
||||
break;
|
||||
|
@ -1465,7 +1465,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
break;
|
||||
|
||||
case 0x15: // sceCdForbidDVDP (0:1)
|
||||
//Console::WriteLn("sceCdForbidDVDP");
|
||||
//Console.WriteLn("sceCdForbidDVDP");
|
||||
SetResultSize(1);
|
||||
cdvd.Result[0] = 5;
|
||||
break;
|
||||
|
@ -1599,7 +1599,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
|
||||
cdvdGetMechaVer(&cdvd.Result[1]);
|
||||
cdvd.Result[0] = cdvdReadRegionParams(&cdvd.Result[3]);//size==8
|
||||
Console::WriteLn("REGION PARAMS = %s %s", mg_zones[cdvd.Result[1]], &cdvd.Result[3]);
|
||||
Console.WriteLn("REGION PARAMS = %s %s", mg_zones[cdvd.Result[1]], &cdvd.Result[3]);
|
||||
cdvd.Result[1] = 1 << cdvd.Result[1]; //encryption zone; see offset 0x1C in encrypted headers
|
||||
//////////////////////////////////////////
|
||||
cdvd.Result[2] = 0; //??
|
||||
|
@ -1766,14 +1766,14 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
break;
|
||||
}
|
||||
|
||||
Console::Write("[MG] ELF_size=0x%X Hdr_size=0x%X unk=0x%X flags=0x%X count=%d zones=",
|
||||
Console.Write("[MG] ELF_size=0x%X Hdr_size=0x%X unk=0x%X flags=0x%X count=%d zones=",
|
||||
*(u32*)&cdvd.mg_buffer[0x10], *(u16*)&cdvd.mg_buffer[0x14], *(u16*)&cdvd.mg_buffer[0x16],
|
||||
*(u16*)&cdvd.mg_buffer[0x18], *(u16*)&cdvd.mg_buffer[0x1A]);
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
if (cdvd.mg_buffer[0x1C] & (1<<i)) Console::Write("%s ", mg_zones[i]);
|
||||
if (cdvd.mg_buffer[0x1C] & (1<<i)) Console.Write("%s ", mg_zones[i]);
|
||||
}
|
||||
Console::Newline();
|
||||
Console.Newline();
|
||||
|
||||
bit_ofs = mg_BIToffset(cdvd.mg_buffer);
|
||||
|
||||
|
@ -1803,7 +1803,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
SetResultSize(1);//in:5
|
||||
cdvd.mg_size = 0;
|
||||
cdvd.mg_datatype = 1;//header data
|
||||
Console::WriteLn("[MG] hcode=%d cnum=%d a2=%d length=0x%X",
|
||||
Console.WriteLn("[MG] hcode=%d cnum=%d a2=%d length=0x%X",
|
||||
cdvd.Param[0], cdvd.Param[3], cdvd.Param[4], cdvd.mg_maxsize = cdvd.Param[1] | (((int)cdvd.Param[2])<<8));
|
||||
|
||||
cdvd.Result[0] = 0; // 0 complete ; 1 busy ; 0x80 error
|
||||
|
@ -1817,7 +1817,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
|
||||
cdvd.mg_maxsize = 0; // don't allow any write
|
||||
cdvd.mg_size = 8+16*cdvd.mg_buffer[4];//new offset, i just moved the data
|
||||
Console::WriteLn("[MG] BIT count=%d", cdvd.mg_buffer[4]);
|
||||
Console.WriteLn("[MG] BIT count=%d", cdvd.mg_buffer[4]);
|
||||
|
||||
cdvd.Result[0] = (cdvd.mg_datatype == 1) ? 0 : 0x80; // 0 complete ; 1 busy ; 0x80 error
|
||||
cdvd.Result[1] = (cdvd.mg_size >> 0) & 0xFF;
|
||||
|
@ -1882,11 +1882,11 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
// fake a 'correct' command
|
||||
SetResultSize(1); //in:0
|
||||
cdvd.Result[0] = 0; // 0 complete ; 1 busy ; 0x80 error
|
||||
Console::WriteLn("SCMD Unknown %x", rt);
|
||||
Console.WriteLn("SCMD Unknown %x", rt);
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
//Console::WriteLn("SCMD - 0x%x\n", rt);
|
||||
//Console.WriteLn("SCMD - 0x%x\n", rt);
|
||||
cdvd.ParamP = 0;
|
||||
cdvd.ParamC = 0;
|
||||
}
|
||||
|
@ -1902,13 +1902,13 @@ static __forceinline void cdvdWrite17(u8 rt) { // SDATAIN
|
|||
|
||||
static __forceinline void cdvdWrite18(u8 rt) { // SDATAOUT
|
||||
CDR_LOG("cdvdWrite18(SDataOut) %x", rt);
|
||||
Console::WriteLn("*PCSX2* SDATAOUT");
|
||||
Console.WriteLn("*PCSX2* SDATAOUT");
|
||||
}
|
||||
|
||||
static __forceinline void cdvdWrite3A(u8 rt) { // DEC-SET
|
||||
CDR_LOG("cdvdWrite3A(DecSet) %x", rt);
|
||||
cdvd.decSet = rt;
|
||||
Console::WriteLn("DecSet Write: %02X", cdvd.decSet);
|
||||
Console.WriteLn("DecSet Write: %02X", cdvd.decSet);
|
||||
}
|
||||
|
||||
void cdvdWrite(u8 key, u8 rt)
|
||||
|
@ -1928,7 +1928,7 @@ void cdvdWrite(u8 key, u8 rt)
|
|||
case 0x18: cdvdWrite18(rt); break;
|
||||
case 0x3A: cdvdWrite3A(rt); break;
|
||||
default:
|
||||
Console::Notice("IOP Unknown 8bit write to addr 0x1f4020%x = 0x%x", key, rt);
|
||||
Console.Notice("IOP Unknown 8bit write to addr 0x1f4020%x = 0x%x", key, rt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ static isoFile *blockDumpFile = NULL;
|
|||
// relying on DEP exceptions -- and a little more reliable too.
|
||||
static void CheckNullCDVD()
|
||||
{
|
||||
DevAssert( CDVD != NULL, "Invalid CDVD object state (null pointer exception)" );
|
||||
pxAssertDev( CDVD != NULL, "Invalid CDVD object state (null pointer exception)" );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -159,15 +159,15 @@ static int FindDiskType(int mType)
|
|||
switch(iCDType)
|
||||
{
|
||||
case CDVD_TYPE_DETCTCD:
|
||||
Console::Status(" * CDVD Disk Open: CD, %d tracks (%d to %d):", tn.etrack-tn.strack+1,tn.strack,tn.etrack);
|
||||
Console.Status(" * CDVD Disk Open: CD, %d tracks (%d to %d):", tn.etrack-tn.strack+1,tn.strack,tn.etrack);
|
||||
break;
|
||||
|
||||
case CDVD_TYPE_DETCTDVDS:
|
||||
Console::Status(" * CDVD Disk Open: DVD, Single layer or unknown:");
|
||||
Console.Status(" * CDVD Disk Open: DVD, Single layer or unknown:");
|
||||
break;
|
||||
|
||||
case CDVD_TYPE_DETCTDVDD:
|
||||
Console::Status(" * CDVD Disk Open: DVD, Double layer:");
|
||||
Console.Status(" * CDVD Disk Open: DVD, Double layer:");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -188,12 +188,12 @@ static int FindDiskType(int mType)
|
|||
if (td.type == CDVD_AUDIO_TRACK)
|
||||
{
|
||||
audioTracks++;
|
||||
Console::Status(" * * Track %d: Audio (%d sectors)", i,tlength);
|
||||
Console.Status(" * * Track %d: Audio (%d sectors)", i,tlength);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataTracks++;
|
||||
Console::Status(" * * Track %d: Data (Mode %d) (%d sectors)", i,((td.type==CDVD_MODE1_TRACK)?1:2),tlength);
|
||||
Console.Status(" * * Track %d: Data (Mode %d) (%d sectors)", i,((td.type==CDVD_MODE1_TRACK)?1:2),tlength);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ s32 DoCDVDreadTrack(u32 lsn, int mode)
|
|||
break;
|
||||
}
|
||||
|
||||
//DevCon::Notice("CDVD readTrack(lsn=%d,mode=%d)",params lsn, lastReadSize);
|
||||
//DevCon.Notice("CDVD readTrack(lsn=%d,mode=%d)",params lsn, lastReadSize);
|
||||
lastLSN = lsn;
|
||||
return CDVD->readTrack(lsn,mode);
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ s32 CALLBACK ISOopen(const char* pTitle)
|
|||
|
||||
if( (pTitle == NULL) || (pTitle[0] == 0) )
|
||||
{
|
||||
Console::Error( "CDVDiso Error: No filename specified." );
|
||||
Console.Error( "CDVDiso Error: No filename specified." );
|
||||
return -1;
|
||||
}
|
||||
|
||||
iso = isoOpen(pTitle);
|
||||
if (iso == NULL)
|
||||
{
|
||||
Console::Error( "CDVDiso Error: Failed loading %s", pTitle );
|
||||
Console.Error( "CDVDiso Error: Failed loading %s", pTitle );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ static void FindLayer1Start()
|
|||
int off = iso->blockofs;
|
||||
u8 tempbuffer[CD_FRAMESIZE_RAW];
|
||||
|
||||
Console::Status("CDVDiso: searching for layer1...");
|
||||
Console.Status("CDVDiso: searching for layer1...");
|
||||
//tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW);
|
||||
for (layer1start = (iso->blocks / 2 - 0x10) & ~0xf; layer1start < 0x200010; layer1start += 16)
|
||||
{
|
||||
|
@ -146,12 +146,12 @@ static void FindLayer1Start()
|
|||
|
||||
if(layer1start == 0x200010)
|
||||
{
|
||||
Console::Status("\tCouldn't find second layer on dual layer... ignoring");
|
||||
Console.Status("\tCouldn't find second layer on dual layer... ignoring");
|
||||
layer1start=-2;
|
||||
}
|
||||
|
||||
if(layer1start>=0)
|
||||
Console::Status("\tfound at 0x%8.8x", layer1start);
|
||||
Console.Status("\tfound at 0x%8.8x", layer1start);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@ s32 cdvdDmaRead(s32 channel, u32* data, u32 wordsLeft, u32* wordsProcessed)
|
|||
cdr.pTransfer+=wordsLeft;
|
||||
*wordsProcessed = wordsLeft;
|
||||
|
||||
Console::Status("New IOP DMA handled CDVD DMA: channel %d, data %p, remaining %08x, processed %08x.", channel,data,wordsLeft, *wordsProcessed);
|
||||
Console.Status("New IOP DMA handled CDVD DMA: channel %d, data %p, remaining %08x, processed %08x.", channel,data,wordsLeft, *wordsProcessed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ int IsoFS_getVolumeDescriptor(void)
|
|||
s32 volDescSector;
|
||||
cdVolDesc localVolDesc;
|
||||
|
||||
DbgCon::WriteLn("IsoFS_GetVolumeDescriptor called");
|
||||
DbgCon.WriteLn("IsoFS_GetVolumeDescriptor called");
|
||||
|
||||
for (volDescSector = 16; volDescSector<20; volDescSector++)
|
||||
{
|
||||
|
@ -205,11 +205,11 @@ int IsoFS_getVolumeDescriptor(void)
|
|||
}
|
||||
|
||||
if (CDVolDesc.filesystemType == 1)
|
||||
DbgCon::WriteLn( Color_Green, "CD FileSystem is ISO9660" );
|
||||
DbgCon.WriteLn( Color_Green, "CD FileSystem is ISO9660" );
|
||||
else if (CDVolDesc.filesystemType == 2)
|
||||
DbgCon::WriteLn( Color_Green, "CD FileSystem is Joliet");
|
||||
DbgCon.WriteLn( Color_Green, "CD FileSystem is Joliet");
|
||||
else
|
||||
DbgCon::Notice("Could not detect CD FileSystem type");
|
||||
DbgCon.Notice("Could not detect CD FileSystem type");
|
||||
|
||||
// CdStop();
|
||||
|
||||
|
@ -223,7 +223,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
dirTocEntry* tocEntryPointer;
|
||||
TocEntry localTocEntry; // used for internal checking only
|
||||
|
||||
DbgCon::WriteLn("IsoFS_findfile(\"%s\") called", fname);
|
||||
DbgCon.WriteLn("IsoFS_findfile(\"%s\") called", fname);
|
||||
|
||||
_splitpath2(fname, pathname, filename);
|
||||
|
||||
|
@ -297,7 +297,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
current_sector++;
|
||||
if (IsoFS_readSectors(current_sector,1,toc) != TRUE)
|
||||
{
|
||||
Console::Error("Couldn't Read from CD !");
|
||||
Console.Error("Couldn't Read from CD !");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
@ -333,7 +333,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
// If we havent found the directory name we wanted then fail
|
||||
if (found_dir != TRUE)
|
||||
{
|
||||
Console::Notice( "IsoFS_findfile: could not find dir" );
|
||||
Console.Notice( "IsoFS_findfile: could not find dir" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
// Read the TOC of the found subdirectory
|
||||
if (IsoFS_readSectors(localTocEntry.fileLBA,1,toc) != TRUE)
|
||||
{
|
||||
Console::Error("Couldn't Read from CD !");
|
||||
Console.Error("Couldn't Read from CD !");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
@ -388,7 +388,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
strcpy(tocEntry->filename, localTocEntry.filename);
|
||||
memcpy(tocEntry->date, localTocEntry.date, 7);
|
||||
|
||||
DbgCon::WriteLn("IsoFS_findfile: found file");
|
||||
DbgCon.WriteLn("IsoFS_findfile: found file");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
dir_lba++;
|
||||
|
||||
if (IsoFS_readSectors(dir_lba,1,toc) != TRUE){
|
||||
Console::Error("Couldn't Read from CD !");
|
||||
Console.Error("Couldn't Read from CD !");
|
||||
return -1;
|
||||
}
|
||||
// CdSync(0x00);
|
||||
|
@ -412,7 +412,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
}
|
||||
}
|
||||
|
||||
DbgCon::Notice("IsoFS_findfile: could not find file");
|
||||
DbgCon.Notice("IsoFS_findfile: could not find file");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ isoFile *isoOpen(const char *filename)
|
|||
iso->handle = _openfile( iso->filename, O_RDONLY);
|
||||
if (iso->handle == NULL)
|
||||
{
|
||||
Console::Error("error loading %s", iso->filename);
|
||||
Console.Error("error loading %s", iso->filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (isoDetect(iso) == -1) return NULL;
|
||||
|
||||
Console::WriteLn("detected blocksize = %d", iso->blocksize);
|
||||
Console.WriteLn("detected blocksize = %d", iso->blocksize);
|
||||
|
||||
if ((strlen(iso->filename) > 3) && strncmp(iso->filename + (strlen(iso->filename) - 3), "I00", 3) == 0)
|
||||
{
|
||||
|
@ -181,12 +181,12 @@ isoFile *isoOpen(const char *filename)
|
|||
iso->blocks = (u32)((_tellfile(iso->handle) - iso->offset) / (iso->blocksize));
|
||||
}
|
||||
|
||||
Console::WriteLn("isoOpen: %s ok", iso->filename);
|
||||
Console::WriteLn("offset = %d", iso->offset);
|
||||
Console::WriteLn("blockofs = %d", iso->blockofs);
|
||||
Console::WriteLn("blocksize = %d", iso->blocksize);
|
||||
Console::WriteLn("blocks = %d", iso->blocks);
|
||||
Console::WriteLn("type = %d", iso->type);
|
||||
Console.WriteLn("isoOpen: %s ok", iso->filename);
|
||||
Console.WriteLn("offset = %d", iso->offset);
|
||||
Console.WriteLn("blockofs = %d", iso->blockofs);
|
||||
Console.WriteLn("blocksize = %d", iso->blocksize);
|
||||
Console.WriteLn("blocks = %d", iso->blocks);
|
||||
Console.WriteLn("type = %d", iso->type);
|
||||
|
||||
return iso;
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ isoFile *isoCreate(const char *filename, int flags)
|
|||
|
||||
if (iso->handle == NULL)
|
||||
{
|
||||
Console::Error("Error loading %s", iso->filename);
|
||||
Console.Error("Error loading %s", iso->filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Console::WriteLn("isoCreate: %s ok", iso->filename);
|
||||
Console::WriteLn("offset = %d", iso->offset);
|
||||
Console.WriteLn("isoCreate: %s ok", iso->filename);
|
||||
Console.WriteLn("offset = %d", iso->offset);
|
||||
|
||||
return iso;
|
||||
}
|
||||
|
@ -235,9 +235,9 @@ int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks)
|
|||
iso->blocks = blocks;
|
||||
iso->blockofs = blockofs;
|
||||
|
||||
Console::WriteLn("blockofs = %d", iso->blockofs);
|
||||
Console::WriteLn("blocksize = %d", iso->blocksize);
|
||||
Console::WriteLn("blocks = %d", iso->blocks);
|
||||
Console.WriteLn("blockofs = %d", iso->blockofs);
|
||||
Console.WriteLn("blocksize = %d", iso->blocksize);
|
||||
Console.WriteLn("blocks = %d", iso->blocks);
|
||||
|
||||
if (iso->flags & ISOFLAGS_BLOCKDUMP_V2)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ int _isoReadBlock(isoFile *iso, u8 *dst, int lsn)
|
|||
|
||||
if (ret < iso->blocksize)
|
||||
{
|
||||
Console::Error("read error %d in _isoReadBlock", ret);
|
||||
Console.Error("read error %d in _isoReadBlock", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ int _isoReadBlockD(isoFile *iso, u8 *dst, int lsn)
|
|||
{
|
||||
int ret;
|
||||
|
||||
// Console::WriteLn("_isoReadBlockD %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
|
||||
// Console.WriteLn("_isoReadBlockD %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
|
||||
|
||||
memset(dst, 0, iso->blockofs);
|
||||
for (int i = 0; i < iso->dtablesize; i++)
|
||||
|
@ -317,7 +317,7 @@ int _isoReadBlockD(isoFile *iso, u8 *dst, int lsn)
|
|||
|
||||
return 0;
|
||||
}
|
||||
Console::WriteLn("Block %d not found in dump", lsn);
|
||||
Console.WriteLn("Block %d not found in dump", lsn);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn)
|
|||
|
||||
ofs = (u64)(lsn - iso->multih[i].slsn) * iso->blocksize + iso->offset;
|
||||
|
||||
// Console::WriteLn("_isoReadBlock %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
|
||||
// Console.WriteLn("_isoReadBlock %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
|
||||
|
||||
memset(dst, 0, iso->blockofs);
|
||||
_seekfile(iso->multih[i].handle, ofs, SEEK_SET);
|
||||
|
@ -347,7 +347,7 @@ int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn)
|
|||
|
||||
if (ret < iso->blocksize)
|
||||
{
|
||||
Console::WriteLn("read error %d in _isoReadBlockM", ret);
|
||||
Console.WriteLn("read error %d in _isoReadBlockM", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
|
|||
|
||||
if (lsn > iso->blocks)
|
||||
{
|
||||
Console::WriteLn("isoReadBlock: %d > %d", lsn, iso->blocks);
|
||||
Console.WriteLn("isoReadBlock: %d > %d", lsn, iso->blocks);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -401,13 +401,13 @@ int _isoWriteBlockD(isoFile *iso, u8 *src, int lsn)
|
|||
{
|
||||
int ret;
|
||||
|
||||
// Console::WriteLn("_isoWriteBlock %d (ofs=%d)", iso->blocksize, ofs);
|
||||
// Console.WriteLn("_isoWriteBlock %d (ofs=%d)", iso->blocksize, ofs);
|
||||
|
||||
ret = _writefile(iso->handle, &lsn, 4);
|
||||
if (ret < 4) return -1;
|
||||
ret = _writefile(iso->handle, src + iso->blockofs, iso->blocksize);
|
||||
|
||||
// Console::WriteLn("_isoWriteBlock %d", ret);
|
||||
// Console.WriteLn("_isoWriteBlock %d", ret);
|
||||
|
||||
if (ret < iso->blocksize) return -1;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void *_openfile(const char *filename, int flags)
|
|||
{
|
||||
HANDLE handle;
|
||||
|
||||
// Console::WriteLn("_openfile %s, %d", filename, flags & O_RDONLY);
|
||||
// Console.WriteLn("_openfile %s, %d", filename, flags & O_RDONLY);
|
||||
if (flags & O_WRONLY)
|
||||
{
|
||||
int _flags = CREATE_NEW;
|
||||
|
@ -52,7 +52,7 @@ int _seekfile(void *handle, u64 offset, int whence)
|
|||
u64 ofs = (u64)offset;
|
||||
PLONG _ofs = (LONG*) & ofs;
|
||||
|
||||
// Console::WriteLn("_seekfile %p, %d_%d", handle, _ofs[1], _ofs[0]);
|
||||
// Console.WriteLn("_seekfile %p, %d_%d", handle, _ofs[1], _ofs[0]);
|
||||
|
||||
SetFilePointer(handle, _ofs[0], &_ofs[1], (whence == SEEK_SET) ? FILE_BEGIN : FILE_END);
|
||||
|
||||
|
@ -64,7 +64,7 @@ int _readfile(void *handle, void *dst, int size)
|
|||
DWORD ret;
|
||||
|
||||
ReadFile(handle, dst, size, &ret, NULL);
|
||||
// Console::WriteLn("_readfile(%p, %d) = %d; %d", handle, size, ret, GetLastError());
|
||||
// Console.WriteLn("_readfile(%p, %d) = %d; %d", handle, size, ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ int _writefile(void *handle, const void *src, int size)
|
|||
|
||||
// _seekfile(handle, _tellfile(handle));
|
||||
WriteFile(handle, src, size, &ret, NULL);
|
||||
// Console::WriteLn("_readfile(%p, %d) = %d", handle, size, ret);
|
||||
// Console.WriteLn("_readfile(%p, %d) = %d", handle, size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ void _closefile(void *handle)
|
|||
|
||||
void *_openfile(const char *filename, int flags)
|
||||
{
|
||||
// Console::WriteLn("_openfile %s %x", filename, flags);
|
||||
// Console.WriteLn("_openfile %s %x", filename, flags);
|
||||
|
||||
if (flags & O_WRONLY)
|
||||
return fopen64(filename, "wb");
|
||||
|
@ -117,7 +117,7 @@ int _seekfile(void *handle, u64 offset, int whence)
|
|||
{
|
||||
int seekerr = fseeko64((FILE*)handle, offset, whence);
|
||||
|
||||
if (seekerr == -1) Console::Error("Failed to seek.");
|
||||
if (seekerr == -1) Console.Error("Failed to seek.");
|
||||
|
||||
return seekerr;
|
||||
}
|
||||
|
|
|
@ -48,12 +48,12 @@ void MapTLB(int i)
|
|||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
DevCon::WriteLn("MAP TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X",
|
||||
DevCon.WriteLn("MAP TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X",
|
||||
i,tlb[i].VPN2,tlb[i].PFN0,tlb[i].PFN1,tlb[i].S,tlb[i].G,tlb[i].ASID,tlb[i].Mask);
|
||||
|
||||
if (tlb[i].S)
|
||||
{
|
||||
DevCon::WriteLn("OMG SPRAM MAPPING %08X %08X\n", tlb[i].VPN2,tlb[i].Mask);
|
||||
DevCon.WriteLn("OMG SPRAM MAPPING %08X %08X\n", tlb[i].VPN2,tlb[i].Mask);
|
||||
vtlb_VMapBuffer(tlb[i].VPN2, psS, 0x4000);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void MapTLB(int i)
|
|||
|
||||
void UnmapTLB(int i)
|
||||
{
|
||||
//Console::WriteLn("Clear TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X", i,tlb[i].VPN2,tlb[i].PFN0,tlb[i].PFN1,tlb[i].S,tlb[i].G,tlb[i].ASID,tlb[i].Mask);
|
||||
//Console.WriteLn("Clear TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X", i,tlb[i].VPN2,tlb[i].PFN0,tlb[i].PFN1,tlb[i].S,tlb[i].G,tlb[i].ASID,tlb[i].Mask);
|
||||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
|
@ -103,7 +103,7 @@ void UnmapTLB(int i)
|
|||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = tlb[i].VPN2 >> 12;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
// Console::WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
// Console.WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memClearPageAddr(addr << 12);
|
||||
|
@ -116,7 +116,7 @@ void UnmapTLB(int i)
|
|||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = (tlb[i].VPN2 >> 12) + tlb[i].Mask + 1;
|
||||
eaddr = saddr + tlb[i].Mask + 1;
|
||||
// Console::WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
// Console.WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
for (addr=saddr; addr<eaddr; addr++) {
|
||||
if ((addr & mask) == ((tlb[i].VPN2 >> 12) & mask)) { //match
|
||||
memClearPageAddr(addr << 12);
|
||||
|
@ -210,10 +210,10 @@ static __forceinline bool PERF_ShouldCountEvent( uint evt )
|
|||
void COP0_DiagnosticPCCR()
|
||||
{
|
||||
if( cpuRegs.PERF.n.pccr.b.Event0 >= 7 && cpuRegs.PERF.n.pccr.b.Event0 <= 10 )
|
||||
Console::Notice( "PERF/PCR0 Unsupported Update Event Mode = 0x%x", cpuRegs.PERF.n.pccr.b.Event0 );
|
||||
Console.Notice( "PERF/PCR0 Unsupported Update Event Mode = 0x%x", cpuRegs.PERF.n.pccr.b.Event0 );
|
||||
|
||||
if( cpuRegs.PERF.n.pccr.b.Event1 >= 7 && cpuRegs.PERF.n.pccr.b.Event1 <= 10 )
|
||||
Console::Notice( "PERF/PCR1 Unsupported Update Event Mode = 0x%x", cpuRegs.PERF.n.pccr.b.Event1 );
|
||||
Console.Notice( "PERF/PCR1 Unsupported Update Event Mode = 0x%x", cpuRegs.PERF.n.pccr.b.Event1 );
|
||||
}
|
||||
extern int branch;
|
||||
__forceinline void COP0_UpdatePCCR()
|
||||
|
@ -337,7 +337,7 @@ void MFC0()
|
|||
if ((_Rd_ != 9) && !_Rt_ ) return;
|
||||
if (_Rd_ != 9) { COP0_LOG("%s", disR5900Current.getCString() ); }
|
||||
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) Console::WriteLn("MFC0 _Rd_ %x = %x", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) Console.WriteLn("MFC0 _Rd_ %x = %x", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
switch (_Rd_)
|
||||
{
|
||||
case 12:
|
||||
|
@ -361,12 +361,12 @@ void MFC0()
|
|||
cpuRegs.GPR.r[_Rt_].SD[0] = (s32)cpuRegs.PERF.n.pcr1;
|
||||
break;
|
||||
}
|
||||
/*Console::WriteLn("MFC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x", params
|
||||
/*Console.WriteLn("MFC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x", params
|
||||
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);*/
|
||||
break;
|
||||
|
||||
case 24:
|
||||
Console::WriteLn("MFC0 Breakpoint debug Registers code = %x", cpuRegs.code & 0x3FF);
|
||||
Console.WriteLn("MFC0 Breakpoint debug Registers code = %x", cpuRegs.code & 0x3FF);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
@ -386,7 +386,7 @@ void MFC0()
|
|||
void MTC0()
|
||||
{
|
||||
COP0_LOG("%s\n", disR5900Current.getCString());
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) Console::WriteLn("MTC0 _Rd_ %x = %x", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
//if(bExecBIOS == FALSE && _Rd_ == 25) Console.WriteLn("MTC0 _Rd_ %x = %x", _Rd_, cpuRegs.CP0.r[_Rd_]);
|
||||
switch (_Rd_)
|
||||
{
|
||||
case 9:
|
||||
|
@ -399,11 +399,11 @@ void MTC0()
|
|||
break;
|
||||
|
||||
case 24:
|
||||
Console::WriteLn("MTC0 Breakpoint debug Registers code = %x", cpuRegs.code & 0x3FF);
|
||||
Console.WriteLn("MTC0 Breakpoint debug Registers code = %x", cpuRegs.code & 0x3FF);
|
||||
break;
|
||||
|
||||
case 25:
|
||||
/*if(bExecBIOS == FALSE && _Rd_ == 25) Console::WriteLn("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x", params
|
||||
/*if(bExecBIOS == FALSE && _Rd_ == 25) Console.WriteLn("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x", params
|
||||
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);*/
|
||||
switch(_Imm_ & 0x3F)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ void BC2F()
|
|||
{
|
||||
if (CP2COND == 0)
|
||||
{
|
||||
Console::WriteLn("VU0 Macro Branch");
|
||||
Console.WriteLn("VU0 Macro Branch");
|
||||
intDoBranch(_BranchTarget_);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void BC2T()
|
|||
{
|
||||
if (CP2COND == 1)
|
||||
{
|
||||
Console::WriteLn("VU0 Macro Branch");
|
||||
Console.WriteLn("VU0 Macro Branch");
|
||||
intDoBranch(_BranchTarget_);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void BC2FL()
|
|||
{
|
||||
if (CP2COND == 0)
|
||||
{
|
||||
Console::WriteLn("VU0 Macro Branch");
|
||||
Console.WriteLn("VU0 Macro Branch");
|
||||
intDoBranch(_BranchTarget_);
|
||||
}
|
||||
else
|
||||
|
@ -71,7 +71,7 @@ void BC2TL()
|
|||
{
|
||||
if (CP2COND == 1)
|
||||
{
|
||||
Console::WriteLn("VU0 Macro Branch");
|
||||
Console.WriteLn("VU0 Macro Branch");
|
||||
intDoBranch(_BranchTarget_);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -295,11 +295,7 @@ public:
|
|||
void Save( const wxString& dstfile );
|
||||
void Save( const wxOutputStream& deststream );
|
||||
|
||||
bool MultitapEnabled( uint port ) const
|
||||
{
|
||||
wxASSERT( port < 2 );
|
||||
return (port==0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
||||
}
|
||||
bool MultitapEnabled( uint port ) const;
|
||||
|
||||
bool operator ==( const Pcsx2Config& right ) const
|
||||
{
|
||||
|
|
|
@ -256,7 +256,7 @@ u32 UpdateVSyncRate()
|
|||
{
|
||||
m_iTicks = ticks;
|
||||
gsOnModeChanged( vSyncInfo.Framerate, m_iTicks );
|
||||
Console::Status( limiterMsg, EmuConfig.Video.FpsLimit, 0 );
|
||||
Console.Status( limiterMsg, EmuConfig.Video.FpsLimit, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -266,7 +266,7 @@ u32 UpdateVSyncRate()
|
|||
{
|
||||
m_iTicks = ticks;
|
||||
gsOnModeChanged( vSyncInfo.Framerate, m_iTicks );
|
||||
Console::Status( limiterMsg, vSyncInfo.Framerate/50, (vSyncInfo.Framerate*2)%100 );
|
||||
Console.Status( limiterMsg, vSyncInfo.Framerate/50, (vSyncInfo.Framerate*2)%100 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ __forceinline void rcntUpdate_vSync()
|
|||
if( vblankinc > 1 )
|
||||
{
|
||||
if( hsc != vSyncInfo.hScanlinesPerFrame )
|
||||
Console::WriteLn( " ** vSync > Abnormal Scanline Count: %d", hsc );
|
||||
Console.WriteLn( " ** vSync > Abnormal Scanline Count: %d", hsc );
|
||||
hsc = 0;
|
||||
vblankinc = 0;
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ void iDumpBlock( int startpc, u8 * ptr )
|
|||
u8 fpuused[33];
|
||||
int numused, fpunumused;
|
||||
|
||||
Console::Status( "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle );
|
||||
Console.Status( "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle );
|
||||
|
||||
g_Conf->Folders.Logs.Mkdir();
|
||||
AsciiFile eff(
|
||||
|
|
|
@ -263,10 +263,10 @@ struct ElfObject
|
|||
secthead = (ELF_SHR*)&data[header.e_shoff];
|
||||
|
||||
if ( ( header.e_shnum > 0 ) && ( header.e_shentsize != sizeof(ELF_SHR) ) )
|
||||
Console::Error( "ElfLoader Warning > Size of section headers is not standard" );
|
||||
Console.Error( "ElfLoader Warning > Size of section headers is not standard" );
|
||||
|
||||
if ( ( header.e_phnum > 0 ) && ( header.e_phentsize != sizeof(ELF_PHR) ) )
|
||||
Console::Error( "ElfLoader Warning > Size of program headers is not standard" );
|
||||
Console.Error( "ElfLoader Warning > Size of program headers is not standard" );
|
||||
|
||||
ELF_LOG( "type: " );
|
||||
switch( header.e_type )
|
||||
|
@ -388,7 +388,7 @@ struct ElfObject
|
|||
size = proghead[ i ].p_filesz;
|
||||
|
||||
if( proghead[ i ].p_vaddr != proghead[ i ].p_paddr )
|
||||
Console::Notice( "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x",
|
||||
Console.Notice( "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x",
|
||||
proghead[ i ].p_paddr, proghead[ i ].p_vaddr);
|
||||
|
||||
// used to be paddr
|
||||
|
@ -475,7 +475,7 @@ struct ElfObject
|
|||
|
||||
SymNames = (char*)data.GetPtr( secthead[ i_dt ].sh_offset );
|
||||
eS = (Elf32_Sym*)data.GetPtr( secthead[ i_st ].sh_offset );
|
||||
Console::WriteLn("found %d symbols", secthead[ i_st ].sh_size / sizeof( Elf32_Sym ));
|
||||
Console.WriteLn("found %d symbols", secthead[ i_st ].sh_size / sizeof( Elf32_Sym ));
|
||||
|
||||
for( uint i = 1; i < ( secthead[ i_st ].sh_size / sizeof( Elf32_Sym ) ); i++ ) {
|
||||
if ( ( eS[ i ].st_value != 0 ) && ( ELF32_ST_TYPE( eS[ i ].st_info ) == 2 ) ) {
|
||||
|
@ -491,17 +491,17 @@ void ElfApplyPatches()
|
|||
wxString filename( wxsFormat( L"%8.8x", ElfCRC ) );
|
||||
|
||||
// if patches found the following status msg will be overwritten
|
||||
Console::SetTitle( wxsFormat( _("Game running [CRC=%s]"), filename.c_str() ) );
|
||||
Console.SetTitle( wxsFormat( _("Game running [CRC=%s]"), filename.c_str() ) );
|
||||
|
||||
if( !EmuConfig.EnablePatches ) return;
|
||||
|
||||
if(LoadPatch( filename ) != 0)
|
||||
{
|
||||
Console::WriteLn( "XML Loader returned an error. Trying to load a pnach..." );
|
||||
Console.WriteLn( "XML Loader returned an error. Trying to load a pnach..." );
|
||||
inifile_read( filename.ToAscii().data() );
|
||||
}
|
||||
else
|
||||
Console::WriteLn( "XML Loading success. Will not load from pnach..." );
|
||||
Console.WriteLn( "XML Loading success. Will not load from pnach..." );
|
||||
|
||||
applypatch( 0 );
|
||||
}
|
||||
|
@ -513,14 +513,14 @@ u32 loadElfCRC( const char* filename )
|
|||
|
||||
IsoFS_init( );
|
||||
|
||||
Console::Status("loadElfCRC: %s", filename);
|
||||
Console.Status("loadElfCRC: %s", filename);
|
||||
|
||||
int mylen = strlen( "cdromN:" );
|
||||
if ( IsoFS_findFile( filename + mylen, &toc ) == -1 ) return 0;
|
||||
|
||||
DevCon::Status( "loadElfFile: %d bytes", toc.fileSize );
|
||||
DevCon.Status( "loadElfFile: %d bytes", toc.fileSize );
|
||||
u32 crcval = ElfObject( wxString::FromAscii( filename ), toc.fileSize ).GetCRC();
|
||||
Console::Status( "loadElfFile: %s; CRC = %8.8X", filename, crcval );
|
||||
Console.Status( "loadElfFile: %s; CRC = %8.8X", filename, crcval );
|
||||
|
||||
return crcval;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ void loadElfFile(const wxString& filename)
|
|||
if( filename.IsEmpty() ) return;
|
||||
|
||||
s64 elfsize;
|
||||
Console::Status( wxsFormat( L"loadElfFile: %s", filename.c_str() ) );
|
||||
Console.Status( wxsFormat( L"loadElfFile: %s", filename.c_str() ) );
|
||||
|
||||
const wxCharBuffer buffer( filename.ToAscii() );
|
||||
const char* fnptr = buffer.data();
|
||||
|
@ -548,12 +548,12 @@ void loadElfFile(const wxString& filename)
|
|||
|
||||
if( !filename.StartsWith( L"cdrom0:" ) && !filename.StartsWith( L"cdrom1:" ) )
|
||||
{
|
||||
DevCon::WriteLn("Loading from a file (or non-cd image)");
|
||||
DevCon.WriteLn("Loading from a file (or non-cd image)");
|
||||
elfsize = Path::GetFileSize( filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
DevCon::WriteLn("Loading from a CD rom or CD image");
|
||||
DevCon.WriteLn("Loading from a CD rom or CD image");
|
||||
useCdvdSource = true;
|
||||
TocEntry toc;
|
||||
IsoFS_init( );
|
||||
|
@ -565,7 +565,7 @@ void loadElfFile(const wxString& filename)
|
|||
if( elfsize > 0xfffffff )
|
||||
throw Exception::BadStream( filename, wxLt("Illegal ELF file size, over 2GB!") );
|
||||
|
||||
Console::Status( wxsFormat(L"loadElfFile: %d", wxULongLong(elfsize).GetLo() ) );
|
||||
Console.Status( wxsFormat(L"loadElfFile: %d", wxULongLong(elfsize).GetLo() ) );
|
||||
if( elfsize == 0 )
|
||||
throw Exception::BadStream( filename, wxLt("Unexpected end of ELF file: ") );
|
||||
|
||||
|
@ -597,12 +597,12 @@ void loadElfFile(const wxString& filename)
|
|||
if( memcmp( "rom0:OSDSYS", (char*)PSM( i ), 11 ) == 0 )
|
||||
{
|
||||
strcpy( (char*)PSM( i ), fnptr );
|
||||
DevCon::Status( "loadElfFile: addr %x \"%s\" -> \"%s\"", i, "rom0:OSDSYS", fnptr );
|
||||
DevCon.Status( "loadElfFile: addr %x \"%s\" -> \"%s\"", i, "rom0:OSDSYS", fnptr );
|
||||
}
|
||||
}
|
||||
|
||||
ElfCRC = elfobj.GetCRC();
|
||||
Console::Status( wxsFormat( L"loadElfFile: %s; CRC = %8.8X", filename.c_str(), ElfCRC ) );
|
||||
Console.Status( wxsFormat( L"loadElfFile: %s; CRC = %8.8X", filename.c_str(), ElfCRC ) );
|
||||
|
||||
ElfApplyPatches();
|
||||
|
||||
|
@ -624,7 +624,7 @@ int GetPS2ElfName( wxString& name )
|
|||
|
||||
// check if the file exists
|
||||
if (IsoFS_findFile("SYSTEM.CNF;1", &tocEntry) != TRUE){
|
||||
Console::Status("GetElfName: SYSTEM.CNF not found; invalid cd image or no disc present.");
|
||||
Console.Status("GetElfName: SYSTEM.CNF not found; invalid cd image or no disc present.");
|
||||
return 0;//could not find; not a PS/PS2 cdvd
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ int GetPS2ElfName( wxString& name )
|
|||
if (pos==NULL){
|
||||
pos=strstr(buffer, "BOOT");
|
||||
if (pos==NULL) {
|
||||
Console::Error("PCSX2 Boot Error: This is not a Playstation or PS2 game!");
|
||||
Console.Error("PCSX2 Boot Error: This is not a Playstation or PS2 game!");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -664,7 +664,7 @@ int GetPS2ElfName( wxString& name )
|
|||
|
||||
u32 addr;
|
||||
|
||||
Console::WriteLn("Loading System.map...");
|
||||
Console.WriteLn("Loading System.map...");
|
||||
while (!feof(fp)) {
|
||||
fseek(fp, 8, SEEK_CUR);
|
||||
buffer[0] = '0'; buffer[1] = 'x';
|
||||
|
|
|
@ -80,7 +80,7 @@ using namespace std; // for min / max
|
|||
// If we have an infinity value, then Overflow has occured.
|
||||
#define checkOverflow(xReg, cFlagsToSet, shouldReturn) { \
|
||||
if ( ( xReg & ~0x80000000 ) == PosInfinity ) { \
|
||||
/*Console::Notice( "FPU OVERFLOW!: Changing to +/-Fmax!!!!!!!!!!!!\n" );*/ \
|
||||
/*Console.Notice( "FPU OVERFLOW!: Changing to +/-Fmax!!!!!!!!!!!!\n" );*/ \
|
||||
xReg = ( xReg & 0x80000000 ) | posFmax; \
|
||||
_ContVal_ |= cFlagsToSet; \
|
||||
if ( shouldReturn ) { return; } \
|
||||
|
@ -90,7 +90,7 @@ using namespace std; // for min / max
|
|||
// If we have a denormal value, then Underflow has occured.
|
||||
#define checkUnderflow(xReg, cFlagsToSet, shouldReturn) { \
|
||||
if ( ( ( xReg & 0x7F800000 ) == 0 ) && ( ( xReg & 0x007FFFFF ) != 0 ) ) { \
|
||||
/*Console::Notice( "FPU UNDERFLOW!: Changing to +/-0!!!!!!!!!!!!\n" );*/ \
|
||||
/*Console.Notice( "FPU UNDERFLOW!: Changing to +/-0!!!!!!!!!!!!\n" );*/ \
|
||||
xReg &= 0x80000000; \
|
||||
_ContVal_ |= cFlagsToSet; \
|
||||
if ( shouldReturn ) { return; } \
|
||||
|
@ -377,14 +377,14 @@ void SUBA_S() {
|
|||
void LWC1() {
|
||||
u32 addr;
|
||||
addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)(cpuRegs.code & 0xffff); // force sign extension to 32bit
|
||||
if (addr & 0x00000003) { Console::Error( "FPU (LWC1 Opcode): Invalid Unaligned Memory Address" ); return; } // Should signal an exception?
|
||||
if (addr & 0x00000003) { Console.Error( "FPU (LWC1 Opcode): Invalid Unaligned Memory Address" ); return; } // Should signal an exception?
|
||||
fpuRegs.fpr[_Rt_].UL = memRead32(addr);
|
||||
}
|
||||
|
||||
void SWC1() {
|
||||
u32 addr;
|
||||
addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)(cpuRegs.code & 0xffff); // force sign extension to 32bit
|
||||
if (addr & 0x00000003) { Console::Error( "FPU (SWC1 Opcode): Invalid Unaligned Memory Address" ); return; } // Should signal an exception?
|
||||
if (addr & 0x00000003) { Console.Error( "FPU (SWC1 Opcode): Invalid Unaligned Memory Address" ); return; } // Should signal an exception?
|
||||
memWrite32(addr, fpuRegs.fpr[_Rt_].UL);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void __fastcall ReadFIFO_page_5(u32 mem, u64 *out)
|
|||
VIF_LOG("ReadFIFO/VIF1, addr=0x%08X", mem);
|
||||
|
||||
if( vif1Regs->stat & (VIF1_STAT_INT|VIF1_STAT_VSS|VIF1_STAT_VIS|VIF1_STAT_VFS) )
|
||||
DevCon::Notice( "Reading from vif1 fifo when stalled" );
|
||||
DevCon.Notice( "Reading from vif1 fifo when stalled" );
|
||||
|
||||
if (vif1Regs->stat & VIF1_STAT_FDR)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ void __fastcall ReadFIFO_page_6(u32 mem, u64 *out)
|
|||
{
|
||||
jASSUME( (mem >= GIF_FIFO) && (mem < IPUout_FIFO) );
|
||||
|
||||
DevCon::Notice( "ReadFIFO/GIF, addr=0x%x", mem );
|
||||
DevCon.Notice( "ReadFIFO/GIF, addr=0x%x", mem );
|
||||
|
||||
//out[0] = psHu64(mem );
|
||||
//out[1] = psHu64(mem+8);
|
||||
|
@ -143,9 +143,9 @@ void __fastcall WriteFIFO_page_5(u32 mem, const mem128_t *value)
|
|||
psHu64(0x5008) = value[1];
|
||||
|
||||
if(vif1Regs->stat & VIF1_STAT_FDR)
|
||||
DevCon::Notice("writing to fifo when fdr is set!");
|
||||
DevCon.Notice("writing to fifo when fdr is set!");
|
||||
if( vif1Regs->stat & (VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS) )
|
||||
DevCon::Notice("writing to vif1 fifo when stalled");
|
||||
DevCon.Notice("writing to vif1 fifo when stalled");
|
||||
|
||||
vif1ch->qwc += 1;
|
||||
int ret = VIF1transfer((u32*)value, 4, 0);
|
||||
|
@ -187,7 +187,7 @@ void __fastcall WriteFIFO_page_7(u32 mem, const mem128_t *value)
|
|||
if( mem == 0 )
|
||||
{
|
||||
// Should this raise a PS2 exception or just ignore silently?
|
||||
Console::Notice( "WriteFIFO/IPUout (ignored)" );
|
||||
Console.Notice( "WriteFIFO/IPUout (ignored)" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ void __fastcall WriteFIFO_page_7(u32 mem, const mem128_t *value)
|
|||
//committing every 16 bytes
|
||||
while( FIFOto_write((u32*)value, 1) == 0 )
|
||||
{
|
||||
Console::WriteLn("IPU sleeping");
|
||||
Console.WriteLn("IPU sleeping");
|
||||
Threading::Timeslice();
|
||||
}
|
||||
}
|
||||
|
|
12
pcsx2/GS.cpp
12
pcsx2/GS.cpp
|
@ -79,7 +79,7 @@ void gsSetRegionMode( GS_RegionMode region )
|
|||
if( gsRegionMode == region ) return;
|
||||
|
||||
gsRegionMode = region;
|
||||
Console::WriteLn( "%s Display Mode Initialized.", (( gsRegionMode == Region_PAL ) ? "PAL" : "NTSC") );
|
||||
Console.WriteLn( "%s Display Mode Initialized.", (( gsRegionMode == Region_PAL ) ? "PAL" : "NTSC") );
|
||||
UpdateVSyncRate();
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void gsCSRwrite(u32 value)
|
|||
else if( value & 0x100 ) // FLUSH
|
||||
{
|
||||
// Our emulated GS has no FIFO, but if it did, it would flush it here...
|
||||
//Console::WriteLn("GS_CSR FLUSH GS fifo: %x (CSRr=%x)", value, GSCSRr);
|
||||
//Console.WriteLn("GS_CSR FLUSH GS fifo: %x (CSRr=%x)", value, GSCSRr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ void gsSyncLimiterLostTime( s32 deltaTime )
|
|||
|
||||
if( !m_StrictSkipping ) return;
|
||||
|
||||
//Console::WriteLn("LostTime on the EE!");
|
||||
//Console.WriteLn("LostTime on the EE!");
|
||||
|
||||
mtgsThread.SendSimplePacket(
|
||||
GS_RINGTYPE_STARTTIME,
|
||||
|
@ -414,7 +414,7 @@ __forceinline void gsFrameSkip( bool forceskip )
|
|||
{
|
||||
if( !FramesToSkip )
|
||||
{
|
||||
//Console::Status( "- Skipping some VUs!" );
|
||||
//Console.Status( "- Skipping some VUs!" );
|
||||
|
||||
GSsetFrameSkip( 1 );
|
||||
FramesToRender = noSkipFrames;
|
||||
|
@ -482,7 +482,7 @@ __forceinline void gsFrameSkip( bool forceskip )
|
|||
|
||||
if( sSlowDeltaTime > (m_iSlowTicks + ((s64)GetTickFrequency() / 4)) )
|
||||
{
|
||||
//Console::Status( "Frameskip couldn't skip enough -- had to lose some time!" );
|
||||
//Console.Status( "Frameskip couldn't skip enough -- had to lose some time!" );
|
||||
m_iSlowStart = iEnd - m_iSlowTicks;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ __forceinline void gsFrameSkip( bool forceskip )
|
|||
return;
|
||||
}
|
||||
|
||||
//Console::WriteLn( "Consecutive Frames -- Lateness: %d", (int)( sSlowDeltaTime / m_iSlowTicks ) );
|
||||
//Console.WriteLn( "Consecutive Frames -- Lateness: %d", (int)( sSlowDeltaTime / m_iSlowTicks ) );
|
||||
|
||||
// -- Consecutive frames section --
|
||||
// Force-render consecutive frames without skipping.
|
||||
|
|
|
@ -128,6 +128,7 @@ public:
|
|||
virtual ~mtgsThreadObject() throw();
|
||||
|
||||
void Start();
|
||||
void OnStart();
|
||||
void PollStatus();
|
||||
|
||||
// Waits for the GS to empty out the entire ring buffer contents.
|
||||
|
@ -166,7 +167,7 @@ protected:
|
|||
// Used internally by SendSimplePacket type functions
|
||||
uint _PrepForSimplePacket();
|
||||
void _FinishSimplePacket( uint future_writepos );
|
||||
sptr ExecuteTask();
|
||||
void ExecuteTask();
|
||||
};
|
||||
|
||||
PCSX2_ALIGNED16_EXTERN( mtgsThreadObject mtgsThread );
|
||||
|
|
|
@ -72,8 +72,8 @@ void SaveGSState(const wxString& file)
|
|||
{
|
||||
if( g_SaveGSStream ) return;
|
||||
|
||||
Console::WriteLn( "Saving GS State..." );
|
||||
Console::WriteLn( wxsFormat( L"\t%s", file.c_str() ) );
|
||||
Console.WriteLn( "Saving GS State..." );
|
||||
Console.WriteLn( wxsFormat( L"\t%s", file.c_str() ) );
|
||||
|
||||
SafeArray<u8> buf;
|
||||
g_fGSSave = new memSavingState( buf );
|
||||
|
@ -88,7 +88,7 @@ void LoadGSState(const wxString& file)
|
|||
{
|
||||
int ret;
|
||||
|
||||
Console::Status( "Loading GS State..." );
|
||||
Console.Status( "Loading GS State..." );
|
||||
|
||||
wxString src( file );
|
||||
|
||||
|
@ -260,7 +260,7 @@ void vSyncDebugStuff( uint frame )
|
|||
if( --g_nLeftGSFrames <= 0 ) {
|
||||
safe_delete( g_fGSSave );
|
||||
g_SaveGSStream = 0;
|
||||
Console::WriteLn("Done saving GS stream");
|
||||
Console.WriteLn("Done saving GS stream");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@ __forceinline void gsInterrupt()
|
|||
|
||||
if (!(gif->chcr.STR))
|
||||
{
|
||||
//Console::WriteLn("Eh? why are you still interrupting! chcr %x, qwc %x, done = %x", gif->chcr._u32, gif->qwc, done);
|
||||
//Console.WriteLn("Eh? why are you still interrupting! chcr %x, qwc %x, done = %x", gif->chcr._u32, gif->qwc, done);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ __forceinline void gsInterrupt()
|
|||
{
|
||||
if (!dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
Console::Notice("gs dma masked, re-scheduling...");
|
||||
Console.Notice("gs dma masked, re-scheduling...");
|
||||
// re-raise the int shortly in the future
|
||||
CPU_INT( 2, 64 );
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ int _GIFchain()
|
|||
//must increment madr and clear qwc, else it loops
|
||||
gif->madr += gif->qwc * 16;
|
||||
gif->qwc = 0;
|
||||
Console::Notice( "Hackfix - NULL GIFchain" );
|
||||
Console.Notice( "Hackfix - NULL GIFchain" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -180,13 +180,13 @@ void GIFdma()
|
|||
|
||||
if (gifRegs->ctrl.PSE) // temporarily stop
|
||||
{
|
||||
Console::WriteLn("Gif dma temp paused?");
|
||||
Console.WriteLn("Gif dma temp paused?");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dmacRegs->ctrl.STD == STD_GIF) && (prevcycles != 0))
|
||||
{
|
||||
Console::WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3, gif->madr, psHu32(DMAC_STADR));
|
||||
Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3, gif->madr, psHu32(DMAC_STADR));
|
||||
|
||||
if ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR)
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ void GIFdma()
|
|||
|
||||
if ((dmacRegs->ctrl.STD == STD_GIF) && (gif->chcr.MOD == NORMAL_MODE))
|
||||
{
|
||||
Console::WriteLn("DMA Stall Control on GIF normal");
|
||||
Console.WriteLn("DMA Stall Control on GIF normal");
|
||||
}
|
||||
|
||||
GIFchain(); //Transfers the data set by the switch
|
||||
|
@ -262,7 +262,7 @@ void GIFdma()
|
|||
if (!gspath3done && ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) && (id == 4))
|
||||
{
|
||||
// stalled
|
||||
Console::WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR));
|
||||
Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR));
|
||||
prevcycles = gscycles;
|
||||
gif->tadr -= 16;
|
||||
hwDmacIrq(DMAC_STALL_SIS);
|
||||
|
@ -314,7 +314,7 @@ void dmaGIF()
|
|||
|
||||
if (dmacRegs->ctrl.MFD == MFD_GIF) // GIF MFIFO
|
||||
{
|
||||
//Console::WriteLn("GIF MFIFO");
|
||||
//Console.WriteLn("GIF MFIFO");
|
||||
gifMFIFOInterrupt();
|
||||
return;
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ void mfifoGIFtransfer(int qwc)
|
|||
{
|
||||
if (gif->tadr == spr0->madr)
|
||||
{
|
||||
//if( gifqwc > 1 ) DevCon::WriteLn("gif mfifo tadr==madr but qwc = %d", gifqwc);
|
||||
//if( gifqwc > 1 ) DevCon.WriteLn("gif mfifo tadr==madr but qwc = %d", gifqwc);
|
||||
hwDmacIrq(DMAC_MFIFO_EMPTY);
|
||||
gifstate |= GIF_STATE_EMPTY;
|
||||
return;
|
||||
|
@ -498,7 +498,7 @@ void mfifoGIFtransfer(int qwc)
|
|||
FreezeRegs(1);
|
||||
if (mfifoGIFchain() == -1)
|
||||
{
|
||||
Console::WriteLn("GIF dmaChain error size=%d, madr=%lx, tadr=%lx", gif->qwc, gif->madr, gif->tadr);
|
||||
Console.WriteLn("GIF dmaChain error size=%d, madr=%lx, tadr=%lx", gif->qwc, gif->madr, gif->tadr);
|
||||
gifstate = GIF_STATE_STALL;
|
||||
}
|
||||
FreezeRegs(0);
|
||||
|
@ -522,7 +522,7 @@ void gifMFIFOInterrupt()
|
|||
|
||||
if (!(gif->chcr.STR))
|
||||
{
|
||||
Console::WriteLn("WTF GIFMFIFO");
|
||||
Console.WriteLn("WTF GIFMFIFO");
|
||||
cpuRegs.interrupt &= ~(1 << 11);
|
||||
return;
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ void gifMFIFOInterrupt()
|
|||
{
|
||||
if (gifqwc <= 0)
|
||||
{
|
||||
//Console::WriteLn("Empty");
|
||||
//Console.WriteLn("Empty");
|
||||
gifstate |= GIF_STATE_EMPTY;
|
||||
gifRegs->stat.IMT = 0; // OPH=0 | APATH=0
|
||||
hwDmacIrq(DMAC_MFIFO_EMPTY);
|
||||
|
@ -551,11 +551,11 @@ void gifMFIFOInterrupt()
|
|||
#ifdef PCSX2_DEVBUILD
|
||||
if (gifstate == GIF_STATE_READY || gif->qwc > 0)
|
||||
{
|
||||
Console::Error("gifMFIFO Panic > Shouldn't go here!");
|
||||
Console.Error("gifMFIFO Panic > Shouldn't go here!");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//if(gifqwc > 0) Console::WriteLn("GIF MFIFO ending with stuff in it %x", gifqwc);
|
||||
//if(gifqwc > 0) Console.WriteLn("GIF MFIFO ending with stuff in it %x", gifqwc);
|
||||
if (!gifmfifoirq) gifqwc = 0;
|
||||
|
||||
gspath3done = false;
|
||||
|
|
|
@ -75,7 +75,7 @@ __forceinline void intcInterrupt()
|
|||
if ((cpuRegs.CP0.n.Status.val & 0x400) != 0x400) return;
|
||||
|
||||
if ((psHu32(INTC_STAT)) == 0) {
|
||||
DevCon::Notice("*PCSX2*: intcInterrupt already cleared");
|
||||
DevCon.Notice("*PCSX2*: intcInterrupt already cleared");
|
||||
return;
|
||||
}
|
||||
if ((psHu32(INTC_STAT) & psHu32(INTC_MASK)) == 0) return;
|
||||
|
@ -188,7 +188,7 @@ bool hwDmacSrcChainWithStack(DMACh *dma, int id) {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
Console::Notice("Call Stack Overflow (report if it fixes/breaks anything)");
|
||||
Console.Notice("Call Stack Overflow (report if it fixes/breaks anything)");
|
||||
return true; //Return done
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ bool hwDmacSrcChainWithStack(DMACh *dma, int id) {
|
|||
return true; //End Transfer
|
||||
}
|
||||
default: { //Else if ASR1 and ASR0 are messed up
|
||||
//Console::Error("TAG_RET: ASR 1 & 0 == 1. This shouldn't happen!");
|
||||
//Console.Error("TAG_RET: ASR 1 & 0 == 1. This shouldn't happen!");
|
||||
//dma->tadr += 16; //Clear tag address - Kills Klonoa 2
|
||||
return true; //End Transfer
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ static __forceinline u8* dmaGetAddr(u32 mem)
|
|||
mem &= ~0xf;
|
||||
|
||||
if( (mem&0xffff0000) == 0x50000000 ) {// reserved scratch pad mem
|
||||
Console::WriteLn("dmaGetAddr: reserved scratch pad mem");
|
||||
Console.WriteLn("dmaGetAddr: reserved scratch pad mem");
|
||||
return NULL;//(u8*)&PS2MEM_SCRATCH[(mem) & 0x3ff0];
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ static __forceinline u8* dmaGetAddr(u32 mem)
|
|||
// do manual LUT since IPU/SPR seems to use addrs 0x3000xxxx quite often
|
||||
// linux doesn't suffer from this because it has better vm support
|
||||
if( memLUT[ (p-PS2MEM_BASE)>>12 ].aPFNs == NULL ) {
|
||||
Console::WriteLn("dmaGetAddr: memLUT PFN warning");
|
||||
Console.WriteLn("dmaGetAddr: memLUT PFN warning");
|
||||
return NULL;//p;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ static __forceinline void *dmaGetAddr(u32 addr) {
|
|||
|
||||
ptr = (u8*)vtlb_GetPhyPtr(addr&0x1FFFFFF0);
|
||||
if (ptr == NULL) {
|
||||
Console::Error( "*PCSX2*: DMA error: %8.8x", addr);
|
||||
Console.Error( "*PCSX2*: DMA error: %8.8x", addr);
|
||||
return NULL;
|
||||
}
|
||||
return ptr;
|
||||
|
|
|
@ -55,7 +55,7 @@ __forceinline mem8_t hwRead8(u32 mem)
|
|||
u8 ret;
|
||||
|
||||
if( mem >= IPU_CMD && mem < D0_CHCR )
|
||||
DevCon::Notice("Unexpected hwRead8 from 0x%x", mem);
|
||||
DevCon.Notice("Unexpected hwRead8 from 0x%x", mem);
|
||||
|
||||
switch (mem)
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ __forceinline mem16_t hwRead16(u32 mem)
|
|||
u16 ret;
|
||||
|
||||
if( mem >= IPU_CMD && mem < D0_CHCR )
|
||||
Console::Notice("Unexpected hwRead16 from 0x%x", mem);
|
||||
Console.Notice("Unexpected hwRead16 from 0x%x", mem);
|
||||
|
||||
switch (mem)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ static __forceinline void DmaExec8( void (*func)(), u32 mem, u8 value )
|
|||
psHu8(mem) = (u8)value;
|
||||
if ((psHu8(mem) & 0x1) && dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
/*Console::WriteLn("Running DMA 8 %x", psHu32(mem & ~0x1));*/
|
||||
/*Console.WriteLn("Running DMA 8 %x", psHu32(mem & ~0x1));*/
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ static __forceinline void DmaExec16( void (*func)(), u32 mem, u16 value )
|
|||
psHu16(mem) = (u16)value;
|
||||
if ((psHu16(mem) & 0x100) && dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
//Console::WriteLn("16bit DMA Start");
|
||||
//Console.WriteLn("16bit DMA Start");
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
}
|
||||
|
||||
if( mem >= IPU_CMD && mem < D0_CHCR )
|
||||
DevCon::Notice( "hwWrite8 to 0x%x = 0x%x", mem, value );
|
||||
DevCon.Notice( "hwWrite8 to 0x%x = 0x%x", mem, value );
|
||||
|
||||
switch (mem) {
|
||||
case RCNT0_COUNT: rcntWcount(0, value); break;
|
||||
|
@ -182,7 +182,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
( value == '\n' && sio_count != 0 ))
|
||||
{
|
||||
sio_buffer[sio_count] = 0;
|
||||
Console::WriteLn( Color_Cyan, sio_buffer );
|
||||
Console.WriteLn( Color_Cyan, sio_buffer );
|
||||
sio_count = 0;
|
||||
}
|
||||
else if( value != '\n' )
|
||||
|
@ -199,7 +199,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("VIF0dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x1;
|
||||
}
|
||||
DmaExec8(dmaVIF0, mem, value);
|
||||
|
@ -209,7 +209,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("VIF1dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x2;
|
||||
}
|
||||
if(value & 0x1) vif1.done = false; //This must be done here! some games (ala Crash of the Titans) pause the dma to start MFIFO
|
||||
|
@ -220,7 +220,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("GSdma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit GIF DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit GIF DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x4;
|
||||
}
|
||||
DmaExec8(dmaGIF, mem, value);
|
||||
|
@ -230,7 +230,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("IPU0dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x8;
|
||||
}
|
||||
DmaExec8(dmaIPU0, mem, value);
|
||||
|
@ -240,7 +240,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("IPU1dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x10;
|
||||
}
|
||||
DmaExec8(dmaIPU1, mem, value);
|
||||
|
@ -251,7 +251,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
// if (value == 0) psxSu32(0x30) = 0x40000;
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x20;
|
||||
}
|
||||
DmaExec8(dmaSIF0, mem, value);
|
||||
|
@ -261,7 +261,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("SIF1dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x40;
|
||||
}
|
||||
DmaExec8(dmaSIF1, mem, value);
|
||||
|
@ -271,7 +271,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("SIF2dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x80;
|
||||
}
|
||||
DmaExec8(dmaSIF2, mem, value);
|
||||
|
@ -281,7 +281,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("fromSPRdma8 EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x100;
|
||||
}
|
||||
DmaExec8(dmaSPR0, mem, value);
|
||||
|
@ -291,7 +291,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
DMA_LOG("toSPRdma8 EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x1) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("8 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("8 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x200;
|
||||
}
|
||||
DmaExec8(dmaSPR1, mem, value);
|
||||
|
@ -350,7 +350,7 @@ void hwWrite8(u32 mem, u8 value)
|
|||
__forceinline void hwWrite16(u32 mem, u16 value)
|
||||
{
|
||||
if( mem >= IPU_CMD && mem < D0_CHCR )
|
||||
Console::Notice( "hwWrite16 to %x", mem );
|
||||
Console.Notice( "hwWrite16 to %x", mem );
|
||||
|
||||
switch(mem)
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("VIF0dma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x1;
|
||||
}
|
||||
DmaExec16(dmaVIF0, mem, value);
|
||||
|
@ -386,7 +386,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("VIF1dma CHCR %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x2;
|
||||
}
|
||||
if(value & 0x100) vif1.done = false; //This must be done here! some games (ala Crash of the Titans) pause the dma to start MFIFO
|
||||
|
@ -430,7 +430,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("0x%8.8x hwWrite32: GSdma %lx", cpuRegs.cycle, value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit GIF DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit GIF DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x4;
|
||||
}
|
||||
DmaExec16(dmaGIF, mem, value);
|
||||
|
@ -472,7 +472,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("IPU0dma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x8;
|
||||
}
|
||||
DmaExec16(dmaIPU0, mem, value);
|
||||
|
@ -504,7 +504,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("IPU1dma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x10;
|
||||
}
|
||||
DmaExec16(dmaIPU1, mem, value);
|
||||
|
@ -536,7 +536,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
// if (value == 0) psxSu32(0x30) = 0x40000;
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x20;
|
||||
}
|
||||
DmaExec16(dmaSIF0, mem, value);
|
||||
|
@ -550,7 +550,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("SIF1dma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x40;
|
||||
}
|
||||
DmaExec16(dmaSIF1, mem, value);
|
||||
|
@ -582,7 +582,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("SIF2dma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x80;
|
||||
}
|
||||
DmaExec16(dmaSIF2, mem, value);
|
||||
|
@ -596,7 +596,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("fromSPRdma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x100;
|
||||
}
|
||||
DmaExec16(dmaSPR0, mem, value);
|
||||
|
@ -606,7 +606,7 @@ __forceinline void hwWrite16(u32 mem, u16 value)
|
|||
DMA_LOG("toSPRdma %lx", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("16 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("16 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x200;
|
||||
}
|
||||
DmaExec16(dmaSPR1, mem, value);
|
||||
|
@ -744,7 +744,7 @@ void __fastcall hwWrite32_page_03( u32 mem, u32 value )
|
|||
break;
|
||||
|
||||
case GIF_STAT: // stat is readonly
|
||||
DevCon::Notice("*PCSX2* GIFSTAT write value = 0x%x (readonly, ignored)", value);
|
||||
DevCon.Notice("*PCSX2* GIFSTAT write value = 0x%x (readonly, ignored)", value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -763,7 +763,7 @@ void __fastcall hwWrite32_page_0B( u32 mem, u32 value )
|
|||
DMA_LOG("IPU0dma EXECUTE, value=0x%x\n", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit IPU0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x8;
|
||||
}
|
||||
DmaExec(dmaIPU0, mem, value);
|
||||
|
@ -780,7 +780,7 @@ void __fastcall hwWrite32_page_0B( u32 mem, u32 value )
|
|||
DMA_LOG("IPU1dma EXECUTE, value=0x%x\n", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit IPU1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x10;
|
||||
}
|
||||
DmaExec(dmaIPU1, mem, value);
|
||||
|
@ -931,7 +931,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit VIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x1;
|
||||
}
|
||||
|
||||
|
@ -944,7 +944,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit VIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x2;
|
||||
}
|
||||
|
||||
|
@ -968,7 +968,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
DMA_LOG("GIFdma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit GIF DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit GIF DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x4;
|
||||
}
|
||||
DmaExec(dmaGIF, mem, value);
|
||||
|
@ -987,7 +987,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
//if (value == 0) psxSu32(0x30) = 0x40000;
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit SIF0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x20;
|
||||
}
|
||||
DmaExec(dmaSIF0, mem, value);
|
||||
|
@ -997,7 +997,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
DMA_LOG("SIF1dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit SIF1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x40;
|
||||
}
|
||||
DmaExec(dmaSIF1, mem, value);
|
||||
|
@ -1012,7 +1012,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
DMA_LOG("SIF2dma EXECUTE, value=0x%x", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit SIF2 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x80;
|
||||
}
|
||||
DmaExec(dmaSIF2, mem, value);
|
||||
|
@ -1022,7 +1022,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
DMA_LOG("SPR0dma EXECUTE (fromSPR), value=0x%x", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit SPR0 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x100;
|
||||
}
|
||||
DmaExec(dmaSPR0, mem, value);
|
||||
|
@ -1032,7 +1032,7 @@ void __fastcall hwWrite32_generic( u32 mem, u32 value )
|
|||
DMA_LOG("SPR1dma EXECUTE (toSPR), value=0x%x", value);
|
||||
if ((value & 0x100) && !dmacRegs->ctrl.DMAE)
|
||||
{
|
||||
DevCon::Notice("32 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
DevCon.Notice("32 bit SPR1 DMA Start while DMAC Disabled\n");
|
||||
QueuedDMA |= 0x200;
|
||||
}
|
||||
DmaExec(dmaSPR1, mem, value);
|
||||
|
@ -1082,7 +1082,7 @@ void __fastcall hwWrite64_page_03( u32 mem, const mem64_t* srcval )
|
|||
switch (mem)
|
||||
{
|
||||
case GIF_CTRL:
|
||||
DevCon::Status("GIF_CTRL write 64", value);
|
||||
DevCon.Status("GIF_CTRL write 64", value);
|
||||
psHu32(mem) = value & 0x8;
|
||||
if(value & 0x1)
|
||||
gsGIFReset();
|
||||
|
@ -1100,7 +1100,7 @@ void __fastcall hwWrite64_page_03( u32 mem, const mem64_t* srcval )
|
|||
// set/clear bits 0 and 2 as per the GIF_MODE value.
|
||||
const u32 bitmask = GIF_MODE_M3R | GIF_MODE_IMT;
|
||||
|
||||
Console::Status("GIFMODE64 %x", value);
|
||||
Console.Status("GIFMODE64 %x", value);
|
||||
|
||||
psHu64(GIF_MODE) = value;
|
||||
psHu32(GIF_STAT) &= ~bitmask;
|
||||
|
|
|
@ -164,24 +164,24 @@ void ipuShutdown()
|
|||
|
||||
void ReportIPU()
|
||||
{
|
||||
Console::WriteLn("g_nDMATransfer = 0x%x.", g_nDMATransfer._u32);
|
||||
Console::WriteLn("FIreadpos = 0x%x, FIwritepos = 0x%x.", FIreadpos, FIwritepos);
|
||||
Console::WriteLn("fifo_input = 0x%x.", fifo_input);
|
||||
Console::WriteLn("FOreadpos = 0x%x, FOwritepos = 0x%x.", FOreadpos, FOwritepos);
|
||||
Console::WriteLn("fifo_output = 0x%x.", fifo_output);
|
||||
Console::WriteLn("g_BP = 0x%x.", g_BP);
|
||||
Console::WriteLn("niq = 0x%x, iq = 0x%x.", niq, iq);
|
||||
Console::WriteLn("vqclut = 0x%x.", vqclut);
|
||||
Console::WriteLn("s_thresh = 0x%x.", s_thresh);
|
||||
Console::WriteLn("coded_block_pattern = 0x%x.", coded_block_pattern);
|
||||
Console::WriteLn("g_decoder = 0x%x.", g_decoder);
|
||||
Console::WriteLn("mpeg2_scan_norm = 0x%x, mpeg2_scan_alt = 0x%x.", mpeg2_scan_norm, mpeg2_scan_alt);
|
||||
Console::WriteLn("g_nCmdPos = 0x%x.", g_nCmdPos);
|
||||
Console::WriteLn("g_nCmdIndex = 0x%x.", g_nCmdIndex);
|
||||
Console::WriteLn("ipuCurCmd = 0x%x.", ipuCurCmd);
|
||||
Console::WriteLn("_readbits = 0x%x.", _readbits);
|
||||
Console::WriteLn("temp will equal 0x%x.", readbits - _readbits);
|
||||
Console::WriteLn("");
|
||||
Console.WriteLn("g_nDMATransfer = 0x%x.", g_nDMATransfer._u32);
|
||||
Console.WriteLn("FIreadpos = 0x%x, FIwritepos = 0x%x.", FIreadpos, FIwritepos);
|
||||
Console.WriteLn("fifo_input = 0x%x.", fifo_input);
|
||||
Console.WriteLn("FOreadpos = 0x%x, FOwritepos = 0x%x.", FOreadpos, FOwritepos);
|
||||
Console.WriteLn("fifo_output = 0x%x.", fifo_output);
|
||||
Console.WriteLn("g_BP = 0x%x.", g_BP);
|
||||
Console.WriteLn("niq = 0x%x, iq = 0x%x.", niq, iq);
|
||||
Console.WriteLn("vqclut = 0x%x.", vqclut);
|
||||
Console.WriteLn("s_thresh = 0x%x.", s_thresh);
|
||||
Console.WriteLn("coded_block_pattern = 0x%x.", coded_block_pattern);
|
||||
Console.WriteLn("g_decoder = 0x%x.", g_decoder);
|
||||
Console.WriteLn("mpeg2_scan_norm = 0x%x, mpeg2_scan_alt = 0x%x.", mpeg2_scan_norm, mpeg2_scan_alt);
|
||||
Console.WriteLn("g_nCmdPos = 0x%x.", g_nCmdPos);
|
||||
Console.WriteLn("g_nCmdIndex = 0x%x.", g_nCmdIndex);
|
||||
Console.WriteLn("ipuCurCmd = 0x%x.", ipuCurCmd);
|
||||
Console.WriteLn("_readbits = 0x%x.", _readbits);
|
||||
Console.WriteLn("temp will equal 0x%x.", readbits - _readbits);
|
||||
Console.WriteLn("");
|
||||
}
|
||||
// fixme - ipuFreeze looks fairly broken. Should probably take a closer look at some point.
|
||||
|
||||
|
@ -284,11 +284,11 @@ __forceinline u64 ipuRead64(u32 mem)
|
|||
break;
|
||||
|
||||
ipucase(IPU_CTRL):
|
||||
DevCon::Notice("reading 64bit IPU ctrl");
|
||||
DevCon.Notice("reading 64bit IPU ctrl");
|
||||
break;
|
||||
|
||||
ipucase(IPU_BP):
|
||||
DevCon::Notice("reading 64bit IPU top");
|
||||
DevCon.Notice("reading 64bit IPU top");
|
||||
break;
|
||||
|
||||
ipucase(IPU_TOP): // IPU_TOP
|
||||
|
@ -346,7 +346,7 @@ __forceinline void ipuWrite32(u32 mem, u32 value)
|
|||
ipuRegs->ctrl._u32 = (value & 0x47f30000) | (ipuRegs->ctrl._u32 & 0x8000ffff);
|
||||
if (ipuRegs->ctrl.IDP == 3)
|
||||
{
|
||||
Console::WriteLn("IPU Invalid Intra DC Precision, switching to 9 bits");
|
||||
Console.WriteLn("IPU Invalid Intra DC Precision, switching to 9 bits");
|
||||
ipuRegs->ctrl.IDP = 1;
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ static BOOL __fastcall ipuCSC(u32 val)
|
|||
|
||||
if (csc.DTE) IPU_LOG("Dithering enabled.");
|
||||
|
||||
//Console::WriteLn("CSC");
|
||||
//Console.WriteLn("CSC");
|
||||
for (;g_nCmdIndex < (int)csc.MBC; g_nCmdIndex++)
|
||||
{
|
||||
|
||||
|
@ -773,7 +773,7 @@ __forceinline void IPU_INTERRUPT() //dma
|
|||
void IPUCMD_WRITE(u32 val)
|
||||
{
|
||||
// don't process anything if currently busy
|
||||
if (ipuRegs->ctrl.BUSY) Console::WriteLn("IPU BUSY!"); // wait for thread
|
||||
if (ipuRegs->ctrl.BUSY) Console.WriteLn("IPU BUSY!"); // wait for thread
|
||||
|
||||
ipuRegs->ctrl.ECD = 0;
|
||||
ipuRegs->ctrl.SCD = 0; //clear ECD/SCD
|
||||
|
@ -969,7 +969,7 @@ void IPUWorker()
|
|||
return;
|
||||
|
||||
default:
|
||||
Console::WriteLn("Unknown IPU command: %x", ipuRegs->cmd.CMD);
|
||||
Console.WriteLn("Unknown IPU command: %x", ipuRegs->cmd.CMD);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1284,7 @@ void __fastcall ipu_dither(const macroblock_rgb32* rgb32, macroblock_rgb16 *rgb1
|
|||
|
||||
void __fastcall ipu_vq(macroblock_rgb16 *rgb16, u8* indx4)
|
||||
{
|
||||
Console::Error("IPU: VQ not implemented");
|
||||
Console.Error("IPU: VQ not implemented");
|
||||
}
|
||||
|
||||
void __fastcall ipu_copy(const macroblock_8 *mb8, macroblock_16 *mb16)
|
||||
|
@ -1361,7 +1361,7 @@ static __forceinline bool IPU1chain(int &totalqwc)
|
|||
|
||||
if (pMem == NULL)
|
||||
{
|
||||
Console::Error("ipu1dma NULL!");
|
||||
Console.Error("ipu1dma NULL!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ static __forceinline bool ipuDmacSrcChain(DMACh *tag, u32 *ptag)
|
|||
break;
|
||||
|
||||
default:
|
||||
Console::Error("IPU ERROR: different transfer mode!, Please report to PCSX2 Team");
|
||||
Console.Error("IPU ERROR: different transfer mode!, Please report to PCSX2 Team");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ int IPU1dma()
|
|||
//Check TIE bit of CHCR and IRQ bit of tag
|
||||
if (ipu1dma->chcr.TIE && (g_nDMATransfer.DOTIE1))
|
||||
{
|
||||
Console::WriteLn("IPU1 TIE");
|
||||
Console.WriteLn("IPU1 TIE");
|
||||
|
||||
IPU_INT_TO(totalqwc * BIAS);
|
||||
g_nDMATransfer.TIE1 = 1;
|
||||
|
@ -1517,7 +1517,7 @@ int IPU1dma()
|
|||
// Normal Mode & qwc is finished
|
||||
if ((ipu1dma->chcr.MOD == NORMAL_MODE) && (ipu1dma->qwc == 0))
|
||||
{
|
||||
//Console::WriteLn("ipu1 normal empty qwc?");
|
||||
//Console.WriteLn("ipu1 normal empty qwc?");
|
||||
return totalqwc;
|
||||
}
|
||||
|
||||
|
@ -1553,7 +1553,7 @@ int IPU1dma()
|
|||
//Check TIE bit of CHCR and IRQ bit of tag
|
||||
if (g_nDMATransfer.DOTIE1)
|
||||
{
|
||||
Console::WriteLn("IPU1 TIE");
|
||||
Console.WriteLn("IPU1 TIE");
|
||||
|
||||
if (IPU1chain(totalqwc)) return totalqwc;
|
||||
|
||||
|
@ -1619,7 +1619,7 @@ int FIFOfrom_write(const u32 *value, int size)
|
|||
|
||||
ipuRegs->ctrl.OFC += firsttrans;
|
||||
IPU0dma();
|
||||
//Console::WriteLn("Written %d qwords, %d", firsttrans,ipuRegs->ctrl.OFC);
|
||||
//Console.WriteLn("Written %d qwords, %d", firsttrans,ipuRegs->ctrl.OFC);
|
||||
|
||||
return firsttrans;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ static std::string disOut;
|
|||
static void debugI()
|
||||
{
|
||||
if( !IsDevBuild ) return;
|
||||
if( cpuRegs.GPR.n.r0.UD[0] || cpuRegs.GPR.n.r0.UD[1] ) Console::Error("R0 is not zero!!!!");
|
||||
if( cpuRegs.GPR.n.r0.UD[0] || cpuRegs.GPR.n.r0.UD[1] ) Console.Error("R0 is not zero!!!!");
|
||||
}
|
||||
|
||||
//long int runs=0;
|
||||
|
@ -51,7 +51,7 @@ static void execI()
|
|||
//runs++;
|
||||
//if (runs > 1599999999){ //leave some time to startup the testgame
|
||||
// if (opcode.Name[0] == 'L') { //find all opcodes beginning with "L"
|
||||
// Console::WriteLn ("Load %s", opcode.Name);
|
||||
// Console.WriteLn ("Load %s", opcode.Name);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static void __fastcall doBranch( u32 target )
|
|||
|
||||
void __fastcall intDoBranch(u32 target)
|
||||
{
|
||||
//Console::WriteLn("Interpreter Branch ");
|
||||
//Console.WriteLn("Interpreter Branch ");
|
||||
_doBranch_shared( target );
|
||||
|
||||
if( Cpu == &intCpu )
|
||||
|
|
|
@ -178,7 +178,7 @@ void bios_write() // 0x35/0x03
|
|||
// fixme: This should use %s with a length parameter (but I forget the exact syntax
|
||||
while (a2 > 0)
|
||||
{
|
||||
Console::Write("%c", *ptr++);
|
||||
Console.Write("%c", *ptr++);
|
||||
a2--;
|
||||
}
|
||||
}
|
||||
|
@ -291,19 +291,19 @@ _start:
|
|||
// Note: Use Read to obtain a write pointer here, since we're just writing back the
|
||||
// temp buffer we saved earlier.
|
||||
memcpy( (void*)iopVirtMemR<void>(sp), save, 4*4);
|
||||
Console::Write( Color_Cyan, "%s", tmp);
|
||||
Console.Write( Color_Cyan, "%s", tmp);
|
||||
pc0 = ra;
|
||||
}
|
||||
|
||||
void bios_putchar () // 3d
|
||||
{
|
||||
Console::Write( Color_Cyan, "%c", a0 );
|
||||
Console.Write( Color_Cyan, "%c", a0 );
|
||||
pc0 = ra;
|
||||
}
|
||||
|
||||
void bios_puts () // 3e/3f
|
||||
{
|
||||
Console::Write( Color_Cyan, Ra0 );
|
||||
Console.Write( Color_Cyan, Ra0 );
|
||||
pc0 = ra;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ static void __fastcall _rcntTestTarget( int i )
|
|||
psxCounters[i].count -= psxCounters[i].target;
|
||||
if(!(psxCounters[i].mode & 0x40))
|
||||
{
|
||||
Console::WriteLn("Counter %x repeat intr not set on zero ret, ignoring target", i);
|
||||
Console.WriteLn("Counter %x repeat intr not set on zero ret, ignoring target", i);
|
||||
psxCounters[i].target |= IOPCNT_FUTURE_TARGET;
|
||||
}
|
||||
} else psxCounters[i].target |= IOPCNT_FUTURE_TARGET;
|
||||
|
@ -637,7 +637,7 @@ __forceinline void psxRcntWmode32( int index, u32 value )
|
|||
// Need to set a rate and target
|
||||
if((counter.mode & 0x7) == 0x7 || (counter.mode & 0x7) == 0x1)
|
||||
{
|
||||
Console::WriteLn( "Gate set on IOP Counter %d, disabling", index );
|
||||
Console.WriteLn( "Gate set on IOP Counter %d, disabling", index );
|
||||
counter.mode |= IOPCNT_STOPPED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ static void __fastcall psxDmaGeneric(u32 madr, u32 bcr, u32 chcr, u32 spuCore, _
|
|||
{
|
||||
const char dmaNum = spuCore ? '7' : '4';
|
||||
|
||||
/*if (chcr & 0x400) DevCon::Status("SPU 2 DMA %c linked list chain mode! chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);
|
||||
if (chcr & 0x40000000) DevCon::Notice("SPU 2 DMA %c Unusual bit set on 'to' direction chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);
|
||||
if ((chcr & 0x1) == 0) DevCon::Status("SPU 2 DMA %c loading from spu2 memory chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);*/
|
||||
/*if (chcr & 0x400) DevCon.Status("SPU 2 DMA %c linked list chain mode! chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);
|
||||
if (chcr & 0x40000000) DevCon.Notice("SPU 2 DMA %c Unusual bit set on 'to' direction chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);
|
||||
if ((chcr & 0x1) == 0) DevCon.Status("SPU 2 DMA %c loading from spu2 memory chcr = %x madr = %x bcr = %x\n", dmaNum, chcr, madr, bcr);*/
|
||||
|
||||
const int size = (bcr >> 16) * (bcr & 0xFFFF);
|
||||
|
||||
|
@ -41,7 +41,7 @@ static void __fastcall psxDmaGeneric(u32 madr, u32 bcr, u32 chcr, u32 spuCore, _
|
|||
if (SPU2async)
|
||||
{
|
||||
SPU2async(psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console::Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console.Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
|
||||
psxCounters[6].sCycleT = psxRegs.cycle;
|
||||
psxCounters[6].CycleT = size * 3;
|
||||
|
@ -53,7 +53,7 @@ static void __fastcall psxDmaGeneric(u32 madr, u32 bcr, u32 chcr, u32 spuCore, _
|
|||
|
||||
if((g_psxNextBranchCycle - psxNextsCounter) > (u32)psxNextCounter)
|
||||
{
|
||||
//DevCon::Notice("SPU2async Setting new counter branch, old %x new %x ((%x - %x = %x) > %x delta)", g_psxNextBranchCycle, psxNextsCounter + psxNextCounter, g_psxNextBranchCycle, psxNextsCounter, (g_psxNextBranchCycle - psxNextsCounter), psxNextCounter);
|
||||
//DevCon.Notice("SPU2async Setting new counter branch, old %x new %x ((%x - %x = %x) > %x delta)", g_psxNextBranchCycle, psxNextsCounter + psxNextCounter, g_psxNextBranchCycle, psxNextsCounter, (g_psxNextBranchCycle - psxNextsCounter), psxNextCounter);
|
||||
g_psxNextBranchCycle = psxNextsCounter + psxNextCounter;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ static void __fastcall psxDmaGeneric(u32 madr, u32 bcr, u32 chcr, u32 spuCore, _
|
|||
break;
|
||||
|
||||
default:
|
||||
Console::Error("*** DMA %c - SPU unknown *** %x addr = %x size = %x", dmaNum, chcr, madr, bcr);
|
||||
Console.Error("*** DMA %c - SPU unknown *** %x addr = %x size = %x", dmaNum, chcr, madr, bcr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ s32 spu2DmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
|||
if (SPU2async)
|
||||
{
|
||||
SPU2async(psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console::Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console.Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
|
||||
psxCounters[6].sCycleT = psxRegs.cycle;
|
||||
psxCounters[6].CycleT = bytes * 3;
|
||||
|
@ -315,7 +315,7 @@ s32 spu2DmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
|||
if (SPU2async)
|
||||
{
|
||||
SPU2async(psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console::Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
//Console.Status("cycles sent to SPU2 %x\n", psxRegs.cycle - psxCounters[6].sCycleT);
|
||||
|
||||
psxCounters[6].sCycleT = psxRegs.cycle;
|
||||
psxCounters[6].CycleT = bytes * 3;
|
||||
|
@ -478,7 +478,7 @@ void IopDmaUpdate(u32 elapsed)
|
|||
|
||||
s32 errDmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
||||
{
|
||||
Console::Error("ERROR: Tried to read using DMA %d (%s). Ignoring.", 0, channel, IopDmaNames[channel]);
|
||||
Console.Error("ERROR: Tried to read using DMA %d (%s). Ignoring.", 0, channel, IopDmaNames[channel]);
|
||||
|
||||
*bytesProcessed = bytesLeft;
|
||||
return 0;
|
||||
|
@ -486,7 +486,7 @@ s32 errDmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
|||
|
||||
s32 errDmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
||||
{
|
||||
Console::Error("ERROR: Tried to write using DMA %d (%s). Ignoring.", 0, channel, IopDmaNames[channel]);
|
||||
Console.Error("ERROR: Tried to write using DMA %d (%s). Ignoring.", 0, channel, IopDmaNames[channel]);
|
||||
|
||||
*bytesProcessed = bytesLeft;
|
||||
return 0;
|
||||
|
|
|
@ -69,7 +69,7 @@ u8 psxHwRead8(u32 add) {
|
|||
case IOP_T5_COUNT:
|
||||
case IOP_T5_MODE:
|
||||
case IOP_T5_TARGET:
|
||||
DevCon::Notice( "IOP Counter Read8 from addr0x%x = 0x%x", add, psxHu8(add) );
|
||||
DevCon.Notice( "IOP Counter Read8 from addr0x%x = 0x%x", add, psxHu8(add) );
|
||||
return psxHu8(add);
|
||||
#endif
|
||||
|
||||
|
@ -623,7 +623,7 @@ void psxHwWrite8(u32 add, u8 value) {
|
|||
USBwrite8(add, value); return;
|
||||
}
|
||||
if((add & 0xf) == 0xa)
|
||||
Console::Error("8bit write (possible chcr set) to addr 0x%x = 0x%x", add, value );
|
||||
Console.Error("8bit write (possible chcr set) to addr 0x%x = 0x%x", add, value );
|
||||
|
||||
switch (add) {
|
||||
case 0x1f801040:
|
||||
|
@ -649,7 +649,7 @@ void psxHwWrite8(u32 add, u8 value) {
|
|||
case IOP_T5_COUNT:
|
||||
case IOP_T5_MODE:
|
||||
case IOP_T5_TARGET:
|
||||
DevCon::Notice( "IOP Counter Write8 to addr 0x%x = 0x%x", add, value );
|
||||
DevCon.Notice( "IOP Counter Write8 to addr 0x%x = 0x%x", add, value );
|
||||
psxHu8(add) = value;
|
||||
return;
|
||||
|
||||
|
@ -673,7 +673,7 @@ void psxHwWrite8(u32 add, u8 value) {
|
|||
( value == '\n' && g_pbufi != 0 ) )
|
||||
{
|
||||
g_pbuf[g_pbufi] = 0;
|
||||
DevCon::WriteLn( Color_Cyan, "%s", g_pbuf );
|
||||
DevCon.WriteLn( Color_Cyan, "%s", g_pbuf );
|
||||
g_pbufi = 0;
|
||||
}
|
||||
else if( value != '\n' )
|
||||
|
@ -703,7 +703,7 @@ void psxHwWrite16(u32 add, u16 value) {
|
|||
USBwrite16(add, value); return;
|
||||
}
|
||||
|
||||
if((add & 0xf) == 0x9) DevCon::WriteLn("16bit write (possible chcr set) %x value %x", add, value);
|
||||
if((add & 0xf) == 0x9) DevCon.WriteLn("16bit write (possible chcr set) %x value %x", add, value);
|
||||
|
||||
switch (add) {
|
||||
case 0x1f801040:
|
||||
|
@ -1236,7 +1236,7 @@ void psxHwWrite32(u32 add, u32 value) {
|
|||
//------------------------------------------------------------------
|
||||
case 0x1f8014c0:
|
||||
PSXHW_LOG("RTC_HOLDMODE 32bit write %lx", value);
|
||||
Console::Notice("** RTC_HOLDMODE 32bit write %lx", value);
|
||||
Console.Notice("** RTC_HOLDMODE 32bit write %lx", value);
|
||||
break;
|
||||
|
||||
case 0x1f801450:
|
||||
|
@ -1341,10 +1341,10 @@ void psxDmaInterrupt2(int n)
|
|||
if (HW_DMA_ICR2 & (1 << (16 + n)))
|
||||
{
|
||||
/* if (HW_DMA_ICR2 & (1 << (24 + n))) {
|
||||
Console::WriteLn("*PCSX2*: HW_DMA_ICR2 n=%d already set", n);
|
||||
Console.WriteLn("*PCSX2*: HW_DMA_ICR2 n=%d already set", n);
|
||||
}
|
||||
if (psxHu32(0x1070) & 8) {
|
||||
Console::WriteLn("*PCSX2*: psxHu32(0x1070) 8 already set (n=%d)", n);
|
||||
Console.WriteLn("*PCSX2*: psxHu32(0x1070) 8 already set (n=%d)", n);
|
||||
}*/
|
||||
HW_DMA_ICR2|= (1 << (24 + n));
|
||||
psxRegs.CP0.n.Cause |= 1 << (16 + n);
|
||||
|
|
|
@ -57,7 +57,7 @@ void psxMemReset()
|
|||
jASSUME( psxMemWLUT != NULL );
|
||||
jASSUME( m_psxAllMem != NULL );
|
||||
|
||||
DbgCon::Status( "psxMemReset > Resetting core memory!" );
|
||||
DbgCon.Status( "psxMemReset > Resetting core memory!" );
|
||||
|
||||
memzero_ptr<0x2000 * sizeof(uptr) * 2>( psxMemWLUT ); // clears both allocations, RLUT and WLUT
|
||||
memzero_ptr<m_psxMemSize>( m_psxAllMem );
|
||||
|
@ -343,7 +343,7 @@ void iopMemWrite8(u32 mem, u8 value)
|
|||
{
|
||||
if (t == 0x1d00)
|
||||
{
|
||||
Console::WriteLn("sw8 [0x%08X]=0x%08X", mem, value);
|
||||
Console.WriteLn("sw8 [0x%08X]=0x%08X", mem, value);
|
||||
psxSu8(mem) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void iopMemWrite16(u32 mem, u16 value)
|
|||
u8* p = (u8 *)(psxMemWLUT[mem >> 16]);
|
||||
if (p != NULL && !(psxRegs.CP0.n.Status & 0x10000) )
|
||||
{
|
||||
if( t==0x1D00 ) Console::WriteLn("sw16 [0x%08X]=0x%08X", mem, value);
|
||||
if( t==0x1D00 ) Console.WriteLn("sw16 [0x%08X]=0x%08X", mem, value);
|
||||
*(u16 *)(p + (mem & 0xffff)) = value;
|
||||
psxCpu->Clear(mem&~3, 1);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ only recv2 & dataout influences padman
|
|||
|
||||
|
||||
void sio2Reset() {
|
||||
DevCon::Status( "Sio2 Reset" );
|
||||
DevCon.Status( "Sio2 Reset" );
|
||||
memzero(sio2);
|
||||
sio2.packet.recvVal1 = 0x1D100; // Nothing is connected at start
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void sio2_serialIn(u8 value){
|
|||
sioWrite8(value);
|
||||
|
||||
if (sio2.packet.sendSize > BUFSIZE) {//asadr
|
||||
Console::Notice("*PCSX2*: sendSize >= %d", BUFSIZE);
|
||||
Console.Notice("*PCSX2*: sendSize >= %d", BUFSIZE);
|
||||
} else {
|
||||
sio2.buf[sio2.packet.sendSize] = sioRead8();
|
||||
sio2.packet.sendSize++;
|
||||
|
@ -182,7 +182,7 @@ void sio2_fifoIn(u8 value){
|
|||
SIODMAWrite(value);
|
||||
|
||||
if (sio2.packet.sendSize > BUFSIZE) {//asadr
|
||||
Console::WriteLn("*PCSX2*: sendSize >= %d", BUFSIZE);
|
||||
Console.WriteLn("*PCSX2*: sendSize >= %d", BUFSIZE);
|
||||
} else {
|
||||
sio2.buf[sio2.packet.sendSize] = sioRead8();
|
||||
sio2.packet.sendSize++;
|
||||
|
@ -194,7 +194,7 @@ u8 sio2_fifoOut(){
|
|||
//PAD_LOG("READING %x\n",sio2.buf[sio2.recvIndex]);
|
||||
return sio2.buf[sio2.recvIndex++];
|
||||
} else {
|
||||
Console::Error( "*PCSX2*: buffer overrun" );
|
||||
Console.Error( "*PCSX2*: buffer overrun" );
|
||||
}
|
||||
return 0; // No Data
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
|
|||
// get bad virtual address
|
||||
uptr offset = (u8*)info->si_addr - psM;
|
||||
|
||||
DevCon::Status( "Protected memory cleanup. Offset 0x%x", offset );
|
||||
DevCon.Status( "Protected memory cleanup. Offset 0x%x", offset );
|
||||
|
||||
if (offset>=Ps2MemSize::Base)
|
||||
{
|
||||
|
|
|
@ -1028,9 +1028,9 @@ void QFSRV() { // JayteeMaster: changed a bit to avoid screw up
|
|||
cpuRegs.GPR.r[_Rd_].UD[1] = cpuRegs.GPR.r[_Rt_].UD[1];
|
||||
//saZero++;
|
||||
//if( saZero >= 388800 )
|
||||
//Console::WriteLn( "SA Is Zero, Bitch: %d zeros and counting.", saZero );
|
||||
//Console.WriteLn( "SA Is Zero, Bitch: %d zeros and counting.", saZero );
|
||||
} else {
|
||||
//Console::WriteLn( "SA Properly Valued at: %d (after %d zeros)", sa_amt, saZero );
|
||||
//Console.WriteLn( "SA Properly Valued at: %d (after %d zeros)", sa_amt, saZero );
|
||||
//saZero = 0;
|
||||
if (sa_amt < 64) {
|
||||
/*
|
||||
|
|
|
@ -33,7 +33,7 @@ using namespace Threading;
|
|||
using namespace std;
|
||||
|
||||
#ifdef DEBUG
|
||||
#define MTGS_LOG Console::WriteLn
|
||||
#define MTGS_LOG Console.WriteLn
|
||||
#else
|
||||
#define MTGS_LOG 0&&
|
||||
#endif
|
||||
|
@ -79,6 +79,8 @@ struct MTGS_BufferedData
|
|||
};
|
||||
|
||||
PCSX2_ALIGNED( 32, static MTGS_BufferedData RingBuffer );
|
||||
extern bool renderswitch;
|
||||
static volatile bool gsIsOpened = false;
|
||||
|
||||
|
||||
#ifdef RINGBUF_DEBUG_STACK
|
||||
|
@ -112,7 +114,15 @@ mtgsThreadObject::mtgsThreadObject() :
|
|||
|
||||
void mtgsThreadObject::Start()
|
||||
{
|
||||
m_returncode = 0;
|
||||
_parent::Start();
|
||||
m_ExecMode = ExecMode_Suspending;
|
||||
SetEvent();
|
||||
}
|
||||
|
||||
void mtgsThreadObject::OnStart()
|
||||
{
|
||||
gsIsOpened = false;
|
||||
|
||||
m_RingPos = 0;
|
||||
m_WritePos = 0;
|
||||
|
||||
|
@ -123,19 +133,12 @@ void mtgsThreadObject::Start()
|
|||
m_packet_size = 0;
|
||||
m_packet_ringpos = 0;
|
||||
|
||||
_parent::Start();
|
||||
m_ExecMode = ExecMode_Suspending;
|
||||
SetEvent();
|
||||
_parent::OnStart();
|
||||
}
|
||||
|
||||
void mtgsThreadObject::PollStatus()
|
||||
{
|
||||
if( m_ExecMode == ExecMode_NoThreadYet )
|
||||
{
|
||||
if( m_returncode != 0 ) // means the thread failed to init the GS plugin
|
||||
throw Exception::PluginOpenError( PluginId_GS );
|
||||
}
|
||||
|
||||
RethrowException();
|
||||
}
|
||||
|
||||
mtgsThreadObject::~mtgsThreadObject() throw()
|
||||
|
@ -172,7 +175,7 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
|
|||
if( m_WritePos == volatize( m_RingPos ) )
|
||||
{
|
||||
// MTGS ringbuffer is empty, but we still have queued frames in the counter? Ouch!
|
||||
Console::Error( "MTGS > Queued framecount mismatch = %d", m_QueuedFrames );
|
||||
Console.Error( "MTGS > Queued framecount mismatch = %d", m_QueuedFrames );
|
||||
m_QueuedFrames = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -182,7 +185,7 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
|
|||
|
||||
m_lock_FrameQueueCounter.Lock();
|
||||
m_QueuedFrames++;
|
||||
//Console::Status( " >> Frame Added!" );
|
||||
//Console.Status( " >> Frame Added!" );
|
||||
m_lock_FrameQueueCounter.Unlock();
|
||||
|
||||
SendSimplePacket( GS_RINGTYPE_VSYNC,
|
||||
|
@ -199,13 +202,11 @@ struct PacketTagType
|
|||
u32 data[3];
|
||||
};
|
||||
|
||||
extern bool renderswitch;
|
||||
static volatile long gsIsOpened = 0;
|
||||
|
||||
static void _clean_close_gs( void* obj )
|
||||
{
|
||||
int result = _InterlockedExchange( &gsIsOpened, 0 );
|
||||
if( result && (g_plugins != NULL) )
|
||||
if( !gsIsOpened ) return;
|
||||
gsIsOpened = false;
|
||||
if( g_plugins != NULL )
|
||||
g_plugins->m_info[PluginId_GS].CommonBindings.Close();
|
||||
}
|
||||
|
||||
|
@ -224,33 +225,34 @@ void mtgsThreadObject::OpenPlugin()
|
|||
GSirqCallback( dummyIrqCallback );
|
||||
|
||||
if( renderswitch )
|
||||
Console::WriteLn( "\t\tForced software switch enabled." );
|
||||
Console.WriteLn( "\t\tForced software switch enabled." );
|
||||
|
||||
int result;
|
||||
|
||||
if( GSopen2 != NULL )
|
||||
m_returncode = GSopen2( (void*)&pDsp, 1 | (renderswitch ? 4 : 0) );
|
||||
result = GSopen2( (void*)&pDsp, 1 | (renderswitch ? 4 : 0) );
|
||||
else
|
||||
m_returncode = GSopen( (void*)&pDsp, "PCSX2", renderswitch ? 2 : 1 );
|
||||
result = GSopen( (void*)&pDsp, "PCSX2", renderswitch ? 2 : 1 );
|
||||
|
||||
gsIsOpened = 1;
|
||||
m_sem_OpenDone.Post();
|
||||
|
||||
if( m_returncode != 0 )
|
||||
if( result != 0 )
|
||||
{
|
||||
DevCon::WriteLn( "MTGS: GSopen Finished, return code: 0x%x", m_returncode );
|
||||
pthread_exit( (void*)m_returncode );
|
||||
DevCon.WriteLn( "GSopen Failed: return code: 0x%x", result );
|
||||
throw Exception::PluginOpenError( PluginId_GS );
|
||||
}
|
||||
|
||||
gsIsOpened = true;
|
||||
m_sem_OpenDone.Post();
|
||||
|
||||
GSCSRr = 0x551B4000; // 0x55190000
|
||||
GSsetGameCRC( ElfCRC, 0 );
|
||||
}
|
||||
|
||||
sptr mtgsThreadObject::ExecuteTask()
|
||||
void mtgsThreadObject::ExecuteTask()
|
||||
{
|
||||
#ifdef RINGBUF_DEBUG_STACK
|
||||
PacketTagType prevCmd;
|
||||
#endif
|
||||
|
||||
gsIsOpened = false;
|
||||
pthread_cleanup_push( _clean_close_gs, this );
|
||||
while( true )
|
||||
{
|
||||
|
@ -263,7 +265,7 @@ sptr mtgsThreadObject::ExecuteTask()
|
|||
// ever be modified by this thread.
|
||||
while( m_RingPos != volatize(m_WritePos))
|
||||
{
|
||||
wxASSERT( m_RingPos < RingBufferSize );
|
||||
pxAssert( m_RingPos < RingBufferSize );
|
||||
|
||||
const PacketTagType& tag = (PacketTagType&)RingBuffer[m_RingPos];
|
||||
u32 ringposinc = 1;
|
||||
|
@ -275,9 +277,9 @@ sptr mtgsThreadObject::ExecuteTask()
|
|||
uptr stackpos = ringposStack.back();
|
||||
if( stackpos != m_RingPos )
|
||||
{
|
||||
Console::Error( "MTGS Ringbuffer Critical Failure ---> %x to %x (prevCmd: %x)\n", stackpos, m_RingPos, prevCmd.command );
|
||||
Console.Error( "MTGS Ringbuffer Critical Failure ---> %x to %x (prevCmd: %x)\n", stackpos, m_RingPos, prevCmd.command );
|
||||
}
|
||||
wxASSERT( stackpos == m_RingPos );
|
||||
pxAssert( stackpos == m_RingPos );
|
||||
prevCmd = tag;
|
||||
ringposStack.pop_back();
|
||||
m_lock_Stack.Unlock();
|
||||
|
@ -333,7 +335,7 @@ sptr mtgsThreadObject::ExecuteTask()
|
|||
m_lock_FrameQueueCounter.Lock();
|
||||
AtomicDecrement( m_QueuedFrames );
|
||||
jASSUME( m_QueuedFrames >= 0 );
|
||||
//Console::Status( " << Frame Removed!" );
|
||||
//Console.Status( " << Frame Removed!" );
|
||||
m_lock_FrameQueueCounter.Unlock();
|
||||
|
||||
if( PADupdate != NULL )
|
||||
|
@ -408,8 +410,8 @@ sptr mtgsThreadObject::ExecuteTask()
|
|||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
default:
|
||||
Console::Error("GSThreadProc, bad packet (%x) at m_RingPos: %x, m_WritePos: %x", tag.command, m_RingPos, m_WritePos);
|
||||
wxASSERT_MSG( false, L"Bad packet encountered in the MTGS Ringbuffer." );
|
||||
Console.Error("GSThreadProc, bad packet (%x) at m_RingPos: %x, m_WritePos: %x", tag.command, m_RingPos, m_WritePos);
|
||||
pxFail( "Bad packet encountered in the MTGS Ringbuffer." );
|
||||
m_RingPos = m_WritePos;
|
||||
continue;
|
||||
#else
|
||||
|
@ -419,15 +421,13 @@ sptr mtgsThreadObject::ExecuteTask()
|
|||
}
|
||||
|
||||
uint newringpos = m_RingPos + ringposinc;
|
||||
wxASSERT( newringpos <= RingBufferSize );
|
||||
pxAssert( newringpos <= RingBufferSize );
|
||||
newringpos &= RingBufferMask;
|
||||
AtomicExchange( m_RingPos, newringpos );
|
||||
}
|
||||
m_RingBufferIsBusy = false;
|
||||
}
|
||||
pthread_cleanup_pop( true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mtgsThreadObject::OnSuspendInThread()
|
||||
|
@ -445,7 +445,7 @@ void mtgsThreadObject::OnResumeInThread()
|
|||
// Used primarily for plugin startup/shutdown.
|
||||
void mtgsThreadObject::WaitGS()
|
||||
{
|
||||
DevAssert( !IsSelf(), "This method is only allowed from threads *not* named MTGS." );
|
||||
pxAssertDev( !IsSelf(), "This method is only allowed from threads *not* named MTGS." );
|
||||
|
||||
if( IsSuspended() ) return;
|
||||
|
||||
|
@ -465,7 +465,7 @@ void mtgsThreadObject::SetEvent()
|
|||
|
||||
void mtgsThreadObject::PrepEventWait()
|
||||
{
|
||||
//Console::Notice( "MTGS Stall! EE waits for nothing! ... except your GPU sometimes." );
|
||||
//Console.Notice( "MTGS Stall! EE waits for nothing! ... except your GPU sometimes." );
|
||||
SetEvent();
|
||||
Timeslice();
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ void mtgsThreadObject::SendDataPacket()
|
|||
m_CopyDataTally += m_packet_size;
|
||||
if( ( m_CopyDataTally > 0x8000 ) || ( ++m_CopyCommandTally > 16 ) )
|
||||
{
|
||||
//Console::Status( "MTGS Kick! DataSize : 0x%5.8x, CommandTally : %d", m_CopyDataTally, m_CopyCommandTally );
|
||||
//Console.Status( "MTGS Kick! DataSize : 0x%5.8x, CommandTally : %d", m_CopyDataTally, m_CopyCommandTally );
|
||||
SetEvent();
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
|
|||
}
|
||||
if (ringtx_s>=128*1024*1024)
|
||||
{
|
||||
Console::Status("GSRingBufCopy:128MB in %d tx -> b/tx: AVG = %.2f , max = %d, min = %d",ringtx_c,ringtx_s/(float)ringtx_c,ringtx_s_max,ringtx_s_min);
|
||||
Console.Status("GSRingBufCopy:128MB in %d tx -> b/tx: AVG = %.2f , max = %d, min = %d",ringtx_c,ringtx_s/(float)ringtx_c,ringtx_s_max,ringtx_s_min);
|
||||
for (int i=0;i<32;i++)
|
||||
{
|
||||
u32 total_bucket=0;
|
||||
|
@ -590,15 +590,15 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
|
|||
{
|
||||
total_bucket+=ringtx_inf[i][j];
|
||||
bucket_subitems++;
|
||||
Console::Notice("GSRingBufCopy :tx [%d,%d] algn %d : count= %d [%.2f%%]",1<<i,(1<<(i+1))-16,1<<j,ringtx_inf[i][j],ringtx_inf[i][j]/(float)ringtx_c*100);
|
||||
Console.Notice("GSRingBufCopy :tx [%d,%d] algn %d : count= %d [%.2f%%]",1<<i,(1<<(i+1))-16,1<<j,ringtx_inf[i][j],ringtx_inf[i][j]/(float)ringtx_c*100);
|
||||
ringtx_inf[i][j]=0;
|
||||
}
|
||||
}
|
||||
if (total_bucket)
|
||||
Console::Notice("GSRingBufCopy :tx [%d,%d] total : count= %d [%.2f%%] [%.2f%%]",1<<i,(1<<(i+1))-16,total_bucket,total_bucket/(float)ringtx_c*100,ringtx_inf_s[i]/(float)ringtx_s*100);
|
||||
Console.Notice("GSRingBufCopy :tx [%d,%d] total : count= %d [%.2f%%] [%.2f%%]",1<<i,(1<<(i+1))-16,total_bucket,total_bucket/(float)ringtx_c*100,ringtx_inf_s[i]/(float)ringtx_s*100);
|
||||
ringtx_inf_s[i]=0;
|
||||
}
|
||||
Console::Notice("GSRingBufCopy :tx ulg count =%d [%.2f%%]",ringtx_s_ulg,ringtx_s_ulg/(float)ringtx_s*100);
|
||||
Console.Notice("GSRingBufCopy :tx ulg count =%d [%.2f%%]",ringtx_s_ulg,ringtx_s_ulg/(float)ringtx_s*100);
|
||||
ringtx_s_ulg=0;
|
||||
ringtx_c=0;
|
||||
ringtx_s=0;
|
||||
|
@ -696,7 +696,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
|
|||
else // always true - if( writepos + size == MTGS_RINGBUFFEREND )
|
||||
{
|
||||
// Yay. Perfect fit. What are the odds?
|
||||
//Console::WriteLn( "MTGS > Perfect Fit!");
|
||||
//Console.WriteLn( "MTGS > Perfect Fit!");
|
||||
|
||||
PrepEventWait();
|
||||
while( true )
|
||||
|
|
|
@ -95,7 +95,7 @@ u8 *psS = NULL; //0.015 mb, scratch pad
|
|||
void MyMemCheck(u32 mem)
|
||||
{
|
||||
if( mem == 0x1c02f2a0 )
|
||||
Console::WriteLn("yo; (mem == 0x1c02f2a0) in MyMemCheck...");
|
||||
Console.WriteLn("yo; (mem == 0x1c02f2a0) in MyMemCheck...");
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
@ -218,7 +218,7 @@ mem8_t __fastcall _ext_memRead8 (u32 mem)
|
|||
case 7: // dev9
|
||||
{
|
||||
mem8_t retval = DEV9read8(mem & ~0xa4000000);
|
||||
Console::WriteLn("DEV9 read8 %8.8lx: %2.2lx", mem & ~0xa4000000, retval);
|
||||
Console.WriteLn("DEV9 read8 %8.8lx: %2.2lx", mem & ~0xa4000000, retval);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ mem16_t __fastcall _ext_memRead16(u32 mem)
|
|||
case 7: // dev9
|
||||
{
|
||||
mem16_t retval = DEV9read16(mem & ~0xa4000000);
|
||||
Console::WriteLn("DEV9 read16 %8.8lx: %4.4lx", mem & ~0xa4000000, retval);
|
||||
Console.WriteLn("DEV9 read16 %8.8lx: %4.4lx", mem & ~0xa4000000, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ mem32_t __fastcall _ext_memRead32(u32 mem)
|
|||
case 7: // dev9
|
||||
{
|
||||
mem32_t retval = DEV9read32(mem & ~0xa4000000);
|
||||
Console::WriteLn("DEV9 read32 %8.8lx: %8.8lx", mem & ~0xa4000000, retval);
|
||||
Console.WriteLn("DEV9 read32 %8.8lx: %8.8lx", mem & ~0xa4000000, retval);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ void __fastcall _ext_memWrite8 (u32 mem, mem8_t value)
|
|||
gsWrite8(mem, value); return;
|
||||
case 7: // dev9
|
||||
DEV9write8(mem & ~0xa4000000, value);
|
||||
Console::WriteLn("DEV9 write8 %8.8lx: %2.2lx", mem & ~0xa4000000, value);
|
||||
Console.WriteLn("DEV9 write8 %8.8lx: %2.2lx", mem & ~0xa4000000, value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ void __fastcall _ext_memWrite16(u32 mem, mem16_t value)
|
|||
gsWrite16(mem, value); return;
|
||||
case 7: // dev9
|
||||
DEV9write16(mem & ~0xa4000000, value);
|
||||
Console::WriteLn("DEV9 write16 %8.8lx: %4.4lx", mem & ~0xa4000000, value);
|
||||
Console.WriteLn("DEV9 write16 %8.8lx: %4.4lx", mem & ~0xa4000000, value);
|
||||
return;
|
||||
case 8: // spu2
|
||||
SPU2write(mem, value); return;
|
||||
|
@ -362,7 +362,7 @@ void __fastcall _ext_memWrite32(u32 mem, mem32_t value)
|
|||
gsWrite32(mem, value); return;
|
||||
case 7: // dev9
|
||||
DEV9write32(mem & ~0xa4000000, value);
|
||||
Console::WriteLn("DEV9 write32 %8.8lx: %8.8lx", mem & ~0xa4000000, value);
|
||||
Console.WriteLn("DEV9 write32 %8.8lx: %8.8lx", mem & ~0xa4000000, value);
|
||||
return;
|
||||
}
|
||||
MEM_LOG("Unknown Memory write32 to address %x with data %8.8x", mem, value);
|
||||
|
@ -546,7 +546,7 @@ void __fastcall vuMicroWrite128(u32 addr,const mem128_t* data)
|
|||
|
||||
void memSetPageAddr(u32 vaddr, u32 paddr)
|
||||
{
|
||||
//Console::WriteLn("memSetPageAddr: %8.8x -> %8.8x", vaddr, paddr);
|
||||
//Console.WriteLn("memSetPageAddr: %8.8x -> %8.8x", vaddr, paddr);
|
||||
|
||||
vtlb_VMap(vaddr,paddr,0x1000);
|
||||
|
||||
|
@ -554,7 +554,7 @@ void memSetPageAddr(u32 vaddr, u32 paddr)
|
|||
|
||||
void memClearPageAddr(u32 vaddr)
|
||||
{
|
||||
//Console::WriteLn("memClearPageAddr: %8.8x", vaddr);
|
||||
//Console.WriteLn("memClearPageAddr: %8.8x", vaddr);
|
||||
|
||||
vtlb_VMapUnmap(vaddr,0x1000); // -> whut ?
|
||||
|
||||
|
@ -851,9 +851,9 @@ void mmap_MarkCountedRamPage( u32 paddr )
|
|||
return; // skip town if we're already protected.
|
||||
|
||||
if( m_PageProtectInfo[rampage].Mode == ProtMode_Manual )
|
||||
DbgCon::WriteLn( "dyna_page_reset @ 0x%05x", paddr>>12 );
|
||||
DbgCon.WriteLn( "dyna_page_reset @ 0x%05x", paddr>>12 );
|
||||
else
|
||||
DbgCon::WriteLn( "Write-protected page @ 0x%05x", paddr>>12 );
|
||||
DbgCon.WriteLn( "Write-protected page @ 0x%05x", paddr>>12 );
|
||||
|
||||
m_PageProtectInfo[rampage].Mode = ProtMode_Write;
|
||||
HostSys::MemProtect( &psM[rampage<<12], 1, Protect_ReadOnly );
|
||||
|
@ -871,7 +871,7 @@ void mmap_ClearCpuBlock( uint offset )
|
|||
jASSUME( m_PageProtectInfo[rampage].Mode != ProtMode_Manual );
|
||||
|
||||
//#ifndef __LINUX__ // this function is called from the signal handler
|
||||
//DbgCon::WriteLn( "Manual page @ 0x%05x", m_PageProtectInfo[rampage].ReverseRamMap>>12 );
|
||||
//DbgCon.WriteLn( "Manual page @ 0x%05x", m_PageProtectInfo[rampage].ReverseRamMap>>12 );
|
||||
//#endif
|
||||
|
||||
HostSys::MemProtect( &psM[rampage<<12], 1, Protect_ReadWrite );
|
||||
|
@ -884,7 +884,7 @@ void mmap_ClearCpuBlock( uint offset )
|
|||
// to ensure the EErec is also reset in conjunction with calling this function.
|
||||
void mmap_ResetBlockTracking()
|
||||
{
|
||||
DevCon::WriteLn( "vtlb/mmap: Block Tracking reset..." );
|
||||
DevCon.WriteLn( "vtlb/mmap: Block Tracking reset..." );
|
||||
memzero( m_PageProtectInfo );
|
||||
HostSys::MemProtect( psM, Ps2MemSize::Base, Protect_ReadWrite );
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ void applypatch(int place)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (place == 0) Console::WriteLn(" patchnumber: %d", patchnumber);
|
||||
if (place == 0) Console.WriteLn(" patchnumber: %d", patchnumber);
|
||||
|
||||
for ( i = 0; i < patchnumber; i++ )
|
||||
{
|
||||
|
@ -447,15 +447,15 @@ void applypatch(int place)
|
|||
|
||||
void patchFunc_comment( char * text1, char * text2 )
|
||||
{
|
||||
Console::WriteLn( "comment: %s", text2 );
|
||||
Console.WriteLn( "comment: %s", text2 );
|
||||
}
|
||||
|
||||
|
||||
void patchFunc_gametitle( char * text1, char * text2 )
|
||||
{
|
||||
Console::WriteLn( "gametitle: %s", text2 );
|
||||
Console.WriteLn( "gametitle: %s", text2 );
|
||||
strgametitle.FromAscii( text2 );
|
||||
Console::SetTitle( strgametitle );
|
||||
Console.SetTitle( strgametitle );
|
||||
}
|
||||
|
||||
void patchFunc_patch( char * cmd, char * param )
|
||||
|
@ -466,7 +466,7 @@ void patchFunc_patch( char * cmd, char * param )
|
|||
{
|
||||
// TODO : Use wxLogError for this, once we have full unicode compliance on cmd/params vars.
|
||||
//wxLogError( L"Patch ERROR: Maximum number of patches reached: %s=%s", cmd, param );
|
||||
Console::Error( "Patch ERROR: Maximum number of patches reached: %s=%s", cmd, param );
|
||||
Console.Error( "Patch ERROR: Maximum number of patches reached: %s=%s", cmd, param );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ void patchFunc_patch( char * cmd, char * param )
|
|||
patch[ patchnumber ].cpu = (patch_cpu_type)PatchTableExecute( pText, NULL, cpuCore );
|
||||
if ( patch[ patchnumber ].cpu == 0 )
|
||||
{
|
||||
Console::Error( "Unrecognized patch '%s'", pText );
|
||||
Console.Error( "Unrecognized patch '%s'", pText );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ void patchFunc_patch( char * cmd, char * param )
|
|||
patch[ patchnumber ].type = (patch_data_type)PatchTableExecute( pText, NULL, dataType );
|
||||
if ( patch[ patchnumber ].type == 0 )
|
||||
{
|
||||
Console::Error( "Unrecognized patch '%s'", pText );
|
||||
Console.Error( "Unrecognized patch '%s'", pText );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ void inifile_read( const char * name )
|
|||
|
||||
if( !f1 )
|
||||
{
|
||||
Console::WriteLn("No patch found. Resuming execution without a patch (this is NOT an error)." );
|
||||
Console.WriteLn("No patch found. Resuming execution without a patch (this is NOT an error)." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ int AddPatch(int Mode, int Place, int Address, int Size, u64 data)
|
|||
|
||||
if ( patchnumber >= MAX_PATCH )
|
||||
{
|
||||
Console::Error( "Patch ERROR: Maximum number of patches reached.");
|
||||
Console.Error( "Patch ERROR: Maximum number of patches reached.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -723,7 +723,7 @@ void patchFunc_roundmode( char * cmd, char * param )
|
|||
|
||||
if( type == 0xffff )
|
||||
{
|
||||
Console::WriteLn("bad argument (%s) to round mode! skipping...\n", pText);
|
||||
Console.WriteLn("bad argument (%s) to round mode! skipping...\n", pText);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
while ( *param && ( *param != ',' ) ) param++; \
|
||||
if ( *param ) param++; \
|
||||
while ( *param && ( *param == ' ' ) ) param++; \
|
||||
if ( *param == 0 ) { Console::Error( _( "Not enough params for inicommand" ) ); return; }
|
||||
if ( *param == 0 ) { Console.Error( _( "Not enough params for inicommand" ) ); return; }
|
||||
|
||||
//
|
||||
// Enums
|
||||
|
|
|
@ -172,6 +172,12 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
|
|||
ini.Flush();
|
||||
}
|
||||
|
||||
bool Pcsx2Config::MultitapEnabled( uint port ) const
|
||||
{
|
||||
pxAssert( port < 2 );
|
||||
return (port==0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
||||
}
|
||||
|
||||
void Pcsx2Config::Load( const wxString& srcfile )
|
||||
{
|
||||
//m_IsLoaded = true;
|
||||
|
|
|
@ -162,7 +162,7 @@ static void CALLBACK GS_printf(int timeout, char *fmt, ...)
|
|||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
Console::WriteLn(msg);
|
||||
Console.WriteLn(msg);
|
||||
}
|
||||
|
||||
// PAD
|
||||
|
@ -662,13 +662,13 @@ static void PS2E_CALLBACK pcsx2_OSD_WriteLn( int icon, const char* msg )
|
|||
|
||||
PluginManager::PluginManager( const wxString (&folders)[PluginId_Count] )
|
||||
{
|
||||
Console::Status( "Loading plugins..." );
|
||||
Console.Status( "Loading plugins..." );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do
|
||||
{
|
||||
const PluginsEnum_t pid = pi->id;
|
||||
|
||||
Console::WriteLn( "\tBinding %s\t: %s ", tbl_PluginInfo[pid].shortname, folders[pid].ToUTF8().data() );
|
||||
Console.WriteLn( "\tBinding %s\t: %s ", tbl_PluginInfo[pid].shortname, folders[pid].ToUTF8().data() );
|
||||
|
||||
if( folders[pid].IsEmpty() )
|
||||
throw Exception::InvalidArgument( "Empty plugin filename." );
|
||||
|
@ -705,7 +705,7 @@ PluginManager::PluginManager( const wxString (&folders)[PluginId_Count] )
|
|||
PADinit = (_PADinit)m_info[PluginId_PAD].CommonBindings.Init;
|
||||
m_info[PluginId_PAD].CommonBindings.Init = _hack_PADinit;
|
||||
|
||||
Console::Status( "Plugins loaded successfully.\n" );
|
||||
Console.Status( "Plugins loaded successfully.\n" );
|
||||
|
||||
// HACK! Manually bind the Internal MemoryCard plugin for now, until
|
||||
// we get things more completed in the new plugin api.
|
||||
|
@ -887,7 +887,7 @@ void PluginManager::Open( PluginsEnum_t pid )
|
|||
{
|
||||
if( m_info[pid].IsOpened ) return;
|
||||
|
||||
Console::WriteLn( "\tOpening %s", tbl_PluginInfo[pid].shortname );
|
||||
Console.WriteLn( "\tOpening %s", tbl_PluginInfo[pid].shortname );
|
||||
|
||||
// Each Open needs to be called explicitly. >_<
|
||||
|
||||
|
@ -911,7 +911,7 @@ void PluginManager::Open( PluginsEnum_t pid )
|
|||
|
||||
void PluginManager::Open()
|
||||
{
|
||||
Console::Status( "Opening plugins..." );
|
||||
Console.Status( "Opening plugins..." );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
||||
Open( pi->id );
|
||||
|
@ -924,13 +924,13 @@ void PluginManager::Open()
|
|||
if (GSopen2) mtgsThread.WaitForOpen();
|
||||
mtgsThread.PollStatus();
|
||||
|
||||
Console::Status( "Plugins opened successfully." );
|
||||
Console.Status( "Plugins opened successfully." );
|
||||
}
|
||||
|
||||
void PluginManager::Close( PluginsEnum_t pid )
|
||||
{
|
||||
if( !m_info[pid].IsOpened ) return;
|
||||
Console::Status( "\tClosing %s", tbl_PluginInfo[pid].shortname );
|
||||
Console.Status( "\tClosing %s", tbl_PluginInfo[pid].shortname );
|
||||
|
||||
if( pid == PluginId_GS )
|
||||
{
|
||||
|
@ -948,7 +948,7 @@ void PluginManager::Close( PluginsEnum_t pid )
|
|||
|
||||
void PluginManager::Close( bool closegs )
|
||||
{
|
||||
DbgCon::Status( "Closing plugins..." );
|
||||
DbgCon.Status( "Closing plugins..." );
|
||||
|
||||
// Close plugins in reverse order of the initialization procedure.
|
||||
|
||||
|
@ -958,7 +958,7 @@ void PluginManager::Close( bool closegs )
|
|||
Close( tbl_PluginInfo[i].id );
|
||||
}
|
||||
|
||||
DbgCon::Status( "Plugins closed successfully." );
|
||||
DbgCon.Status( "Plugins closed successfully." );
|
||||
}
|
||||
|
||||
// Initializes all plugins. Plugin initialization should be done once for every new emulation
|
||||
|
@ -979,10 +979,10 @@ void PluginManager::Init()
|
|||
if( m_info[pid].IsInitialized ) continue;
|
||||
if( !printlog )
|
||||
{
|
||||
Console::Status( "Initializing plugins..." );
|
||||
Console.Status( "Initializing plugins..." );
|
||||
printlog = true;
|
||||
}
|
||||
Console::WriteLn( "\tInit %s", tbl_PluginInfo[pid].shortname );
|
||||
Console.WriteLn( "\tInit %s", tbl_PluginInfo[pid].shortname );
|
||||
m_info[pid].IsInitialized = true;
|
||||
if( 0 != m_info[pid].CommonBindings.Init() )
|
||||
throw Exception::PluginInitError( pid );
|
||||
|
@ -999,7 +999,7 @@ void PluginManager::Init()
|
|||
}
|
||||
|
||||
if( printlog )
|
||||
Console::Status( "Plugins initialized successfully.\n" );
|
||||
Console.Status( "Plugins initialized successfully.\n" );
|
||||
}
|
||||
|
||||
// Shuts down all plugins. Plugins are closed first, if necessary.
|
||||
|
@ -1013,7 +1013,7 @@ void PluginManager::Shutdown()
|
|||
mtgsThread.Cancel(); // speedier shutdown!
|
||||
|
||||
Close();
|
||||
DbgCon::Status( "Shutting down plugins..." );
|
||||
DbgCon.Status( "Shutting down plugins..." );
|
||||
|
||||
// Shutdown plugins in reverse order (probably doesn't matter...
|
||||
// ... but what the heck, right?)
|
||||
|
@ -1022,7 +1022,7 @@ void PluginManager::Shutdown()
|
|||
{
|
||||
const PluginsEnum_t pid = tbl_PluginInfo[i].id;
|
||||
if( !m_info[pid].IsInitialized ) continue;
|
||||
DevCon::WriteLn( "\tShutdown %s", tbl_PluginInfo[pid].shortname );
|
||||
DevCon.WriteLn( "\tShutdown %s", tbl_PluginInfo[pid].shortname );
|
||||
m_info[pid].IsInitialized = false;
|
||||
m_info[pid].CommonBindings.Shutdown();
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ void PluginManager::Shutdown()
|
|||
SysPlugins.Mcd = NULL;
|
||||
}
|
||||
|
||||
DbgCon::Status( "Plugins shutdown successfully." );
|
||||
DbgCon.Status( "Plugins shutdown successfully." );
|
||||
}
|
||||
|
||||
// For internal use only, unless you're the MTGS. Then it's for you too!
|
||||
|
@ -1063,7 +1063,7 @@ bool PluginManager::DoFreeze( PluginsEnum_t pid, int mode, freezeData* data )
|
|||
//
|
||||
void PluginManager::Freeze( PluginsEnum_t pid, SaveStateBase& state )
|
||||
{
|
||||
Console::WriteLn( "\t%s %s", state.IsSaving() ? "Saving" : "Loading",
|
||||
Console.WriteLn( "\t%s %s", state.IsSaving() ? "Saving" : "Loading",
|
||||
tbl_PluginInfo[pid].shortname );
|
||||
|
||||
freezeData fP = { 0, NULL };
|
||||
|
@ -1078,7 +1078,7 @@ void PluginManager::Freeze( PluginsEnum_t pid, SaveStateBase& state )
|
|||
// no state data to read, but the plugin expects some state data.
|
||||
// Issue a warning to console...
|
||||
if( fP.size != 0 )
|
||||
Console::Notice( "\tWarning: No data for this plugin was found. Plugin status may be unpredictable." );
|
||||
Console.Notice( "\tWarning: No data for this plugin was found. Plugin status may be unpredictable." );
|
||||
return;
|
||||
|
||||
// Note: Size mismatch check could also be done here on loading, but
|
||||
|
|
|
@ -228,17 +228,17 @@ public:
|
|||
PluginManagerBase() {}
|
||||
virtual ~PluginManagerBase() {}
|
||||
|
||||
virtual void Init() { wxASSERT_MSG( false, L"Null PluginManager!" ); }
|
||||
virtual void Init() { pxFail( "Null PluginManager!" ); }
|
||||
virtual void Shutdown() {}
|
||||
virtual void Open() { }
|
||||
virtual void Open( PluginsEnum_t pid ) { wxASSERT_MSG( false, L"Null PluginManager!" ); }
|
||||
virtual void Open( PluginsEnum_t pid ) { pxFail( "Null PluginManager!" ); }
|
||||
virtual void Close( PluginsEnum_t pid ) {}
|
||||
virtual void Close( bool closegs=true ) {}
|
||||
|
||||
virtual void Freeze( PluginsEnum_t pid, SaveStateBase& state ) { wxASSERT_MSG( false, L"Null PluginManager!" ); }
|
||||
virtual void Freeze( PluginsEnum_t pid, SaveStateBase& state ) { pxFail( "Null PluginManager!" ); }
|
||||
virtual bool DoFreeze( PluginsEnum_t pid, int mode, freezeData* data )
|
||||
{
|
||||
wxASSERT_MSG( false, L"Null PluginManager!" );
|
||||
pxFail( "Null PluginManager!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,10 +69,6 @@ typedef int BOOL;
|
|||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#ifndef wxASSERT_MSG_A
|
||||
# define wxASSERT_MSG_A( cond, msg ) wxASSERT_MSG( cond, wxString::FromAscii(msg).c_str() );
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin Pcsx2 Includes: Add items here that are local to Pcsx2 but stay relatively
|
||||
// unchanged for long periods of time, or happen to be used by almost everything, so they
|
||||
|
@ -82,6 +78,8 @@ typedef int BOOL;
|
|||
#include "Pcsx2Defs.h"
|
||||
#include "i18n.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "Utilities/Assertions.h"
|
||||
#include "Utilities/wxBaseTools.h"
|
||||
#include "Utilities/ScopedPtr.h"
|
||||
#include "Utilities/Path.h"
|
||||
|
|
|
@ -72,7 +72,7 @@ void psxShutdown() {
|
|||
|
||||
void psxException(u32 code, u32 bd) {
|
||||
// PSXCPU_LOG("psxException %x: %x, %x", code, psxHu32(0x1070), psxHu32(0x1074));
|
||||
//Console::WriteLn("!! psxException %x: %x, %x", code, psxHu32(0x1070), psxHu32(0x1074));
|
||||
//Console.WriteLn("!! psxException %x: %x, %x", code, psxHu32(0x1070), psxHu32(0x1074));
|
||||
// Set the Cause
|
||||
psxRegs.CP0.n.Cause &= ~0x7f;
|
||||
psxRegs.CP0.n.Cause |= code;
|
||||
|
@ -166,7 +166,7 @@ __forceinline void PSX_INT( IopEventId n, s32 ecycle )
|
|||
|
||||
// Exception: IRQ16 - SIO - it drops ints like crazy when handling PAD stuff.
|
||||
//if( /*n!=16 &&*/ psxRegs.interrupt & (1<<n) )
|
||||
// Console::WriteLn( "***** IOP > Twice-thrown int on IRQ %d", n );
|
||||
// Console.WriteLn( "***** IOP > Twice-thrown int on IRQ %d", n );
|
||||
|
||||
psxRegs.interrupt |= 1 << n;
|
||||
|
||||
|
@ -266,7 +266,7 @@ void iopTestIntc()
|
|||
|
||||
cpuSetNextBranchDelta( 16 );
|
||||
iopBranchAction = true;
|
||||
//Console::Error( "** IOP Needs an EE EventText, kthx ** %d", psxCycleEE );
|
||||
//Console.Error( "** IOP Needs an EE EventText, kthx ** %d", psxCycleEE );
|
||||
|
||||
// Note: No need to set the iop's branch delta here, since the EE
|
||||
// will run an IOP branch test regardless.
|
||||
|
|
|
@ -217,7 +217,7 @@ void zeroEx()
|
|||
|
||||
fname = irxlibs[i].names[code];
|
||||
//if( strcmp(fname, "setIOPrcvaddr") == 0 ) {
|
||||
// Console::WriteLn("yo");
|
||||
// Console.WriteLn("yo");
|
||||
// varLog |= 0x100000;
|
||||
// Log = 1;
|
||||
// }
|
||||
|
@ -258,15 +258,15 @@ void zeroEx()
|
|||
}
|
||||
|
||||
if (!strncmp(lib, "loadcore", 8) && code == 6) {
|
||||
DevCon::WriteLn("loadcore RegisterLibraryEntries (%x): %8.8s", psxRegs.pc, iopVirtMemR<char>(psxRegs.GPR.n.a0+12));
|
||||
DevCon.WriteLn("loadcore RegisterLibraryEntries (%x): %8.8s", psxRegs.pc, iopVirtMemR<char>(psxRegs.GPR.n.a0+12));
|
||||
}
|
||||
|
||||
if (!strncmp(lib, "intrman", 7) && code == 4) {
|
||||
DevCon::WriteLn("intrman RegisterIntrHandler (%x): intr %s, handler %x", psxRegs.pc, intrname[psxRegs.GPR.n.a0], psxRegs.GPR.n.a2);
|
||||
DevCon.WriteLn("intrman RegisterIntrHandler (%x): intr %s, handler %x", psxRegs.pc, intrname[psxRegs.GPR.n.a0], psxRegs.GPR.n.a2);
|
||||
}
|
||||
|
||||
if (!strncmp(lib, "sifcmd", 6) && code == 17) {
|
||||
DevCon::WriteLn("sifcmd sceSifRegisterRpc (%x): rpc_id %x", psxRegs.pc, psxRegs.GPR.n.a1);
|
||||
DevCon.WriteLn("sifcmd sceSifRegisterRpc (%x): rpc_id %x", psxRegs.pc, psxRegs.GPR.n.a1);
|
||||
}
|
||||
|
||||
if (!strncmp(lib, "sysclib", 8))
|
||||
|
|
|
@ -156,7 +156,7 @@ void psxSYSCALL() {
|
|||
}
|
||||
|
||||
void psxRFE() {
|
||||
// Console::WriteLn("RFE\n");
|
||||
// Console.WriteLn("RFE\n");
|
||||
psxRegs.CP0.n.Status = (psxRegs.CP0.n.Status & 0xfffffff0) |
|
||||
((psxRegs.CP0.n.Status & 0x3c) >> 2);
|
||||
// Log=0;
|
||||
|
@ -300,7 +300,7 @@ void psxCTC0() { _rFs_ = _u32(_rRt_); }
|
|||
* Format: ? *
|
||||
*********************************************************/
|
||||
void psxNULL() {
|
||||
Console::Notice("psx: Unimplemented op %x", psxRegs.code);
|
||||
Console.Notice("psx: Unimplemented op %x", psxRegs.code);
|
||||
}
|
||||
|
||||
void psxSPECIAL() {
|
||||
|
|
|
@ -113,12 +113,12 @@ __releaseinline void cpuException(u32 code, u32 bd)
|
|||
errLevel2 = TRUE;
|
||||
checkStatus = (cpuRegs.CP0.n.Status.b.DEV == 0); // for perf/debug exceptions
|
||||
|
||||
Console::Error("*PCSX2* FIX ME: Level 2 cpuException");
|
||||
Console.Error("*PCSX2* FIX ME: Level 2 cpuException");
|
||||
if ((code & 0x38000) <= 0x8000 )
|
||||
{
|
||||
//Reset / NMI
|
||||
cpuRegs.pc = 0xBFC00000;
|
||||
Console::Notice("Reset request");
|
||||
Console.Notice("Reset request");
|
||||
UpdateCP0Status();
|
||||
return;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ __releaseinline void cpuException(u32 code, u32 bd)
|
|||
else if((code & 0x38000) == 0x18000)
|
||||
offset = 0x100; //Debug
|
||||
else
|
||||
Console::Error("Unknown Level 2 Exception!! Cause %x", code);
|
||||
Console.Error("Unknown Level 2 Exception!! Cause %x", code);
|
||||
}
|
||||
|
||||
if (cpuRegs.CP0.n.Status.b.EXL == 0)
|
||||
|
@ -135,7 +135,7 @@ __releaseinline void cpuException(u32 code, u32 bd)
|
|||
cpuRegs.CP0.n.Status.b.EXL = 1;
|
||||
if (bd)
|
||||
{
|
||||
Console::Notice("branch delay!!");
|
||||
Console.Notice("branch delay!!");
|
||||
cpuRegs.CP0.n.EPC = cpuRegs.pc - 4;
|
||||
cpuRegs.CP0.n.Cause |= 0x80000000;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ __releaseinline void cpuException(u32 code, u32 bd)
|
|||
else
|
||||
{
|
||||
offset = 0x180; //Override the cause
|
||||
if (errLevel2) Console::Notice("cpuException: Status.EXL = 1 cause %x", code);
|
||||
if (errLevel2) Console.Notice("cpuException: Status.EXL = 1 cause %x", code);
|
||||
}
|
||||
|
||||
if (checkStatus)
|
||||
|
@ -161,10 +161,10 @@ __releaseinline void cpuException(u32 code, u32 bd)
|
|||
|
||||
void cpuTlbMiss(u32 addr, u32 bd, u32 excode)
|
||||
{
|
||||
Console::Error("cpuTlbMiss pc:%x, cycl:%x, addr: %x, status=%x, code=%x",
|
||||
Console.Error("cpuTlbMiss pc:%x, cycl:%x, addr: %x, status=%x, code=%x",
|
||||
cpuRegs.pc, cpuRegs.cycle, addr, cpuRegs.CP0.n.Status.val, excode);
|
||||
|
||||
if (bd) Console::Notice("branch delay!!");
|
||||
if (bd) Console.Notice("branch delay!!");
|
||||
|
||||
assert(0); // temporary
|
||||
|
||||
|
@ -201,7 +201,7 @@ __forceinline void _cpuTestMissingINTC() {
|
|||
if (cpuRegs.CP0.n.Status.val & 0x400 &&
|
||||
psHu32(INTC_STAT) & psHu32(INTC_MASK)) {
|
||||
if ((cpuRegs.interrupt & (1 << 30)) == 0) {
|
||||
Console::Error("*PCSX2*: Error, missing INTC Interrupt");
|
||||
Console.Error("*PCSX2*: Error, missing INTC Interrupt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ __forceinline void _cpuTestMissingDMAC() {
|
|||
(psHu16(0xe012) & psHu16(0xe010) ||
|
||||
psHu16(0xe010) & 0x8000)) {
|
||||
if ((cpuRegs.interrupt & (1 << 31)) == 0) {
|
||||
Console::Error("*PCSX2*: Error, missing DMAC Interrupt");
|
||||
Console.Error("*PCSX2*: Error, missing DMAC Interrupt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ static __forceinline void _cpuTestTIMR()
|
|||
if ( (cpuRegs.CP0.n.Status.val & 0x8000) &&
|
||||
cpuRegs.CP0.n.Count >= cpuRegs.CP0.n.Compare && cpuRegs.CP0.n.Count < cpuRegs.CP0.n.Compare+1000 )
|
||||
{
|
||||
Console::Status("timr intr: %x, %x", cpuRegs.CP0.n.Count, cpuRegs.CP0.n.Compare);
|
||||
Console.Status("timr intr: %x, %x", cpuRegs.CP0.n.Count, cpuRegs.CP0.n.Compare);
|
||||
cpuException(0x808000, cpuRegs.branch);
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ __forceinline void _cpuBranchTest_Shared()
|
|||
if( iopBranchAction )
|
||||
{
|
||||
//if( EEsCycle < -450 )
|
||||
// Console::WriteLn( " IOP ahead by: %d cycles", -EEsCycle );
|
||||
// Console.WriteLn( " IOP ahead by: %d cycles", -EEsCycle );
|
||||
|
||||
// Experimental and Probably Unnecessry Logic -->
|
||||
// Check if the EE already has an exception pending, and if so we shouldn't
|
||||
|
@ -420,7 +420,7 @@ __forceinline void _cpuBranchTest_Shared()
|
|||
int cycleCount = std::min( EEsCycle, (s32)(eeWaitCycles>>4) );
|
||||
int cyclesRun = cycleCount - psxCpu->ExecuteBlock( cycleCount );
|
||||
EEsCycle -= cyclesRun;
|
||||
//Console::Notice( "IOP Exception-Pending Execution -- EEsCycle: %d", EEsCycle );
|
||||
//Console.Notice( "IOP Exception-Pending Execution -- EEsCycle: %d", EEsCycle );
|
||||
}
|
||||
else*/
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ __forceinline void _cpuBranchTest_Shared()
|
|||
// IOP extra timeslices in short order.
|
||||
|
||||
cpuSetNextBranchDelta( 48 );
|
||||
//Console::Notice( "EE ahead of the IOP -- Rapid Branch! %d", EEsCycle );
|
||||
//Console.Notice( "EE ahead of the IOP -- Rapid Branch! %d", EEsCycle );
|
||||
}
|
||||
|
||||
// The IOP could be running ahead/behind of us, so adjust the iop's next branch by its
|
||||
|
@ -556,7 +556,7 @@ void cpuExecuteBios()
|
|||
// Set the video mode to user's default request:
|
||||
gsSetRegionMode( (GS_RegionMode)EmuConfig.Video.DefaultRegionMode );
|
||||
|
||||
Console::Status( "Executing Bios Stub..." );
|
||||
Console.Status( "Executing Bios Stub..." );
|
||||
|
||||
PCSX2_MEM_PROTECT_BEGIN();
|
||||
g_ExecBiosHack = true;
|
||||
|
@ -588,7 +588,7 @@ void cpuExecuteBios()
|
|||
// with new faster versions:
|
||||
Cpu->Reset();
|
||||
|
||||
Console::Notice("Execute Bios Stub Complete");
|
||||
Console.Notice("Execute Bios Stub Complete");
|
||||
//GSprintf(5, "PCSX2 " PCSX2_VERSION "\nExecuteBios Complete\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -136,9 +136,9 @@ void Unknown() {
|
|||
CPU_LOG("%8.8lx: Unknown opcode called", cpuRegs.pc);
|
||||
}
|
||||
|
||||
void MMI_Unknown() { Console::Notice("Unknown MMI opcode called"); }
|
||||
void COP0_Unknown() { Console::Notice("Unknown COP0 opcode called"); }
|
||||
void COP1_Unknown() { Console::Notice("Unknown FPU/COP1 opcode called"); }
|
||||
void MMI_Unknown() { Console.Notice("Unknown MMI opcode called"); }
|
||||
void COP0_Unknown() { Console.Notice("Unknown COP0 opcode called"); }
|
||||
void COP1_Unknown() { Console.Notice("Unknown FPU/COP1 opcode called"); }
|
||||
|
||||
|
||||
|
||||
|
@ -761,7 +761,7 @@ int __Deci2Call(int call, u32 *addr)
|
|||
else
|
||||
{
|
||||
deci2handler = NULL;
|
||||
DevCon::Notice( "Deci2Call.Open > NULL address ignored." );
|
||||
DevCon.Notice( "Deci2Call.Open > NULL address ignored." );
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
@ -780,7 +780,7 @@ int __Deci2Call(int call, u32 *addr)
|
|||
deci2addr[3], deci2addr[2], deci2addr[1], deci2addr[0]);
|
||||
|
||||
// cpuRegs.pc = deci2handler;
|
||||
// Console::WriteLn("deci2msg: %s", (char*)PSM(deci2addr[4]+0xc));
|
||||
// Console.WriteLn("deci2msg: %s", (char*)PSM(deci2addr[4]+0xc));
|
||||
if (deci2addr == NULL) return 1;
|
||||
if (deci2addr[1]>0xc){
|
||||
u8* pdeciaddr = (u8*)dmaGetAddr(deci2addr[4]+0xc);
|
||||
|
@ -790,7 +790,7 @@ int __Deci2Call(int call, u32 *addr)
|
|||
pdeciaddr += (deci2addr[4]+0xc)%16;
|
||||
memcpy(deci2buffer, pdeciaddr, deci2addr[1]-0xc);
|
||||
deci2buffer[deci2addr[1]-0xc>=255?255:deci2addr[1]-0xc]='\0';
|
||||
Console::Write( Color_Cyan, deci2buffer );
|
||||
Console.Write( Color_Cyan, deci2buffer );
|
||||
}
|
||||
deci2addr[3] = 0;
|
||||
return 1;
|
||||
|
@ -809,7 +809,7 @@ int __Deci2Call(int call, u32 *addr)
|
|||
|
||||
case 0x10://kputs
|
||||
if( addr != NULL )
|
||||
Console::Write( Color_Cyan, "%s", PSM(*addr));
|
||||
Console.Write( Color_Cyan, "%s", PSM(*addr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -831,7 +831,7 @@ void SYSCALL()
|
|||
if (call == 0x7c)
|
||||
{
|
||||
if(cpuRegs.GPR.n.a0.UL[0] == 0x10)
|
||||
Console::Write( Color_Cyan, (char*)PSM(memRead32(cpuRegs.GPR.n.a1.UL[0])) );
|
||||
Console.Write( Color_Cyan, (char*)PSM(memRead32(cpuRegs.GPR.n.a1.UL[0])) );
|
||||
else
|
||||
__Deci2Call( cpuRegs.GPR.n.a0.UL[0], (u32*)PSM(cpuRegs.GPR.n.a1.UL[0]) );
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ static bool state_buffer_lock = false;
|
|||
// form the main thread.
|
||||
bool sys_resume_lock = false;
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// StateThread_Freeze
|
||||
// --------------------------------------------------------------------------------------
|
||||
class StateThread_Freeze : public PersistentThread
|
||||
{
|
||||
typedef PersistentThread _parent;
|
||||
|
@ -38,9 +41,9 @@ class StateThread_Freeze : public PersistentThread
|
|||
public:
|
||||
StateThread_Freeze( const wxString& file )
|
||||
{
|
||||
m_name = L"SaveState::CopyAndZip";
|
||||
m_name = L"SaveState::Freeze";
|
||||
|
||||
DevAssert( wxThread::IsMain(), "StateThread creation is allowed from the Main thread only." );
|
||||
AllowFromMainThreadOnly();
|
||||
if( state_buffer_lock )
|
||||
throw Exception::RuntimeError( "Cannot save state; a previous save or load action is already in progress." );
|
||||
|
||||
|
@ -49,22 +52,63 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
sptr ExecuteTask()
|
||||
void OnStart() {}
|
||||
void ExecuteTask()
|
||||
{
|
||||
memSavingState( state_buffer ).FreezeAll();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoThreadCleanup()
|
||||
void OnThreadCleanup()
|
||||
{
|
||||
wxCommandEvent evt( pxEVT_FreezeFinished );
|
||||
evt.SetClientData( this );
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
//
|
||||
// --------------------------------------------------------------------------------------
|
||||
class StateThread_Thaw : public PersistentThread
|
||||
{
|
||||
typedef PersistentThread _parent;
|
||||
|
||||
public:
|
||||
StateThread_Thaw( const wxString& file )
|
||||
{
|
||||
m_name = L"SaveState::Thaw";
|
||||
|
||||
AllowFromMainThreadOnly();
|
||||
if( state_buffer_lock )
|
||||
throw Exception::RuntimeError( "Cannot sload state; a previous save or load action is already in progress." );
|
||||
|
||||
Start();
|
||||
sys_resume_lock = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnStart() {}
|
||||
|
||||
void ExecuteTask()
|
||||
{
|
||||
memSavingState( state_buffer ).FreezeAll();
|
||||
}
|
||||
|
||||
void OnThreadCleanup()
|
||||
{
|
||||
wxCommandEvent evt( pxEVT_FreezeFinished );
|
||||
evt.SetClientData( this );
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
//
|
||||
// --------------------------------------------------------------------------------------
|
||||
class StateThread_ZipToDisk : public PersistentThread
|
||||
{
|
||||
typedef PersistentThread _parent;
|
||||
|
@ -77,7 +121,7 @@ public:
|
|||
{
|
||||
m_name = L"SaveState::ZipToDisk";
|
||||
|
||||
DevAssert( wxThread::IsMain(), "StateThread creation is allowed from the Main thread only." );
|
||||
AllowFromMainThreadOnly();
|
||||
if( state_buffer_lock )
|
||||
throw Exception::RuntimeError( "Cannot save state; a previous save or load action is already in progress." );
|
||||
|
||||
|
@ -101,26 +145,29 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
sptr ExecuteTask()
|
||||
void OnStart() {}
|
||||
|
||||
void ExecuteTask()
|
||||
{
|
||||
Sleep( 2 );
|
||||
if( gzwrite( (gzFile)m_gzfp, state_buffer.GetPtr(), state_buffer.GetSizeInBytes() ) < state_buffer.GetSizeInBytes() )
|
||||
throw Exception::BadStream();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoThreadCleanup()
|
||||
void OnThreadCleanup()
|
||||
{
|
||||
wxCommandEvent evt( pxEVT_FreezeFinished );
|
||||
evt.SetClientData( this ); // tells message to clean us up.
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
//
|
||||
// --------------------------------------------------------------------------------------
|
||||
class StateThread_UnzipFromDisk : public PersistentThread
|
||||
{
|
||||
typedef PersistentThread _parent;
|
||||
|
@ -133,7 +180,7 @@ public:
|
|||
{
|
||||
m_name = L"SaveState::UnzipFromDisk";
|
||||
|
||||
DevAssert( wxThread::IsMain(), "StateThread creation is allowed from the Main thread only." );
|
||||
AllowFromMainThreadOnly();
|
||||
if( state_buffer_lock )
|
||||
throw Exception::RuntimeError( "Cannot save state; a previous save or load action is already in progress." );
|
||||
|
||||
|
@ -157,7 +204,9 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
sptr ExecuteTask()
|
||||
void OnStart() {}
|
||||
|
||||
void ExecuteTask()
|
||||
{
|
||||
// fixme: should start initially with the file size, and then grow from there.
|
||||
|
||||
|
@ -171,13 +220,13 @@ protected:
|
|||
} while( !gzeof(m_gzfp) );
|
||||
}
|
||||
|
||||
void DoThreadCleanup()
|
||||
void OnThreadCleanup()
|
||||
{
|
||||
wxCommandEvent evt( pxEVT_ThawFinished );
|
||||
evt.SetClientData( this ); // tells message to clean us up.
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -187,32 +236,51 @@ void Pcsx2App::OnFreezeFinished( wxCommandEvent& evt )
|
|||
state_buffer_lock = false;
|
||||
|
||||
SysClearExecutionCache();
|
||||
SysResume();
|
||||
sCoreThread.Resume();
|
||||
|
||||
if( PersistentThread* thread = (PersistentThread*)evt.GetClientData() )
|
||||
{
|
||||
delete thread;
|
||||
}
|
||||
delete (PersistentThread*)evt.GetClientData();
|
||||
}
|
||||
|
||||
void Pcsx2App::OnThawFinished( wxCommandEvent& evt )
|
||||
{
|
||||
PersistentThread* thr = (PersistentThread*)evt.GetClientData();
|
||||
if( thr == NULL )
|
||||
{
|
||||
pxAssert( false );
|
||||
return;
|
||||
}
|
||||
|
||||
/*catch( Exception::BadSavedState& ex)
|
||||
{
|
||||
// At this point we can return control back to the user, no questions asked.
|
||||
// StateLoadErrors are only thorwn if the load failed prior to any virtual
|
||||
// machine memory contents being changed. (usually missing file errors)
|
||||
|
||||
Console.Notice( ex.FormatDiagnosticMessage() );
|
||||
sCoreThread.Resume();
|
||||
}*/
|
||||
|
||||
state_buffer.Dispose();
|
||||
state_buffer_lock = false;
|
||||
|
||||
SysClearExecutionCache();
|
||||
SysResume();
|
||||
sCoreThread.Resume();
|
||||
|
||||
if( PersistentThread* thread = (PersistentThread*)evt.GetClientData() )
|
||||
{
|
||||
delete thread;
|
||||
}
|
||||
delete (PersistentThread*)evt.GetClientData();
|
||||
}
|
||||
|
||||
void StateCopy_SaveToFile( const wxString& file )
|
||||
{
|
||||
if( state_buffer_lock ) return;
|
||||
// [TODO] Implement optional 7zip compression here?
|
||||
new StateThread_ZipToDisk( file );
|
||||
}
|
||||
|
||||
void StateCopy_LoadFromFile( const wxString& file )
|
||||
{
|
||||
if( state_buffer_lock ) return;
|
||||
|
||||
sCoreThread.ShortSuspend();
|
||||
new StateThread_UnzipFromDisk( file );
|
||||
}
|
||||
|
||||
// Saves recovery state info to the given saveslot, or saves the active emulation state
|
||||
|
|
|
@ -38,12 +38,12 @@ static void TestClearVUs(u32 madr, u32 size)
|
|||
{
|
||||
if (madr < 0x11004000)
|
||||
{
|
||||
DbgCon::Notice("scratch pad clearing vu0");
|
||||
DbgCon.Notice("scratch pad clearing vu0");
|
||||
CpuVU0.Clear(madr&0xfff, size);
|
||||
}
|
||||
else if (madr >= 0x11008000 && madr < 0x1100c000)
|
||||
{
|
||||
DbgCon::Notice("scratch pad clearing vu1");
|
||||
DbgCon.Notice("scratch pad clearing vu1");
|
||||
CpuVU1.Clear(madr&0x3fff, size);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ int _SPR0chain()
|
|||
case MFD_VIF1:
|
||||
case MFD_GIF:
|
||||
if ((spr0->madr & ~dmacRegs->rbsr.RMSK) != dmacRegs->rbor.ADDR)
|
||||
Console::WriteLn("SPR MFIFO Write outside MFIFO area");
|
||||
Console.WriteLn("SPR MFIFO Write outside MFIFO area");
|
||||
else
|
||||
mfifotransferred += spr0->qwc;
|
||||
|
||||
|
@ -101,7 +101,7 @@ void _SPR0interleave()
|
|||
u32 *pMem;
|
||||
|
||||
if (tqwc == 0) tqwc = qwc;
|
||||
//Console::WriteLn("dmaSPR0 interleave");
|
||||
//Console.WriteLn("dmaSPR0 interleave");
|
||||
SPR_LOG("SPR0 interleave size=%d, tqwc=%d, sqwc=%d, addr=%lx sadr=%lx",
|
||||
spr0->qwc, tqwc, sqwc, spr0->madr, spr0->sadr);
|
||||
|
||||
|
@ -138,7 +138,7 @@ static __forceinline void _dmaSPR0()
|
|||
{
|
||||
if (dmacRegs->ctrl.STS == STS_fromSPR)
|
||||
{
|
||||
Console::WriteLn("SPR0 stall %d", dmacRegs->ctrl.STS);
|
||||
Console.WriteLn("SPR0 stall %d", dmacRegs->ctrl.STS);
|
||||
}
|
||||
|
||||
// Transfer Dn_QWC from SPR to Dn_MADR
|
||||
|
@ -176,7 +176,7 @@ static __forceinline void _dmaSPR0()
|
|||
|
||||
if (dmacRegs->ctrl.STS == STS_fromSPR) // STS == fromSPR
|
||||
{
|
||||
Console::WriteLn("SPR stall control");
|
||||
Console.WriteLn("SPR stall control");
|
||||
}
|
||||
|
||||
switch (id)
|
||||
|
@ -196,7 +196,7 @@ static __forceinline void _dmaSPR0()
|
|||
SPR0chain();
|
||||
if (spr0->chcr.TIE && Tag::IRQ(ptag)) //Check TIE bit of CHCR and IRQ bit of tag
|
||||
{
|
||||
//Console::WriteLn("SPR0 TIE");
|
||||
//Console.WriteLn("SPR0 TIE");
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
|
@ -231,9 +231,9 @@ void SPRFROMinterrupt()
|
|||
{
|
||||
case MFD_GIF:
|
||||
{
|
||||
if ((spr0->madr & ~dmacRegs->rbsr.RMSK) != dmacRegs->rbor.ADDR) Console::WriteLn("GIF MFIFO Write outside MFIFO area");
|
||||
if ((spr0->madr & ~dmacRegs->rbsr.RMSK) != dmacRegs->rbor.ADDR) Console.WriteLn("GIF MFIFO Write outside MFIFO area");
|
||||
spr0->madr = dmacRegs->rbor.ADDR + (spr0->madr & dmacRegs->rbsr.RMSK);
|
||||
//Console::WriteLn("mfifoGIFtransfer %x madr %x, tadr %x", gif->chcr._u32, gif->madr, gif->tadr);
|
||||
//Console.WriteLn("mfifoGIFtransfer %x madr %x, tadr %x", gif->chcr._u32, gif->madr, gif->tadr);
|
||||
mfifoGIFtransfer(mfifotransferred);
|
||||
mfifotransferred = 0;
|
||||
if (gif->chcr.STR) return;
|
||||
|
@ -241,9 +241,9 @@ void SPRFROMinterrupt()
|
|||
}
|
||||
case MFD_VIF1:
|
||||
{
|
||||
if ((spr0->madr & ~psHu32(DMAC_RBSR)) != psHu32(DMAC_RBOR)) Console::WriteLn("VIF MFIFO Write outside MFIFO area");
|
||||
if ((spr0->madr & ~psHu32(DMAC_RBSR)) != psHu32(DMAC_RBOR)) Console.WriteLn("VIF MFIFO Write outside MFIFO area");
|
||||
spr0->madr = dmacRegs->rbor.ADDR + (spr0->madr & dmacRegs->rbsr.RMSK);
|
||||
//Console::WriteLn("mfifoVIF1transfer %x madr %x, tadr %x", vif1ch->chcr._u32, vif1ch->madr, vif1ch->tadr);
|
||||
//Console.WriteLn("mfifoVIF1transfer %x madr %x, tadr %x", vif1ch->chcr._u32, vif1ch->madr, vif1ch->tadr);
|
||||
mfifoVIF1transfer(mfifotransferred);
|
||||
mfifotransferred = 0;
|
||||
if (vif1ch->chcr.STR) return;
|
||||
|
@ -386,7 +386,7 @@ void _dmaSPR1() // toSPR work function
|
|||
{
|
||||
SPR_LOG("dmaIrq Set");
|
||||
|
||||
//Console::WriteLn("SPR1 TIE");
|
||||
//Console.WriteLn("SPR1 TIE");
|
||||
done = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ void SaveStateBase::PrepBlock( int size )
|
|||
|
||||
void SaveStateBase::FreezeTag( const char* src )
|
||||
{
|
||||
wxASSERT( strlen(src) < (sizeof( m_tagspace )-1) );
|
||||
const int allowedlen = sizeof( m_tagspace )-1;
|
||||
pxAssertDev( strlen(src) < allowedlen, wxsFormat( L"Tag name exceeds the allowed length of %d chars.", allowedlen) );
|
||||
|
||||
memzero( m_tagspace );
|
||||
strcpy( m_tagspace, src );
|
||||
|
@ -84,7 +85,7 @@ void SaveStateBase::FreezeTag( const char* src )
|
|||
|
||||
if( strcmp( m_tagspace, src ) != 0 )
|
||||
{
|
||||
wxASSERT_MSG( false, L"Savestate data corruption detected while reading tag" );
|
||||
pxFail( "Savestate data corruption detected while reading tag" );
|
||||
throw Exception::BadSavedState(
|
||||
// Untranslated diagnostic msg (use default msg for translation)
|
||||
L"Savestate data corruption detected while reading tag: " + wxString::FromAscii(src)
|
||||
|
@ -118,7 +119,7 @@ void SaveStateBase::FreezeBios()
|
|||
{
|
||||
if( memcmp( descin, desccmp, 128 ) != 0 )
|
||||
{
|
||||
Console::Error(
|
||||
Console.Error(
|
||||
"\n\tWarning: BIOS Version Mismatch, savestate may be unstable!\n"
|
||||
"\t\tCurrent Version: %s\n"
|
||||
"\t\tSavestate Version: %s\n",
|
||||
|
@ -240,7 +241,7 @@ bool SaveStateBase::FreezeSection()
|
|||
|
||||
FreezeMainMemory();
|
||||
int realsectsize = m_idx - seekpos;
|
||||
wxASSERT( sectlen == realsectsize );
|
||||
pxAssert( sectlen == realsectsize );
|
||||
m_sectid++;
|
||||
}
|
||||
break;
|
||||
|
@ -311,7 +312,7 @@ bool SaveStateBase::FreezeSection()
|
|||
|
||||
case FreezeId_Unknown:
|
||||
default:
|
||||
wxASSERT( IsSaving() );
|
||||
pxAssert( IsSaving() );
|
||||
|
||||
// Skip unknown sections with a warning log.
|
||||
// Maybe it'll work! (haha?)
|
||||
|
@ -321,7 +322,7 @@ bool SaveStateBase::FreezeSection()
|
|||
Freeze( size );
|
||||
m_tagspace[sizeof(m_tagspace)-1] = 0;
|
||||
|
||||
Console::Notice(
|
||||
Console.Notice(
|
||||
"Warning: Unknown tag encountered while loading savestate; going to ignore it!\n"
|
||||
"\tTagname: %s, Size: %d", m_tagspace, size
|
||||
);
|
||||
|
|
|
@ -200,6 +200,7 @@ extern bool StateCopy_HasPartialState();
|
|||
extern void StateCopy_FreezeToMem();
|
||||
extern void StateCopy_ThawFromMem();
|
||||
extern void StateCopy_SaveToFile( const wxString& file );
|
||||
extern void StateCopy_LoadFromFile( const wxString& file );
|
||||
extern void StateCopy_SaveToSlot( uint num );
|
||||
extern void StateCopy_Clear();
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ __forceinline void SIF1Dma()
|
|||
|
||||
if (sif1dma->chcr.TTE)
|
||||
{
|
||||
Console::WriteLn("SIF1 TTE");
|
||||
Console.WriteLn("SIF1 TTE");
|
||||
SIF1write(ptag + 2, 2);
|
||||
}
|
||||
|
||||
|
@ -338,11 +338,11 @@ __forceinline void SIF1Dma()
|
|||
break;
|
||||
|
||||
default:
|
||||
Console::WriteLn("Bad addr1 source chain");
|
||||
Console.WriteLn("Bad addr1 source chain");
|
||||
}
|
||||
if ((sif1dma->chcr.TIE) && (Tag::IRQ(ptag)))
|
||||
{
|
||||
Console::WriteLn("SIF1 TIE");
|
||||
Console.WriteLn("SIF1 TIE");
|
||||
sif1.end = 1;
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ __forceinline void dmaSIF2()
|
|||
|
||||
sif2dma->chcr.STR = 0;
|
||||
hwDmacIrq(DMAC_SIF2);
|
||||
Console::WriteLn("*PCSX2*: dmaSIF2");
|
||||
Console.WriteLn("*PCSX2*: dmaSIF2");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ void SIO_CommandWrite(u8 value,int way) {
|
|||
sio.buf[2]='+';
|
||||
sio.buf[3]=sio.terminator;
|
||||
//if (sio.k != 0 || (sio.sector & 0xf) != 0)
|
||||
// Console::Notice("saving : odd position for erase.");
|
||||
// Console.Notice("saving : odd position for erase.");
|
||||
|
||||
_EraseMCDBlock((512+16)*(sio.sector&~0xf));
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void __Log( const char* fmt, ... )
|
|||
#ifdef PCSX2_DEVBUILD
|
||||
if (varLog.LogToConsole) // log to console enabled?
|
||||
{
|
||||
Console::Write(tmp);
|
||||
Console.Write(tmp);
|
||||
|
||||
}
|
||||
else if( emuLog != NULL ) // manually write to the logfile.
|
||||
|
@ -111,7 +111,7 @@ static __forceinline void _vSourceLog( u16 protocol, u8 source, u32 cpuPc, u32 c
|
|||
|
||||
if (varLog.LogToConsole) // log to console enabled?
|
||||
{
|
||||
Console::WriteLn(tmp);
|
||||
Console.WriteLn(tmp);
|
||||
|
||||
} else if( emuLog != NULL ) // manually write to the logfile.
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ void statsClose() {
|
|||
#else
|
||||
f = fopen(LOGS_DIR "/stats.txt", "w");
|
||||
#endif
|
||||
if (!f) { Console::WriteLn("Can't open stats.txt"); return; }
|
||||
if (!f) { Console.WriteLn("Can't open stats.txt"); return; }
|
||||
fprintf(f, "-- PCSX2 v%s statics--\n\n", PCSX2_VERSION);
|
||||
fprintf(f, "Ran for %d seconds\n", t);
|
||||
fprintf(f, "Total VSyncs: %d (%s)\n", stats.vsyncCount, Config.PsxType ? "PAL" : "NTSC");
|
||||
|
|
|
@ -42,20 +42,18 @@ SessionOverrideFlags g_Session = {false};
|
|||
// This function should be called once during program execution.
|
||||
void SysDetect()
|
||||
{
|
||||
using namespace Console;
|
||||
|
||||
Notice("PCSX2 %d.%d.%d.r%d %s - compiled on " __DATE__, PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
||||
Console.Notice("PCSX2 %d.%d.%d.r%d %s - compiled on " __DATE__, PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
||||
SVN_REV, SVN_MODS ? "(modded)" : ""
|
||||
);
|
||||
|
||||
Notice("Savestate version: %x", g_SaveVersion);
|
||||
Console.Notice("Savestate version: %x", g_SaveVersion);
|
||||
|
||||
cpudetectInit();
|
||||
|
||||
SetColor( Color_Black );
|
||||
Console.SetColor( Color_Black );
|
||||
|
||||
WriteLn( "x86Init:" );
|
||||
WriteLn( wxsFormat(
|
||||
Console.WriteLn( "x86Init:" );
|
||||
Console.WriteLn( wxsFormat(
|
||||
L"\tCPU vendor name = %s\n"
|
||||
L"\tFamilyID = %x\n"
|
||||
L"\tx86Family = %s\n"
|
||||
|
@ -92,11 +90,11 @@ void SysDetect()
|
|||
JoinString( result[0], features[0], L".. " );
|
||||
JoinString( result[1], features[1], L".. " );
|
||||
|
||||
WriteLn( L"Features Detected:\n\t" + result[0] + (result[1].IsEmpty() ? L"" : (L"\n\t" + result[1])) + L"\n" );
|
||||
Console.WriteLn( L"Features Detected:\n\t" + result[0] + (result[1].IsEmpty() ? L"" : (L"\n\t" + result[1])) + L"\n" );
|
||||
|
||||
//if ( x86caps.VendorName[0] == 'A' ) //AMD cpu
|
||||
|
||||
Console::ClearColor();
|
||||
Console.ClearColor();
|
||||
}
|
||||
|
||||
// returns the translated error message for the Virtual Machine failing to allocate!
|
||||
|
@ -110,7 +108,7 @@ static wxString GetMemoryErrorVM()
|
|||
|
||||
SysCoreAllocations::SysCoreAllocations()
|
||||
{
|
||||
Console::Status( "Initializing PS2 virtual machine..." );
|
||||
Console.Status( "Initializing PS2 virtual machine..." );
|
||||
|
||||
RecSuccess_EE = false;
|
||||
RecSuccess_IOP = false;
|
||||
|
@ -148,7 +146,7 @@ SysCoreAllocations::SysCoreAllocations()
|
|||
);
|
||||
}
|
||||
|
||||
Console::Status( "Allocating memory for recompilers..." );
|
||||
Console.Status( "Allocating memory for recompilers..." );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -157,7 +155,7 @@ SysCoreAllocations::SysCoreAllocations()
|
|||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
Console::Error( L"EE Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
Console.Error( L"EE Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
recCpu.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -168,7 +166,7 @@ SysCoreAllocations::SysCoreAllocations()
|
|||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
Console::Error( L"IOP Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
Console.Error( L"IOP Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
psxRec.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -181,7 +179,7 @@ SysCoreAllocations::SysCoreAllocations()
|
|||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
Console::Error( L"VU0 Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
Console.Error( L"VU0 Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
VU0micro::recShutdown();
|
||||
}
|
||||
|
||||
|
@ -192,7 +190,7 @@ SysCoreAllocations::SysCoreAllocations()
|
|||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
Console::Error( L"VU1 Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
Console.Error( L"VU1 Recompiler Allocation Failed:\n" + ex.FormatDiagnosticMessage() );
|
||||
VU1micro::recShutdown();
|
||||
}
|
||||
|
||||
|
@ -252,13 +250,6 @@ void SysClearExecutionCache()
|
|||
vuMicroCpuReset();
|
||||
}
|
||||
|
||||
void SysLoadState( const wxString& srcfile )
|
||||
{
|
||||
//SysClearExecutionCache();
|
||||
//cpuReset();
|
||||
//joe.FreezeAll();
|
||||
}
|
||||
|
||||
// Maps a block of memory for use as a recompiled code buffer, and ensures that the
|
||||
// allocation is below a certain memory address (specified in "bounds" parameter).
|
||||
// The allocated block has code execution privileges.
|
||||
|
@ -269,7 +260,7 @@ u8 *SysMmapEx(uptr base, u32 size, uptr bounds, const char *caller)
|
|||
|
||||
if( (Mem == NULL) || (bounds != 0 && (((uptr)Mem + size) > bounds)) )
|
||||
{
|
||||
DevCon::Notice( "First try failed allocating %s at address 0x%x", caller, base );
|
||||
DevCon.Notice( "First try failed allocating %s at address 0x%x", caller, base );
|
||||
|
||||
// memory allocation *must* have the top bit clear, so let's try again
|
||||
// with NULL (let the OS pick something for us).
|
||||
|
@ -279,7 +270,7 @@ u8 *SysMmapEx(uptr base, u32 size, uptr bounds, const char *caller)
|
|||
Mem = (u8*)HostSys::Mmap( NULL, size );
|
||||
if( bounds != 0 && (((uptr)Mem + size) > bounds) )
|
||||
{
|
||||
DevCon::Error( "Fatal Error:\n\tSecond try failed allocating %s, block ptr 0x%x does not meet required criteria.", caller, Mem );
|
||||
DevCon.Error( "Fatal Error:\n\tSecond try failed allocating %s, block ptr 0x%x does not meet required criteria.", caller, Mem );
|
||||
SafeSysMunmap( Mem, size );
|
||||
|
||||
// returns NULL, caller should throw an exception.
|
||||
|
|
|
@ -55,8 +55,6 @@ protected:
|
|||
|
||||
|
||||
extern void SysDetect(); // Detects cpu type and fills cpuInfo structs.
|
||||
|
||||
extern void SysLoadState( const wxString& file );
|
||||
extern void SysClearExecutionCache(); // clears recompiled execution caches!
|
||||
|
||||
|
||||
|
|
|
@ -45,14 +45,14 @@ SysSuspendableThread::~SysSuspendableThread() throw()
|
|||
{
|
||||
}
|
||||
|
||||
void SysSuspendableThread::Start()
|
||||
void SysSuspendableThread::OnStart()
|
||||
{
|
||||
if( !DevAssert( m_ExecMode == ExecMode_NoThreadYet, "SysSustainableThread:Start(): Invalid execution mode" ) ) return;
|
||||
if( !pxAssertDev( m_ExecMode == ExecMode_NoThreadYet, "SysSustainableThread:Start(): Invalid execution mode" ) ) return;
|
||||
|
||||
m_ResumeEvent.Reset();
|
||||
m_SuspendEvent.Reset();
|
||||
|
||||
_parent::Start();
|
||||
_parent::OnStart();
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ void SysSuspendableThread::Suspend( bool isBlocking )
|
|||
if( m_ExecMode == ExecMode_Running )
|
||||
m_ExecMode = ExecMode_Suspending;
|
||||
|
||||
DevAssert( m_ExecMode == ExecMode_Suspending, "ExecMode should be nothing other than Suspended..." );
|
||||
pxAssertDev( m_ExecMode == ExecMode_Suspending, "ExecMode should be nothing other than Suspended..." );
|
||||
}
|
||||
m_sem_event.Post();
|
||||
m_SuspendEvent.WaitGui();
|
||||
|
@ -120,7 +120,7 @@ void SysSuspendableThread::Resume()
|
|||
}
|
||||
}
|
||||
|
||||
DevAssert( m_ExecMode == ExecMode_Suspended,
|
||||
pxAssertDev( m_ExecMode == ExecMode_Suspended,
|
||||
"SysSuspendableThread is not in a suspended/idle state? wtf!" );
|
||||
|
||||
m_ExecMode = ExecMode_Running;
|
||||
|
@ -136,11 +136,11 @@ void SysSuspendableThread::Resume()
|
|||
// (Called from the context of this thread only)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
void SysSuspendableThread::DoThreadCleanup()
|
||||
void SysSuspendableThread::OnThreadCleanup()
|
||||
{
|
||||
ScopedLock locker( m_lock_ExecMode );
|
||||
m_ExecMode = ExecMode_NoThreadYet;
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
|
||||
void SysSuspendableThread::StateCheck( bool isCancelable )
|
||||
|
@ -162,7 +162,7 @@ void SysSuspendableThread::StateCheck( bool isCancelable )
|
|||
case ExecMode_NoThreadYet:
|
||||
// threads should never have this state set while the thread is in any way
|
||||
// active or alive. (for obvious reasons!!)
|
||||
DevAssert( false, "Invalid execution state detected." );
|
||||
pxFailDev( "Invalid execution state detected." );
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -272,7 +272,7 @@ void SysCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
// --------------------------------------------------------------------------------------
|
||||
SysCoreThread& SysCoreThread::Get()
|
||||
{
|
||||
wxASSERT_MSG( tls_coreThread != NULL, L"This function must be called from the context of a running SysCoreThread." );
|
||||
pxAssertMsg( tls_coreThread != NULL, L"This function must be called from the context of a running SysCoreThread." );
|
||||
return *tls_coreThread;
|
||||
}
|
||||
|
||||
|
@ -350,10 +350,10 @@ void SysCoreThread::CpuExecute()
|
|||
|
||||
static void _cet_callback_cleanup( void* handle )
|
||||
{
|
||||
((SysCoreThread*)handle)->DoThreadCleanup();
|
||||
((SysCoreThread*)handle)->OnThreadCleanup();
|
||||
}
|
||||
|
||||
sptr SysCoreThread::ExecuteTask()
|
||||
void SysCoreThread::ExecuteTask()
|
||||
{
|
||||
tls_coreThread = this;
|
||||
|
||||
|
@ -361,8 +361,6 @@ sptr SysCoreThread::ExecuteTask()
|
|||
CpuInitializeMess();
|
||||
StateCheck();
|
||||
CpuExecute();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SysCoreThread::OnSuspendInThread()
|
||||
|
@ -378,9 +376,9 @@ void SysCoreThread::OnResumeInThread()
|
|||
|
||||
|
||||
// Invoked by the pthread_exit or pthread_cancel
|
||||
void SysCoreThread::DoThreadCleanup()
|
||||
void SysCoreThread::OnThreadCleanup()
|
||||
{
|
||||
m_plugins.Shutdown();
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,17 +61,16 @@ public:
|
|||
virtual void Resume();
|
||||
|
||||
virtual void StateCheck( bool isCancelable = true );
|
||||
virtual void DoThreadCleanup();
|
||||
virtual void OnThreadCleanup();
|
||||
|
||||
// This function is called by Resume immediately prior to releasing the suspension of
|
||||
// the core emulation thread. You should overload this rather than Resume(), since
|
||||
// Resume() has a lot of checks and balances to prevent re-entrance and race conditions.
|
||||
virtual void OnResumeReady() {}
|
||||
|
||||
|
||||
virtual void OnStart();
|
||||
|
||||
protected:
|
||||
// Marked as protected because user code should call Resume instead, which performs
|
||||
// a thread-safe check/init/resume procedure.
|
||||
virtual void Start();
|
||||
|
||||
// Extending classes should implement this, but should not call it. The parent class
|
||||
// handles invocation by the following guidelines: Called *in thread* from StateCheck()
|
||||
|
@ -107,7 +106,7 @@ public:
|
|||
virtual ~SysCoreThread() throw();
|
||||
|
||||
virtual void ApplySettings( const Pcsx2Config& src );
|
||||
virtual void DoThreadCleanup();
|
||||
virtual void OnThreadCleanup();
|
||||
virtual void ShortSuspend();
|
||||
virtual void OnResumeReady();
|
||||
|
||||
|
@ -118,5 +117,5 @@ protected:
|
|||
virtual void Start();
|
||||
virtual void OnSuspendInThread();
|
||||
virtual void OnResumeInThread();
|
||||
virtual sptr ExecuteTask();
|
||||
virtual void ExecuteTask();
|
||||
};
|
||||
|
|
22
pcsx2/Tags.h
22
pcsx2/Tags.h
|
@ -117,7 +117,7 @@ namespace Tag
|
|||
{
|
||||
if (ptag == NULL) // Is ptag empty?
|
||||
{
|
||||
Console::Error("%s BUSERR", s);
|
||||
Console.Error("%s BUSERR", s);
|
||||
UpperTransfer(tag, ptag);
|
||||
|
||||
// Set BEIS (BUSERR) in DMAC_STAT register
|
||||
|
@ -177,21 +177,21 @@ static __forceinline void PrintCHCR(const char* s, DMACh *tag)
|
|||
u8 num_addr = tag->chcr.ASP;
|
||||
u32 mode = tag->chcr.MOD;
|
||||
|
||||
Console::Write("%s chcr %s mem: ", s, (tag->chcr.DIR) ? "from" : "to");
|
||||
Console.Write("%s chcr %s mem: ", s, (tag->chcr.DIR) ? "from" : "to");
|
||||
|
||||
if (mode == NORMAL_MODE)
|
||||
Console::Write(" normal mode; ");
|
||||
Console.Write(" normal mode; ");
|
||||
else if (mode == CHAIN_MODE)
|
||||
Console::Write(" chain mode; ");
|
||||
Console.Write(" chain mode; ");
|
||||
else if (mode == INTERLEAVE_MODE)
|
||||
Console::Write(" interleave mode; ");
|
||||
Console.Write(" interleave mode; ");
|
||||
else
|
||||
Console::Write(" ?? mode; ");
|
||||
Console.Write(" ?? mode; ");
|
||||
|
||||
if (num_addr != 0) Console::Write("ASP = %d;", num_addr);
|
||||
if (tag->chcr.TTE) Console::Write("TTE;");
|
||||
if (tag->chcr.TIE) Console::Write("TIE;");
|
||||
if (tag->chcr.STR) Console::Write(" (DMA started)."); else Console::Write(" (DMA stopped).");
|
||||
Console::WriteLn("");
|
||||
if (num_addr != 0) Console.Write("ASP = %d;", num_addr);
|
||||
if (tag->chcr.TTE) Console.Write("TTE;");
|
||||
if (tag->chcr.TIE) Console.Write("TIE;");
|
||||
if (tag->chcr.STR) Console.Write(" (DMA started)."); else Console.Write(" (DMA stopped).");
|
||||
Console.Newline();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ __forceinline void _vu0run(bool breakOnMbit) {
|
|||
do {
|
||||
// knockout kings 2002 loops here with sVU
|
||||
if (breakOnMbit && (VU0.cycle-startcycle > 0x1000)) {
|
||||
Console::Notice("VU0 perma-stall, breaking execution...");
|
||||
Console.Notice("VU0 perma-stall, breaking execution...");
|
||||
break; // mVU will never get here (it handles mBit internally)
|
||||
}
|
||||
CpuVU0.ExecuteBlock();
|
||||
|
@ -159,17 +159,17 @@ void CTC2() {
|
|||
case REG_FBRST:
|
||||
VU0.VI[REG_FBRST].UL = cpuRegs.GPR.r[_Rt_].UL[0] & 0x0C0C;
|
||||
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x1) { // VU0 Force Break
|
||||
Console::Error("fixme: VU0 Force Break");
|
||||
Console.Error("fixme: VU0 Force Break");
|
||||
}
|
||||
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x2) { // VU0 Reset
|
||||
//Console::WriteLn("fixme: VU0 Reset");
|
||||
//Console.WriteLn("fixme: VU0 Reset");
|
||||
vu0ResetRegs();
|
||||
}
|
||||
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x100) { // VU1 Force Break
|
||||
Console::Error("fixme: VU1 Force Break");
|
||||
Console.Error("fixme: VU1 Force Break");
|
||||
}
|
||||
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x200) { // VU1 Reset
|
||||
// Console::WriteLn("fixme: VU1 Reset");
|
||||
// Console.WriteLn("fixme: VU1 Reset");
|
||||
vu1ResetRegs();
|
||||
}
|
||||
break;
|
||||
|
@ -354,7 +354,7 @@ void vu0Finish()
|
|||
if(VU0.VI[REG_VPU_STAT].UL & 0x1) {
|
||||
VU0.VI[REG_VPU_STAT].UL &= ~1;
|
||||
// this log tends to spam a lot (MGS3)
|
||||
//Console::Notice("vu0Finish > stall aborted by force.");
|
||||
//Console.Notice("vu0Finish > stall aborted by force.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ void vu0ExecMicro(u32 addr) {
|
|||
VUM_LOG("vu0ExecMicro %x", addr);
|
||||
|
||||
if(VU0.VI[REG_VPU_STAT].UL & 0x1) {
|
||||
DevCon::Notice("vu0ExecMicro > Stalling for previous microprogram to finish");
|
||||
DevCon.Notice("vu0ExecMicro > Stalling for previous microprogram to finish");
|
||||
vu0Finish();
|
||||
}
|
||||
VU0.VI[REG_VPU_STAT].UL|= 0x1;
|
||||
|
|
|
@ -52,7 +52,7 @@ static void _vu0Exec(VURegs* VU)
|
|||
|
||||
if(VU0.VI[REG_TPC].UL >= VU0.maxmicro){
|
||||
#ifdef CPU_LOG
|
||||
Console::WriteLn("VU0 memory overflow!!: %x", VU->VI[REG_TPC].UL);
|
||||
Console.WriteLn("VU0 memory overflow!!: %x", VU->VI[REG_TPC].UL);
|
||||
#endif
|
||||
VU0.VI[REG_VPU_STAT].UL&= ~0x1;
|
||||
VU->cycle++;
|
||||
|
@ -67,7 +67,7 @@ static void _vu0Exec(VURegs* VU)
|
|||
}
|
||||
if (ptr[1] & 0x20000000) { /* M flag */
|
||||
VU->flags|= VUFLAG_MFLAGSET;
|
||||
// Console::WriteLn("fixme: M flag set");
|
||||
// Console.WriteLn("fixme: M flag set");
|
||||
}
|
||||
if (ptr[1] & 0x10000000) { /* D flag */
|
||||
if (VU0.VI[REG_FBRST].UL & 0x4) {
|
||||
|
@ -106,19 +106,19 @@ static void _vu0Exec(VURegs* VU)
|
|||
vfreg = 0; vireg = 0;
|
||||
if (uregs.VFwrite) {
|
||||
if (lregs.VFwrite == uregs.VFwrite) {
|
||||
// Console::Notice("*PCSX2*: Warning, VF write to the same reg in both lower/upper cycle");
|
||||
// Console.Notice("*PCSX2*: Warning, VF write to the same reg in both lower/upper cycle");
|
||||
discard = 1;
|
||||
}
|
||||
if (lregs.VFread0 == uregs.VFwrite ||
|
||||
lregs.VFread1 == uregs.VFwrite) {
|
||||
// Console::WriteLn("saving reg %d at pc=%x", i, VU->VI[REG_TPC].UL);
|
||||
// Console.WriteLn("saving reg %d at pc=%x", i, VU->VI[REG_TPC].UL);
|
||||
_VF = VU->VF[uregs.VFwrite];
|
||||
vfreg = uregs.VFwrite;
|
||||
}
|
||||
}
|
||||
if (uregs.VIread & (1 << REG_CLIP_FLAG)) {
|
||||
if (lregs.VIwrite & (1 << REG_CLIP_FLAG)) {
|
||||
Console::Notice("*PCSX2*: Warning, VI write to the same reg in both lower/upper cycle");
|
||||
Console.Notice("*PCSX2*: Warning, VI write to the same reg in both lower/upper cycle");
|
||||
discard = 1;
|
||||
}
|
||||
if (lregs.VIread & (1 << REG_CLIP_FLAG)) {
|
||||
|
@ -176,7 +176,7 @@ void vu0Exec(VURegs* VU)
|
|||
{
|
||||
if (VU->VI[REG_TPC].UL >= VU->maxmicro) {
|
||||
#ifdef CPU_LOG
|
||||
Console::Notice("VU0 memory overflow!!: %x", VU->VI[REG_TPC].UL);
|
||||
Console.Notice("VU0 memory overflow!!: %x", VU->VI[REG_TPC].UL);
|
||||
#endif
|
||||
VU0.VI[REG_VPU_STAT].UL&= ~0x1;
|
||||
} else {
|
||||
|
@ -184,11 +184,11 @@ void vu0Exec(VURegs* VU)
|
|||
}
|
||||
VU->cycle++;
|
||||
|
||||
if (VU->VI[0].UL != 0) DbgCon::Error("VI[0] != 0!!!!\n");
|
||||
if (VU->VF[0].f.x != 0.0f) DbgCon::Error("VF[0].x != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.y != 0.0f) DbgCon::Error("VF[0].y != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.z != 0.0f) DbgCon::Error("VF[0].z != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.w != 1.0f) DbgCon::Error("VF[0].w != 1.0!!!!\n");
|
||||
if (VU->VI[0].UL != 0) DbgCon.Error("VI[0] != 0!!!!\n");
|
||||
if (VU->VF[0].f.x != 0.0f) DbgCon.Error("VF[0].x != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.y != 0.0f) DbgCon.Error("VF[0].y != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.z != 0.0f) DbgCon.Error("VF[0].z != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.w != 1.0f) DbgCon.Error("VF[0].w != 1.0!!!!\n");
|
||||
}
|
||||
|
||||
namespace VU0micro
|
||||
|
|
|
@ -102,19 +102,19 @@ static void _vu1Exec(VURegs* VU)
|
|||
vfreg = 0; vireg = 0;
|
||||
if (uregs.VFwrite) {
|
||||
if (lregs.VFwrite == uregs.VFwrite) {
|
||||
// Console::Notice("*PCSX2*: Warning, VF write to the same reg in both lower/upper cycle");
|
||||
// Console.Notice("*PCSX2*: Warning, VF write to the same reg in both lower/upper cycle");
|
||||
discard = 1;
|
||||
}
|
||||
if (lregs.VFread0 == uregs.VFwrite ||
|
||||
lregs.VFread1 == uregs.VFwrite) {
|
||||
// Console::WriteLn("saving reg %d at pc=%x", i, VU->VI[REG_TPC].UL);
|
||||
// Console.WriteLn("saving reg %d at pc=%x", i, VU->VI[REG_TPC].UL);
|
||||
_VF = VU->VF[uregs.VFwrite];
|
||||
vfreg = uregs.VFwrite;
|
||||
}
|
||||
}
|
||||
if (uregs.VIread & (1 << REG_CLIP_FLAG)) {
|
||||
if (lregs.VIwrite & (1 << REG_CLIP_FLAG)) {
|
||||
Console::Notice("*PCSX2*: Warning, VI write to the same reg in both lower/upper cycle");
|
||||
Console.Notice("*PCSX2*: Warning, VI write to the same reg in both lower/upper cycle");
|
||||
discard = 1;
|
||||
}
|
||||
if (lregs.VIread & (1 << REG_CLIP_FLAG)) {
|
||||
|
@ -170,11 +170,11 @@ void vu1Exec(VURegs* VU)
|
|||
_vu1Exec(VU);
|
||||
VU->cycle++;
|
||||
|
||||
if (VU->VI[0].UL != 0) DbgCon::Error("VI[0] != 0!!!!\n");
|
||||
if (VU->VF[0].f.x != 0.0f) DbgCon::Error("VF[0].x != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.y != 0.0f) DbgCon::Error("VF[0].y != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.z != 0.0f) DbgCon::Error("VF[0].z != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.w != 1.0f) DbgCon::Error("VF[0].w != 1.0!!!!\n");
|
||||
if (VU->VI[0].UL != 0) DbgCon.Error("VI[0] != 0!!!!\n");
|
||||
if (VU->VF[0].f.x != 0.0f) DbgCon.Error("VF[0].x != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.y != 0.0f) DbgCon.Error("VF[0].y != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.z != 0.0f) DbgCon.Error("VF[0].z != 0.0!!!!\n");
|
||||
if (VU->VF[0].f.w != 1.0f) DbgCon.Error("VF[0].w != 1.0!!!!\n");
|
||||
}
|
||||
|
||||
namespace VU1micro
|
||||
|
|
|
@ -179,7 +179,7 @@ static __releaseinline void __fastcall _vuFMACAdd(VURegs * VU, int reg, int xyzw
|
|||
if (VU->fmac[i].enable == 1) continue;
|
||||
break;
|
||||
}
|
||||
//if (i==8) Console::Error("*PCSX2*: error , out of fmacs %d", VU->cycle);
|
||||
//if (i==8) Console.Error("*PCSX2*: error , out of fmacs %d", VU->cycle);
|
||||
|
||||
|
||||
VUM_LOG("adding FMAC pipe[%d]; xyzw=%x", i, xyzw);
|
||||
|
@ -2064,10 +2064,10 @@ void _vuXGKICK(VURegs * VU)
|
|||
|
||||
if((size << 4) > (u32)(0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)))
|
||||
{
|
||||
//DevCon::Notice("addr + Size = 0x%x, transferring %x then doing %x", ((VU->VI[_Is_].US[0]*16) & 0x3fff) + (size << 4), (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)) >> 4, size - (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff) >> 4));
|
||||
//DevCon.Notice("addr + Size = 0x%x, transferring %x then doing %x", ((VU->VI[_Is_].US[0]*16) & 0x3fff) + (size << 4), (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)) >> 4, size - (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff) >> 4));
|
||||
memcpy_aligned(pmem, (u8*)VU->Mem+((VU->VI[_Is_].US[0]*16) & 0x3fff), 0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff));
|
||||
size -= (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)) >> 4;
|
||||
//DevCon::Notice("Size left %x", size);
|
||||
//DevCon.Notice("Size left %x", size);
|
||||
pmem += 0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff);
|
||||
memcpy_aligned(pmem, (u8*)VU->Mem, size<<4);
|
||||
}
|
||||
|
|
|
@ -582,7 +582,7 @@ void mfifoVIF1transfer(int qwc)
|
|||
int temp = vif1ch->madr; //Temporarily Store ADDR
|
||||
vif1ch->madr = qwctag(vif1ch->tadr + 16); //Set MADR to QW following the tag
|
||||
vif1ch->tadr = temp; //Copy temporarily stored ADDR to Tag
|
||||
if ((temp & dmacRegs->rbsr.RMSK) != dmacRegs->rbor.ADDR) Console::WriteLn("Next tag = %x outside ring %x size %x", temp, psHu32(DMAC_RBOR), psHu32(DMAC_RBSR));
|
||||
if ((temp & dmacRegs->rbsr.RMSK) != dmacRegs->rbor.ADDR) Console.WriteLn("Next tag = %x outside ring %x size %x", temp, psHu32(DMAC_RBOR), psHu32(DMAC_RBSR));
|
||||
vif1.done = false;
|
||||
break;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ void vifMFIFOInterrupt()
|
|||
case 0: //Set up transfer
|
||||
if (vif1ch->tadr == spr0->madr)
|
||||
{
|
||||
// Console::WriteLn("Empty 1");
|
||||
// Console.WriteLn("Empty 1");
|
||||
vifqwc = 0;
|
||||
vif1.inprogress |= 0x10;
|
||||
vif1Regs->stat &= ~VIF1_STAT_FQC; // FQC=0
|
||||
|
@ -685,7 +685,7 @@ void vifMFIFOInterrupt()
|
|||
|
||||
/*if (vifqwc <= 0)
|
||||
{
|
||||
//Console::WriteLn("Empty 2");
|
||||
//Console.WriteLn("Empty 2");
|
||||
//vif1.inprogress |= 0x10;
|
||||
vif1Regs->stat &= ~VIF1_STAT_FQC; // FQC=0
|
||||
hwDmacIrq(DMAC_MFIFO_EMPTY);
|
||||
|
|
106
pcsx2/VifDma.cpp
106
pcsx2/VifDma.cpp
|
@ -308,7 +308,7 @@ static void ProcessMemSkip(int size, unsigned int unpackType, const unsigned int
|
|||
VIFUNPACK_LOG("Processing V4-5 skip, size = %d", size);
|
||||
break;
|
||||
default:
|
||||
Console::WriteLn("Invalid unpack type %x", unpackType);
|
||||
Console.WriteLn("Invalid unpack type %x", unpackType);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -389,14 +389,14 @@ static int VIFalign(u32 *data, vifCode *v, unsigned int size, const unsigned int
|
|||
//This is just to make sure the alignment isnt loopy on a split packet
|
||||
if(vifRegs->offset != ((vif->tag.addr & 0xf) >> 2))
|
||||
{
|
||||
DevCon::Error("Warning: Unpack alignment error");
|
||||
DevCon.Error("Warning: Unpack alignment error");
|
||||
}
|
||||
|
||||
VIFUNPACK_LOG("Aligning packet size = %d offset %d addr %x", size, vifRegs->offset, vif->tag.addr);
|
||||
|
||||
if (((u32)size / (u32)ft->dsize) < ((u32)ft->qsize - vifRegs->offset))
|
||||
{
|
||||
DevCon::Error("Wasn't enough left size/dsize = %x left to write %x", (size / ft->dsize), (ft->qsize - vifRegs->offset));
|
||||
DevCon.Error("Wasn't enough left size/dsize = %x left to write %x", (size / ft->dsize), (ft->qsize - vifRegs->offset));
|
||||
}
|
||||
unpacksize = min((size / ft->dsize), (ft->qsize - vifRegs->offset));
|
||||
|
||||
|
@ -413,7 +413,7 @@ static int VIFalign(u32 *data, vifCode *v, unsigned int size, const unsigned int
|
|||
}
|
||||
else
|
||||
{
|
||||
DevCon::Notice("Offset = %x", vifRegs->offset);
|
||||
DevCon.Notice("Offset = %x", vifRegs->offset);
|
||||
vif->tag.addr += unpacksize * 4;
|
||||
return size>>2;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ static int VIFalign(u32 *data, vifCode *v, unsigned int size, const unsigned int
|
|||
/* unpack one qword */
|
||||
if(vif->tag.addr + ((size / ft->dsize) * 4) >= (u32)(VIFdmanum ? 0x4000 : 0x1000))
|
||||
{
|
||||
//DevCon::Notice("Overflow");
|
||||
//DevCon.Notice("Overflow");
|
||||
vif->tag.addr &= (u32)(VIFdmanum ? 0x3fff : 0xfff);
|
||||
dest = (u32*)(VU->Mem + v->addr);
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static void VIFunpack(u32 *data, vifCode *v, unsigned int size, const unsigned i
|
|||
{
|
||||
if (v->addr >= memlimit)
|
||||
{
|
||||
//DevCon::Notice("Overflown at the start");
|
||||
//DevCon.Notice("Overflown at the start");
|
||||
v->addr &= (memlimit - 1);
|
||||
dest = (u32*)(VU->Mem + v->addr);
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ static void VIFunpack(u32 *data, vifCode *v, unsigned int size, const unsigned i
|
|||
}
|
||||
else
|
||||
{
|
||||
//DevCon::Notice("VIF%x Unpack ending %x > %x", VIFdmanum, tempsize, VIFdmanum ? 0x4000 : 0x1000);
|
||||
//DevCon.Notice("VIF%x Unpack ending %x > %x", VIFdmanum, tempsize, VIFdmanum ? 0x4000 : 0x1000);
|
||||
tempsize = size;
|
||||
size = 0;
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ static void VIFunpack(u32 *data, vifCode *v, unsigned int size, const unsigned i
|
|||
int incdest = ((vifRegs->cycle.cl - vifRegs->cycle.wl) << 2) + 4;
|
||||
size = 0;
|
||||
int addrstart = v->addr;
|
||||
if((tempsize >> 2) != vif->tag.size) DevCon::Notice("split when size != tagsize");
|
||||
if((tempsize >> 2) != vif->tag.size) DevCon.Notice("split when size != tagsize");
|
||||
|
||||
VIFUNPACK_LOG("sorting tempsize :p, size %d, vifnum %d, addr %x", tempsize, vifRegs->num, vif->tag.addr);
|
||||
|
||||
|
@ -753,7 +753,7 @@ static void VIFunpack(u32 *data, vifCode *v, unsigned int size, const unsigned i
|
|||
{
|
||||
if(v->addr >= memlimit)
|
||||
{
|
||||
DevCon::Notice("Mem limit ovf");
|
||||
DevCon.Notice("Mem limit ovf");
|
||||
v->addr &= (memlimit - 1);
|
||||
dest = (u32*)(VU->Mem + v->addr);
|
||||
}
|
||||
|
@ -819,9 +819,9 @@ static void VIFunpack(u32 *data, vifCode *v, unsigned int size, const unsigned i
|
|||
|
||||
if(vifRegs->cycle.cl > 0) // Quicker and avoids zero division :P
|
||||
if((u32)(((size / ft->gsize) / vifRegs->cycle.cl) * vifRegs->cycle.wl) < vifRegs->num)
|
||||
DevCon::Notice("Filling write warning! %x < %x and CL = %x WL = %x", (size / ft->gsize), vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl);
|
||||
DevCon.Notice("Filling write warning! %x < %x and CL = %x WL = %x", (size / ft->gsize), vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl);
|
||||
|
||||
//DevCon::Notice("filling write %d cl %d, wl %d mask %x mode %x unpacktype %x addr %x", vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mask, vifRegs->mode, unpackType, vif->tag.addr);
|
||||
//DevCon.Notice("filling write %d cl %d, wl %d mask %x mode %x unpacktype %x addr %x", vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mask, vifRegs->mode, unpackType, vif->tag.addr);
|
||||
while (vifRegs->num > 0)
|
||||
{
|
||||
if (vif->cl == vifRegs->cycle.wl)
|
||||
|
@ -878,7 +878,7 @@ static void vuExecMicro(u32 addr, const u32 VIFdmanum)
|
|||
}
|
||||
|
||||
if (VU->vifRegs->itops > (VIFdmanum ? 0x3ffu : 0xffu))
|
||||
Console::WriteLn("VIF%d ITOP overrun! %x", VIFdmanum, VU->vifRegs->itops);
|
||||
Console.WriteLn("VIF%d ITOP overrun! %x", VIFdmanum, VU->vifRegs->itops);
|
||||
|
||||
VU->vifRegs->itop = VU->vifRegs->itops;
|
||||
|
||||
|
@ -926,7 +926,7 @@ static __forceinline void vif0UNPACK(u32 *data)
|
|||
|
||||
if (vif0Regs->cycle.wl == 0 && vif0Regs->cycle.wl < vif0Regs->cycle.cl)
|
||||
{
|
||||
Console::WriteLn("Vif0 CL %d, WL %d", vif0Regs->cycle.cl, vif0Regs->cycle.wl);
|
||||
Console.WriteLn("Vif0 CL %d, WL %d", vif0Regs->cycle.cl, vif0Regs->cycle.wl);
|
||||
vif0.cmd &= ~0x7f;
|
||||
return;
|
||||
}
|
||||
|
@ -960,7 +960,7 @@ static __forceinline void vif0UNPACK(u32 *data)
|
|||
|
||||
static __forceinline void vif0mpgTransfer(u32 addr, u32 *data, int size)
|
||||
{
|
||||
/* Console::WriteLn("vif0mpgTransfer addr=%x; size=%x", addr, size);
|
||||
/* Console.WriteLn("vif0mpgTransfer addr=%x; size=%x", addr, size);
|
||||
{
|
||||
FILE *f = fopen("vu1.raw", "wb");
|
||||
fwrite(data, 1, size*4, f);
|
||||
|
@ -980,7 +980,7 @@ static __forceinline void vif0mpgTransfer(u32 addr, u32 *data, int size)
|
|||
|
||||
static int __fastcall Vif0TransNull(u32 *data) // Shouldnt go here
|
||||
{
|
||||
Console::WriteLn("VIF0 Shouldnt go here CMD = %x", vif0Regs->code);
|
||||
Console.WriteLn("VIF0 Shouldnt go here CMD = %x", vif0Regs->code);
|
||||
vif0.cmd = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ static int __fastcall Vif0TransMPG(u32 *data) // MPG
|
|||
{
|
||||
if (vif0.vifpacketsize < vif0.tag.size)
|
||||
{
|
||||
if((vif0.tag.addr + vif0.vifpacketsize) > 0x1000) DevCon::Notice("Vif0 MPG Split Overflow");
|
||||
if((vif0.tag.addr + vif0.vifpacketsize) > 0x1000) DevCon.Notice("Vif0 MPG Split Overflow");
|
||||
|
||||
vif0mpgTransfer(vif0.tag.addr, data, vif0.vifpacketsize);
|
||||
vif0.tag.addr += vif0.vifpacketsize << 2;
|
||||
|
@ -1077,7 +1077,7 @@ static int __fastcall Vif0TransMPG(u32 *data) // MPG
|
|||
{
|
||||
int ret;
|
||||
|
||||
if((vif0.tag.addr + vif0.tag.size) > 0x1000) DevCon::Notice("Vif0 MPG Overflow");
|
||||
if((vif0.tag.addr + vif0.tag.size) > 0x1000) DevCon.Notice("Vif0 MPG Overflow");
|
||||
|
||||
vif0mpgTransfer(vif0.tag.addr, data, vif0.tag.size);
|
||||
ret = vif0.tag.size;
|
||||
|
@ -1222,7 +1222,7 @@ static void Vif0CMDNull() // invalid opcode
|
|||
// if ME1, then force the vif to interrupt
|
||||
if (!(vif0Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
||||
{
|
||||
Console::WriteLn("UNKNOWN VifCmd: %x", vif0.cmd);
|
||||
Console.WriteLn("UNKNOWN VifCmd: %x", vif0.cmd);
|
||||
vif0Regs->stat |= VIF0_STAT_ER1;
|
||||
vif0.irq++;
|
||||
}
|
||||
|
@ -1252,7 +1252,7 @@ int VIF0transfer(u32 *data, int size, int istag)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (vif0.tag.size != 0) Console::WriteLn("no vif0 cmd but tag size is left last cmd read %x", vif0Regs->code);
|
||||
if (vif0.tag.size != 0) Console.WriteLn("no vif0 cmd but tag size is left last cmd read %x", vif0Regs->code);
|
||||
|
||||
// if interrupt and new cmd is NOT MARK
|
||||
if (vif0.irq) break;
|
||||
|
@ -1274,7 +1274,7 @@ int VIF0transfer(u32 *data, int size, int istag)
|
|||
{
|
||||
if (!(vif0Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
||||
{
|
||||
Console::WriteLn("UNKNOWN VifCmd: %x", vif0.cmd);
|
||||
Console.WriteLn("UNKNOWN VifCmd: %x", vif0.cmd);
|
||||
vif0Regs->stat |= VIF0_STAT_ER1;
|
||||
vif0.irq++;
|
||||
}
|
||||
|
@ -1315,7 +1315,7 @@ int VIF0transfer(u32 *data, int size, int istag)
|
|||
vif0.vifstalled = true;
|
||||
|
||||
if (((vif0Regs->code >> 24) & 0x7f) != 0x7)vif0Regs->stat |= VIF0_STAT_VIS;
|
||||
//else Console::WriteLn("VIF0 IRQ on MARK");
|
||||
//else Console.WriteLn("VIF0 IRQ on MARK");
|
||||
|
||||
// spiderman doesn't break on qw boundaries
|
||||
vif0.irqoffset = transferred % 4; // cannot lose the offset
|
||||
|
@ -1326,7 +1326,7 @@ int VIF0transfer(u32 *data, int size, int istag)
|
|||
vif0ch->madr += (transferred << 4);
|
||||
vif0ch->qwc -= transferred;
|
||||
}
|
||||
//else Console::WriteLn("Stall on vif0, FromSPR = %x, Vif0MADR = %x Sif0MADR = %x STADR = %x", psHu32(0x1000d010), vif0ch->madr, psHu32(0x1000c010), psHu32(DMAC_STADR));
|
||||
//else Console.WriteLn("Stall on vif0, FromSPR = %x, Vif0MADR = %x Sif0MADR = %x STADR = %x", psHu32(0x1000d010), vif0ch->madr, psHu32(0x1000c010), psHu32(DMAC_STADR));
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
@ -1440,14 +1440,14 @@ void vif0Interrupt()
|
|||
}
|
||||
}
|
||||
|
||||
if (!vif0ch->chcr.STR) Console::WriteLn("Vif0 running when CHCR = %x", vif0ch->chcr._u32);
|
||||
if (!vif0ch->chcr.STR) Console.WriteLn("Vif0 running when CHCR = %x", vif0ch->chcr._u32);
|
||||
|
||||
if ((vif0ch->chcr.MOD == CHAIN_MODE) && (!vif0.done) && (!vif0.vifstalled))
|
||||
{
|
||||
|
||||
if (!(dmacRegs->ctrl.DMAE))
|
||||
{
|
||||
Console::WriteLn("vif0 dma masked");
|
||||
Console.WriteLn("vif0 dma masked");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1460,8 +1460,8 @@ void vif0Interrupt()
|
|||
return;
|
||||
}
|
||||
|
||||
if (vif0ch->qwc > 0) Console::WriteLn("VIF0 Ending with QWC left");
|
||||
if (vif0.cmd != 0) Console::WriteLn("vif0.cmd still set %x", vif0.cmd);
|
||||
if (vif0ch->qwc > 0) Console.WriteLn("VIF0 Ending with QWC left");
|
||||
if (vif0.cmd != 0) Console.WriteLn("vif0.cmd still set %x", vif0.cmd);
|
||||
|
||||
vif0ch->chcr.STR = 0;
|
||||
hwDmacIrq(DMAC_VIF0);
|
||||
|
@ -1519,7 +1519,7 @@ void dmaVIF0()
|
|||
{
|
||||
if (_VIF0chain() == -2)
|
||||
{
|
||||
Console::WriteLn("Stall on normal %x", vif0Regs->stat);
|
||||
Console.WriteLn("Stall on normal %x", vif0Regs->stat);
|
||||
vif0.vifstalled = true;
|
||||
return;
|
||||
}
|
||||
|
@ -1552,7 +1552,7 @@ void vif0Write32(u32 mem, u32 value)
|
|||
if (value & 0x1)
|
||||
{
|
||||
/* Reset VIF */
|
||||
//Console::WriteLn("Vif0 Reset %x", vif0Regs->stat);
|
||||
//Console.WriteLn("Vif0 Reset %x", vif0Regs->stat);
|
||||
memzero(vif0);
|
||||
vif0ch->qwc = 0; //?
|
||||
cpuRegs.interrupt &= ~1; //Stop all vif0 DMA's
|
||||
|
@ -1571,7 +1571,7 @@ void vif0Write32(u32 mem, u32 value)
|
|||
vif0Regs->stat |= VIF0_STAT_VFS;
|
||||
vif0Regs->stat &= ~VIF0_STAT_VPS;
|
||||
vif0.vifstalled = true;
|
||||
Console::WriteLn("vif0 force break");
|
||||
Console.WriteLn("vif0 force break");
|
||||
}
|
||||
|
||||
if (value & 0x4)
|
||||
|
@ -1638,7 +1638,7 @@ void vif0Write32(u32 mem, u32 value)
|
|||
break;
|
||||
|
||||
default:
|
||||
Console::WriteLn("Unknown Vif0 write to %x", mem);
|
||||
Console.WriteLn("Unknown Vif0 write to %x", mem);
|
||||
psHu32(mem) = value;
|
||||
break;
|
||||
}
|
||||
|
@ -1695,7 +1695,7 @@ static __forceinline void vif1UNPACK(u32 *data)
|
|||
{
|
||||
if (vif1Regs->cycle.wl < vif1Regs->cycle.cl)
|
||||
{
|
||||
Console::WriteLn("Vif1 CL %d, WL %d", vif1Regs->cycle.cl, vif1Regs->cycle.wl);
|
||||
Console.WriteLn("Vif1 CL %d, WL %d", vif1Regs->cycle.cl, vif1Regs->cycle.wl);
|
||||
vif1.cmd &= ~0x7f;
|
||||
return;
|
||||
}
|
||||
|
@ -1734,7 +1734,7 @@ static __forceinline void vif1UNPACK(u32 *data)
|
|||
|
||||
static __forceinline void vif1mpgTransfer(u32 addr, u32 *data, int size)
|
||||
{
|
||||
/* Console::WriteLn("vif1mpgTransfer addr=%x; size=%x", addr, size);
|
||||
/* Console.WriteLn("vif1mpgTransfer addr=%x; size=%x", addr, size);
|
||||
{
|
||||
FILE *f = fopen("vu1.raw", "wb");
|
||||
fwrite(data, 1, size*4, f);
|
||||
|
@ -1754,7 +1754,7 @@ static __forceinline void vif1mpgTransfer(u32 addr, u32 *data, int size)
|
|||
|
||||
static int __fastcall Vif1TransNull(u32 *data) // Shouldnt go here
|
||||
{
|
||||
Console::WriteLn("Shouldnt go here CMD = %x", vif1Regs->code);
|
||||
Console.WriteLn("Shouldnt go here CMD = %x", vif1Regs->code);
|
||||
vif1.cmd = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1836,7 +1836,7 @@ static int __fastcall Vif1TransMPG(u32 *data)
|
|||
{
|
||||
if (vif1.vifpacketsize < vif1.tag.size)
|
||||
{
|
||||
if((vif1.tag.addr + vif1.vifpacketsize) > 0x4000) DevCon::Notice("Vif1 MPG Split Overflow");
|
||||
if((vif1.tag.addr + vif1.vifpacketsize) > 0x4000) DevCon.Notice("Vif1 MPG Split Overflow");
|
||||
vif1mpgTransfer(vif1.tag.addr, data, vif1.vifpacketsize);
|
||||
vif1.tag.addr += vif1.vifpacketsize << 2;
|
||||
vif1.tag.size -= vif1.vifpacketsize;
|
||||
|
@ -1845,7 +1845,7 @@ static int __fastcall Vif1TransMPG(u32 *data)
|
|||
else
|
||||
{
|
||||
int ret;
|
||||
if((vif1.tag.addr + vif1.tag.size) > 0x4000) DevCon::Notice("Vif1 MPG Overflow");
|
||||
if((vif1.tag.addr + vif1.tag.size) > 0x4000) DevCon.Notice("Vif1 MPG Overflow");
|
||||
vif1mpgTransfer(vif1.tag.addr, data, vif1.tag.size);
|
||||
ret = vif1.tag.size;
|
||||
vif1.tag.size = 0;
|
||||
|
@ -2037,7 +2037,7 @@ u8 schedulepath3msk = 0;
|
|||
void Vif1MskPath3() // MSKPATH3
|
||||
{
|
||||
vif1Regs->mskpath3 = schedulepath3msk & 0x1;
|
||||
//Console::WriteLn("VIF MSKPATH3 %x", vif1Regs->mskpath3);
|
||||
//Console.WriteLn("VIF MSKPATH3 %x", vif1Regs->mskpath3);
|
||||
|
||||
if (vif1Regs->mskpath3)
|
||||
{
|
||||
|
@ -2146,7 +2146,7 @@ static void Vif1CMDNull() // invalid opcode
|
|||
|
||||
if (!(vif1Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
||||
{
|
||||
Console::WriteLn("UNKNOWN VifCmd: %x\n", vif1.cmd);
|
||||
Console.WriteLn("UNKNOWN VifCmd: %x\n", vif1.cmd);
|
||||
vif1Regs->stat |= VIF1_STAT_ER1;
|
||||
vif1.irq++;
|
||||
}
|
||||
|
@ -2224,7 +2224,7 @@ int VIF1transfer(u32 *data, int size, int istag)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (vif1.tag.size != 0) DevCon::Error("no vif1 cmd but tag size is left last cmd read %x", vif1Regs->code);
|
||||
if (vif1.tag.size != 0) DevCon.Error("no vif1 cmd but tag size is left last cmd read %x", vif1Regs->code);
|
||||
|
||||
if (vif1.irq) break;
|
||||
|
||||
|
@ -2244,7 +2244,7 @@ int VIF1transfer(u32 *data, int size, int istag)
|
|||
{
|
||||
if (!(vif0Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
||||
{
|
||||
Console::WriteLn("UNKNOWN VifCmd: %x", vif1.cmd);
|
||||
Console.WriteLn("UNKNOWN VifCmd: %x", vif1.cmd);
|
||||
vif1Regs->stat |= VIF1_STAT_ER1;
|
||||
vif1.irq++;
|
||||
}
|
||||
|
@ -2297,7 +2297,7 @@ int VIF1transfer(u32 *data, int size, int istag)
|
|||
vif1ch->qwc -= transferred;
|
||||
|
||||
if ((vif1ch->qwc == 0) && (vif1.irqoffset == 0)) vif1.inprogress = 0;
|
||||
//Console::WriteLn("Stall on vif1, FromSPR = %x, Vif1MADR = %x Sif0MADR = %x STADR = %x", psHu32(0x1000d010), vif1ch->madr, psHu32(0x1000c010), psHu32(DMAC_STADR));
|
||||
//Console.WriteLn("Stall on vif1, FromSPR = %x, Vif1MADR = %x Sif0MADR = %x STADR = %x", psHu32(0x1000d010), vif1ch->madr, psHu32(0x1000c010), psHu32(DMAC_STADR));
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
@ -2330,7 +2330,7 @@ void vif1TransferFromMemory()
|
|||
// VIF from gsMemory
|
||||
if (pMem == NULL) //Is vif0ptag empty?
|
||||
{
|
||||
Console::WriteLn("Vif1 Tag BUSERR");
|
||||
Console.WriteLn("Vif1 Tag BUSERR");
|
||||
dmacRegs->stat.BEIS = 1; //If yes, set BEIS (BUSERR) in DMAC_STAT register
|
||||
vif1.done = true;
|
||||
vif1Regs->stat &= ~VIF1_STAT_FQC;
|
||||
|
@ -2510,7 +2510,7 @@ __forceinline void vif1Interrupt()
|
|||
|
||||
}
|
||||
|
||||
if (!(vif1ch->chcr.STR)) Console::WriteLn("Vif1 running when CHCR == %x", vif1ch->chcr._u32);
|
||||
if (!(vif1ch->chcr.STR)) Console.WriteLn("Vif1 running when CHCR == %x", vif1ch->chcr._u32);
|
||||
|
||||
if (vif1.irq && vif1.tag.size == 0)
|
||||
{
|
||||
|
@ -2546,7 +2546,7 @@ __forceinline void vif1Interrupt()
|
|||
|
||||
if (!(dmacRegs->ctrl.DMAE))
|
||||
{
|
||||
Console::WriteLn("vif1 dma masked");
|
||||
Console.WriteLn("vif1 dma masked");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2562,8 +2562,8 @@ __forceinline void vif1Interrupt()
|
|||
return; //Dont want to end if vif is stalled.
|
||||
}
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if (vif1ch->qwc > 0) Console::WriteLn("VIF1 Ending with %x QWC left");
|
||||
if (vif1.cmd != 0) Console::WriteLn("vif1.cmd still set %x tag size %x", vif1.cmd, vif1.tag.size);
|
||||
if (vif1ch->qwc > 0) Console.WriteLn("VIF1 Ending with %x QWC left");
|
||||
if (vif1.cmd != 0) Console.WriteLn("vif1.cmd still set %x tag size %x", vif1.cmd, vif1.tag.size);
|
||||
#endif
|
||||
|
||||
vif1Regs->stat &= ~VIF1_STAT_VPS; //Vif goes idle as the stall happened between commands;
|
||||
|
@ -2590,9 +2590,9 @@ void dmaVIF1()
|
|||
|
||||
if (dmacRegs->ctrl.MFD == MFD_VIF1) // VIF MFIFO
|
||||
{
|
||||
//Console::WriteLn("VIFMFIFO\n");
|
||||
//Console.WriteLn("VIFMFIFO\n");
|
||||
// Test changed because the Final Fantasy 12 opening somehow has the tag in *Undefined* mode, which is not in the documentation that I saw.
|
||||
if (vif1ch->chcr.MOD == NORMAL_MODE) Console::WriteLn("MFIFO mode is normal (which isn't normal here)! %x", vif1ch->chcr);
|
||||
if (vif1ch->chcr.MOD == NORMAL_MODE) Console.WriteLn("MFIFO mode is normal (which isn't normal here)! %x", vif1ch->chcr);
|
||||
vifMFIFOInterrupt();
|
||||
return;
|
||||
}
|
||||
|
@ -2600,7 +2600,7 @@ void dmaVIF1()
|
|||
#ifdef PCSX2_DEVBUILD
|
||||
if (dmacRegs->ctrl.STD == STD_VIF1)
|
||||
{
|
||||
//DevCon::WriteLn("VIF Stall Control Source = %x, Drain = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3);
|
||||
//DevCon.WriteLn("VIF Stall Control Source = %x, Drain = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2608,7 +2608,7 @@ void dmaVIF1()
|
|||
{
|
||||
|
||||
if (dmacRegs->ctrl.STD == STD_VIF1)
|
||||
Console::WriteLn("DMA Stall Control on VIF1 normal");
|
||||
Console.WriteLn("DMA Stall Control on VIF1 normal");
|
||||
|
||||
if (vif1ch->chcr.DIR) // to Memory
|
||||
vif1.dmamode = VIF_NORMAL_TO_MEM_MODE;
|
||||
|
@ -2675,7 +2675,7 @@ void vif1Write32(u32 mem, u32 value)
|
|||
vif1Regs->stat &= ~VIF1_STAT_VPS;
|
||||
cpuRegs.interrupt &= ~((1 << 1) | (1 << 10)); //Stop all vif1 DMA's
|
||||
vif1.vifstalled = true;
|
||||
Console::WriteLn("vif1 force break");
|
||||
Console.WriteLn("vif1 force break");
|
||||
}
|
||||
|
||||
if (value & 0x4)
|
||||
|
@ -2710,7 +2710,7 @@ void vif1Write32(u32 mem, u32 value)
|
|||
// loop necessary for spiderman
|
||||
if ((psHu32(DMAC_CTRL) & 0xC) == 0x8)
|
||||
{
|
||||
//Console::WriteLn("MFIFO Stall");
|
||||
//Console.WriteLn("MFIFO Stall");
|
||||
CPU_INT(10, vif1ch->qwc * BIAS);
|
||||
}
|
||||
else
|
||||
|
@ -2741,7 +2741,7 @@ void vif1Write32(u32 mem, u32 value)
|
|||
// different so can't be stalled
|
||||
if (vif1Regs->stat & (VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS))
|
||||
{
|
||||
DevCon::WriteLn("changing dir when vif1 fifo stalled");
|
||||
DevCon.WriteLn("changing dir when vif1 fifo stalled");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2781,7 +2781,7 @@ void vif1Write32(u32 mem, u32 value)
|
|||
break;
|
||||
|
||||
default:
|
||||
Console::WriteLn("Unknown Vif1 write to %x", mem);
|
||||
Console.WriteLn("Unknown Vif1 write to %x", mem);
|
||||
psHu32(mem) = value;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ class AppCoreThread;
|
|||
#include "System.h"
|
||||
#include "System/SysThreads.h"
|
||||
|
||||
#define AllowFromMainThreadOnly() \
|
||||
pxAssertMsg( wxThread::IsMain(), "Thread affinity violation: Call allowed from main thread only." )
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 )
|
||||
DECLARE_EVENT_TYPE( pxEVT_OpenModalDialog, -1 )
|
||||
|
@ -45,6 +48,12 @@ BEGIN_DECLARE_EVENT_TYPES()
|
|||
DECLARE_EVENT_TYPE( pxEVT_ThawFinished, -1 )
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
// This is used when the GS plugin is handling its own window. Messages from the PAD
|
||||
// are piped through to an app-level message handler, which dispatches them through
|
||||
// the universal Accelerator table.
|
||||
static const int pxID_PadHandler_Keydown = 8030;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// All Menu Options for the Main Window! :D
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -338,7 +347,6 @@ public:
|
|||
void SysExecute();
|
||||
void SysExecute( CDVD_SourceType cdvdsrc );
|
||||
void SysReset();
|
||||
bool SysIsActive() const;
|
||||
|
||||
const wxBitmap& GetLogoBitmap();
|
||||
wxImageList& GetImgList_Config();
|
||||
|
@ -346,17 +354,19 @@ public:
|
|||
|
||||
const AppImageIds& GetImgId() const { return m_ImageId; }
|
||||
|
||||
bool HasMainFrame() const { return m_MainFrame != NULL; }
|
||||
bool HasCoreThread() const { return m_CoreThread != NULL; }
|
||||
|
||||
MainEmuFrame& GetMainFrame() const;
|
||||
SysCoreThread& GetCoreThread() const;
|
||||
MainEmuFrame& GetMainFrameOrExcept() const;
|
||||
SysCoreThread& GetCoreThreadOrExcept() const;
|
||||
|
||||
bool HasMainFrame() const { return m_MainFrame != NULL; }
|
||||
bool HasCoreThread() const { return m_CoreThread != NULL; }
|
||||
|
||||
MainEmuFrame* GetMainFramePtr() const { return m_MainFrame; }
|
||||
SysCoreThread* GetCoreThreadPtr() const { return m_CoreThread; }
|
||||
|
||||
void OpenGsFrame();
|
||||
void OnGsFrameClosed();
|
||||
|
||||
void OnMainFrameClosed();
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Overrides of wxApp virtuals:
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -375,9 +385,12 @@ public:
|
|||
// Console / Program Logging Helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
ConsoleLogFrame* GetProgramLog();
|
||||
void CloseProgramLog();
|
||||
void ProgramLog_CountMsg();
|
||||
void ProgramLog_PostEvent( wxEvent& evt );
|
||||
void EnableConsoleLogging() const;
|
||||
void DisableWindowLogging() const;
|
||||
void DisableDiskLogging() const;
|
||||
void OnProgramLogClosed();
|
||||
|
||||
protected:
|
||||
void InitDefaultGlobalAccelerators();
|
||||
|
@ -433,29 +446,52 @@ public:
|
|||
virtual ~AppCoreThread() throw();
|
||||
|
||||
virtual void Suspend( bool isBlocking=true );
|
||||
virtual void Resume();
|
||||
virtual void StateCheck( bool isCancelable=true );
|
||||
virtual void ApplySettings( const Pcsx2Config& src );
|
||||
|
||||
protected:
|
||||
virtual void OnResumeReady();
|
||||
virtual void DoThreadCleanup();
|
||||
sptr ExecuteTask();
|
||||
virtual void OnThreadCleanup();
|
||||
virtual void ExecuteTask();
|
||||
};
|
||||
|
||||
DECLARE_APP(Pcsx2App)
|
||||
|
||||
class EntryGuard
|
||||
{
|
||||
public:
|
||||
int& Counter;
|
||||
EntryGuard( int& counter ) : Counter( counter )
|
||||
{ ++Counter; }
|
||||
// --------------------------------------------------------------------------------------
|
||||
// s* macros! ['s' stands for 'shortcut']
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Use these for "silent fail" invocation of PCSX2 Application-related constructs. If the
|
||||
// construct (albeit wxApp, MainFrame, CoreThread, etc) is null, the requested method will
|
||||
// not be invoked, and an optional "else" clause cn be affixed for handling the end case.
|
||||
//
|
||||
// Usage Examples:
|
||||
// sCoreThread.Suspend(); // Suspends the CoreThread, or does nothing if the CoreThread handle is NULL
|
||||
// sCoreThread.Suspend(); else Console.WriteLn( "Judge Wapner" ); // 'else' clause for handling NULL scenarios.
|
||||
//
|
||||
// Note! These macros are not "syntax complete", which means they could generat unexpected
|
||||
// syntax errors in some situatins, and more importantly they cannot be used for invoking
|
||||
// functions with return values.
|
||||
//
|
||||
// Rationale: There are a lot of situations where we want to invoke a void-style method on
|
||||
// various volatile object pointers (App, Corethread, MainFrame, etc). Typically if these
|
||||
// objects are NULL the most intuitive response is to simply ignore the call request and
|
||||
// continue running silently. These macros make that possible without any extra boilerplate
|
||||
// conditionals or temp variable defines in the code.
|
||||
//
|
||||
#define sApp \
|
||||
if( Pcsx2App* __app_ = (Pcsx2App*)wxApp::GetInstance() ) (*__app_)
|
||||
|
||||
virtual ~EntryGuard() throw()
|
||||
{ --Counter; }
|
||||
#define sCoreThread \
|
||||
if( SysCoreThread* __thread_ = GetCoreThreadPtr() ) (*__thread_)
|
||||
|
||||
bool IsReentrant() const { return Counter > 1; }
|
||||
};
|
||||
#define sMainFrame \
|
||||
if( MainEmuFrame* __frame_ = GetMainFramePtr() ) (*__frame_)
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// External App-related Globals and Shortcuts
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
extern bool sys_resume_lock;
|
||||
|
||||
|
@ -473,14 +509,12 @@ extern void AppApplySettings( const AppConfig* oldconf=NULL );
|
|||
extern bool SysHasValidState();
|
||||
|
||||
extern void SysStatus( const wxString& text );
|
||||
extern void SysSuspend( bool closePlugins = true );
|
||||
extern void SysResume();
|
||||
extern void SysReset();
|
||||
extern void SysExecute();
|
||||
extern void SysExecute( CDVD_SourceType cdvdsrc );
|
||||
|
||||
extern bool HasMainFrame();
|
||||
extern bool HasCoreThread();
|
||||
|
||||
extern MainEmuFrame& GetMainFrame();
|
||||
extern SysCoreThread& GetCoreThread();
|
||||
|
||||
extern MainEmuFrame* GetMainFramePtr();
|
||||
extern SysCoreThread* GetCoreThreadPtr();
|
||||
|
|
|
@ -105,8 +105,8 @@ void Pcsx2App::OnAssertFailure( const wxChar *file, int line, const wxChar *func
|
|||
wxString trace( L"Call stack:\n" + pxGetStackTrace() );
|
||||
|
||||
wxMessageOutputDebug().Printf( dbgmsg );
|
||||
Console::Error( dbgmsg );
|
||||
Console::WriteLn( trace );
|
||||
Console.Error( dbgmsg );
|
||||
Console.WriteLn( trace );
|
||||
|
||||
int retval = Msgbox::Assertion( dbgmsg, trace );
|
||||
|
||||
|
|
|
@ -532,6 +532,8 @@ void AppConfig_OnChangedSettingsFolder( bool overwrite )
|
|||
|
||||
wxString newlogname( Path::Combine( g_Conf->Folders.Logs.ToString(), L"emuLog.txt" ) );
|
||||
|
||||
wxGetApp().DisableDiskLogging();
|
||||
|
||||
if( emuLog != NULL )
|
||||
{
|
||||
if( emuLogName != newlogname )
|
||||
|
@ -544,6 +546,7 @@ void AppConfig_OnChangedSettingsFolder( bool overwrite )
|
|||
if( emuLog == NULL )
|
||||
{
|
||||
emuLogName = newlogname;
|
||||
emuLog = fopen( emuLogName.ToUTF8().data(), "wb" );
|
||||
emuLog = fopen( toUTF8(emuLogName), "wb" );
|
||||
}
|
||||
wxGetApp().EnableConsoleLogging();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,380 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "IniInterface.h"
|
||||
#include "MainFrame.h"
|
||||
#include "ConsoleLogger.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
#include "Dialogs/ModalPopups.h"
|
||||
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
static bool m_ForceWizard = false;
|
||||
|
||||
namespace Exception
|
||||
{
|
||||
// --------------------------------------------------------------------------
|
||||
// Exception used to perform an "errorless" termination of the app during OnInit
|
||||
// procedures. This happens when a user cancels out of startup prompts/wizards.
|
||||
//
|
||||
class StartupAborted : public BaseException
|
||||
{
|
||||
public:
|
||||
DEFINE_EXCEPTION_COPYTORS( StartupAborted )
|
||||
|
||||
StartupAborted( const wxString& msg_eng=L"Startup initialization was aborted by the user." )
|
||||
{
|
||||
// english messages only for this exception.
|
||||
BaseException::InitBaseEx( msg_eng, msg_eng );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void Pcsx2App::OpenWizardConsole()
|
||||
{
|
||||
if( !IsDebugBuild ) return;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
}
|
||||
|
||||
// User mode settings can't be stored in the CWD for two reasons:
|
||||
// (a) the user may not have permission to do so (most obvious)
|
||||
// (b) it would result in sloppy usermode.ini found all over a hard drive if people runs the
|
||||
// exe from many locations (ugh).
|
||||
//
|
||||
// So better to use the registry on Win32 and a "default ini location" config file under Linux,
|
||||
// and store the usermode settings for the CWD based on the CWD's hash.
|
||||
//
|
||||
void Pcsx2App::ReadUserModeSettings()
|
||||
{
|
||||
wxString cwd( wxGetCwd() );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length() );
|
||||
|
||||
wxDirName usrlocaldir( wxStandardPaths::Get().GetUserLocalDataDir() );
|
||||
if( !usrlocaldir.Exists() )
|
||||
{
|
||||
Console.Status( L"Creating UserLocalData folder: " + usrlocaldir.ToString() );
|
||||
usrlocaldir.Mkdir();
|
||||
}
|
||||
|
||||
wxFileName usermodefile( FilenameDefs::GetUsermodeConfig() );
|
||||
usermodefile.SetPath( usrlocaldir.ToString() );
|
||||
ScopedPtr<wxFileConfig> conf_usermode( OpenFileConfig( usermodefile.GetFullPath() ) );
|
||||
|
||||
wxString groupname( wxsFormat( L"CWD.%08x", hashres ) );
|
||||
|
||||
if( m_ForceWizard || !conf_usermode->HasGroup( groupname ) )
|
||||
{
|
||||
// first time startup, so give the user the choice of user mode:
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled FirstTime Wizard." );
|
||||
|
||||
// Save user's new settings
|
||||
IniSaver saver( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( saver, groupname );
|
||||
AppConfig_OnChangedSettingsFolder( true );
|
||||
AppSaveSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
// usermode.ini exists -- assume Documents mode, unless the ini explicitly
|
||||
// specifies otherwise.
|
||||
UseAdminMode = false;
|
||||
|
||||
IniLoader loader( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( loader, groupname );
|
||||
|
||||
if( !wxFile::Exists( GetSettingsFilename() ) )
|
||||
{
|
||||
// user wiped their pcsx2.ini -- needs a reconfiguration via wizard!
|
||||
// (we skip the first page since it's a usermode.ini thing)
|
||||
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetPostUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled Configuration Wizard." );
|
||||
|
||||
// Save user's new settings
|
||||
IniSaver saver( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( saver, groupname );
|
||||
AppConfig_OnChangedSettingsFolder( true );
|
||||
AppSaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser )
|
||||
{
|
||||
parser.SetLogo( (wxString)L" >> PCSX2 -- A Playstation2 Emulator for the PC <<\n\n" +
|
||||
_("All options are for the current session only and will not be saved.\n")
|
||||
);
|
||||
|
||||
parser.AddParam( _("IsoFile"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL );
|
||||
|
||||
parser.AddSwitch( L"h", L"help", _("displays this list of command line options"), wxCMD_LINE_OPTION_HELP );
|
||||
|
||||
parser.AddSwitch( wxEmptyString,L"nogui", _("disables display of the gui while running games") );
|
||||
parser.AddSwitch( wxEmptyString,L"skipbios",_("skips standard BIOS splash screens and software checks") );
|
||||
parser.AddOption( wxEmptyString,L"elf", _("executes an ELF image"), wxCMD_LINE_VAL_STRING );
|
||||
parser.AddSwitch( wxEmptyString,L"nodisc", _("boots an empty dvd tray; use to enter the PS2 system menu") );
|
||||
parser.AddSwitch( wxEmptyString,L"usecd", _("boots from the configured CDVD plugin (ignores IsoFile parameter)") );
|
||||
|
||||
parser.AddOption( wxEmptyString,L"cfgpath", _("changes the configuration file path"), wxCMD_LINE_VAL_STRING );
|
||||
parser.AddOption( wxEmptyString,L"cfg", _("specifies the PCSX2 configuration file to use [not implemented]"), wxCMD_LINE_VAL_STRING );
|
||||
|
||||
parser.AddSwitch( wxEmptyString,L"forcewiz",_("Forces PCSX2 to start the First-time Wizard") );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
||||
parser.AddOption( wxEmptyString, pi->GetShortname().Lower(),
|
||||
wxsFormat( _("specify the file to use as the %s plugin"), pi->GetShortname().c_str() )
|
||||
);
|
||||
} while( ++pi, pi->shortname != NULL );
|
||||
|
||||
parser.SetSwitchChars( L"-" );
|
||||
}
|
||||
|
||||
bool Pcsx2App::OnCmdLineError( wxCmdLineParser& parser )
|
||||
{
|
||||
wxApp::OnCmdLineError( parser );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
|
||||
{
|
||||
if( parser.GetParamCount() >= 1 )
|
||||
{
|
||||
// [TODO] : Unnamed parameter is taken as an "autorun" option for a cdvd/iso.
|
||||
parser.GetParam( 0 );
|
||||
}
|
||||
|
||||
// Suppress wxWidgets automatic options parsing since none of them pertain to PCSX2 needs.
|
||||
//wxApp::OnCmdLineParsed( parser );
|
||||
|
||||
//bool yay = parser.Found(L"nogui");
|
||||
m_ForceWizard = parser.Found( L"forcewiz" );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do
|
||||
{
|
||||
wxString dest;
|
||||
if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue;
|
||||
|
||||
OverrideOptions.Filenames.Plugins[pi->id] = dest;
|
||||
|
||||
if( wxFileExists( dest ) )
|
||||
Console.Notice( pi->GetShortname() + L" override: " + dest );
|
||||
else
|
||||
{
|
||||
bool result = Msgbox::OkCancel(
|
||||
wxsFormat( _("Plugin Override Error! Specified %s plugin does not exist:\n\n"), pi->GetShortname().c_str() ) +
|
||||
dest +
|
||||
_("Press OK to use the default configured plugin, or Cancel to close."),
|
||||
_("Plugin Override Error - PCSX2"), wxICON_ERROR
|
||||
);
|
||||
|
||||
if( !result ) return false;
|
||||
}
|
||||
} while( ++pi, pi->shortname != NULL );
|
||||
|
||||
parser.Found( L"cfgpath", &OverrideOptions.SettingsFolder );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef void (wxEvtHandler::*pxMessageBoxEventFunction)(pxMessageBoxEvent&);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool Pcsx2App::OnInit()
|
||||
{
|
||||
g_Conf = new AppConfig();
|
||||
EnableConsoleLogging();
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
if( !wxApp::OnInit() ) return false;
|
||||
|
||||
m_StdoutRedirHandle = NewPipeRedir(stdout);
|
||||
m_StderrRedirHandle = NewPipeRedir(stderr);
|
||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||
|
||||
#define pxMessageBoxEventThing(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxMessageBoxEventFunction, &func )
|
||||
|
||||
Connect( pxEVT_MSGBOX, pxMessageBoxEventThing( Pcsx2App::OnMessageBox ) );
|
||||
Connect( pxEVT_CallStackBox, pxMessageBoxEventThing( Pcsx2App::OnMessageBox ) );
|
||||
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
|
||||
Connect( pxEVT_OpenModalDialog, wxCommandEventHandler( Pcsx2App::OnOpenModalDialog ) );
|
||||
Connect( pxEVT_ReloadPlugins, wxCommandEventHandler( Pcsx2App::OnReloadPlugins ) );
|
||||
Connect( pxEVT_LoadPluginsComplete, wxCommandEventHandler( Pcsx2App::OnLoadPluginsComplete ) );
|
||||
|
||||
Connect( pxEVT_FreezeFinished, wxCommandEventHandler( Pcsx2App::OnCoreThreadTerminated ) );
|
||||
|
||||
Connect( pxEVT_FreezeFinished, wxCommandEventHandler( Pcsx2App::OnFreezeFinished ) );
|
||||
Connect( pxEVT_ThawFinished, wxCommandEventHandler( Pcsx2App::OnThawFinished ) );
|
||||
|
||||
Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
|
||||
|
||||
// User/Admin Mode Dual Setup:
|
||||
// PCSX2 now supports two fundamental modes of operation. The default is Classic mode,
|
||||
// which uses the Current Working Directory (CWD) for all user data files, and requires
|
||||
// Admin access on Vista (and some Linux as well). The second mode is the Vista-
|
||||
// compatible \documents folder usage. The mode is determined by the presence and
|
||||
// contents of a usermode.ini file in the CWD. If the ini file is missing, we assume
|
||||
// the user is setting up a classic install. If the ini is present, we read the value of
|
||||
// the UserMode and SettingsPath vars.
|
||||
//
|
||||
// Conveniently this dual mode setup applies equally well to most modern Linux distros.
|
||||
|
||||
try
|
||||
{
|
||||
InitDefaultGlobalAccelerators();
|
||||
|
||||
delete wxLog::SetActiveTarget( new pxLogConsole() );
|
||||
ReadUserModeSettings();
|
||||
|
||||
AppConfig_OnChangedSettingsFolder();
|
||||
|
||||
m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" );
|
||||
|
||||
if( m_ProgramLogBox )
|
||||
{
|
||||
wxWindow* deleteme = m_ProgramLogBox;
|
||||
OnProgramLogClosed();
|
||||
delete deleteme;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
}
|
||||
|
||||
m_ProgramLogBox = new ConsoleLogFrame( m_MainFrame, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
EnableConsoleLogging();
|
||||
|
||||
SetTopWindow( m_MainFrame ); // not really needed...
|
||||
SetExitOnFrameDelete( true ); // but being explicit doesn't hurt...
|
||||
m_MainFrame->Show();
|
||||
|
||||
SysDetect();
|
||||
AppApplySettings();
|
||||
|
||||
m_CoreAllocs = new SysCoreAllocations();
|
||||
|
||||
if( m_CoreAllocs->HadSomeFailures( g_Conf->EmuOptions.Cpu.Recompiler ) )
|
||||
{
|
||||
wxString message( _("The following cpu recompilers failed to initialize and will not be available:\n\n") );
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_EE )
|
||||
{
|
||||
message += L"\t* R5900 (EE)\n";
|
||||
g_Session.ForceDisableEErec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_IOP )
|
||||
{
|
||||
message += L"\t* R3000A (IOP)\n";
|
||||
g_Session.ForceDisableIOPrec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_VU0 )
|
||||
{
|
||||
message += L"\t* VU0\n";
|
||||
g_Session.ForceDisableVU0rec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_VU1 )
|
||||
{
|
||||
message += L"\t* VU1\n";
|
||||
g_Session.ForceDisableVU1rec = true;
|
||||
}
|
||||
|
||||
message += pxE( ".Popup Error:EmuCore:MemoryForRecs",
|
||||
L"These errors are the result of memory allocation failures (see the program log for details). "
|
||||
L"Closing out some memory hogging background tasks may resolve this error.\n\n"
|
||||
L"These recompilers have been disabled and interpreters will be used in their place. "
|
||||
L"Interpreters can be very slow, so don't get too excited. Press OK to continue or CANCEL to close PCSX2."
|
||||
);
|
||||
|
||||
if( !Msgbox::OkCancel( message, _("PCSX2 Initialization Error"), wxICON_ERROR ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadPluginsPassive();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
catch( Exception::StartupAborted& ex )
|
||||
{
|
||||
Console.Notice( ex.FormatDiagnosticMessage() );
|
||||
return false;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// Failures on the core initialization procedure (typically OutOfMemory errors) are bad,
|
||||
// since it means the emulator is completely non-functional. Let's pop up an error and
|
||||
// exit gracefully-ish.
|
||||
//
|
||||
catch( Exception::RuntimeError& ex )
|
||||
{
|
||||
Console.Error( ex.FormatDiagnosticMessage() );
|
||||
Msgbox::Alert( ex.FormatDisplayMessage() + L"\n\nPress OK to close PCSX2.",
|
||||
_("PCSX2 Critical Error"), wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Pcsx2App::CleanupMess()
|
||||
{
|
||||
if( m_CorePlugins )
|
||||
{
|
||||
m_CorePlugins->Close();
|
||||
m_CorePlugins->Shutdown();
|
||||
}
|
||||
|
||||
// Notice: deleting the plugin manager (unloading plugins) here causes Lilypad to crash,
|
||||
// likely due to some pending message in the queue that references lilypad procs.
|
||||
// We don't need to unload plugins anyway tho -- shutdown is plenty safe enough for
|
||||
// closing out all the windows. So just leave it be and let the plugins get unloaded
|
||||
// during the wxApp destructor. -- air
|
||||
|
||||
// FIXME: performing a wxYield() here may fix that problem. -- air
|
||||
}
|
||||
|
||||
Pcsx2App::Pcsx2App() :
|
||||
m_MainFrame( NULL )
|
||||
, m_gsFrame( NULL )
|
||||
, m_ProgramLogBox( NULL )
|
||||
, m_ConfigImages( 32, 32 )
|
||||
, m_ConfigImagesAreLoaded( false )
|
||||
, m_ToolbarImages( NULL )
|
||||
, m_Bitmap_Logo( NULL )
|
||||
{
|
||||
SetAppName( L"pcsx2" );
|
||||
BuildCommandHash();
|
||||
}
|
||||
|
||||
Pcsx2App::~Pcsx2App()
|
||||
{
|
||||
// Typically OnExit cleans everything up before we get here, *unless* we cancel
|
||||
// out of program startup in OnInit (return false) -- then remaining cleanup needs
|
||||
// to happen here in the destructor.
|
||||
|
||||
CleanupMess();
|
||||
Console_SetActiveHandler( ConsoleWriter_Null );
|
||||
|
||||
if( emuLog != NULL )
|
||||
{
|
||||
fclose( emuLog );
|
||||
emuLog = NULL;
|
||||
}
|
||||
}
|
|
@ -18,19 +18,13 @@
|
|||
#include "MainFrame.h"
|
||||
#include "Plugins.h"
|
||||
#include "SaveState.h"
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
#include "Dialogs/ModalPopups.h"
|
||||
#include "Dialogs/ConfigurationDialog.h"
|
||||
#include "Dialogs/LogOptionsDialog.h"
|
||||
|
||||
#include "Utilities/ScopedPtr.h"
|
||||
#include "Utilities/HashMap.h"
|
||||
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
IMPLEMENT_APP(Pcsx2App)
|
||||
|
||||
DEFINE_EVENT_TYPE( pxEVT_SemaphorePing );
|
||||
|
@ -48,25 +42,6 @@ bool UseDefaultSettingsFolder = true;
|
|||
ScopedPtr<AppConfig> g_Conf;
|
||||
ConfigOverrides OverrideOptions;
|
||||
|
||||
namespace Exception
|
||||
{
|
||||
// --------------------------------------------------------------------------
|
||||
// Exception used to perform an "errorless" termination of the app during OnInit
|
||||
// procedures. This happens when a user cancels out of startup prompts/wizards.
|
||||
//
|
||||
class StartupAborted : public BaseException
|
||||
{
|
||||
public:
|
||||
DEFINE_EXCEPTION_COPYTORS( StartupAborted )
|
||||
|
||||
StartupAborted( const wxString& msg_eng=L"Startup initialization was aborted by the user." )
|
||||
{
|
||||
// english messages only for this exception.
|
||||
BaseException::InitBaseEx( msg_eng, msg_eng );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
AppCoreThread::AppCoreThread( PluginManager& plugins ) :
|
||||
SysCoreThread( plugins )
|
||||
, m_kevt()
|
||||
|
@ -91,10 +66,21 @@ void AppCoreThread::Suspend( bool isBlocking )
|
|||
m_kevt.m_altDown = false;
|
||||
}
|
||||
|
||||
void AppCoreThread::Resume()
|
||||
{
|
||||
// Thread control (suspend / resume) should only be performed from the main/gui thread.
|
||||
if( !AllowFromMainThreadOnly() ) return;
|
||||
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console.WriteLn( "SysResume: State is locked, ignoring Resume request!" );
|
||||
return;
|
||||
}
|
||||
_parent::Resume();
|
||||
}
|
||||
|
||||
void AppCoreThread::OnResumeReady()
|
||||
{
|
||||
if( !DevAssert( wxThread::IsMain(), "SysCoreThread can only be resumed from the main/gui thread." ) ) return;
|
||||
|
||||
if( m_shortSuspend ) return;
|
||||
|
||||
ApplySettings( g_Conf->EmuOptions );
|
||||
|
@ -110,18 +96,13 @@ void AppCoreThread::OnResumeReady()
|
|||
// Typically the thread handles all its own errors, so there's no need to have error
|
||||
// handling here. However it's a good idea to update the status of the GUI to reflect
|
||||
// the new (lack of) thread status, so this posts a message to the App to do so.
|
||||
void AppCoreThread::DoThreadCleanup()
|
||||
void AppCoreThread::OnThreadCleanup()
|
||||
{
|
||||
wxCommandEvent evt( pxEVT_AppCoreThread_Terminated );
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
_parent::DoThreadCleanup();
|
||||
_parent::OnThreadCleanup();
|
||||
}
|
||||
|
||||
// This is used when the GS plugin is handling its own window. Messages from the PAD
|
||||
// are piped through to an app-level message handler, which dispatches them through
|
||||
// the universal Accelerator table.
|
||||
static const int pxID_PadHandler_Keydown = 8030;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
extern int TranslateGDKtoWXK( u32 keysym );
|
||||
#endif
|
||||
|
@ -168,19 +149,11 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
// usually the desired behavior) will be ignored.
|
||||
|
||||
static int localc = 0;
|
||||
EntryGuard guard( localc );
|
||||
RecursionGuard guard( localc );
|
||||
if(guard.IsReentrant()) return;
|
||||
SysCoreThread::ApplySettings( src );
|
||||
}
|
||||
|
||||
// Returns true if there is a "valid" virtual machine state from the user's perspective. This
|
||||
// means the user has started the emulator and not issued a full reset.
|
||||
__forceinline bool SysHasValidState()
|
||||
{
|
||||
bool isRunning = HasCoreThread() ? GetCoreThread().IsRunning() : false;
|
||||
return isRunning || StateCopy_HasFullState();
|
||||
}
|
||||
|
||||
bool HandlePluginError( Exception::PluginError& ex )
|
||||
{
|
||||
if( pxDialogExists( DialogId_CoreSettings ) ) return true;
|
||||
|
@ -200,7 +173,7 @@ bool HandlePluginError( Exception::PluginError& ex )
|
|||
return result;
|
||||
}
|
||||
|
||||
sptr AppCoreThread::ExecuteTask()
|
||||
void AppCoreThread::ExecuteTask()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -233,7 +206,7 @@ sptr AppCoreThread::ExecuteTask()
|
|||
catch( Exception::PluginError& ex )
|
||||
{
|
||||
m_plugins.Close();
|
||||
Console::Error( ex.FormatDiagnosticMessage() );
|
||||
Console.Error( ex.FormatDiagnosticMessage() );
|
||||
Msgbox::Alert( ex.FormatDisplayMessage(), _("Plugin Open Error") );
|
||||
|
||||
/*if( HandlePluginError( ex ) )
|
||||
|
@ -251,300 +224,12 @@ sptr AppCoreThread::ExecuteTask()
|
|||
m_plugins.Close();
|
||||
Msgbox::Alert( ex.FormatDisplayMessage() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Pcsx2App::OpenWizardConsole()
|
||||
{
|
||||
if( !IsDebugBuild ) return;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
}
|
||||
|
||||
static bool m_ForceWizard = false;
|
||||
|
||||
// User mode settings can't be stored in the CWD for two reasons:
|
||||
// (a) the user may not have permission to do so (most obvious)
|
||||
// (b) it would result in sloppy usermode.ini found all over a hard drive if people runs the
|
||||
// exe from many locations (ugh).
|
||||
//
|
||||
// So better to use the registry on Win32 and a "default ini location" config file under Linux,
|
||||
// and store the usermode settings for the CWD based on the CWD's hash.
|
||||
//
|
||||
void Pcsx2App::ReadUserModeSettings()
|
||||
{
|
||||
wxString cwd( wxGetCwd() );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length() );
|
||||
|
||||
wxDirName usrlocaldir( wxStandardPaths::Get().GetUserLocalDataDir() );
|
||||
if( !usrlocaldir.Exists() )
|
||||
{
|
||||
Console::Status( L"Creating UserLocalData folder: " + usrlocaldir.ToString() );
|
||||
usrlocaldir.Mkdir();
|
||||
}
|
||||
|
||||
wxFileName usermodefile( FilenameDefs::GetUsermodeConfig() );
|
||||
usermodefile.SetPath( usrlocaldir.ToString() );
|
||||
ScopedPtr<wxFileConfig> conf_usermode( OpenFileConfig( usermodefile.GetFullPath() ) );
|
||||
|
||||
wxString groupname( wxsFormat( L"CWD.%08x", hashres ) );
|
||||
|
||||
if( m_ForceWizard || !conf_usermode->HasGroup( groupname ) )
|
||||
{
|
||||
// first time startup, so give the user the choice of user mode:
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled FirstTime Wizard." );
|
||||
|
||||
// Save user's new settings
|
||||
IniSaver saver( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( saver, groupname );
|
||||
AppConfig_OnChangedSettingsFolder( true );
|
||||
AppSaveSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
// usermode.ini exists -- assume Documents mode, unless the ini explicitly
|
||||
// specifies otherwise.
|
||||
UseAdminMode = false;
|
||||
|
||||
IniLoader loader( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( loader, groupname );
|
||||
|
||||
if( !wxFile::Exists( GetSettingsFilename() ) )
|
||||
{
|
||||
// user wiped their pcsx2.ini -- needs a reconfiguration via wizard!
|
||||
// (we skip the first page since it's a usermode.ini thing)
|
||||
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetPostUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled Configuration Wizard." );
|
||||
|
||||
// Save user's new settings
|
||||
IniSaver saver( *conf_usermode );
|
||||
g_Conf->LoadSaveUserMode( saver, groupname );
|
||||
AppConfig_OnChangedSettingsFolder( true );
|
||||
AppSaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser )
|
||||
{
|
||||
parser.SetLogo( (wxString)L" >> PCSX2 -- A Playstation2 Emulator for the PC <<\n\n" +
|
||||
_("All options are for the current session only and will not be saved.\n")
|
||||
);
|
||||
|
||||
parser.AddParam( _("IsoFile"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL );
|
||||
|
||||
parser.AddSwitch( L"h", L"help", _("displays this list of command line options"), wxCMD_LINE_OPTION_HELP );
|
||||
|
||||
parser.AddSwitch( wxEmptyString,L"nogui", _("disables display of the gui while running games") );
|
||||
parser.AddSwitch( wxEmptyString,L"skipbios",_("skips standard BIOS splash screens and software checks") );
|
||||
parser.AddOption( wxEmptyString,L"elf", _("executes an ELF image"), wxCMD_LINE_VAL_STRING );
|
||||
parser.AddSwitch( wxEmptyString,L"nodisc", _("boots an empty dvd tray; use to enter the PS2 system menu") );
|
||||
parser.AddSwitch( wxEmptyString,L"usecd", _("boots from the configured CDVD plugin (ignores IsoFile parameter)") );
|
||||
|
||||
parser.AddOption( wxEmptyString,L"cfgpath", _("changes the configuration file path"), wxCMD_LINE_VAL_STRING );
|
||||
parser.AddOption( wxEmptyString,L"cfg", _("specifies the PCSX2 configuration file to use [not implemented]"), wxCMD_LINE_VAL_STRING );
|
||||
|
||||
parser.AddSwitch( wxEmptyString,L"forcewiz",_("Forces PCSX2 to start the First-time Wizard") );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
||||
parser.AddOption( wxEmptyString, pi->GetShortname().Lower(),
|
||||
wxsFormat( _("specify the file to use as the %s plugin"), pi->GetShortname().c_str() )
|
||||
);
|
||||
} while( ++pi, pi->shortname != NULL );
|
||||
|
||||
parser.SetSwitchChars( L"-" );
|
||||
}
|
||||
|
||||
bool Pcsx2App::OnCmdLineError( wxCmdLineParser& parser )
|
||||
{
|
||||
wxApp::OnCmdLineError( parser );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
|
||||
{
|
||||
if( parser.GetParamCount() >= 1 )
|
||||
{
|
||||
// [TODO] : Unnamed parameter is taken as an "autorun" option for a cdvd/iso.
|
||||
parser.GetParam( 0 );
|
||||
}
|
||||
|
||||
// Suppress wxWidgets automatic options parsing since none of them pertain to PCSX2 needs.
|
||||
//wxApp::OnCmdLineParsed( parser );
|
||||
|
||||
//bool yay = parser.Found(L"nogui");
|
||||
m_ForceWizard = parser.Found( L"forcewiz" );
|
||||
|
||||
const PluginInfo* pi = tbl_PluginInfo; do
|
||||
{
|
||||
wxString dest;
|
||||
if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue;
|
||||
|
||||
OverrideOptions.Filenames.Plugins[pi->id] = dest;
|
||||
|
||||
if( wxFileExists( dest ) )
|
||||
Console::Notice( pi->GetShortname() + L" override: " + dest );
|
||||
else
|
||||
{
|
||||
bool result = Msgbox::OkCancel(
|
||||
wxsFormat( _("Plugin Override Error! Specified %s plugin does not exist:\n\n"), pi->GetShortname().c_str() ) +
|
||||
dest +
|
||||
_("Press OK to use the default configured plugin, or Cancel to close."),
|
||||
_("Plugin Override Error - PCSX2"), wxICON_ERROR
|
||||
);
|
||||
|
||||
if( !result ) return false;
|
||||
}
|
||||
} while( ++pi, pi->shortname != NULL );
|
||||
|
||||
parser.Found( L"cfgpath", &OverrideOptions.SettingsFolder );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef void (wxEvtHandler::*pxMessageBoxEventFunction)(pxMessageBoxEvent&);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool Pcsx2App::OnInit()
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
if( !wxApp::OnInit() ) return false;
|
||||
|
||||
g_Conf = new AppConfig();
|
||||
|
||||
m_StdoutRedirHandle = NewPipeRedir(stdout);
|
||||
m_StderrRedirHandle = NewPipeRedir(stderr);
|
||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||
|
||||
#define pxMessageBoxEventThing(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxMessageBoxEventFunction, &func )
|
||||
|
||||
Connect( pxEVT_MSGBOX, pxMessageBoxEventThing( Pcsx2App::OnMessageBox ) );
|
||||
Connect( pxEVT_CallStackBox, pxMessageBoxEventThing( Pcsx2App::OnMessageBox ) );
|
||||
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
|
||||
Connect( pxEVT_OpenModalDialog, wxCommandEventHandler( Pcsx2App::OnOpenModalDialog ) );
|
||||
Connect( pxEVT_ReloadPlugins, wxCommandEventHandler( Pcsx2App::OnReloadPlugins ) );
|
||||
Connect( pxEVT_LoadPluginsComplete, wxCommandEventHandler( Pcsx2App::OnLoadPluginsComplete ) );
|
||||
|
||||
Connect( pxEVT_FreezeFinished, wxCommandEventHandler( Pcsx2App::OnFreezeFinished ) );
|
||||
Connect( pxEVT_ThawFinished, wxCommandEventHandler( Pcsx2App::OnThawFinished ) );
|
||||
|
||||
Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
|
||||
|
||||
// User/Admin Mode Dual Setup:
|
||||
// PCSX2 now supports two fundamental modes of operation. The default is Classic mode,
|
||||
// which uses the Current Working Directory (CWD) for all user data files, and requires
|
||||
// Admin access on Vista (and some Linux as well). The second mode is the Vista-
|
||||
// compatible \documents folder usage. The mode is determined by the presence and
|
||||
// contents of a usermode.ini file in the CWD. If the ini file is missing, we assume
|
||||
// the user is setting up a classic install. If the ini is present, we read the value of
|
||||
// the UserMode and SettingsPath vars.
|
||||
//
|
||||
// Conveniently this dual mode setup applies equally well to most modern Linux distros.
|
||||
|
||||
try
|
||||
{
|
||||
InitDefaultGlobalAccelerators();
|
||||
|
||||
delete wxLog::SetActiveTarget( new pxLogConsole() );
|
||||
ReadUserModeSettings();
|
||||
|
||||
AppConfig_OnChangedSettingsFolder();
|
||||
|
||||
m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" );
|
||||
|
||||
if( m_ProgramLogBox )
|
||||
{
|
||||
delete m_ProgramLogBox;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
}
|
||||
|
||||
m_ProgramLogBox = new ConsoleLogFrame( m_MainFrame, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
|
||||
SetTopWindow( m_MainFrame ); // not really needed...
|
||||
SetExitOnFrameDelete( true ); // but being explicit doesn't hurt...
|
||||
m_MainFrame->Show();
|
||||
|
||||
SysDetect();
|
||||
AppApplySettings();
|
||||
|
||||
m_CoreAllocs = new SysCoreAllocations();
|
||||
|
||||
if( m_CoreAllocs->HadSomeFailures( g_Conf->EmuOptions.Cpu.Recompiler ) )
|
||||
{
|
||||
wxString message( _("The following cpu recompilers failed to initialize and will not be available:\n\n") );
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_EE )
|
||||
{
|
||||
message += L"\t* R5900 (EE)\n";
|
||||
g_Session.ForceDisableEErec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_IOP )
|
||||
{
|
||||
message += L"\t* R3000A (IOP)\n";
|
||||
g_Session.ForceDisableIOPrec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_VU0 )
|
||||
{
|
||||
message += L"\t* VU0\n";
|
||||
g_Session.ForceDisableVU0rec = true;
|
||||
}
|
||||
|
||||
if( !m_CoreAllocs->RecSuccess_VU1 )
|
||||
{
|
||||
message += L"\t* VU1\n";
|
||||
g_Session.ForceDisableVU1rec = true;
|
||||
}
|
||||
|
||||
message += pxE( ".Popup Error:EmuCore:MemoryForRecs",
|
||||
L"These errors are the result of memory allocation failures (see the program log for details). "
|
||||
L"Closing out some memory hogging background tasks may resolve this error.\n\n"
|
||||
L"These recompilers have been disabled and interpreters will be used in their place. "
|
||||
L"Interpreters can be very slow, so don't get too excited. Press OK to continue or CANCEL to close PCSX2."
|
||||
);
|
||||
|
||||
if( !Msgbox::OkCancel( message, _("PCSX2 Initialization Error"), wxICON_ERROR ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadPluginsPassive();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
catch( Exception::StartupAborted& ex )
|
||||
{
|
||||
Console::Notice( ex.FormatDiagnosticMessage() );
|
||||
return false;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// Failures on the core initialization procedure (typically OutOfMemory errors) are bad,
|
||||
// since it means the emulator is completely non-functional. Let's pop up an error and
|
||||
// exit gracefully-ish.
|
||||
//
|
||||
catch( Exception::RuntimeError& ex )
|
||||
{
|
||||
Console::Error( ex.FormatDiagnosticMessage() );
|
||||
Msgbox::Alert( ex.FormatDisplayMessage() + L"\n\nPress OK to close PCSX2.",
|
||||
_("PCSX2 Critical Error"), wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allows for activating menu actions from anywhere in PCSX2.
|
||||
// And it's Thread Safe!
|
||||
void Pcsx2App::PostMenuAction( MenuIdentifiers menu_id ) const
|
||||
{
|
||||
wxASSERT( m_MainFrame != NULL );
|
||||
if( m_MainFrame == NULL ) return;
|
||||
|
||||
wxCommandEvent joe( wxEVT_COMMAND_MENU_SELECTED, menu_id );
|
||||
|
@ -570,7 +255,7 @@ void Pcsx2App::PostPadKey( wxKeyEvent& evt )
|
|||
|
||||
int Pcsx2App::ThreadedModalDialog( DialogIdentifiers dialogId )
|
||||
{
|
||||
wxASSERT( !wxThread::IsMain() ); // don't call me from MainThread!
|
||||
AllowFromMainThreadOnly();
|
||||
|
||||
MsgboxEventResult result;
|
||||
wxCommandEvent joe( pxEVT_OpenModalDialog, dialogId );
|
||||
|
@ -601,6 +286,7 @@ void Pcsx2App::Ping() const
|
|||
// Invoked by the AppCoreThread when the thread has terminated itself.
|
||||
void Pcsx2App::OnCoreThreadTerminated( wxCommandEvent& evt )
|
||||
{
|
||||
|
||||
if( HasMainFrame() )
|
||||
GetMainFrame().ApplySettings();
|
||||
m_CoreThread = NULL;
|
||||
|
@ -621,7 +307,7 @@ void Pcsx2App::OnOpenModalDialog( wxCommandEvent& evt )
|
|||
case DialogId_CoreSettings:
|
||||
{
|
||||
static int _guard = 0;
|
||||
EntryGuard guard( _guard );
|
||||
RecursionGuard guard( _guard );
|
||||
if( guard.IsReentrant() ) return;
|
||||
evtres.result = ConfigurationDialog().ShowModal();
|
||||
}
|
||||
|
@ -630,7 +316,7 @@ void Pcsx2App::OnOpenModalDialog( wxCommandEvent& evt )
|
|||
case DialogId_BiosSelector:
|
||||
{
|
||||
static int _guard = 0;
|
||||
EntryGuard guard( _guard );
|
||||
RecursionGuard guard( _guard );
|
||||
if( guard.IsReentrant() ) return;
|
||||
evtres.result = BiosSelectorDialog().ShowModal();
|
||||
}
|
||||
|
@ -639,7 +325,7 @@ void Pcsx2App::OnOpenModalDialog( wxCommandEvent& evt )
|
|||
case DialogId_LogOptions:
|
||||
{
|
||||
static int _guard = 0;
|
||||
EntryGuard guard( _guard );
|
||||
RecursionGuard guard( _guard );
|
||||
if( guard.IsReentrant() ) return;
|
||||
evtres.result = LogOptionsDialog().ShowModal();
|
||||
}
|
||||
|
@ -648,7 +334,7 @@ void Pcsx2App::OnOpenModalDialog( wxCommandEvent& evt )
|
|||
case DialogId_About:
|
||||
{
|
||||
static int _guard = 0;
|
||||
EntryGuard guard( _guard );
|
||||
RecursionGuard guard( _guard );
|
||||
if( guard.IsReentrant() ) return;
|
||||
evtres.result = AboutBoxDialog().ShowModal();
|
||||
}
|
||||
|
@ -677,30 +363,12 @@ void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt )
|
|||
|
||||
if( cmd != NULL )
|
||||
{
|
||||
DbgCon::WriteLn( "(app) Invoking command: %s", cmd->Id );
|
||||
DbgCon.WriteLn( "(app) Invoking command: %s", cmd->Id );
|
||||
cmd->Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Pcsx2App::CleanupMess()
|
||||
{
|
||||
if( m_CorePlugins )
|
||||
{
|
||||
m_CorePlugins->Close();
|
||||
m_CorePlugins->Shutdown();
|
||||
}
|
||||
|
||||
// Notice: deleting the plugin manager (unloading plugins) here causes Lilypad to crash,
|
||||
// likely due to some pending message in the queue that references lilypad procs.
|
||||
// We don't need to unload plugins anyway tho -- shutdown is plenty safe enough for
|
||||
// closing out all the windows. So just leave it be and let the plugins get unloaded
|
||||
// during the wxApp destructor. -- air
|
||||
|
||||
m_ProgramLogBox = NULL;
|
||||
m_MainFrame = NULL;
|
||||
}
|
||||
|
||||
void Pcsx2App::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const
|
||||
{
|
||||
try
|
||||
|
@ -710,10 +378,10 @@ void Pcsx2App::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent&
|
|||
// ----------------------------------------------------------------------------
|
||||
catch( Exception::PluginError& ex )
|
||||
{
|
||||
Console::Error( ex.FormatDiagnosticMessage() );
|
||||
Console.Error( ex.FormatDiagnosticMessage() );
|
||||
if( !HandlePluginError( ex ) )
|
||||
{
|
||||
Console::Error( L"User-canceled plugin configuration after load failure. Plugins not loaded!" );
|
||||
Console.Error( L"User-canceled plugin configuration after load failure. Plugins not loaded!" );
|
||||
Msgbox::Alert( _("Warning! Plugins have not been loaded. PCSX2 will be inoperable.") );
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +391,7 @@ void Pcsx2App::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent&
|
|||
// Runtime errors which have been unhandled should still be safe to recover from,
|
||||
// so lets issue a message to the user and then continue the message pump.
|
||||
|
||||
Console::Error( ex.FormatDiagnosticMessage() );
|
||||
Console.Error( ex.FormatDiagnosticMessage() );
|
||||
Msgbox::Alert( ex.FormatDisplayMessage() );
|
||||
}
|
||||
}
|
||||
|
@ -756,61 +424,31 @@ int Pcsx2App::OnExit()
|
|||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
Pcsx2App::Pcsx2App() :
|
||||
m_MainFrame( NULL )
|
||||
, m_gsFrame( NULL )
|
||||
, m_ProgramLogBox( NULL )
|
||||
, m_ConfigImages( 32, 32 )
|
||||
, m_ConfigImagesAreLoaded( false )
|
||||
, m_ToolbarImages( NULL )
|
||||
, m_Bitmap_Logo( NULL )
|
||||
{
|
||||
SetAppName( L"pcsx2" );
|
||||
BuildCommandHash();
|
||||
}
|
||||
|
||||
Pcsx2App::~Pcsx2App()
|
||||
{
|
||||
// Typically OnExit cleans everything up before we get here, *unless* we cancel
|
||||
// out of program startup in OnInit (return false) -- then remaining cleanup needs
|
||||
// to happen here in the destructor.
|
||||
|
||||
CleanupMess();
|
||||
}
|
||||
|
||||
// This method generates debug assertions if the MainFrame handle is NULL (typically
|
||||
// indicating that PCSX2 is running in NoGUI mode, or that the main frame has been
|
||||
// closed). In most cases you'll want to use HasMainFrame() to test for thread
|
||||
// validity first, or use GetMainFramePtr() and manually check for NULL (choice
|
||||
// is a matter of programmer preference).
|
||||
MainEmuFrame& Pcsx2App::GetMainFrame() const
|
||||
{
|
||||
wxASSERT( ((uptr)GetTopWindow()) == ((uptr)m_MainFrame) );
|
||||
wxASSERT( m_MainFrame != NULL );
|
||||
pxAssert( ((uptr)GetTopWindow()) == ((uptr)m_MainFrame) );
|
||||
pxAssert( m_MainFrame != NULL );
|
||||
return *m_MainFrame;
|
||||
}
|
||||
|
||||
// This method generates debug assertions if the CoreThread handle is NULL (typically
|
||||
// indicating that there is no active emulation session). In most cases you'll want
|
||||
// to use HasCoreThread() to test for thread validity first, or use GetCoreThreadPtr()
|
||||
// and manually check for NULL (choice is a matter of programmer preference).
|
||||
SysCoreThread& Pcsx2App::GetCoreThread() const
|
||||
{
|
||||
wxASSERT( m_CoreThread != NULL );
|
||||
return *m_CoreThread;
|
||||
}
|
||||
|
||||
|
||||
MainEmuFrame& Pcsx2App::GetMainFrameOrExcept() const
|
||||
{
|
||||
if( m_MainFrame == NULL )
|
||||
throw Exception::ObjectIsNull( "main application frame" );
|
||||
|
||||
return *m_MainFrame;
|
||||
}
|
||||
|
||||
SysCoreThread& Pcsx2App::GetCoreThreadOrExcept() const
|
||||
{
|
||||
if( !m_CoreThread )
|
||||
throw Exception::ObjectIsNull( "core emulation thread" );
|
||||
|
||||
pxAssert( m_CoreThread != NULL );
|
||||
return *m_CoreThread;
|
||||
}
|
||||
|
||||
void AppApplySettings( const AppConfig* oldconf )
|
||||
{
|
||||
DevAssert( wxThread::IsMain(), "ApplySettings valid from the GUI thread only." );
|
||||
AllowFromMainThreadOnly();
|
||||
|
||||
// Ensure existence of necessary documents folders. Plugins and other parts
|
||||
// of PCSX2 rely on them.
|
||||
|
@ -868,60 +506,6 @@ void AppSaveSettings()
|
|||
GetMainFrame().SaveRecentIsoList( *conf );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Sys/Core API and Shortcuts (for wxGetApp())
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
// Executes the emulator using a saved/existing virtual machine state and currently
|
||||
// configured CDVD source device.
|
||||
void Pcsx2App::SysExecute()
|
||||
{
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console::WriteLn( "SysExecute: State is locked, ignoring Execute request!" );
|
||||
return;
|
||||
}
|
||||
|
||||
SysReset();
|
||||
LoadPluginsImmediate();
|
||||
m_CoreThread = new AppCoreThread( *m_CorePlugins );
|
||||
m_CoreThread->Resume();
|
||||
}
|
||||
|
||||
// Executes the specified cdvd source and optional elf file. This command performs a
|
||||
// full closure of any existing VM state and starts a fresh VM with the requested
|
||||
// sources.
|
||||
void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc )
|
||||
{
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console::WriteLn( "SysExecute: State is locked, ignoring Execute request!" );
|
||||
return;
|
||||
}
|
||||
|
||||
SysReset();
|
||||
LoadPluginsImmediate();
|
||||
CDVDsys_SetFile( CDVDsrc_Iso, g_Conf->CurrentIso );
|
||||
CDVDsys_ChangeSource( cdvdsrc );
|
||||
|
||||
m_CoreThread = new AppCoreThread( *m_CorePlugins );
|
||||
m_CoreThread->Resume();
|
||||
}
|
||||
|
||||
void Pcsx2App::SysReset()
|
||||
{
|
||||
m_CoreThread = NULL;
|
||||
}
|
||||
|
||||
// Returns the state of the emulated system (Virtual Machine). Returns true if the
|
||||
// system is active, or is in the process of reporting or handling an error. Returns
|
||||
// false if there is no active system (thread is shutdown or hasn't been started).
|
||||
bool Pcsx2App::SysIsActive() const
|
||||
{
|
||||
return m_CoreThread && m_CoreThread->IsRunning();
|
||||
}
|
||||
|
||||
|
||||
void Pcsx2App::OpenGsFrame()
|
||||
{
|
||||
if( m_gsFrame != NULL ) return;
|
||||
|
@ -942,67 +526,104 @@ void Pcsx2App::OnGsFrameClosed()
|
|||
m_gsFrame = NULL;
|
||||
}
|
||||
|
||||
void Pcsx2App::OnProgramLogClosed()
|
||||
{
|
||||
if( m_ProgramLogBox == NULL ) return;
|
||||
DisableWindowLogging();
|
||||
m_ProgramLogBox = NULL;
|
||||
}
|
||||
|
||||
void Pcsx2App::OnMainFrameClosed()
|
||||
{
|
||||
// Nothing threaded depends on the mainframe (yet) -- it all passes through the main wxApp
|
||||
// message handler. But that might change in the future.
|
||||
if( m_MainFrame == NULL ) return;
|
||||
m_MainFrame = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Sys/Core API and Shortcuts (for wxGetApp())
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
// Executes the emulator using a saved/existing virtual machine state and currently
|
||||
// configured CDVD source device.
|
||||
void Pcsx2App::SysExecute()
|
||||
{
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console.WriteLn( "SysExecute: State is locked, ignoring Execute request!" );
|
||||
return;
|
||||
}
|
||||
|
||||
SysReset();
|
||||
LoadPluginsImmediate();
|
||||
m_CoreThread = new AppCoreThread( *m_CorePlugins );
|
||||
m_CoreThread->Resume();
|
||||
}
|
||||
|
||||
// Executes the specified cdvd source and optional elf file. This command performs a
|
||||
// full closure of any existing VM state and starts a fresh VM with the requested
|
||||
// sources.
|
||||
void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc )
|
||||
{
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console.WriteLn( "SysExecute: State is locked, ignoring Execute request!" );
|
||||
return;
|
||||
}
|
||||
|
||||
SysReset();
|
||||
LoadPluginsImmediate();
|
||||
CDVDsys_SetFile( CDVDsrc_Iso, g_Conf->CurrentIso );
|
||||
CDVDsys_ChangeSource( cdvdsrc );
|
||||
|
||||
m_CoreThread = new AppCoreThread( *m_CorePlugins );
|
||||
m_CoreThread->Resume();
|
||||
}
|
||||
|
||||
void Pcsx2App::SysReset()
|
||||
{
|
||||
m_CoreThread = NULL;
|
||||
}
|
||||
|
||||
// Returns true if there is a "valid" virtual machine state from the user's perspective. This
|
||||
// means the user has started the emulator and not issued a full reset.
|
||||
// Thread Safety: The state of the system can change in parallel to execution of the
|
||||
// main thread. If you need to perform an extended length activity on the execution
|
||||
// state (such as saving it), you *must* suspend the Corethread first!
|
||||
__forceinline bool SysHasValidState()
|
||||
{
|
||||
bool isRunning = HasCoreThread() ? GetCoreThread().IsRunning() : false;
|
||||
return isRunning || StateCopy_HasFullState();
|
||||
}
|
||||
|
||||
// Writes text to console and updates the window status bar and/or HUD or whateverness.
|
||||
// FIXME: This probably isn't thread safe. >_<
|
||||
void SysStatus( const wxString& text )
|
||||
{
|
||||
// mirror output to the console!
|
||||
Console::Status( text.c_str() );
|
||||
Console.Status( text.c_str() );
|
||||
if( HasMainFrame() )
|
||||
GetMainFrame().SetStatusText( text );
|
||||
}
|
||||
|
||||
// Executes the emulator using a saved/existing virtual machine state and currently
|
||||
// configured CDVD source device.
|
||||
void SysExecute()
|
||||
{
|
||||
wxGetApp().SysExecute();
|
||||
}
|
||||
|
||||
void SysExecute( CDVD_SourceType cdvdsrc )
|
||||
{
|
||||
wxGetApp().SysExecute( cdvdsrc );
|
||||
}
|
||||
|
||||
void SysResume()
|
||||
{
|
||||
if( !HasCoreThread() ) return;
|
||||
|
||||
if( sys_resume_lock )
|
||||
{
|
||||
Console::WriteLn( "SysResume: State is locked, ignoring Resume request!" );
|
||||
return;
|
||||
}
|
||||
|
||||
GetCoreThread().Resume();
|
||||
}
|
||||
|
||||
void SysSuspend( bool closePlugins )
|
||||
{
|
||||
if( !HasCoreThread() ) return;
|
||||
|
||||
if( closePlugins )
|
||||
GetCoreThread().Suspend();
|
||||
else
|
||||
GetCoreThread().ShortSuspend();
|
||||
}
|
||||
|
||||
void SysReset()
|
||||
{
|
||||
wxGetApp().SysReset();
|
||||
}
|
||||
|
||||
bool HasMainFrame()
|
||||
{
|
||||
return wxGetApp().HasMainFrame();
|
||||
return wxTheApp && wxGetApp().HasMainFrame();
|
||||
}
|
||||
|
||||
bool HasCoreThread()
|
||||
{
|
||||
return wxGetApp().HasCoreThread();
|
||||
return wxTheApp && wxGetApp().HasCoreThread();
|
||||
}
|
||||
|
||||
// This method generates debug assertions if either the wxApp or MainFrame handles are
|
||||
// NULL (typically indicating that PCSX2 is running in NoGUI mode, or that the main
|
||||
// frame has been closed). In most cases you'll want to use HasMainFrame() to test
|
||||
// for gui validity first, or use GetMainFramePtr() and manually check for NULL (choice
|
||||
// is a matter of programmer preference).
|
||||
MainEmuFrame& GetMainFrame()
|
||||
{
|
||||
return wxGetApp().GetMainFrame();
|
||||
|
@ -1012,3 +633,18 @@ SysCoreThread& GetCoreThread()
|
|||
{
|
||||
return wxGetApp().GetCoreThread();
|
||||
}
|
||||
|
||||
// Returns a pointer to the main frame of the GUI (frame may be hidden from view), or
|
||||
// NULL if no main frame exists (NoGUI mode and/or the frame has been destroyed). If
|
||||
// the wxApp is NULL then this will also return NULL.
|
||||
MainEmuFrame* GetMainFramePtr()
|
||||
{
|
||||
return wxTheApp ? wxGetApp().GetMainFramePtr() : NULL;
|
||||
}
|
||||
|
||||
// Returns a pointer to the CoreThread of the GUI (thread may be stopped or suspended),
|
||||
// or NULL if no core thread exists, or if the wxApp is also NULL.
|
||||
SysCoreThread* GetCoreThreadPtr()
|
||||
{
|
||||
return wxTheApp ? wxGetApp().GetCoreThreadPtr() : NULL;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
|
|||
//wxFileInputStream stream( zipped.ToString() )
|
||||
//wxZipInputStream zstream( stream );
|
||||
|
||||
Console::Error( "Loading themes from zipfile is not supported yet.\nFalling back on default theme." );
|
||||
Console.Error( "Loading themes from zipfile is not supported yet.\nFalling back on default theme." );
|
||||
}
|
||||
|
||||
// Overrides zipfile settings (fix when zipfile support added)
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include <wx/file.h>
|
||||
#include <wx/textfile.h>
|
||||
|
||||
using Console::Colors;
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_LOG_Write, -1)
|
||||
DECLARE_EVENT_TYPE(wxEVT_LOG_Newline, -1)
|
||||
|
@ -73,12 +71,12 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
|
|||
|
||||
case wxLOG_FatalError:
|
||||
// This one is unused by wx, and unused by PCSX2 (we prefer exceptions, thanks).
|
||||
DevAssert( false, "Stop using FatalError and use assertions or exceptions instead." );
|
||||
pxFailDev( "Stop using FatalError and use assertions or exceptions instead." );
|
||||
break;
|
||||
|
||||
case wxLOG_Status:
|
||||
// Also unsed by wx, and unused by PCSX2 also (we prefer direct API calls to our main window!)
|
||||
DevAssert( false, "Stop using wxLogStatus just access the Pcsx2App functions directly instead." );
|
||||
pxFailDev( "Stop using wxLogStatus just access the Pcsx2App functions directly instead." );
|
||||
break;
|
||||
|
||||
case wxLOG_Info:
|
||||
|
@ -86,22 +84,22 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
|
|||
// fallthrough!
|
||||
|
||||
case wxLOG_Message:
|
||||
Console::WriteLn( wxString(L"wx > ") + szString );
|
||||
Console.WriteLn( wxString(L"wx > ") + szString );
|
||||
break;
|
||||
|
||||
case wxLOG_Error:
|
||||
Console::Error( wxString(L"wx > ") + szString );
|
||||
Console.Error( wxString(L"wx > ") + szString );
|
||||
break;
|
||||
|
||||
case wxLOG_Warning:
|
||||
Console::Notice( wxString(L"wx > ") + szString );
|
||||
Console.Notice( wxString(L"wx > ") + szString );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
sptr ConsoleTestThread::ExecuteTask()
|
||||
void ConsoleTestThread::ExecuteTask()
|
||||
{
|
||||
static int numtrack = 0;
|
||||
|
||||
|
@ -109,11 +107,10 @@ sptr ConsoleTestThread::ExecuteTask()
|
|||
{
|
||||
// Two lines, both formatted, and varied colors. This makes for a fairly realistic
|
||||
// worst case scenario (without being entirely unrealistic).
|
||||
Console::WriteLn( wxsFormat( L"This is a threaded logging test. Something bad could happen... %d", ++numtrack ) );
|
||||
Console::Status( wxsFormat( L"Testing high stress loads %s", L"(multi-color)" ) );
|
||||
Console.WriteLn( wxsFormat( L"This is a threaded logging test. Something bad could happen... %d", ++numtrack ) );
|
||||
Console.Status( wxsFormat( L"Testing high stress loads %s", L"(multi-color)" ) );
|
||||
Sleep( 0 );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -212,7 +209,7 @@ void ConsoleLogFrame::ColorArray::SetFont( int fontsize )
|
|||
Create( fontsize );
|
||||
}
|
||||
|
||||
static const Console::Colors DefaultConsoleColor = Color_White;
|
||||
static const ConsoleColors DefaultConsoleColor = Color_White;
|
||||
|
||||
enum MenuIDs_t
|
||||
{
|
||||
|
@ -297,9 +294,10 @@ ConsoleLogFrame::ConsoleLogFrame( MainEmuFrame *parent, const wxString& title, A
|
|||
ConsoleLogFrame::~ConsoleLogFrame()
|
||||
{
|
||||
safe_delete( m_threadlogger );
|
||||
wxGetApp().OnProgramLogClosed();
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::SetColor( Colors color )
|
||||
void ConsoleLogFrame::SetColor( ConsoleColors color )
|
||||
{
|
||||
if( color != m_curcolor )
|
||||
m_TextCtrl.SetDefaultStyle( m_ColorTable[m_curcolor=color] );
|
||||
|
@ -335,7 +333,7 @@ void ConsoleLogFrame::Write( const wxString& text )
|
|||
|
||||
// Implementation note: Calls SetColor and Write( text ). Override those virtuals
|
||||
// and this one will magically follow suite. :)
|
||||
void ConsoleLogFrame::Write( Colors color, const wxString& text )
|
||||
void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text )
|
||||
{
|
||||
SetColor( color );
|
||||
Write( text );
|
||||
|
@ -383,7 +381,7 @@ void ConsoleLogFrame::OnMoveAround( wxMoveEvent& evt )
|
|||
wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) );
|
||||
|
||||
m_conf.AutoDock = snapzone.Contains( GetPosition() );
|
||||
//Console::WriteLn( "DockCheck: %d", g_Conf->ConLogBox.AutoDock );
|
||||
//Console.WriteLn( "DockCheck: %d", g_Conf->ConLogBox.AutoDock );
|
||||
if( m_conf.AutoDock )
|
||||
{
|
||||
SetPosition( topright + wxSize( 1,0 ) );
|
||||
|
@ -407,6 +405,7 @@ void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& event)
|
|||
else
|
||||
{
|
||||
safe_delete( m_threadlogger );
|
||||
wxGetApp().OnProgramLogClosed();
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
@ -476,12 +475,12 @@ void ConsoleLogFrame::OnFontSize( wxMenuEvent& evt )
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Logging Events (typically recieved from Console class interfaces)
|
||||
// Logging Events (typically received from Console class interfaces)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ConsoleLogFrame::OnWrite( wxCommandEvent& event )
|
||||
{
|
||||
Write( (Colors)event.GetExtraLong(), event.GetString() );
|
||||
Write( (ConsoleColors)event.GetExtraLong(), event.GetString() );
|
||||
DoMessage();
|
||||
}
|
||||
|
||||
|
@ -532,7 +531,7 @@ void ConsoleLogFrame::CountMessage()
|
|||
//
|
||||
void ConsoleLogFrame::DoMessage()
|
||||
{
|
||||
wxASSERT_MSG( wxThread::IsMain(), L"DoMessage must only be called from the main gui thread!" );
|
||||
AllowFromMainThreadOnly();
|
||||
|
||||
int cur = _InterlockedDecrement( &m_msgcounter );
|
||||
|
||||
|
@ -552,144 +551,188 @@ void ConsoleLogFrame::DoMessage()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
ConsoleLogFrame* Pcsx2App::GetProgramLog()
|
||||
{
|
||||
return m_ProgramLogBox;
|
||||
}
|
||||
|
||||
void Pcsx2App::CloseProgramLog()
|
||||
{
|
||||
if( m_ProgramLogBox == NULL ) return;
|
||||
|
||||
m_ProgramLogBox->Close();
|
||||
|
||||
// disable future console log messages from being sent to the window.
|
||||
m_ProgramLogBox = NULL;
|
||||
}
|
||||
|
||||
void Pcsx2App::ProgramLog_CountMsg()
|
||||
{
|
||||
if ((wxTheApp == NULL) || ( m_ProgramLogBox == NULL )) return;
|
||||
// New console log object model makes this check obsolete:
|
||||
//if( m_ProgramLogBox == NULL ) return;
|
||||
m_ProgramLogBox->CountMessage();
|
||||
}
|
||||
|
||||
void Pcsx2App::ProgramLog_PostEvent( wxEvent& evt )
|
||||
{
|
||||
if ((wxTheApp == NULL) || ( m_ProgramLogBox == NULL )) return;
|
||||
// New console log object model makes this check obsolete:
|
||||
//if( m_ProgramLogBox == NULL ) return;
|
||||
m_ProgramLogBox->GetEventHandler()->AddPendingEvent( evt );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
namespace Console
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleImpl_ToFile
|
||||
// --------------------------------------------------------------------------------------
|
||||
static void __concall _immediate_logger( const char* src )
|
||||
{
|
||||
// thread-local console color storage.
|
||||
static __threadlocal Colors th_CurrentColor = DefaultConsoleColor;
|
||||
|
||||
static Threading::MutexLock immediate_log_lock;
|
||||
|
||||
// performs immediate thread-safe (mutex locked) logging to disk and to the Linux console.
|
||||
// Many platforms still do not provide thread-safe implementations of fputs or printf, so
|
||||
// they are implemented here using a mutex lock for maximum safety.
|
||||
static void _immediate_logger( const char* src )
|
||||
{
|
||||
|
||||
ScopedLock locker( immediate_log_lock );
|
||||
|
||||
if( emuLog != NULL )
|
||||
fputs( src, emuLog ); // fputs does not do automatic newlines, so it's ok!
|
||||
|
||||
// Linux has a handy dandy universal console...
|
||||
// [TODO] make this a configurable option? Do we care? :)
|
||||
#ifdef __LINUX__
|
||||
// puts does automatic newlines, which we don't want here
|
||||
|
||||
/*if (strchr(src, '\n'))
|
||||
{
|
||||
fputs( "PCSX2 > ", stdout );
|
||||
fputs( src , stdout);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
fputs( src, stdout );
|
||||
//}
|
||||
fputs( src, stdout );
|
||||
#endif
|
||||
px_fputs( emuLog, src );
|
||||
}
|
||||
|
||||
}
|
||||
static void __concall ConsoleToFile_Newline()
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
fputc( '\n', stdout );
|
||||
fputc( '\n', emuLog );
|
||||
#else
|
||||
fputs( "\r\n", emuLog );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void _immediate_logger( const wxString& src )
|
||||
{
|
||||
_immediate_logger( src.ToUTF8().data() );
|
||||
}
|
||||
static void __concall ConsoleToFile_DoWrite( const wxString& fmt )
|
||||
{
|
||||
_immediate_logger( toUTF8(fmt) );
|
||||
}
|
||||
|
||||
void __fastcall SetTitle( const wxString& title )
|
||||
{
|
||||
if( wxTheApp == NULL ) return;
|
||||
static void __concall ConsoleToFile_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
_immediate_logger( toUTF8(fmt) );
|
||||
ConsoleToFile_Newline();
|
||||
|
||||
wxCommandEvent evt( wxEVT_SetTitleText );
|
||||
evt.SetString( title );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
}
|
||||
if( emuLog != NULL )
|
||||
fflush( emuLog );
|
||||
}
|
||||
|
||||
void __fastcall SetColor( Colors color )
|
||||
{
|
||||
th_CurrentColor = color;
|
||||
}
|
||||
extern const IConsoleWriter ConsoleWriter_File;
|
||||
const IConsoleWriter ConsoleWriter_File =
|
||||
{
|
||||
ConsoleToFile_DoWrite,
|
||||
ConsoleToFile_DoWriteLn,
|
||||
ConsoleToFile_Newline,
|
||||
|
||||
void ClearColor()
|
||||
{
|
||||
th_CurrentColor = DefaultConsoleColor;
|
||||
}
|
||||
ConsoleWriter_Null.SetTitle,
|
||||
ConsoleWriter_Null.SetColor,
|
||||
ConsoleWriter_Null.ClearColor,
|
||||
};
|
||||
|
||||
bool Newline()
|
||||
{
|
||||
_immediate_logger( "\n" );
|
||||
// thread-local console color storage.
|
||||
static __threadlocal ConsoleColors th_CurrentColor = DefaultConsoleColor;
|
||||
|
||||
if( wxTheApp == NULL ) return false;
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleToWindow Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
static void __concall ConsoleToWindow_SetTitle( const wxString& title )
|
||||
{
|
||||
wxCommandEvent evt( wxEVT_SetTitleText );
|
||||
evt.SetString( title );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
}
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Newline );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
wxGetApp().ProgramLog_CountMsg();
|
||||
static void __concall ConsoleToWindow_SetColor( ConsoleColors color )
|
||||
{
|
||||
th_CurrentColor = color;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static void __concall ConsoleToWindow_ClearColor()
|
||||
{
|
||||
th_CurrentColor = DefaultConsoleColor;
|
||||
}
|
||||
|
||||
bool __fastcall Write( const wxString& fmt )
|
||||
{
|
||||
_immediate_logger( fmt );
|
||||
template< const IConsoleWriter& secondary >
|
||||
static void __concall ConsoleToWindow_Newline()
|
||||
{
|
||||
secondary.Newline();
|
||||
|
||||
if( wxTheApp == NULL ) return false;
|
||||
wxCommandEvent evt( wxEVT_LOG_Newline );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_PostEvent( evt );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_CountMsg();
|
||||
}
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmt );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
wxGetApp().ProgramLog_CountMsg();
|
||||
template< const IConsoleWriter& secondary >
|
||||
static void __concall ConsoleToWindow_DoWrite( const wxString& fmt )
|
||||
{
|
||||
secondary.DoWrite( fmt );
|
||||
|
||||
return false;
|
||||
}
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmt );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_PostEvent( evt );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_CountMsg();
|
||||
}
|
||||
|
||||
bool __fastcall WriteLn( const wxString& fmt )
|
||||
{
|
||||
const wxString fmtline( fmt + L"\n" );
|
||||
//_immediate_logger( "PCSX2 > ");
|
||||
_immediate_logger( fmtline );
|
||||
template< const IConsoleWriter& secondary >
|
||||
static void __concall ConsoleToWindow_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
secondary.DoWriteLn( fmt );
|
||||
|
||||
if( emuLog != NULL )
|
||||
fflush( emuLog );
|
||||
// Implementation note: I've duplicated Write+Newline behavior here to avoid polluting
|
||||
// the message pump with lots of erroneous messages (Newlines can be bound into Write message).
|
||||
|
||||
// Implementation note: I've duplicated Write+Newline behavior here to avoid polluting
|
||||
// the message pump with lots of erroneous messages (Newlines can be bound into Write message).
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmt + L"\n" );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_PostEvent( evt );
|
||||
((Pcsx2App&)*wxTheApp).ProgramLog_CountMsg();
|
||||
}
|
||||
|
||||
if( wxTheApp == NULL ) return false;
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmtline );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
wxGetApp().ProgramLog_CountMsg();
|
||||
typedef void __concall DoWriteFn(const wxString&);
|
||||
|
||||
return false;
|
||||
}
|
||||
static const IConsoleWriter ConsoleWriter_Window =
|
||||
{
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_DoWriteLn<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_Newline<ConsoleWriter_Null>,
|
||||
|
||||
ConsoleToWindow_SetTitle,
|
||||
ConsoleToWindow_SetColor,
|
||||
ConsoleToWindow_ClearColor,
|
||||
};
|
||||
|
||||
static const IConsoleWriter ConsoleWriter_WindowAndFile =
|
||||
{
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_File>,
|
||||
ConsoleToWindow_DoWriteLn<ConsoleWriter_File>,
|
||||
ConsoleToWindow_Newline<ConsoleWriter_File>,
|
||||
|
||||
ConsoleToWindow_SetTitle,
|
||||
ConsoleToWindow_SetColor,
|
||||
ConsoleToWindow_ClearColor,
|
||||
};
|
||||
|
||||
void Pcsx2App::EnableConsoleLogging() const
|
||||
{
|
||||
if( emuLog )
|
||||
Console_SetActiveHandler( (m_ProgramLogBox!=NULL) ? (IConsoleWriter&)ConsoleWriter_WindowAndFile : (IConsoleWriter&)ConsoleWriter_File );
|
||||
else
|
||||
Console_SetActiveHandler( (m_ProgramLogBox!=NULL) ? (IConsoleWriter&)ConsoleWriter_Window : (IConsoleWriter&)ConsoleWriter_Buffered );
|
||||
}
|
||||
|
||||
// Used to disable the emuLog disk logger, typically used when disabling or re-initializing the
|
||||
// emuLog file handle. Call SetConsoleLogging to re-enable the disk logger when finished.
|
||||
void Pcsx2App::DisableDiskLogging() const
|
||||
{
|
||||
Console_SetActiveHandler( (m_ProgramLogBox!=NULL) ? (IConsoleWriter&)ConsoleWriter_Window : (IConsoleWriter&)ConsoleWriter_Buffered );
|
||||
|
||||
// Semi-hack: It's possible, however very unlikely, that a secondary thread could attempt
|
||||
// to write to the logfile just before we disable logging, and would thus have a pending write
|
||||
// operation to emuLog file handle at the same time we're trying to re-initialize it. The CRT
|
||||
// has some guards of its own, and PCSX2 itself typically suspends the "log happy" threads
|
||||
// when changing settings, so the chance for problems is low. We minimize it further here
|
||||
// by sleeping off 5ms, which should allow any pending log-to-disk events to finish up.
|
||||
//
|
||||
// (the most ideal solution would be a mutex lock in the Disk logger itself, but for now I
|
||||
// am going to try and keep the logger lock-free and use this semi-hack instead).
|
||||
|
||||
Threading::Sleep( 5 );
|
||||
}
|
||||
|
||||
void Pcsx2App::DisableWindowLogging() const
|
||||
{
|
||||
Console_SetActiveHandler( (emuLog!=NULL) ? (IConsoleWriter&)ConsoleWriter_File : (IConsoleWriter&)ConsoleWriter_Buffered );
|
||||
Threading::Sleep( 5 );
|
||||
}
|
||||
|
||||
DEFINE_EVENT_TYPE( pxEVT_MSGBOX );
|
||||
|
@ -875,5 +918,4 @@ namespace Msgbox
|
|||
{
|
||||
CallStack( src.FormatDisplayMessage(), src.FormatDiagnosticMessage(), wxEmptyString, L"PCSX2 Unhandled Exception", wxOK );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class ConsoleTestThread : public Threading::PersistentThread
|
|||
{
|
||||
protected:
|
||||
volatile bool m_done;
|
||||
sptr ExecuteTask();
|
||||
void ExecuteTask();
|
||||
|
||||
public:
|
||||
ConsoleTestThread() :
|
||||
|
@ -82,6 +82,10 @@ public:
|
|||
{
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnStart() {}
|
||||
void OnThreadCleanup() {}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -113,7 +117,7 @@ protected:
|
|||
void SetFont( const wxFont& font );
|
||||
void SetFont( int fontsize );
|
||||
|
||||
const wxTextAttr& operator[]( Console::Colors coloridx ) const
|
||||
const wxTextAttr& operator[]( ConsoleColors coloridx ) const
|
||||
{
|
||||
return m_table[(int)coloridx];
|
||||
}
|
||||
|
@ -123,7 +127,7 @@ protected:
|
|||
ConLogConfig& m_conf;
|
||||
wxTextCtrl& m_TextCtrl;
|
||||
ColorArray m_ColorTable;
|
||||
Console::Colors m_curcolor;
|
||||
ConsoleColors m_curcolor;
|
||||
volatile long m_msgcounter; // used to track queued messages and throttle load placed on the gui message pump
|
||||
|
||||
Semaphore m_semaphore;
|
||||
|
@ -137,7 +141,7 @@ public:
|
|||
virtual ~ConsoleLogFrame();
|
||||
|
||||
virtual void Write( const wxString& text );
|
||||
virtual void SetColor( Console::Colors color );
|
||||
virtual void SetColor( ConsoleColors color );
|
||||
virtual void ClearColor();
|
||||
virtual void DockedMove();
|
||||
|
||||
|
@ -145,7 +149,7 @@ public:
|
|||
// (settings change if the user moves the window or changes the font size)
|
||||
const ConLogConfig& GetConfig() const { return m_conf; }
|
||||
|
||||
void Write( Console::Colors color, const wxString& text );
|
||||
void Write( ConsoleColors color, const wxString& text );
|
||||
void Newline();
|
||||
void CountMessage();
|
||||
void DoMessage();
|
||||
|
|
|
@ -76,7 +76,7 @@ void GSFrame::OnKeyDown( wxKeyEvent& evt )
|
|||
|
||||
if( cmd != NULL )
|
||||
{
|
||||
DbgCon::WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
||||
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
||||
cmd->Invoke();
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue