This commit is contained in:
ramapcsx2 2014-07-12 14:41:50 +02:00
commit 58b63cb58c
33 changed files with 113 additions and 165 deletions

View File

@ -1,71 +1,6 @@
# Contribution requirement
* be patient
Your contribution will gladly be reviewed but
* discuss with us your future contribution before coding it
Let's avoid duplicate work! Besides specification could be clarified this way.
[Please read me before posting any issue](https://github.com/PCSX2/pcsx2/wiki/How-to-create-useful-and-valid-issues)
# Window contribution possibility
* check linux chapter ;) Various improvements are actually cross platform!
# Linux contribution possibility
You're welcome to the [linux contribution thread](http://forums.pcsx2.net/Thread-Areas-of-interest-for-new-linux-developers) to have full details. Here an handy list of feature that you could implement. Feel free to propse new enhancement.
## House keeping and general compilation
* clean gcc flags
* clean gcc warning
* support clang (template mess)
* speed comparison clang/gcc
* support avx (gsdx)
* add missing/update copyright header
* LTO support
* PGO support
## Core
* support XZ compressed iso
## GSdx
* Fix OpenGL
* implement DX features on OGL (Amsodean's fxaa/video recording ....)
* Fix GLES3
* add tooltip on gsdx gui
* finish shader subroutine usage (+find a way to clean shader and avoid duplication)
* finish buffer storage
* OSD
## CDVD
* port CDVDgiga to linux ?
## zzogl
* reduce gl requirement to 3.3 + gl4 extension
* use multibind
* fix EGL
* port GLSL to window
* Drop old GLSL backend (and much later Nivida CG)
* support wx3.0
## Portability
* port GSThread to std::thread
* port core thread to std::thread
* C11 aligned_alloc
* C++11 alignof/alignas syntax
* replace volatile/lock-free queue with real C++ atomic
## Debian package
* need a refresh to the latest standard
* Clean debian/copyright => debmake -k
## QA
* [C++11 auto port](http://clang.llvm.org/extra/clang-modernize.html). Initial requirement: drop XP and support clang/llvm
* [Clean header include](https://code.google.com/p/include-what-you-use/)
* address sanitizer (gcc or clang)
* valgrind (not sure it can run PCSX2, maybe limit the scope to plugin)
* reformat the core/plugin to a constant style with tool like astyle
# Very very long term feature
Those features will require a lots of work! It would require months if not years. There are listed here for completeness ;)
* PS2 ROM reimplementation (wrongly named HLE bios)
* Android X86 port
* Win/Linux ARM port
If you want to contribute be sure to check those links
1. [TODO list](https://github.com/PCSX2/pcsx2/wiki/Idea-of-contribution-%28aka-todo-list%29)
2. [wxWidgets coding stategies](https://github.com/PCSX2/pcsx2/wiki/wxWidgets-Coding-Strategies)
3. [Coding style](https://github.com/PCSX2/pcsx2/wiki/Code-Formatting-Guidelines)

View File

@ -23,6 +23,7 @@ do
case $f in
--dev|--devel ) flags="$flags -DCMAKE_BUILD_TYPE=Devel" ;;
--dbg|--debug ) flags="$flags -DCMAKE_BUILD_TYPE=Debug" ;;
--strip ) flags="$flags -DCMAKE_BUILD_STRIP=TRUE" ;;
--release ) flags="$flags -DCMAKE_BUILD_TYPE=Release" ;;
--glsl ) flags="$flags -DGLSL_API=TRUE" ;;
--egl ) flags="$flags -DEGL_API=TRUE" ;;

View File

@ -34,7 +34,7 @@ option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
option(EXTRA_PLUGINS "Build various 'extra' plugins")
# FIXME do a proper detection
set(SDL2_LIBRARY "-lSDL2")
option(SDL2_LIBRARY "Use SDL2 on spu2x and onepad")
option(SDL2_API "Use SDL2 on spu2x and onepad")
if(PACKAGE_MODE)
if(NOT DEFINED PLUGIN_DIR)
@ -85,7 +85,7 @@ if(_ARCH_64 AND 64BIT_BUILD)
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
endif()
set(ARCH_FLAG "-m64 -msse -msse2 -march=pentium4")
set(ARCH_FLAG "-m64 -msse -msse2")
add_definitions(-D_ARCH_64=1)
else()
message("Compiling 32bit build on 32/64bit architecture")
@ -183,12 +183,17 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
# -Wstrict-aliasing: to fix one day aliasing issue
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.
# -Wno-unused-function: warn for function not used in release build
set(DEFAULT_WARNINGS "-Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function")
set(HARDEING_OPT "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}")
# -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler.
set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable")
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
set(COMMON_FLAG "-pipe -std=c++0x -fvisibility=hidden -pthread")
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
set(DEFAULT_GCC_FLAG "-g ${DEFAULT_GCC_FLAG}")
set(DEBUG_FLAG "-g")
else()
set(DEBUG_FLAG "")
endif()
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${HARDENING_FLAG} ${DEBUG_FLAG}")
# c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")

View File

@ -77,7 +77,11 @@ extern "C" unsigned __int64 __xgetbv(int);
// restaints must be enforced).
//
#ifndef C_ASSERT
# define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
#ifdef __LINUX__
# define C_ASSERT(e) static_assert(e, "this is a nice message to explain the failure ;)")
#else
# define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
#endif
#endif
// --------------------------------------------------------------------------------------

View File

@ -129,32 +129,32 @@ struct IConsoleWriter
//
struct NullConsoleWriter
{
void WriteRaw( const wxString& ) {}
void DoWriteLn( const wxString& ) {}
void DoSetColor( ConsoleColors ) {}
void DoWriteFromStdout( const wxString& ) {}
void WriteRaw( const wxString& fmt ) {}
void DoWriteLn( const wxString& fmt ) {}
void DoSetColor( ConsoleColors color ) {}
void DoWriteFromStdout( const wxString& fmt ) {}
void Newline() {}
void SetTitle( const wxString& ) {}
void SetTitle( const wxString& title ) {}
ConsoleColors GetColor() const { return Color_Current; }
const NullConsoleWriter& SetColor( ConsoleColors ) const { return *this; }
const NullConsoleWriter& SetColor( ConsoleColors color ) const { return *this; }
const NullConsoleWriter& ClearColor() const { return *this; }
const NullConsoleWriter& SetIndent( int =1 ) const { return *this; }
const NullConsoleWriter& SetIndent( int tabcount=1 ) const { return *this; }
NullConsoleWriter Indent( int =1 ) const { return NullConsoleWriter(); }
NullConsoleWriter Indent( int tabcount=1 ) const { return NullConsoleWriter(); }
bool FormatV( const char* , va_list ) const { return false; }
bool WriteLn( ConsoleColors , const char* , ... ) const { return false; }
bool WriteLn( const char* , ... ) const { return false; }
bool Error( const char* , ... ) const { return false; }
bool Warning( const char* , ... ) const { return false; }
bool FormatV( const char* fmt, va_list args ) const { return false; }
bool WriteLn( ConsoleColors color, const char* fmt, ... ) const { return false; }
bool WriteLn( const char* fmt, ... ) const { return false; }
bool Error( const char* fmt, ... ) const { return false; }
bool Warning( const char* fmt, ... ) const { return false; }
bool FormatV( const wxChar* , va_list ) const { return false; }
bool WriteLn( ConsoleColors , const wxChar* , ... ) const { return false; }
bool WriteLn( const wxChar* , ... ) const { return false; }
bool Error( const wxChar* , ... ) const { return false; }
bool Warning( const wxChar* , ... ) const { return false; }
bool FormatV( const wxChar* fmt, va_list args ) const { return false; }
bool WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const { return false; }
bool WriteLn( const wxChar* fmt, ... ) const { return false; }
bool Error( const wxChar* fmt, ... ) const { return false; }
bool Warning( const wxChar* fmt, ... ) const { return false; }
};
// --------------------------------------------------------------------------------------

View File

@ -52,12 +52,12 @@ public:
OnPageFaultEvent( evtinfo, handled );
}
virtual void DispatchEvent( const PageFaultInfo& )
virtual void DispatchEvent( const PageFaultInfo& evtinfo )
{
pxFailRel( "Don't call me, damnit. Use DispatchException instead." );
}
virtual void OnPageFaultEvent( const PageFaultInfo& , bool& ) {}
virtual void OnPageFaultEvent( const PageFaultInfo& evtinfo, bool& handled ) {}
};
// --------------------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ namespace Threading
void SetThread( pxThread& thr ) { m_thread = &thr; }
void SetThread( pxThread* thr ) { m_thread = thr; }
void DispatchEvent( const int& )
void DispatchEvent( const int& params )
{
OnThreadCleanup();
}

View File

@ -143,7 +143,7 @@ public:
return false;
}
virtual void ApplyPrefix( FastFormatAscii& ) const {}
virtual void ApplyPrefix( FastFormatAscii& ascii ) const {}
virtual void DoWrite( const char* fmt ) const=0;
};

View File

@ -51,8 +51,10 @@ static __fi void memset8( T& obj )
// Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset.
if( (sizeof(T) & 0x3) != 0 )
memset( &obj, data, sizeof( T ) );
else
memset32<data + (data<<8) + (data<<16) + (data<<24)>( obj );
else {
const u32 data32 = data + (data<<8) + (data<<16) + (data<<24);
memset32<data32>( obj );
}
}
template< u16 data, typename T >
@ -60,8 +62,10 @@ static __fi void memset16( T& obj )
{
if( (sizeof(T) & 0x3) != 0 )
_memset16_unaligned( &obj, data, sizeof( T ) );
else
memset32<data + (data<<16)>( obj );
else {
const u32 data32 = data + (data<<16);
memset32<data32>( obj );
}
}
@ -92,6 +96,7 @@ static __fi void memset_8( void *dest )
// macro to execute the x86/32 "stosd" copies.
switch( remdat )
{
#if 0
case 1:
*(u32*)dest = data32;
return;
@ -157,6 +162,7 @@ static __fi void memset_8( void *dest )
);
return;
#endif
default:
__asm__ volatile

View File

@ -438,7 +438,7 @@ public:
// NOTE: Enabling system menu on dialogs usually doesn't work, and might cause
// other unwanted behavior, such as a missing close button.
pxDialogCreationFlags SystemMenu( bool =true ) const
pxDialogCreationFlags SystemMenu( bool enable=true ) const
{
return pxDialogCreationFlags(*this).SetSystemMenu( false );
}
@ -648,7 +648,7 @@ public:
protected:
// line may be empty
virtual void OnOutputLine(const wxString&) { }
virtual void OnOutputLine(const wxString& line) { }
// called at the start of every new line (except the very first one)
virtual void OnNewLine() { }

View File

@ -11,19 +11,11 @@ set(Output Utilities)
# set common flags
set(CommonFlags
-pthread
-fvisibility=hidden
-fno-dse
-fno-guess-branch-probability
-fno-strict-aliasing
-fno-tree-dse
-pipe
-Wunused-variable)
# set warning flags
set(DebugFlags
-g
-W)
)
# set optimization flags
set(OptimizationFlags
@ -70,7 +62,7 @@ set(OptimizationFlags
if(CMAKE_BUILD_TYPE STREQUAL Debug)
# add defines
add_definitions(${CommonFlags} ${DebugFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD)
add_definitions(${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build

View File

@ -77,8 +77,8 @@ Threading::MutexRecursive::MutexRecursive() : Mutex( false )
pthread_mutexattr_settype( &_attr_recursive, PTHREAD_MUTEX_RECURSIVE );
}
int err = 0;
err = pthread_mutex_init( &m_mutex, &_attr_recursive );
if (pthread_mutex_init( &m_mutex, &_attr_recursive ))
Console.Error( "(Thread Log) Failed to initialize mutex.");
}
Threading::MutexRecursive::~MutexRecursive() throw()

View File

@ -11,19 +11,11 @@ set(Output x86emitter)
# set common flags
set(CommonFlags
-pthread
-fvisibility=hidden
-fno-guess-branch-probability
-fno-dse
-fno-tree-dse
-fno-strict-aliasing
-pipe
-Wunused-variable)
# set warning flags
set(DebugFlags
-W
-g)
)
# set optimization flags
set(OptimizationFlags
@ -70,7 +62,7 @@ set(OptimizationFlags
if(CMAKE_BUILD_TYPE STREQUAL Debug)
# add defines
add_definitions(${CommonFlags} ${DebugFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG)
add_definitions(${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build

View File

@ -30,8 +30,9 @@ const wxChar* EnumToString( SSE_RoundMode sse )
case SSEround_NegInf: return L"NegativeInfinity";
case SSEround_PosInf: return L"PositiveInfinity";
case SSEround_Chop: return L"Chop";
default: return L"Invalid";
}
return L"Invalid";
}

View File

@ -105,7 +105,7 @@ static void WriteIndexToFile(Access* index, const wxString filename) {
class ChunksCache {
public:
ChunksCache(uint initialLimitMb) : m_size(0), m_entries(0), m_limit(initialLimitMb * 1024 * 1024) {};
ChunksCache(uint initialLimitMb) : m_entries(0), m_size(0), m_limit(initialLimitMb * 1024 * 1024) {};
~ChunksCache() { Clear(); };
void SetLimit(uint megabytes);
void Clear() { MatchLimit(true); };
@ -125,8 +125,8 @@ private:
CacheEntry(void* pMallocedSrc, PX_off_t offset, int length, int coverage) :
data(pMallocedSrc),
offset(offset),
size(length),
coverage(coverage)
coverage(coverage),
size(length)
{};
~CacheEntry() { if (data) free(data); };
@ -199,9 +199,9 @@ class GzippedFileReader : public AsyncFileReader
public:
GzippedFileReader(void) :
m_pIndex(0),
m_cache(CACHE_SIZE_MB),
m_zstates(0),
m_src(0),
m_zstates(0) {
m_cache(CACHE_SIZE_MB) {
m_blocksize = 2048;
};
@ -466,4 +466,4 @@ bool CompressedFileReader::DetectCompressed(AsyncFileReader* pReader) {
AsyncFileReader* CompressedFileReader::GetNewReader(const wxString& fileName) {
//if (GzippedFileReader::CanHandle(pReader))
return new GzippedFileReader();
}
}

View File

@ -12,20 +12,14 @@ set(CommonFlags
# Disable this optimization for the moment
-fno-omit-frame-pointer
# END GCC-4.6
-pthread
-fvisibility=hidden
-fno-guess-branch-probability
-fno-dse
-fno-tree-dse
-fno-strict-aliasing
-Wno-parentheses
-Wstrict-aliasing # Allow to track strict aliasing issue.
-std=c++0x
-pipe)
# set warning flags
set(DebugFlags
-W
-g)
-Wno-char-subscripts # only impact svu which is deprecated
)
# set optimization flags
set(OptimizationFlags
@ -72,7 +66,7 @@ set(OptimizationFlags
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(Output pcsx2-dbg)
add_definitions(${CommonFlags} ${DebugFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP)
add_definitions(${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build

View File

@ -211,6 +211,8 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
address = info.address+info.size;
}
break;
default:
break;
}
}
@ -986,6 +988,8 @@ void DisassemblyData::createLines()
pos += 4;
}
break;
default:
break;
}
size_t len = strlen(buffer);

View File

@ -32,7 +32,7 @@ struct DisassemblyLineInfo
u32 totalSize;
};
enum LineType { LINE_UP, LINE_DOWN, LINE_RIGHT };
enum LineType { LINE_UP, LINE_DOWN };
struct BranchLine
{

View File

@ -291,6 +291,8 @@ namespace MIPSAnalyst
case BRANCH:
info.branchTarget = info.opcodeAddress + 4 + ((signed short)(op&0xFFFF)<<2);
break;
case NONE:
return false;
}
return true;

View File

@ -648,7 +648,6 @@ struct Gif_Unit {
}
void PrintPathInfo(GIF_PATH path) {
(void)path; // avoid silly warning
GUNIT_LOG("Gif Path %d - [hasData = %d][state = %d]", path,
gifPath[path].hasDataRemaining(), gifPath[path].state);
}

View File

@ -264,9 +264,6 @@ namespace ioman {
void close()
{
if (type == FILE_FREE)
return;
switch (type)
{
case FILE_FILE:
@ -277,6 +274,8 @@ namespace ioman {
dir->close();
dir = NULL;
break;
case FILE_FREE:
return;
}
type = FILE_FREE;

View File

@ -42,9 +42,9 @@ public:
virtual void close() = 0;
virtual int lseek(s32 , s32 ) { return -IOP_EIO; }
virtual int read(void *, u32 ) { return -IOP_EIO; }
virtual int write(void *, u32 ) { return -IOP_EIO; }
virtual int lseek(s32 offset, s32 whence) { return -IOP_EIO; }
virtual int read(void *buf, u32 count) { return -IOP_EIO; }
virtual int write(void *buf, u32 count) { return -IOP_EIO; }
};
class IOManDir {

View File

@ -34,7 +34,7 @@ using namespace Threading;
#if 0 //PCSX2_DEBUG
# define MTGS_LOG Console.WriteLn
#else
# define MTGS_LOG 0&&
# define MTGS_LOG(...) do {} while (0)
#endif
// forces the compiler to treat a non-volatile value as volatile.

View File

@ -42,9 +42,9 @@ void ProfilerTerminateSource( const wxString& Name );
#define ProfilerInit() (void)0
#define ProfilerTerm() (void)0
#define ProfilerSetEnabled 0&&
#define ProfilerRegisterSource 0&&
#define ProfilerTerminateSource 0&&
#define ProfilerSetEnabled(...) (void)0
#define ProfilerRegisterSource(...) (void)0
#define ProfilerTerminateSource(...) (void)0
#endif

View File

@ -93,6 +93,9 @@ void SysThreadBase::Suspend( bool isBlocking )
switch( m_ExecMode )
{
// FIXME what to do for this case
// case ExecMode_NoThreadYet:
// Check again -- status could have changed since above.
case ExecMode_Closed: return;
@ -109,6 +112,9 @@ void SysThreadBase::Suspend( bool isBlocking )
case ExecMode_Opened:
m_ExecMode = ExecMode_Closing;
break;
case ExecMode_Closing:
break;
}
pxAssertDev( m_ExecMode == ExecMode_Closing, "ExecMode should be nothing other than Closing..." );
@ -214,6 +220,10 @@ void SysThreadBase::Resume()
if( (m_ExecMode != ExecMode_Closed) && (m_ExecMode != ExecMode_Paused) ) return;
if( !GetCorePlugins().AreLoaded() ) return;
break;
case ExecMode_Paused:
case ExecMode_Closed:
break;
}
pxAssertDev( (m_ExecMode == ExecMode_Closed) || (m_ExecMode == ExecMode_Paused),

View File

@ -236,7 +236,7 @@ public:
IEventListener_SysState() {}
virtual ~IEventListener_SysState() throw() {}
virtual void DispatchEvent( const SysStateUnlockedParams& )
virtual void DispatchEvent( const SysStateUnlockedParams& status )
{
SysStateAction_OnUnlocked();
}

View File

@ -177,10 +177,10 @@ public:
void Step();
void Execute(u32 cycles);
void Clear(u32 , u32 ) {}
void Clear(u32 addr, u32 size) {}
uint GetCacheReserve() const { return 0; }
void SetCacheReserve( uint ) const {}
void SetCacheReserve( uint reserveInMegs ) const {}
};
class InterpVU1 : public BaseVUmicroCPU
@ -198,11 +198,11 @@ public:
void Step();
void Execute(u32 cycles);
void Clear(u32 , u32 ) {}
void Clear(u32 addr, u32 size) {}
void ResumeXGkick() {}
uint GetCacheReserve() const { return 0; }
void SetCacheReserve( uint ) const {}
void SetCacheReserve( uint reserveInMegs ) const {}
};
// --------------------------------------------------------------------------------------

View File

@ -132,6 +132,9 @@ void Pcsx2App::DispatchEvent( CoreThreadStatus evt )
{
switch( evt )
{
// FIXME what to do for this case
// case CoreThread_Indeterminate:
case CoreThread_Started:
case CoreThread_Reset:
case CoreThread_Stopped:

View File

@ -182,6 +182,7 @@ namespace Implementations
case AspectRatio_Stretch: art = AspectRatio_4_3; arts = L"AspectRatio_4_3"; break;
case AspectRatio_4_3: art = AspectRatio_16_9; arts = L"AspectRatio_16:9"; break;
case AspectRatio_16_9: art = AspectRatio_Stretch; arts = L"AspectRatio_Stretch";break;
default: break;
}
Console.WriteLn(L"(GSwindow) Aspect ratio: %s.", arts.c_str());

View File

@ -244,8 +244,7 @@ GameDatabaseListView& GameDatabaseListView::SortBy( GameDataColumnId column )
case GdbCol_Compat: std::sort(begin, end, GLSort_byCompat(isDescending)); break;
case GdbCol_Patches: std::sort(begin, end, GLSort_byPatches(isDescending)); break;
// do not use jNO_DEFAULT here -- keeps release builds from crashing (it'll just
// ignore the sort request!)
default: break; // for GdbCol_Count
}
//m_GamesInView.( );

View File

@ -26,7 +26,7 @@ static VURegs& vu0Regs = vuRegs[0];
using namespace R5900::Dynarec;
#define printCOP2 0&&
#define printCOP2(...) (void)0
//#define printCOP2 DevCon.Status
void setupMacroOp(int mode, const char* opName) {

View File

@ -339,7 +339,7 @@ static void SuperVUEliminateDeadCode();
static void SuperVUAssignRegs();
//void SuperVUFreeXMMreg(int xmmreg, int xmmtype, int reg);
#define SuperVUFreeXMMreg 0&&
#define SuperVUFreeXMMreg(...) (void)0
void SuperVUFreeXMMregs(u32* livevars);
static u32* SuperVUStaticAlloc(u32 size);

View File

@ -19,6 +19,7 @@ set(CommonFlags
-fno-strict-aliasing
-Wno-unknown-pragmas
-Wno-parentheses
-Wunused-variable # __dummy variable need to be investigated
)
set(OptimizationFlags